Android Open Source - ddgatve-android Data Holder






From Project

Back to project page ddgatve-android.

License

The source code is released under:

Apache License

If you think the Android project ddgatve-android 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 lv.ddgatve.games.mtable;
/*from ww  w.j av  a  2s  .  c  o  m*/
import java.util.Date;

public class DataHolder {

  private static DataHolder instance;

  private Questions q;

  private int totalCorrect;
  
  private long startMilliseconds;

  private DataHolder() {
    q = new Questions(150);
    totalCorrect = 0;
    startMilliseconds = (new Date()).getTime();
  }
  
  public static DataHolder getInstance() {
    if (instance == null) {
      instance = new DataHolder();
    }
    return instance;
  }

  public String getQuestion() {
    return q.getQuestion();
  }
  
  public int getQuestionType() { 
    return q.getType();
  }
  
  public void nextQuestion() {
    q.next();
  }
  
  public int getAnswer() {
    return q.getAnswer();
  }
  
  public int getTotalCorrect() {
    return totalCorrect;
  }

  public void incrementTotalCorrect() {
    totalCorrect++;
  }
  
  public String timeDifference() {
    long current = (new Date()).getTime();
    int difference = (int) Math.round(1.0*(current - startMilliseconds)/1000);
    int minutes = difference / 60; 
    int seconds = difference - 60*minutes;
    return minutes + " min?tes, " + seconds + " sekundes";  
  }
  
  public void reset() {
    totalCorrect = 0;
    q = new Questions(150);
    startMilliseconds = (new Date()).getTime();
  }
}




Java Source Code List

lv.ddgatve.applets.ColoredCircleApplet.java
lv.ddgatve.applets.MovingCircleApplet.java
lv.ddgatve.applets.PlainCircleApplet.java
lv.ddgatve.applets.SmoothCircleApplet.java
lv.ddgatve.games.game15.Game15Activity.java
lv.ddgatve.games.game15.Game15Frame.java
lv.ddgatve.games.game15.ImageAdapter.java
lv.ddgatve.games.game15.PickFrameDialogFragment.java
lv.ddgatve.games.game15.SummaryActivity.java
lv.ddgatve.games.main.MainActivity.java
lv.ddgatve.games.mtable.DataHolder.java
lv.ddgatve.games.mtable.DisplayMessageActivity.java
lv.ddgatve.games.mtable.MainActivity.java
lv.ddgatve.games.mtable.Questions.java
lv.ddgatve.games.mtable.SummaryActivity.java
lv.ddgatve.math.main.ExampleActivity.java
lv.ddgatve.math.main.MainActivity.java
lv.ddgatve.math.main.PostAsyncTask.java
lv.ddgatve.math.main.RegisterActivity.java
lv.hello.HelloWorld.java
lv.hello.MultiplicationTable.java
lv.kapsitis.myfirstapp.MainActivity.java