The Bedrock Addons app is designed with conditionals to simplify the development experience for new developers.

With the open source project, you can set up conditional statements to simplify your development experience, and to create things (such as UI elements) that have not been introduced into the database by combining multiple database entries.

Example: Updated tags

Updated tags that appear on content appear based on conditional statements instead of in the database to allow developers to have freedom in what they want to add to their tags. There is a basic set of tags that can be utilized for your specific needs.

<TextView
    android:id="@+id/updated"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:background="@drawable/updated_tag"
    android:paddingLeft="4dp"
    android:paddingTop="1dp"
    android:paddingRight="4dp"
    android:paddingBottom="1dp"
    android:layout_marginLeft="2dp"
    android:layout_marginRight="2dp"
    android:text="Updated"
    android:textColor="@android:color/white"
    android:layout_gravity="center_vertical"
    android:textSize="11sp" />
ActivityContentDetails.java

This If statement is what controls the visibility of the code above. It says that if the date that the content was created at is not equal to the time it was last updated, it will show the tag, and set the tag text to updated.

The view is visible by default, so you only need to hide the view. Setting update.setText to "Updated" is required because sometimes android:text="Updated" does not display correctly. This is a bug with Android, not the application.

if (news.created_at != news.last_update) {
	update.setText("Updated");
    } else {
    update.setVisibility(View.GONE);
}
ActivityContentDetails.java