本文整理汇总了Java中com.eveningoutpost.dexdrip.UtilityModels.BgSparklineBuilder类的典型用法代码示例。如果您正苦于以下问题:Java BgSparklineBuilder类的具体用法?Java BgSparklineBuilder怎么用?Java BgSparklineBuilder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BgSparklineBuilder类属于com.eveningoutpost.dexdrip.UtilityModels包,在下文中一共展示了BgSparklineBuilder类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: displayCurrentInfo
import com.eveningoutpost.dexdrip.UtilityModels.BgSparklineBuilder; //导入依赖的package包/类
private static void displayCurrentInfo(AppWidgetManager appWidgetManager, int appWidgetId, Context context, RemoteViews views) {
BgGraphBuilder bgGraphBuilder = new BgGraphBuilder(context);
BgReading lastBgreading = BgReading.lastNoSenssor();
SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(context);
boolean showLines = settings.getBoolean("widget_range_lines", false);
if (lastBgreading != null) {
double estimate = 0;
int height = appWidgetManager.getAppWidgetOptions(appWidgetId).getInt(AppWidgetManager.OPTION_APPWIDGET_MAX_HEIGHT);
int width = appWidgetManager.getAppWidgetOptions(appWidgetId).getInt(AppWidgetManager.OPTION_APPWIDGET_MAX_WIDTH);
views.setImageViewBitmap(R.id.widgetGraph, new BgSparklineBuilder(context)
.setBgGraphBuilder(bgGraphBuilder)
.setHeight(height).setWidth(width).showHighLine(showLines).showLowLine(showLines).build());
if ((new Date().getTime()) - (60000 * 11) - lastBgreading.timestamp > 0) {
estimate = lastBgreading.calculated_value;
Log.d(TAG, "old value, estimate " + estimate);
views.setTextViewText(R.id.widgetBg, bgGraphBuilder.unitized_string(estimate));
views.setTextViewText(R.id.widgetArrow, "--");
views.setInt(R.id.widgetBg, "setPaintFlags", Paint.STRIKE_THRU_TEXT_FLAG | Paint.ANTI_ALIAS_FLAG);
} else {
estimate = lastBgreading.calculated_value;
String stringEstimate = bgGraphBuilder.unitized_string(estimate);
String slope_arrow = lastBgreading.slopeArrow();
if (lastBgreading.hide_slope) {
slope_arrow = "--";
}
Log.d(TAG, "newish value, estimate " + stringEstimate + slope_arrow);
views.setTextViewText(R.id.widgetBg, stringEstimate);
views.setTextViewText(R.id.widgetArrow, slope_arrow);
views.setInt(R.id.widgetBg, "setPaintFlags", 0);
}
List<BgReading> bgReadingList = BgReading.latest(2);
if(bgReadingList != null && bgReadingList.size() == 2) {
views.setTextViewText(R.id.widgetDelta, bgGraphBuilder.unitizedDeltaString(true, true));
} else {
views.setTextViewText(R.id.widgetDelta, "--");
}
int timeAgo =(int) Math.floor((new Date().getTime() - lastBgreading.timestamp)/(1000*60));
if (timeAgo == 1) {
views.setTextViewText(R.id.readingAge, timeAgo + " Minute ago");
} else {
views.setTextViewText(R.id.readingAge, timeAgo + " Minutes ago");
}
if (timeAgo > 15) {
views.setTextColor(R.id.readingAge, Color.parseColor("#FFBB33"));
} else {
views.setTextColor(R.id.readingAge, Color.WHITE);
}
if(settings.getBoolean("extra_status_line", false) && settings.getBoolean("widget_status_line", false)) {
views.setTextViewText(R.id.widgetStatusLine, Home.extraStatusLine(settings));
views.setViewVisibility(R.id.widgetStatusLine, View.VISIBLE);
} else {
views.setTextViewText(R.id.widgetStatusLine, "");
views.setViewVisibility(R.id.widgetStatusLine, View.GONE);
}
if (bgGraphBuilder.unitized(estimate) <= bgGraphBuilder.lowMark) {
views.setTextColor(R.id.widgetBg, Color.parseColor("#C30909"));
views.setTextColor(R.id.widgetDelta, Color.parseColor("#C30909"));
views.setTextColor(R.id.widgetArrow, Color.parseColor("#C30909"));
} else if (bgGraphBuilder.unitized(estimate) >= bgGraphBuilder.highMark) {
views.setTextColor(R.id.widgetBg, Color.parseColor("#FFBB33"));
views.setTextColor(R.id.widgetDelta, Color.parseColor("#FFBB33"));
views.setTextColor(R.id.widgetArrow, Color.parseColor("#FFBB33"));
} else {
views.setTextColor(R.id.widgetBg, Color.WHITE);
views.setTextColor(R.id.widgetDelta, Color.WHITE);
views.setTextColor(R.id.widgetArrow, Color.WHITE);
}
}
}