Back to project page android-appwidget-cirrus.
The source code is released under:
MIT License
If you think the Android project android-appwidget-cirrus listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
/* Copyright 2014 Wayne D Grant (www.waynedgrant.com) Licensed under the MIT License */ /*from w ww . j a va 2s. c om*/ package com.waynedgrant.cirrus.presentation.formatters; import static com.waynedgrant.cirrus.units.WindDirectionUnit.COMPASS_DEGREES; import java.util.Locale; import com.waynedgrant.cirrus.measures.WindDirection; import com.waynedgrant.cirrus.units.WindDirectionUnit; public class WindDirectionFormatter { private WindDirection windDirection; public WindDirectionFormatter(WindDirection windDirection) { this.windDirection = windDirection; } public String format(WindDirectionUnit unit) { String formatted = null; if (windDirection != null) { if (unit == COMPASS_DEGREES) { formatted = String.format(Locale.US, "%1d", windDirection.getCompassDegrees()); } else { formatted = String.format(Locale.US, "%1s", windDirection.getCardinalDirection().name()); } } else { if (unit == WindDirectionUnit.COMPASS_DEGREES) { formatted = "---"; } else { formatted = "---"; } } return formatted; } }