Android Open Source - AndroidCharts My Utils






From Project

Back to project page AndroidCharts.

License

The source code is released under:

MIT License

If you think the Android project AndroidCharts listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.dacer.androidcharts;
/*from  w w  w. ja  va 2s  .com*/

import android.content.Context;

/**
 * Created by Dacer on 10/8/13.
 */
public class MyUtils {

    public static int dip2px(Context context, float dipValue){
        final float scale = context.getResources().getDisplayMetrics().density;
        return (int)(dipValue * scale + 0.5f);
    }

    public static int px2dip(Context context, float pxValue){
        final float scale = context.getResources().getDisplayMetrics().density;
        return (int)(pxValue / scale + 0.5f);
    }

    public static int sp2px(Context context, float spValue) {
        final float fontScale = context.getResources().getDisplayMetrics().scaledDensity;
        return (int) (spValue * fontScale + 0.5f);
    }

}




Java Source Code List

com.dacer.androidcharts.BarView.java
com.dacer.androidcharts.ClockPieHelper.java
com.dacer.androidcharts.ClockPieView.java
com.dacer.androidcharts.LineView.java
com.dacer.androidcharts.MyUtils.java
com.dacer.androidcharts.PieHelper.java
com.dacer.androidcharts.PieView.java
com.dacer.androidcharts.TempLog.java
com.dacer.androidchartsexample.BarFragment.java
com.dacer.androidchartsexample.ClockPieFragment.java
com.dacer.androidchartsexample.LineFragment.java
com.dacer.androidchartsexample.MainActivity.java
com.dacer.androidchartsexample.NavigationDrawerFragment.java
com.dacer.androidchartsexample.PieFragment.java