use of com.amazon.android.model.content.Content in project zype-firebuilder by zype.
the class ContentTranslatorTest method testSetMemberVariableTags.
/**
* Tests the {@link ContentTranslator#setMemberVariable(Content, String, Object)} method for
* the tags member variable.
*/
@Test
public void testSetMemberVariableTags() throws Exception {
String tags = "['tag1', 'tag2', 'tag3']";
Content content = new Content();
assertTrue(mContentTranslator.setMemberVariable(content, "mTags", tags));
assertEquals(content.getTags().size(), 3);
}
use of com.amazon.android.model.content.Content in project zype-firebuilder by zype.
the class ContentTranslatorTest method testValidateModelFalseDescription.
/**
* Tests the {@link ContentTranslator#validateModel(Content)} method for the false case where
* the description is invalid.
*/
@Test
public void testValidateModelFalseDescription() throws Exception {
Content content = createValidContent();
// make good content bad
content.setDescription("");
assertFalse(mContentTranslator.validateModel(content));
}
use of com.amazon.android.model.content.Content in project zype-firebuilder by zype.
the class ContentTranslatorTest method testValidateModelNullValue.
/**
* Tests the {@link ContentTranslator#validateModel(Content)} method for the false case where
* the title is null.
*/
@Test
public void testValidateModelNullValue() throws Exception {
Content content = createValidContent();
// make good content bad
content.setTitle(null);
assertFalse(mContentTranslator.validateModel(content));
}
use of com.amazon.android.model.content.Content in project zype-firebuilder by zype.
the class ContentTranslatorTest method testValidateModelFalseTitleCase.
/**
* Tests the {@link ContentTranslator#validateModel(Content)} method for the false case where
* the title is invalid.
*/
@Test
public void testValidateModelFalseTitleCase() throws Exception {
Content content = createValidContent();
// make good content bad
content.setTitle("");
assertFalse(mContentTranslator.validateModel(content));
}
use of com.amazon.android.model.content.Content in project zype-firebuilder by zype.
the class ContentBrowseActivity method onItemSelected.
/**
* {@inheritDoc}
* Called by the browse fragment ({@link ContentBrowseFragment}. Switches the content
* title, description, and image.
*/
@Override
public void onItemSelected(Object item, Row row, boolean isLastContentRow) {
if (item != null) {
lastRowSelected = isLastContentRow;
}
if (row != lastSelectedRow && item != null) {
lastSelectedRow = row;
lastSelectedRowChanged = true;
} else {
lastSelectedRowChanged = false;
}
lastSelectedItemIndex = ((ArrayObjectAdapter) ((ListRow) row).getAdapter()).indexOf(item);
if (item instanceof Content) {
Content content = (Content) item;
callImageLoadSubscription(content.getTitle(), content.getDescription(), content.getBackgroundImageUrl());
} else // Update screen background with selected playlist (category) image
if (item instanceof ContentContainer) {
ContentContainer contentContainer = (ContentContainer) item;
callImageLoadSubscription(contentContainer.getName(), contentContainer.getExtraStringValue("description"), contentContainer.getExtraStringValue(Content.BACKGROUND_IMAGE_URL_FIELD_NAME));
} else if (item instanceof Action) {
Action settingsAction = (Action) item;
// Terms of use action.
if (ContentBrowser.TERMS.equals(settingsAction.getAction())) {
callImageLoadSubscription(getString(R.string.terms_title), getString(R.string.terms_description), null);
} else // Login and logout action.
if (ContentBrowser.LOGIN_LOGOUT.equals(settingsAction.getAction())) {
if (settingsAction.getState() == LogoutSettingsFragment.TYPE_LOGOUT) {
callImageLoadSubscription(getString(R.string.logout_label), getString(R.string.logout_description), null);
} else {
callImageLoadSubscription(getString(R.string.login_label), getString(R.string.login_description), null);
}
}
}
}
Aggregations