Android Open Source - Joetz-Android-V2 Period Category

From Project

Back to project page Joetz-Android-V2.


The source code is released under:

GNU General Public License

If you think the Android project Joetz-Android-V2 listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.example.jens.myapplication.domain;
/* ww  w .j  a va 2s .co m*/
import com.example.jens.myapplication.R;

 * Created by Sam on 5/12/2014.
public enum PeriodCategory {

    private long value;
    private PeriodCategory(long value){
        this.value = value;

     * Finds the category of the parameter (only one flag is allowed)
     * @param singleCategory
     * @return The found category, if not found, returns OTHER
    public static PeriodCategory findCategory(long singleCategory){
        for(PeriodCategory pc : values()){
            if(pc.value == singleCategory){
                return pc;
        return OTHER;

    public long getValue(){
        return value;

     * Get the string resource id associated with this period
     * @return string resource id
    public int getNameResourceId(){
            case OTHER: return R.string.none;
            case CHRISTMAS: return R.string.christmas_vacation;
            case EASTER: return R.string.easter_vacation;
            case SUMMER: return R.string.summer_vacation;
            case KROKUS: return R.string.krokus_vacation;
            case AUTUMN: return R.string.autumn_vacation;
        return R.string.none;

     * get the drawable resource id associated with the period
     * @return drawable resource id
    public int getResourceIdImage(){
            case OTHER: return R.color.transparent;
            case CHRISTMAS: return R.drawable.kerstvakantie;
            case EASTER: return R.drawable.paasvakantie;
            case SUMMER: return R.drawable.zomervakantie;
            case KROKUS: return R.drawable.krokusvakantie;
            case AUTUMN: return R.drawable.herfstvakantie;
        return R.color.transparent;

Java Source Code List