Skip to content

Instantly share code, notes, and snippets.

@ChandraniChatterjeeMolly
Created March 7, 2017 04:45
Show Gist options
  • Save ChandraniChatterjeeMolly/8565b7e9246bdb043188d7c567051b9d to your computer and use it in GitHub Desktop.
Save ChandraniChatterjeeMolly/8565b7e9246bdb043188d7c567051b9d to your computer and use it in GitHub Desktop.
miwok:Word
package com.example.android.miwok;
/**
* {@link Word} represents a vocabulary word that the user wants to learn.
* It contains a default translation, a Miwok translation, and an image for that word.
*/
public class Word {
/** Default translation for the word */
private String mDefaultTranslation;
/** Miwok translation for the word */
private String mMiwokTranslation;
/** Image resource ID for the word */
private int mImageResourceId = NO_IMAGE_PROVIDED;
/** Constant value that represents no image was provided for this word */
private static final int NO_IMAGE_PROVIDED = -1;
private int mMediaPlayerId;
/**
* Create a new Word object.
*
* @param defaultTranslation is the word in a language that the user is already familiar with
* (such as English)
* @param miwokTranslation is the word in the Miwok language
*/
public Word(String defaultTranslation, String miwokTranslation, int mplayerId) {
mDefaultTranslation = defaultTranslation;
mMiwokTranslation = miwokTranslation;
mMediaPlayerId = mplayerId;
}
/**
* Create a new Word object.
*
* @param defaultTranslation is the word in a language that the user is already familiar with
* (such as English)
* @param miwokTranslation is the word in the Miwok language
* @param imageResourceId is the drawable resource ID for the image associated with the word
*
*/
public Word(String defaultTranslation, String miwokTranslation, int imageResourceId, int mplayerId) {
mDefaultTranslation = defaultTranslation;
mMiwokTranslation = miwokTranslation;
mImageResourceId = imageResourceId;
mMediaPlayerId = mplayerId;
}
/**
* Get the default translation of the word.
*/
public String getDefaultTranslation() {
return mDefaultTranslation;
}
/**
* Get the Miwok translation of the word.
*/
public String getMiwokTranslation() {
return mMiwokTranslation;
}
/**
* Return the image resource ID of the word.
*/
public int getImageResourceId() {
return mImageResourceId;
}
/**
* Return the media player resource ID of the word.
*/
public int getMediaplayerId() { return mMediaPlayerId; }
/**
* Returns whether or not there is an image for this word.
*/
public boolean hasImage() {
return mImageResourceId != NO_IMAGE_PROVIDED;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment