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