Example usage for android.util DisplayMetrics DENSITY_XHIGH

List of usage examples for android.util DisplayMetrics DENSITY_XHIGH

Introduction

In this page you can find the example usage for android.util DisplayMetrics DENSITY_XHIGH.

Prototype

int DENSITY_XHIGH

To view the source code for android.util DisplayMetrics DENSITY_XHIGH.

Click Source Link

Document

Standard quantized DPI for extra-high-density screens.

Usage

From source file:com.cypress.cysmart.BLEServiceFragments.SensorHubService.java

private void setupPressureGraph(View parent) {
    {/* w  w  w .  ja  va 2s  .  c  o  m*/
        /**
         * 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  w w .j  a  va  2  s  .  c  om*/
        /**
         * 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 ava2 s .c o  m
 * @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:es.javocsoft.android.lib.toolbox.ToolBox.java

/**
 * Returns the device resolution type.//from   w  w  w.  j  ava  2s .  c  om
 * 
 * @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;
}