mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 752172 - Turn SiteIdentityPopup into a singleton. r=mbrubeck
This commit is contained in:
parent
c10f9bc947
commit
d5d8dbb0b3
@ -181,7 +181,7 @@ public class BrowserToolbar {
|
||||
|
||||
// Calculate the left margin for the arrow based on the position of the lock icon.
|
||||
int leftMargin = lockLocation[0] - lockLayoutParams.rightMargin;
|
||||
GeckoApp.mSiteIdentityPopup.show(leftMargin);
|
||||
SiteIdentityPopup.getInstance().show(leftMargin);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -138,7 +138,6 @@ abstract public class GeckoApp
|
||||
|
||||
public static BrowserToolbar mBrowserToolbar;
|
||||
public static DoorHangerPopup mDoorHangerPopup;
|
||||
public static SiteIdentityPopup mSiteIdentityPopup;
|
||||
public static FormAssistPopup mFormAssistPopup;
|
||||
public Favicons mFavicons;
|
||||
|
||||
@ -1658,7 +1657,6 @@ abstract public class GeckoApp
|
||||
mPluginContainer = (AbsoluteLayout) findViewById(R.id.plugin_container);
|
||||
|
||||
mDoorHangerPopup = new DoorHangerPopup(this);
|
||||
mSiteIdentityPopup = new SiteIdentityPopup(this);
|
||||
mFormAssistPopup = (FormAssistPopup) findViewById(R.id.form_assist_popup);
|
||||
|
||||
Log.w(LOGTAG, "zerdatime " + SystemClock.uptimeMillis() + " - UI almost up");
|
||||
@ -1949,8 +1947,7 @@ abstract public class GeckoApp
|
||||
// Undo whatever we did in onPause.
|
||||
super.onResume();
|
||||
|
||||
if (mSiteIdentityPopup != null)
|
||||
mSiteIdentityPopup.dismiss();
|
||||
SiteIdentityPopup.getInstance().dismiss();
|
||||
|
||||
int newOrientation = getResources().getConfiguration().orientation;
|
||||
|
||||
@ -2079,8 +2076,7 @@ abstract public class GeckoApp
|
||||
mOrientation = newConfig.orientation;
|
||||
if (mFormAssistPopup != null)
|
||||
mFormAssistPopup.hide();
|
||||
if (mSiteIdentityPopup != null)
|
||||
mSiteIdentityPopup.dismiss();
|
||||
SiteIdentityPopup.getInstance().dismiss();
|
||||
refreshActionBar();
|
||||
}
|
||||
}
|
||||
@ -2524,8 +2520,9 @@ abstract public class GeckoApp
|
||||
return;
|
||||
}
|
||||
|
||||
if (mSiteIdentityPopup.isShowing()) {
|
||||
mSiteIdentityPopup.dismiss();
|
||||
SiteIdentityPopup identityPopup = SiteIdentityPopup.getInstance();
|
||||
if (identityPopup.isShowing()) {
|
||||
identityPopup.dismiss();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -20,6 +20,10 @@ import android.widget.TextView;
|
||||
import org.json.JSONObject;
|
||||
import org.json.JSONException;
|
||||
|
||||
/**
|
||||
* SiteIdentityPopup is a singleton class that displays site identity data in
|
||||
* an arrow panel popup hanging from the lock icon in the browser toolbar.
|
||||
*/
|
||||
public class SiteIdentityPopup extends PopupWindow {
|
||||
private static final String LOGTAG = "GeckoSiteIdentityPopup";
|
||||
|
||||
@ -27,7 +31,6 @@ public class SiteIdentityPopup extends PopupWindow {
|
||||
public static final String VERIFIED = "verified";
|
||||
public static final String IDENTIFIED = "identified";
|
||||
|
||||
private Context mContext;
|
||||
private Resources mResources;
|
||||
private boolean mInflated;
|
||||
|
||||
@ -40,19 +43,27 @@ public class SiteIdentityPopup extends PopupWindow {
|
||||
private ImageView mLarry;
|
||||
private ImageView mArrow;
|
||||
|
||||
public SiteIdentityPopup(Context aContext) {
|
||||
super(aContext);
|
||||
mContext = aContext;
|
||||
mResources = aContext.getResources();
|
||||
private SiteIdentityPopup() {
|
||||
super(GeckoApp.mAppContext);
|
||||
|
||||
mResources = GeckoApp.mAppContext.getResources();
|
||||
mInflated = false;
|
||||
}
|
||||
}
|
||||
|
||||
private static class InstanceHolder {
|
||||
private static final SiteIdentityPopup INSTANCE = new SiteIdentityPopup();
|
||||
}
|
||||
|
||||
public static SiteIdentityPopup getInstance() {
|
||||
return SiteIdentityPopup.InstanceHolder.INSTANCE;
|
||||
}
|
||||
|
||||
private void init() {
|
||||
setBackgroundDrawable(new BitmapDrawable());
|
||||
setOutsideTouchable(true);
|
||||
setWindowLayoutMode(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT);
|
||||
|
||||
LayoutInflater inflater = LayoutInflater.from(mContext);
|
||||
LayoutInflater inflater = LayoutInflater.from(GeckoApp.mAppContext);
|
||||
RelativeLayout layout = (RelativeLayout) inflater.inflate(R.layout.site_identity_popup, null);
|
||||
setContentView(layout);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user