Android Context Get getMinFontSize(Context context)

Here you can find the source of getMinFontSize(Context context)

Description

get Min Font Size

Declaration

public static int getMinFontSize(Context context) 

Method Source Code

//package com.java2s;
import android.content.Context;

import android.util.DisplayMetrics;
import android.view.Display;
import android.view.WindowManager;

public class Main {
    private static DisplayMetrics _display_metrics = null;
    private static float MIN_FONT_SIZE = 0.1f;
    public static int STANDARD_DPI = 160;

    public static int getMinFontSize(Context context) {
        retrieveDisplayMetrics(context);
        float sys_scale = context.getResources().getConfiguration().fontScale;
        return (int) (MIN_FONT_SIZE * _display_metrics.density
                * STANDARD_DPI * sys_scale);
    }/*from  w  ww .j av a 2 s . c  om*/

    private static void retrieveDisplayMetrics(Context context) {
        if (_display_metrics == null) {
            Display display = ((WindowManager) context
                    .getSystemService(Context.WINDOW_SERVICE))
                    .getDefaultDisplay();
            _display_metrics = new DisplayMetrics();
            display.getMetrics(_display_metrics);
        }
    }
}

Related

  1. getLinePaint(Context context)
  2. getLineThickness(Context context)
  3. getLocationProvider(Context context)
  4. getLongSPR(String key, Context context)
  5. getMemoryClass(Context context)
  6. getMobilityPackageInfo(Context context)
  7. getMobilityVersion(Context context)
  8. getMusesAppContext()
  9. getNameFromUri(Context context, Uri uri)