Code example for TypedValue

Methods: resolveAttribute

0
		webView.getSettings().setPluginState(PluginState.ON);
		webView.loadUrl(String.format("data:text/html;charset=utf-8,%s", Uri.encode(html)));
	} 
 
    public static boolean isDarkTheme(Context context) {
        TypedValue tv = new TypedValue();
        float [] hsv =  new float[3];
        context.getTheme().resolveAttribute(android.R.attr.textColorPrimary, tv, true);
        Color.colorToHSV(context.getResources().getColor(tv.resourceId), hsv);
        return hsv[2] > 0.5f;
    } 
 
	@SuppressLint("DefaultLocale") 
	public static String getQuantityString(View view, int id, int count) {
		return String.format("%,d %s", count, view.getContext().getResources().getQuantityString(id, count));
	} 
 
	public static void displayInstantAnswer(View view, BaseModel model) {
		TextView title = (TextView) view.findViewById(R.id.uv_title);
		TextView detail = (TextView) view.findViewById(R.id.uv_detail);
		View suggestionDetails = view.findViewById(R.id.uv_suggestion_details);