mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 752709 - Extract a getDisplayMetrics function into GeckoApp. r=cpeterson
This commit is contained in:
parent
6aa006d2b1
commit
afd0d96e91
@ -44,7 +44,6 @@ import android.text.style.StyleSpan;
|
||||
import android.text.style.UnderlineSpan;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.widget.AdapterView;
|
||||
@ -648,9 +647,7 @@ public class AboutHomeContent extends ScrollView
|
||||
|
||||
public TopSitesGridView(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
DisplayMetrics dm = new DisplayMetrics();
|
||||
GeckoApp.mAppContext.getWindowManager().getDefaultDisplay().getMetrics(dm);
|
||||
mDisplayDensity = dm.density;
|
||||
mDisplayDensity = GeckoApp.mAppContext.getDisplayMetrics().density;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -153,8 +153,7 @@ public class FormAssistPopup extends RelativeLayout implements GeckoEventListene
|
||||
addView(mValidationMessage);
|
||||
mValidationMessageText = (TextView) mValidationMessage.findViewById(R.id.validation_message_text);
|
||||
|
||||
DisplayMetrics metrics = new DisplayMetrics();
|
||||
GeckoApp.mAppContext.getWindowManager().getDefaultDisplay().getMetrics(metrics);
|
||||
DisplayMetrics metrics = GeckoApp.mAppContext.getDisplayMetrics();
|
||||
sValidationTextMarginTop = (int) (VALIDATION_MESSAGE_MARGIN_TOP_IN_DPI * metrics.density);
|
||||
|
||||
sValidationTextLayoutNormal = new RelativeLayout.LayoutParams(mValidationMessageText.getLayoutParams());
|
||||
@ -197,8 +196,7 @@ public class FormAssistPopup extends RelativeLayout implements GeckoEventListene
|
||||
// Initialize static variables based on DisplayMetrics. We delay this to
|
||||
// make sure DisplayMetrics isn't null to avoid an NPE.
|
||||
if (sAutoCompleteMinWidth == 0) {
|
||||
DisplayMetrics metrics = new DisplayMetrics();
|
||||
GeckoApp.mAppContext.getWindowManager().getDefaultDisplay().getMetrics(metrics);
|
||||
DisplayMetrics metrics = GeckoApp.mAppContext.getDisplayMetrics();
|
||||
sAutoCompleteMinWidth = (int) (AUTOCOMPLETE_MIN_WIDTH_IN_DPI * metrics.density);
|
||||
sAutoCompleteRowHeight = (int) (AUTOCOMPLETE_ROW_HEIGHT_IN_DPI * metrics.density);
|
||||
sValidationMessageHeight = (int) (VALIDATION_MESSAGE_HEIGHT_IN_DPI * metrics.density);
|
||||
|
@ -515,6 +515,12 @@ abstract public class GeckoApp
|
||||
outState.putString(SAVED_STATE_TITLE, tab.getDisplayTitle());
|
||||
}
|
||||
|
||||
public DisplayMetrics getDisplayMetrics() {
|
||||
DisplayMetrics metrics = new DisplayMetrics();
|
||||
getWindowManager().getDefaultDisplay().getMetrics(metrics);
|
||||
return metrics;
|
||||
}
|
||||
|
||||
void getAndProcessThumbnailForTab(final Tab tab) {
|
||||
boolean isSelectedTab = Tabs.getInstance().isSelectedTab(tab);
|
||||
final Bitmap bitmap = isSelectedTab ? mLayerClient.getBitmap() : null;
|
||||
|
@ -461,8 +461,7 @@ public class GeckoAppShell
|
||||
if (restoreMode != RESTORE_NONE)
|
||||
combinedArgs += " -restoremode " + restoreMode;
|
||||
|
||||
DisplayMetrics metrics = new DisplayMetrics();
|
||||
GeckoApp.mAppContext.getWindowManager().getDefaultDisplay().getMetrics(metrics);
|
||||
DisplayMetrics metrics = GeckoApp.mAppContext.getDisplayMetrics();
|
||||
combinedArgs += " -width " + metrics.widthPixels + " -height " + metrics.heightPixels;
|
||||
|
||||
GeckoApp.mAppContext.runOnUiThread(new Runnable() {
|
||||
@ -1182,9 +1181,7 @@ public class GeckoAppShell
|
||||
|
||||
public static int getDpi() {
|
||||
if (sDensityDpi == 0) {
|
||||
DisplayMetrics metrics = new DisplayMetrics();
|
||||
GeckoApp.mAppContext.getWindowManager().getDefaultDisplay().getMetrics(metrics);
|
||||
sDensityDpi = metrics.densityDpi;
|
||||
sDensityDpi = GeckoApp.mAppContext.getDisplayMetrics().densityDpi;
|
||||
}
|
||||
|
||||
return sDensityDpi;
|
||||
|
@ -252,8 +252,7 @@ public class GeckoEvent {
|
||||
}
|
||||
} else {
|
||||
float size = event.getSize(eventIndex);
|
||||
DisplayMetrics displaymetrics = new DisplayMetrics();
|
||||
GeckoApp.mAppContext.getWindowManager().getDefaultDisplay().getMetrics(displaymetrics);
|
||||
DisplayMetrics displaymetrics = GeckoApp.mAppContext.getDisplayMetrics();
|
||||
size = size*Math.min(displaymetrics.heightPixels, displaymetrics.widthPixels);
|
||||
mPointRadii[index] = new Point((int)size,(int)size);
|
||||
mOrientations[index] = 0;
|
||||
|
@ -12,7 +12,6 @@ import android.graphics.Color;
|
||||
import android.graphics.drawable.BitmapDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.AsyncTask;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.util.Log;
|
||||
import android.view.Surface;
|
||||
import android.view.View;
|
||||
@ -139,9 +138,7 @@ public final class Tab {
|
||||
|
||||
float getDensity() {
|
||||
if (sDensity == 0.0f) {
|
||||
DisplayMetrics metrics = new DisplayMetrics();
|
||||
GeckoApp.mAppContext.getWindowManager().getDefaultDisplay().getMetrics(metrics);
|
||||
sDensity = metrics.density;
|
||||
sDensity = GeckoApp.mAppContext.getDisplayMetrics().density;
|
||||
}
|
||||
return sDensity;
|
||||
}
|
||||
|
@ -107,8 +107,7 @@ public class GeckoLayerClient implements GeckoEventResponder,
|
||||
|
||||
/* Informs Gecko that the screen size has changed. */
|
||||
private void sendResizeEventIfNecessary(boolean force) {
|
||||
DisplayMetrics metrics = new DisplayMetrics();
|
||||
GeckoApp.mAppContext.getWindowManager().getDefaultDisplay().getMetrics(metrics);
|
||||
DisplayMetrics metrics = GeckoApp.mAppContext.getDisplayMetrics();
|
||||
View view = mLayerController.getView();
|
||||
|
||||
IntSize newScreenSize = new IntSize(metrics.widthPixels, metrics.heightPixels);
|
||||
|
@ -32,8 +32,7 @@ public class ViewportMetrics {
|
||||
private float mZoomFactor;
|
||||
|
||||
public ViewportMetrics() {
|
||||
DisplayMetrics metrics = new DisplayMetrics();
|
||||
GeckoApp.mAppContext.getWindowManager().getDefaultDisplay().getMetrics(metrics);
|
||||
DisplayMetrics metrics = GeckoApp.mAppContext.getDisplayMetrics();
|
||||
|
||||
mPageRect = new RectF(0, 0, metrics.widthPixels, metrics.heightPixels);
|
||||
mCssPageRect = new RectF(0, 0, metrics.widthPixels, metrics.heightPixels);
|
||||
|
Loading…
Reference in New Issue
Block a user