Android Open Source - improv-referee Improv Renderer






From Project

Back to project page improv-referee.

License

The source code is released under:

Copyright (C) <2011> by <Pierre-Henri Trivier> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to de...

If you think the Android project improv-referee 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 fr.pht.improv.model;
/*from   w w  w. j a  v  a 2  s  . co m*/

public class ImprovRenderer {
    private Improv improv;
    private final String compared;
    private final String mixt;
    private final String unlimited;
    private final String categoryFree;
    
    public ImprovRenderer(String compared, String mixt, String unlimited, String categoryFree) {
        this.compared = compared;
        this.mixt = mixt;
        this.unlimited = unlimited;
        this.categoryFree = categoryFree;
    }
    
    public void setImprov(Improv improv) {
        this.improv = improv;
    }
    
    public String getTitle() {
        return improv.getTitle();
    }
    
    public String getType() {
        if (improv.getType() == ImprovType.COMPARED) {
            return this.compared;
        } else {
            return this.mixt;
        }
    }
    
    public String getCategory() {
        String res = improv.getCategory();
        if (res == null || "".equals(res)) {
            res = categoryFree;
        }
        return res;
    }
    
    public String getPlayerCount() {
        if (improv.getPlayerCount() == 0) {
            return this.unlimited;
        } else {
            return String.valueOf(improv.getPlayerCount());
        }
    }
    
    public String getDuration() {
        return displayTime(improv.getDuration());
    }
    
    public static String displayTime(int duration) {
        StringBuffer res = new StringBuffer();
        int minutes = duration / 60;
        int seconds = duration % 60;
        
        if (minutes > 0) {
            res.append(minutes).append("m ");
        }
        if (seconds > 0 && duration != 0) {
            res.append(seconds).append("s");
        }
        return res.toString();
    }
    
}




Java Source Code List

fr.pht.improv.db.ImprovDbHelper.java
fr.pht.improv.db.ImprovDbTable.java
fr.pht.improv.model.ImprovRenderer.java
fr.pht.improv.model.ImprovType.java
fr.pht.improv.model.Improv.java
fr.pht.improv.reader.ImprovDatabaseReader.java
fr.pht.improv.reader.ImprovLineReader.java
fr.pht.improv.referee.ImprovDetailActivity.java
fr.pht.improv.referee.ImprovListActivity.java
fr.pht.improv.referee.ImprovListFragment.java
fr.pht.improv.referee.ImprovRefereeActivity.java
fr.pht.improv.referee.ProgressListener.java
fr.pht.improv.referee.ProgressTimer.java
fr.pht.improv.referee.contentprovider.ImprovContentProvider.java