List of usage examples for android.util DisplayMetrics DENSITY_HIGH
int DENSITY_HIGH
To view the source code for android.util DisplayMetrics DENSITY_HIGH.
Click Source Link
From source file:com.cypress.cysmart.BLEServiceFragments.SensorHubService.java
private void setupPressureGraph(View parent) { {//from ww w. j a va 2 s . c om /** * Setting graph titles */ String graphTitle = getResources().getString(R.string.sen_hub_pressure); String graphXAxis = getResources().getString(R.string.health_temperature_time); String graphYAxis = getResources().getString(R.string.sen_hub_pressure); // Creating an XYSeries for temperature mPressureDataSeries = new XYSeries(graphTitle); // Creating a dataset to hold each series XYMultipleSeriesDataset mDataset = new XYMultipleSeriesDataset(); // Adding temperature Series to the dataset mDataset.addSeries(mPressureDataSeries); // Creating XYSeriesRenderer to customize XYSeriesRenderer mRenderer = new XYSeriesRenderer(); mRenderer.setColor(getResources().getColor(R.color.main_bg_color)); mRenderer.setPointStyle(PointStyle.CIRCLE); mRenderer.setFillPoints(true); mRenderer.setLineWidth(5); // Creating a XYMultipleSeriesRenderer to customize the whole chart XYMultipleSeriesRenderer mMultiRenderer = new XYMultipleSeriesRenderer(); switch (getResources().getDisplayMetrics().densityDpi) { case DisplayMetrics.DENSITY_XHIGH: mMultiRenderer.setMargins(new int[] { 40, 90, 25, 10 }); mMultiRenderer.setAxisTitleTextSize(Constants.TEXT_SIZE_XHDPI); mMultiRenderer.setChartTitleTextSize(Constants.TEXT_SIZE_XHDPI); mMultiRenderer.setLabelsTextSize(Constants.TEXT_SIZE_XHDPI); mMultiRenderer.setLegendTextSize(Constants.TEXT_SIZE_XHDPI); break; case DisplayMetrics.DENSITY_HIGH: mMultiRenderer.setMargins(new int[] { 30, 50, 25, 10 }); mMultiRenderer.setAxisTitleTextSize(Constants.TEXT_SIZE_HDPI); mMultiRenderer.setChartTitleTextSize(Constants.TEXT_SIZE_HDPI); mMultiRenderer.setLabelsTextSize(Constants.TEXT_SIZE_HDPI); mMultiRenderer.setLegendTextSize(Constants.TEXT_SIZE_HDPI); break; case DisplayMetrics.DENSITY_XXHIGH: mMultiRenderer.setMargins(new int[] { 50, 100, 35, 20 }); mMultiRenderer.setAxisTitleTextSize(Constants.TEXT_SIZE_XXHDPI); mMultiRenderer.setChartTitleTextSize(Constants.TEXT_SIZE_XXHDPI); mMultiRenderer.setLabelsTextSize(Constants.TEXT_SIZE_XXHDPI); mMultiRenderer.setLegendTextSize(Constants.TEXT_SIZE_XXHDPI); break; default: mMultiRenderer.setMargins(new int[] { 30, 50, 25, 10 }); mMultiRenderer.setAxisTitleTextSize(Constants.TEXT_SIZE_LDPI); mMultiRenderer.setChartTitleTextSize(Constants.TEXT_SIZE_LDPI); mMultiRenderer.setLabelsTextSize(Constants.TEXT_SIZE_LDPI); mMultiRenderer.setLegendTextSize(Constants.TEXT_SIZE_LDPI); break; } mMultiRenderer.setXTitle(graphXAxis); mMultiRenderer.setLabelsColor(Color.BLACK); mMultiRenderer.setYTitle(graphYAxis); mMultiRenderer.setMarginsColor(Color.argb(0x00, 0xff, 0x00, 0x00)); mMultiRenderer.setPanEnabled(true, true); mMultiRenderer.setYLabelsColor(0, Color.BLACK); mMultiRenderer.setXLabelsColor(Color.BLACK); mMultiRenderer.setApplyBackgroundColor(true); mMultiRenderer.setBackgroundColor(Color.WHITE); mMultiRenderer.setGridColor(Color.BLACK); mMultiRenderer.setShowGrid(true); mMultiRenderer.setShowLegend(false); // Adding mRenderer to multipleRenderer mMultiRenderer.addSeriesRenderer(mRenderer); // Getting a reference to LinearLayout of the MainActivity Layout mPressureGraphLayoutParent = (LinearLayout) parent.findViewById(R.id.pressure_chart_container); mPressureChart = ChartFactory.getLineChartView(getActivity(), mDataset, mMultiRenderer); // Adding the Line Chart to the LinearLayout mPressureGraphLayoutParent.addView(mPressureChart); } }
From source file:com.cypress.cysmart.BLEServiceFragments.SensorHubService.java
private void setupTempGraph(View parent) { {/*from w ww. j a va2 s . c o m*/ /** * Setting graph titles */ String graphTitle = getResources().getString(R.string.sen_hub_temperature); String graphXAxis = getResources().getString(R.string.health_temperature_time); String graphYAxis = getResources().getString(R.string.sen_hub_temperature); // Creating an XYSeries for temperature mTemperatureDataSeries = new XYSeries(graphTitle); // Creating a dataset to hold each series XYMultipleSeriesDataset mDataset = new XYMultipleSeriesDataset(); // Adding temperature Series to the dataset mDataset.addSeries(mTemperatureDataSeries); // Creating XYSeriesRenderer to customize XYSeriesRenderer mRenderer = new XYSeriesRenderer(); mRenderer.setColor(getResources().getColor(R.color.main_bg_color)); mRenderer.setPointStyle(PointStyle.CIRCLE); mRenderer.setFillPoints(true); mRenderer.setLineWidth(5); // Creating a XYMultipleSeriesRenderer to customize the whole chart XYMultipleSeriesRenderer mMultiRenderer = new XYMultipleSeriesRenderer(); switch (getResources().getDisplayMetrics().densityDpi) { case DisplayMetrics.DENSITY_XHIGH: mMultiRenderer.setMargins(new int[] { 40, 90, 25, 10 }); mMultiRenderer.setAxisTitleTextSize(Constants.TEXT_SIZE_XHDPI); mMultiRenderer.setChartTitleTextSize(Constants.TEXT_SIZE_XHDPI); mMultiRenderer.setLabelsTextSize(Constants.TEXT_SIZE_XHDPI); mMultiRenderer.setLegendTextSize(Constants.TEXT_SIZE_XHDPI); break; case DisplayMetrics.DENSITY_HIGH: mMultiRenderer.setMargins(new int[] { 30, 50, 25, 10 }); mMultiRenderer.setAxisTitleTextSize(Constants.TEXT_SIZE_HDPI); mMultiRenderer.setChartTitleTextSize(Constants.TEXT_SIZE_HDPI); mMultiRenderer.setLabelsTextSize(Constants.TEXT_SIZE_HDPI); mMultiRenderer.setLegendTextSize(Constants.TEXT_SIZE_HDPI); break; case DisplayMetrics.DENSITY_XXHIGH: mMultiRenderer.setMargins(new int[] { 50, 100, 35, 20 }); mMultiRenderer.setAxisTitleTextSize(Constants.TEXT_SIZE_XXHDPI); mMultiRenderer.setChartTitleTextSize(Constants.TEXT_SIZE_XXHDPI); mMultiRenderer.setLabelsTextSize(Constants.TEXT_SIZE_XXHDPI); mMultiRenderer.setLegendTextSize(Constants.TEXT_SIZE_XXHDPI); break; default: mMultiRenderer.setMargins(new int[] { 30, 50, 25, 10 }); mMultiRenderer.setAxisTitleTextSize(Constants.TEXT_SIZE_LDPI); mMultiRenderer.setChartTitleTextSize(Constants.TEXT_SIZE_LDPI); mMultiRenderer.setLabelsTextSize(Constants.TEXT_SIZE_LDPI); mMultiRenderer.setLegendTextSize(Constants.TEXT_SIZE_LDPI); break; } mMultiRenderer.setXTitle(graphXAxis); mMultiRenderer.setLabelsColor(Color.BLACK); mMultiRenderer.setYTitle(graphYAxis); mMultiRenderer.setMarginsColor(Color.argb(0x00, 0xff, 0x00, 0x00)); mMultiRenderer.setPanEnabled(true, true); mMultiRenderer.setYLabelsColor(0, Color.BLACK); mMultiRenderer.setXLabelsColor(Color.BLACK); mMultiRenderer.setApplyBackgroundColor(true); mMultiRenderer.setBackgroundColor(Color.WHITE); mMultiRenderer.setGridColor(Color.BLACK); mMultiRenderer.setShowGrid(true); mMultiRenderer.setShowLegend(false); // Adding mRenderer to multipleRenderer mMultiRenderer.addSeriesRenderer(mRenderer); // Getting a reference to LinearLayout of the MainActivity Layout mTemperatureGraphLayoutParent = (LinearLayout) parent.findViewById(R.id.temp_chart_container); mTemperaturerChart = ChartFactory.getLineChartView(getActivity(), mDataset, mMultiRenderer); // Adding the Line Chart to the LinearLayout mTemperatureGraphLayoutParent.addView(mTemperaturerChart); } }
From source file:com.cypress.cysmart.BLEServiceFragments.SensorHubService.java
/** * Setting accelerometer graph/*from w w w . j a v a 2 s . com*/ * @param parent */ private void setupAccChart(View parent) { /** * Setting graph titles */ String graphXTitle = getResources().getString(R.string.sen_hub_accelerometer_x); String graphYTitle = getResources().getString(R.string.sen_hub_accelerometer_Y); String graphZTitle = getResources().getString(R.string.sen_hub_accelerometer_Z); String graphXAxis = getResources().getString(R.string.health_temperature_time); String graphYAxis = getResources().getString(R.string.sen_hub_accelerometer); // Creating an XYSeries for Accelerometer mAccXDataSeries = new XYSeries(graphXTitle); mAccYDataSeries = new XYSeries(graphYTitle); mAccZDataSeries = new XYSeries(graphZTitle); // Creating a dataset to hold each series XYMultipleSeriesDataset mDataset = new XYMultipleSeriesDataset(); // Adding temperature Series to the dataset mDataset.addSeries(mAccXDataSeries); mDataset.addSeries(mAccYDataSeries); mDataset.addSeries(mAccZDataSeries); // Creating XYSeriesRenderer to customize XYSeriesRenderer mXRenderer = new XYSeriesRenderer(); mXRenderer.setColor(Color.RED); mXRenderer.setPointStyle(PointStyle.CIRCLE); mXRenderer.setFillPoints(true); mXRenderer.setLineWidth(5); XYSeriesRenderer mYRenderer = new XYSeriesRenderer(); mYRenderer.setColor(Color.BLUE); mYRenderer.setPointStyle(PointStyle.CIRCLE); mYRenderer.setFillPoints(true); mYRenderer.setLineWidth(5); XYSeriesRenderer mZRenderer = new XYSeriesRenderer(); mZRenderer.setColor(Color.GREEN); mZRenderer.setPointStyle(PointStyle.CIRCLE); mZRenderer.setFillPoints(true); mZRenderer.setLineWidth(5); // Creating a XYMultipleSeriesRenderer to customize the whole chart XYMultipleSeriesRenderer mMultiRenderer = new XYMultipleSeriesRenderer(); switch (getResources().getDisplayMetrics().densityDpi) { case DisplayMetrics.DENSITY_XHIGH: mMultiRenderer.setMargins(new int[] { 40, 90, 25, 10 }); mMultiRenderer.setAxisTitleTextSize(Constants.TEXT_SIZE_XHDPI); mMultiRenderer.setChartTitleTextSize(Constants.TEXT_SIZE_XHDPI); mMultiRenderer.setLabelsTextSize(Constants.TEXT_SIZE_XHDPI); mMultiRenderer.setLegendTextSize(Constants.TEXT_SIZE_XHDPI); break; case DisplayMetrics.DENSITY_HIGH: mMultiRenderer.setMargins(new int[] { 30, 50, 25, 10 }); mMultiRenderer.setAxisTitleTextSize(Constants.TEXT_SIZE_HDPI); mMultiRenderer.setChartTitleTextSize(Constants.TEXT_SIZE_HDPI); mMultiRenderer.setLabelsTextSize(Constants.TEXT_SIZE_HDPI); mMultiRenderer.setLegendTextSize(Constants.TEXT_SIZE_HDPI); break; case DisplayMetrics.DENSITY_XXHIGH: mMultiRenderer.setMargins(new int[] { 50, 100, 35, 20 }); mMultiRenderer.setAxisTitleTextSize(Constants.TEXT_SIZE_XXHDPI); mMultiRenderer.setChartTitleTextSize(Constants.TEXT_SIZE_XXHDPI); mMultiRenderer.setLabelsTextSize(Constants.TEXT_SIZE_XXHDPI); mMultiRenderer.setLegendTextSize(Constants.TEXT_SIZE_XXHDPI); break; default: mMultiRenderer.setMargins(new int[] { 30, 50, 25, 10 }); mMultiRenderer.setAxisTitleTextSize(Constants.TEXT_SIZE_LDPI); mMultiRenderer.setChartTitleTextSize(Constants.TEXT_SIZE_LDPI); mMultiRenderer.setLabelsTextSize(Constants.TEXT_SIZE_LDPI); mMultiRenderer.setLegendTextSize(Constants.TEXT_SIZE_LDPI); break; } mMultiRenderer.setXTitle(graphXAxis); mMultiRenderer.setLabelsColor(Color.BLACK); mMultiRenderer.setYTitle(graphYAxis); mMultiRenderer.setMarginsColor(Color.argb(0x00, 0xff, 0x00, 0x00)); mMultiRenderer.setPanEnabled(true, true); mMultiRenderer.setYLabelsColor(0, Color.BLACK); mMultiRenderer.setXLabelsColor(Color.BLACK); mMultiRenderer.setApplyBackgroundColor(true); mMultiRenderer.setBackgroundColor(Color.WHITE); mMultiRenderer.setGridColor(Color.BLACK); mMultiRenderer.setShowGrid(true); mMultiRenderer.setShowLegend(false); // Adding mRenderer to multipleRenderer mMultiRenderer.addSeriesRenderer(mXRenderer); mMultiRenderer.addSeriesRenderer(mYRenderer); mMultiRenderer.addSeriesRenderer(mZRenderer); // Getting a reference to LinearLayout of the MainActivity Layout mACCGraphLayoutParent = (LinearLayout) parent.findViewById(R.id.accelerometer_chart_container); mAccelerometerChart = ChartFactory.getLineChartView(getActivity(), mDataset, mMultiRenderer); // Adding the Line Chart to the LinearLayout mACCGraphLayoutParent.addView(mAccelerometerChart); }
From source file:com.mobicage.rogerthat.MainService.java
public int getScreenScale() { // Based on UIScreen.scale on iOS if (mScreenScale == null) { switch (getResources().getDisplayMetrics().densityDpi) { case DisplayMetrics.DENSITY_LOW: mScreenScale = 1;//from w w w .j av a 2 s .c o m break; case DisplayMetrics.DENSITY_MEDIUM: mScreenScale = 2; break; case DisplayMetrics.DENSITY_HIGH: mScreenScale = 3; break; default: mScreenScale = 2; break; } } return mScreenScale; }
From source file:com.codename1.impl.android.AndroidImplementation.java
@Override public int getDeviceDensity() { DisplayMetrics metrics = new DisplayMetrics(); if (getActivity() != null) { getActivity().getWindowManager().getDefaultDisplay().getMetrics(metrics); } else {/*from w w w . ja v a2 s . com*/ metrics = getContext().getResources().getDisplayMetrics(); } if (metrics.densityDpi < DisplayMetrics.DENSITY_MEDIUM) { return Display.DENSITY_LOW; } if (metrics.densityDpi < 213) { return Display.DENSITY_MEDIUM; } // 213 == TV if (metrics.densityDpi >= 213 && metrics.densityDpi <= DisplayMetrics.DENSITY_HIGH) { return Display.DENSITY_HIGH; } if (metrics.densityDpi > DisplayMetrics.DENSITY_HIGH && metrics.densityDpi < 400) { return Display.DENSITY_VERY_HIGH; } if (metrics.densityDpi >= 400 && metrics.densityDpi < 560) { return Display.DENSITY_HD; } if (metrics.densityDpi >= 560 && metrics.densityDpi <= 640) { return Display.DENSITY_2HD; } if (metrics.densityDpi > 640) { return Display.DENSITY_4K; } return Display.DENSITY_MEDIUM; }
From source file:org.zywx.wbpalmstar.engine.universalex.EUExWindow.java
public void openAdMsg(String[] parm) { EBrowserWindow curWind = mBrwView.getBrowserWindow(); if (null == curWind) { return;//w w w . j a va2 s.c o m } WWidgetData wd = mBrwView.getCurrentWidget(); boolean b1 = mBrwView.checkType(EBrwViewEntry.VIEW_TYPE_MAIN); boolean b2 = 0 == wd.m_widgetAdStatus; boolean b3 = parm.length < 4; if (!b1 || b2 || b3) { // 0 means do not show ad return; } String inType = parm[0]; String inDTime = parm[1]; String inInterval = parm[2]; String inFlag = parm[3]; int type = 0, flag = 0, dtime = 0, interval = 0, w = RelativeLayout.LayoutParams.FILL_PARENT, h = 50; MessageDigest md = null; int density = ESystemInfo.getIntence().mDensityDpi; switch (density) { case DisplayMetrics.DENSITY_LOW: h = 40; break; case DisplayMetrics.DENSITY_MEDIUM: h = 50; break; case DisplayMetrics.DENSITY_HIGH: h = 60; break; case 320: // DisplayMetrics.DENSITY_XHIGH from 2.3.3 h = 70; break; } try { if (null != inType && inType.length() != 0) { type = Integer.parseInt(inType); } if (null != inDTime && inDTime.length() != 0) { dtime = Integer.parseInt(inDTime); } if (null != inInterval && inInterval.length() != 0) { interval = Integer.parseInt(inInterval); } if (null != inFlag && inFlag.length() != 0) { flag = Integer.parseInt(inFlag); } md = MessageDigest.getInstance("MD5"); } catch (Exception e) { errorCallback(0, EUExCallback.F_E_UEXWINDOW_EVAL, "Illegal parameter"); return; } StringBuffer sb = new StringBuffer(m_AdUrl); sb.append("?appid="); sb.append(wd.m_appId); sb.append("&pt=1"); sb.append("&dw="); sb.append(ESystemInfo.getIntence().mWidthPixels); sb.append("&dh="); sb.append(ESystemInfo.getIntence().mHeightPixels); sb.append("&md5="); if (null == md) { return; } String jid = wd.m_appId + "BD7463CD-D608-BEB4-C633-EF3574213060"; md.reset(); md.update(jid.getBytes()); byte[] md5Bytes = md.digest(); StringBuffer hexValue = new StringBuffer(); for (int i = 0; i < md5Bytes.length; i++) { int val = ((int) md5Bytes[i]) & 0xff; if (val < 16) hexValue.append("0"); hexValue.append(Integer.toHexString(val)); } sb.append(hexValue); sb.append("&type="); if (type == 1) { sb.append(1); h = w; } else { sb.append(0); } String url = sb.toString(); curWind.openAd(type, url, dtime * 1000, h, w, interval * 1000, flag); }
From source file:es.javocsoft.android.lib.toolbox.ToolBox.java
/** * Returns the device resolution type.//from w w w . j a v a 2s.com * * @param context * @return {@link es.javocsoft.android.lib.toolbox.ToolBox.DEVICE_RESOLUTION_TYPE} */ public static DEVICE_RESOLUTION_TYPE device_getResolutionType(Context context) { DEVICE_RESOLUTION_TYPE res = null; DisplayMetrics metrics = new DisplayMetrics(); WindowManager windowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); windowManager.getDefaultDisplay().getMetrics(metrics); switch (metrics.densityDpi) { case DisplayMetrics.DENSITY_LOW: res = DEVICE_RESOLUTION_TYPE.ldpi; break; case DisplayMetrics.DENSITY_MEDIUM: res = DEVICE_RESOLUTION_TYPE.mdpi; break; case DisplayMetrics.DENSITY_HIGH: res = DEVICE_RESOLUTION_TYPE.hdpi; break; case DisplayMetrics.DENSITY_XHIGH: res = DEVICE_RESOLUTION_TYPE.xhdpi; break; case DisplayMetrics.DENSITY_XXHIGH: res = DEVICE_RESOLUTION_TYPE.xxhdpi; break; } return res; }