From 0e6827d25383e195cfbf4dd4b1fa3e00a4ab31c9 Mon Sep 17 00:00:00 2001 From: joelmoniz Date: Sat, 26 Jul 2014 17:37:30 +0400 Subject: [PATCH] Added isSpecial() to check if contrib is to be highlighted --- app/src/processing/app/contrib/Contribution.java | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/app/src/processing/app/contrib/Contribution.java b/app/src/processing/app/contrib/Contribution.java index 451ab7d4e..92f21d155 100644 --- a/app/src/processing/app/contrib/Contribution.java +++ b/app/src/processing/app/contrib/Contribution.java @@ -30,9 +30,10 @@ import processing.core.PApplet; abstract public class Contribution { + static final String SPECIAL_CATEGORY_NAME = "Starred"; static final List validCategories = Arrays.asList("3D", "Animation", "Data", "Geometry", "GUI", "Hardware", - "I/O", "Math", "Simulation", "Sound", "Typography", + "I/O", "Math", "Simulation", "Sound", SPECIAL_CATEGORY_NAME, "Typography", "Utilities", "Video & Vision", "Other"); //protected String category; // "Sound" @@ -165,6 +166,19 @@ abstract public class Contribution { } + /** + * Returns true if the contribution is a starred/recommended contribution, or + * is by the Processing Foundation. + * + * @return + */ + boolean isSpecial() { + if (authorList.indexOf("The Processing Foundation") != -1 || categories.contains(SPECIAL_CATEGORY_NAME)) + return true; + return false; + } + + /** * @return a single element list with "Unknown" as the category. */