Android Open Source - OpenHSK Hanzi






From Project

Back to project page OpenHSK.

License

The source code is released under:

This work is licensed under a Creative Commons Attribution 3.0 Unported License. Original author of word lists: http://lingomi.com/ Original author of definitions: http://cc-cedict.org Original autho...

If you think the Android project OpenHSK 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 edu.openhsk.models;
/*from ww  w . j  a  va  2  s. co m*/
import android.content.ContentValues;

public class Hanzi {
  private String word; // the Chinese character(s) in UTF-8
  private String pinyin; // the pronunciation in alphabet, with tone marks
  private String definition; // the meaning of the character(s) in english
  private String searchKey; // this is used for text searching by pinyin (no tones)
  private boolean isLearned; // a user set variable to track learned characters
  private String soundfile; //the filename of the pronunciation recording

  public Hanzi() {
    // this ctor intentionally left empty
  }

  /**
   * Constructor for use when parsing character data in CSV format.
   */
  public Hanzi(String word, String pinyin, String definition, String searchKey) {
    this.word = word;
    this.pinyin = pinyin;
    this.definition = definition;
    this.searchKey = searchKey;
    this.isLearned = false;
    this.soundfile = "";
  }

  /**
   * Constructor for use when deserializing character data from the database.
   */
  public Hanzi(String word, String pinyin, String definition, String searchKey, 
      boolean isLearned, String soundfile) {
    this.word = word;
    this.pinyin = pinyin;
    this.definition = definition;
    this.searchKey = searchKey;
    this.isLearned = isLearned;
    this.soundfile = soundfile;
  }

  public String getWord() {
    return word;
  }

  public void setWord(String word) {
    this.word = word;
  }

  public String getPinyin() {
    return pinyin;
  }

  public void setPinyin(String pinyin) {
    this.pinyin = pinyin;
  }

  public String getDefinition() {
    return definition;
  }

  public void setDefinition(String definition) {
    this.definition = definition;
  }

  public String getSearchKey() {
    return searchKey;
  }

  public void setSearchKey(String searchKey) {
    this.searchKey = searchKey;
  }

  public boolean isLearned() {
    return isLearned;
  }

  public void setIsLearned(boolean learned) {
    this.isLearned = learned;
  }

  public String getSoundfile() {
    return soundfile;
  }

  public void setSoundfile(String soundfile) {
    this.soundfile = soundfile;
  }

  @Override
  public String toString() {
    return "Hanzi [word=" + word + ", pinyin=" + pinyin + ", definition="
        + definition + ", searchKey=" + searchKey + ", isLearned="
        + isLearned + ", soundfile=" + soundfile + "]";
  }

  public ContentValues toContentValues(int wordListId) {
    ContentValues cv = new ContentValues(7);
    cv.put("wordlistid", wordListId);
    cv.put("word", word);
    cv.put("pinyin", pinyin);
    cv.put("definition", definition);
    cv.put("searchkey", searchKey);
    cv.put("islearned", 0);
    if (soundfile != null) cv.put("soundfile", soundfile);
    return cv;
  }
}




Java Source Code List

edu.openhsk.CharacterListActivity.java
edu.openhsk.CharacterViewActivity.java
edu.openhsk.CreateWordActivity.java
edu.openhsk.CreateWordListActivity.java
edu.openhsk.ExamActivity.java
edu.openhsk.ExamResultActivity.java
edu.openhsk.MainActivity.java
edu.openhsk.QuizActivity.java
edu.openhsk.WordListSelectionActivity.java
edu.openhsk.adapters.WordListViewBinder.java
edu.openhsk.adapters.WordViewBinder.java
edu.openhsk.models.ExamResult.java
edu.openhsk.models.Hanzi.java
edu.openhsk.models.QuizHanzi.java
edu.openhsk.models.WordList.java
edu.openhsk.repository.DatabaseHelper.java
edu.openhsk.repository.DatabaseMetadata.java
edu.openhsk.repository.HanziRepository.java
edu.openhsk.repository.HelpfulCursor.java
edu.openhsk.repository.QuizRepository.java
edu.openhsk.repository.SimpleCursorLoader.java
edu.openhsk.repository.WordListRepository.java
edu.openhsk.service.QuizService.java
edu.openhsk.utils.AsyncSoundPlayer.java
edu.openhsk.utils.CSVExporter.java
edu.openhsk.utils.CSVParser.java
edu.openhsk.utils.PinyinReplacer.java
edu.openhsk.utils.SoundManager.java
edu.openhsk.views.BarGraph.java
edu.openhsk.views.Bar.java
edu.openhsk.views.ExamResultPieChart.java