Back to project page makler.
The source code is released under:
GNU General Public License
If you think the Android project makler listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package pl.net.newton.Makler.db.alert; /*from ww w.ja v a 2s . c om*/ import java.math.BigDecimal; import android.content.Context; import android.content.res.Resources; import pl.net.newton.Makler.R; import pl.net.newton.Makler.db.quote.Quote; import pl.net.newton.Makler.db.quote.QuoteField; public enum Subject { KURS { @Override public BigDecimal getValue(Quote q) { return q.getAsDecimal(QuoteField.QUOTE); } }, WOLUMEN { @Override public BigDecimal getValue(Quote q) { return q.getAsDecimal(QuoteField.VOL); } }, WARTOSC { @Override public BigDecimal getValue(Quote q) { return q.getAsDecimal(QuoteField.VALUE); } }; public abstract BigDecimal getValue(Quote q); public static Subject getFromLabel(Context context, String label) { Resources res = context.getResources(); String[] codes = res.getStringArray(R.array.alert_subjects_codes); String[] labels = res.getStringArray(R.array.alert_subjects_strings); for (int i = 0; i < labels.length; i++) { if (labels[i].equals(label)) { return Subject.valueOf(codes[i]); } } return null; } public String getLabel(Context context) { Resources res = context.getResources(); String[] codes = res.getStringArray(R.array.alert_subjects_codes); String[] labels = res.getStringArray(R.array.alert_subjects_strings); for (int i = 0; i < codes.length; i++) { if (Subject.valueOf(codes[i]) == this) { return labels[i]; } } return null; } }