mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 719479 - Don't animate tab counter during session restore. r=mfinkle
This commit is contained in:
parent
b206de36b1
commit
a2f48f5d4a
@ -151,7 +151,7 @@ public class BrowserToolbar extends LinearLayout {
|
|||||||
addTab();
|
addTab();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
mTabs.setImageLevel(1);
|
mTabs.setImageLevel(0);
|
||||||
|
|
||||||
mCounterColor = 0xFFC7D1DB;
|
mCounterColor = 0xFFC7D1DB;
|
||||||
|
|
||||||
@ -224,8 +224,8 @@ public class BrowserToolbar extends LinearLayout {
|
|||||||
public int getHighlightColor() {
|
public int getHighlightColor() {
|
||||||
return mColor;
|
return mColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateTabs(int count) {
|
public void updateTabCountAndAnimate(int count) {
|
||||||
if (mCount > count) {
|
if (mCount > count) {
|
||||||
mTabsCount.setInAnimation(mSlideDownIn);
|
mTabsCount.setInAnimation(mSlideDownIn);
|
||||||
mTabsCount.setOutAnimation(mSlideDownOut);
|
mTabsCount.setOutAnimation(mSlideDownOut);
|
||||||
@ -267,6 +267,12 @@ public class BrowserToolbar extends LinearLayout {
|
|||||||
}, 2 * mDuration);
|
}, 2 * mDuration);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void updateTabCount(int count) {
|
||||||
|
mTabsCount.setCurrentText(String.valueOf(count));
|
||||||
|
mTabs.setImageLevel(count);
|
||||||
|
mTabsCount.setVisibility(count > 1 ? View.VISIBLE : View.INVISIBLE);
|
||||||
|
}
|
||||||
|
|
||||||
public void setProgressVisibility(boolean visible) {
|
public void setProgressVisibility(boolean visible) {
|
||||||
if (visible) {
|
if (visible) {
|
||||||
mFavicon.setImageDrawable(mProgressSpinner);
|
mFavicon.setImageDrawable(mProgressSpinner);
|
||||||
@ -326,7 +332,7 @@ public class BrowserToolbar extends LinearLayout {
|
|||||||
setSecurityMode(tab.getSecurityMode());
|
setSecurityMode(tab.getSecurityMode());
|
||||||
setProgressVisibility(tab.isLoading());
|
setProgressVisibility(tab.isLoading());
|
||||||
setShadowVisibility(!(tab.getURL().startsWith("about:")));
|
setShadowVisibility(!(tab.getURL().startsWith("about:")));
|
||||||
updateTabs(Tabs.getInstance().getCount());
|
updateTabCountAndAnimate(Tabs.getInstance().getCount());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1659,6 +1659,20 @@ abstract public class GeckoApp
|
|||||||
checkAndLaunchUpdate();
|
checkAndLaunchUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
|
setContentView(R.layout.gecko_app);
|
||||||
|
|
||||||
|
mOrientation = getResources().getConfiguration().orientation;
|
||||||
|
|
||||||
|
if (Build.VERSION.SDK_INT >= 11) {
|
||||||
|
refreshActionBar();
|
||||||
|
} else {
|
||||||
|
mBrowserToolbar = (BrowserToolbar) findViewById(R.id.browser_toolbar);
|
||||||
|
}
|
||||||
|
|
||||||
|
mBrowserToolbar.setTitle(mLastTitle);
|
||||||
|
|
||||||
String passedUri = null;
|
String passedUri = null;
|
||||||
String uri = getURIFromIntent(intent);
|
String uri = getURIFromIntent(intent);
|
||||||
if (uri != null && uri.length() > 0)
|
if (uri != null && uri.length() > 0)
|
||||||
@ -1672,8 +1686,12 @@ abstract public class GeckoApp
|
|||||||
if (profileDir != null)
|
if (profileDir != null)
|
||||||
sessionExists = new File(profileDir, "sessionstore.bak").exists();
|
sessionExists = new File(profileDir, "sessionstore.bak").exists();
|
||||||
Log.w(LOGTAG, "zerdatime " + SystemClock.uptimeMillis() + " - finish check sessionstore.bak exists");
|
Log.w(LOGTAG, "zerdatime " + SystemClock.uptimeMillis() + " - finish check sessionstore.bak exists");
|
||||||
if (!sessionExists)
|
if (!sessionExists) {
|
||||||
|
mBrowserToolbar.updateTabCount(1);
|
||||||
showAboutHome();
|
showAboutHome();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
mBrowserToolbar.updateTabCount(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sGREDir == null)
|
if (sGREDir == null)
|
||||||
@ -1698,20 +1716,6 @@ abstract public class GeckoApp
|
|||||||
checkAndSetLaunchState(LaunchState.Launching, LaunchState.Launched))
|
checkAndSetLaunchState(LaunchState.Launching, LaunchState.Launched))
|
||||||
sGeckoThread.start();
|
sGeckoThread.start();
|
||||||
|
|
||||||
super.onCreate(savedInstanceState);
|
|
||||||
|
|
||||||
setContentView(R.layout.gecko_app);
|
|
||||||
|
|
||||||
mOrientation = getResources().getConfiguration().orientation;
|
|
||||||
|
|
||||||
if (Build.VERSION.SDK_INT >= 11) {
|
|
||||||
refreshActionBar();
|
|
||||||
} else {
|
|
||||||
mBrowserToolbar = (BrowserToolbar) findViewById(R.id.browser_toolbar);
|
|
||||||
}
|
|
||||||
|
|
||||||
mBrowserToolbar.setTitle(mLastTitle);
|
|
||||||
|
|
||||||
mFavicons = new Favicons(this);
|
mFavicons = new Favicons(this);
|
||||||
|
|
||||||
// setup gecko layout
|
// setup gecko layout
|
||||||
@ -1727,7 +1731,7 @@ abstract public class GeckoApp
|
|||||||
mBrowserToolbar.setTitle(tab.getDisplayTitle());
|
mBrowserToolbar.setTitle(tab.getDisplayTitle());
|
||||||
mBrowserToolbar.setFavicon(tab.getFavicon());
|
mBrowserToolbar.setFavicon(tab.getFavicon());
|
||||||
mBrowserToolbar.setProgressVisibility(tab.isLoading());
|
mBrowserToolbar.setProgressVisibility(tab.isLoading());
|
||||||
mBrowserToolbar.updateTabs(Tabs.getInstance().getCount());
|
mBrowserToolbar.updateTabCountAndAnimate(Tabs.getInstance().getCount());
|
||||||
}
|
}
|
||||||
|
|
||||||
tabs.setContentResolver(getContentResolver());
|
tabs.setContentResolver(getContentResolver());
|
||||||
|
@ -55,6 +55,7 @@ public class Tabs implements GeckoEventListener {
|
|||||||
private HashMap<Integer, Tab> tabs;
|
private HashMap<Integer, Tab> tabs;
|
||||||
private ArrayList<Tab> order;
|
private ArrayList<Tab> order;
|
||||||
private ContentResolver resolver;
|
private ContentResolver resolver;
|
||||||
|
private boolean mRestoringSession = false;
|
||||||
|
|
||||||
private Tabs() {
|
private Tabs() {
|
||||||
tabs = new HashMap<Integer, Tab>();
|
tabs = new HashMap<Integer, Tab>();
|
||||||
@ -68,6 +69,8 @@ public class Tabs implements GeckoEventListener {
|
|||||||
GeckoAppShell.registerGeckoEventListener("Tab:Close", this);
|
GeckoAppShell.registerGeckoEventListener("Tab:Close", this);
|
||||||
GeckoAppShell.registerGeckoEventListener("Tab:Select", this);
|
GeckoAppShell.registerGeckoEventListener("Tab:Select", this);
|
||||||
GeckoAppShell.registerGeckoEventListener("Tab:ScreenshotData", this);
|
GeckoAppShell.registerGeckoEventListener("Tab:ScreenshotData", this);
|
||||||
|
GeckoAppShell.registerGeckoEventListener("Session:RestoreBegin", this);
|
||||||
|
GeckoAppShell.registerGeckoEventListener("Session:RestoreEnd", this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getCount() {
|
public int getCount() {
|
||||||
@ -88,11 +91,13 @@ public class Tabs implements GeckoEventListener {
|
|||||||
tabs.put(id, tab);
|
tabs.put(id, tab);
|
||||||
order.add(tab);
|
order.add(tab);
|
||||||
|
|
||||||
GeckoApp.mAppContext.mMainHandler.post(new Runnable() {
|
if (!mRestoringSession) {
|
||||||
public void run() {
|
GeckoApp.mAppContext.mMainHandler.post(new Runnable() {
|
||||||
GeckoApp.mBrowserToolbar.updateTabs(getCount());
|
public void run() {
|
||||||
}
|
GeckoApp.mBrowserToolbar.updateTabCountAndAnimate(getCount());
|
||||||
});
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
Log.i(LOGTAG, "Added a tab with id: " + id + ", url: " + url);
|
Log.i(LOGTAG, "Added a tab with id: " + id + ", url: " + url);
|
||||||
return tab;
|
return tab;
|
||||||
@ -197,7 +202,7 @@ public class Tabs implements GeckoEventListener {
|
|||||||
GeckoApp.mAppContext.mMainHandler.post(new Runnable() {
|
GeckoApp.mAppContext.mMainHandler.post(new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
GeckoApp.mAppContext.onTabsChanged(closedTab);
|
GeckoApp.mAppContext.onTabsChanged(closedTab);
|
||||||
GeckoApp.mBrowserToolbar.updateTabs(Tabs.getInstance().getCount());
|
GeckoApp.mBrowserToolbar.updateTabCountAndAnimate(Tabs.getInstance().getCount());
|
||||||
GeckoApp.mDoorHangerPopup.updatePopup();
|
GeckoApp.mDoorHangerPopup.updatePopup();
|
||||||
GeckoApp.mAppContext.hidePlugins(closedTab, true);
|
GeckoApp.mAppContext.hidePlugins(closedTab, true);
|
||||||
}
|
}
|
||||||
@ -290,6 +295,15 @@ public class Tabs implements GeckoEventListener {
|
|||||||
return;
|
return;
|
||||||
byte[] compressed = GeckoAppShell.decodeBase64(data.substring(22));
|
byte[] compressed = GeckoAppShell.decodeBase64(data.substring(22));
|
||||||
GeckoApp.mAppContext.processThumbnail(tab, null, compressed);
|
GeckoApp.mAppContext.processThumbnail(tab, null, compressed);
|
||||||
|
} else if (event.equals("Session:RestoreBegin")) {
|
||||||
|
mRestoringSession = true;
|
||||||
|
} else if (event.equals("Session:RestoreEnd")) {
|
||||||
|
mRestoringSession = false;
|
||||||
|
GeckoApp.mAppContext.mMainHandler.post(new Runnable() {
|
||||||
|
public void run() {
|
||||||
|
GeckoApp.mBrowserToolbar.updateTabCount(getCount());
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.i(LOGTAG, "handleMessage throws " + e + " for message: " + event);
|
Log.i(LOGTAG, "handleMessage throws " + e + " for message: " + event);
|
||||||
|
@ -292,6 +292,12 @@ var BrowserApp = {
|
|||||||
// A restored tab should not be active if we are loading a URL
|
// A restored tab should not be active if we are loading a URL
|
||||||
let restoreToFront = false;
|
let restoreToFront = false;
|
||||||
|
|
||||||
|
sendMessageToJava({
|
||||||
|
gecko: {
|
||||||
|
type: "Session:RestoreBegin"
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// Open any commandline URLs, except the homepage
|
// Open any commandline URLs, except the homepage
|
||||||
if (url && url != "about:home") {
|
if (url && url != "about:home") {
|
||||||
this.addTab(url);
|
this.addTab(url);
|
||||||
@ -308,6 +314,12 @@ var BrowserApp = {
|
|||||||
let params = { selected: restoreToFront };
|
let params = { selected: restoreToFront };
|
||||||
BrowserApp.addTab("about:home", { showProgress: false });
|
BrowserApp.addTab("about:home", { showProgress: false });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sendMessageToJava({
|
||||||
|
gecko: {
|
||||||
|
type: "Session:RestoreEnd"
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
Services.obs.addObserver(restoreCleanup, "sessionstore-windows-restored", false);
|
Services.obs.addObserver(restoreCleanup, "sessionstore-windows-restored", false);
|
||||||
|
Loading…
Reference in New Issue
Block a user