Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix part #164: Hifi content card #338

Merged
merged 16 commits into from
Nov 18, 2019
Merged
4 changes: 2 additions & 2 deletions app/src/main/res/drawable/content_blue_background.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
android:shape="rectangle">
<stroke
android:width="1dp"
android:color="@color/blue_shade_200"/>
android:color="@color/oppiaStrokeBlue"/>
<corners
android:radius="4dp"/>
<solid
android:color="@color/oppiaLightBlue"/>
android:color="@color/oppiaSolidBlue"/>
</shape>
19 changes: 11 additions & 8 deletions app/src/main/res/layout/content_item.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,23 @@
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="4dp"
android:paddingStart="8dp"
android:paddingEnd="8dp">
android:layout_marginStart="20dp"
veena14cs marked this conversation as resolved.
Show resolved Hide resolved
android:layout_marginEnd="28dp"
android:layout_marginTop="24dp"
android:background="@drawable/content_blue_background">

<TextView
android:id="@+id/content_text_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="4dp"
android:background="@drawable/content_blue_background"
android:padding="12dp"
android:paddingStart="12dp"
android:paddingTop="16dp"
android:paddingEnd="12dp"
android:paddingBottom="16dp"
android:fontFamily="sans-serif"
android:text="@{htmlContent}"
android:visibility="@{htmlContent.length() > 0 ? View.VISIBLE : View.GONE, default=gone}"
android:textColor="@color/oppiaPrimaryText"
android:textSize="16sp" />
android:textSize="16sp"
android:visibility="@{htmlContent.length() > 0 ? View.VISIBLE : View.GONE, default=gone}" />
</FrameLayout>
</layout>
16 changes: 11 additions & 5 deletions app/src/main/res/layout/feedback_item.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,24 @@
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="4dp"
android:paddingEnd="8dp">
android:background="@drawable/content_blue_background"
android:layout_marginStart="20dp"
android:layout_marginEnd="28dp"
android:layout_marginTop="16dp"
android:layout_marginBottom="28dp">

<TextView
android:id="@+id/feedback_text_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="4dp"
android:background="@drawable/content_blue_background"
android:padding="12dp"
android:paddingStart="12dp"
android:paddingTop="16dp"
android:paddingEnd="12dp"
android:paddingBottom="16dp"
android:fontFamily="sans-serif"
android:text="@{htmlContent}"
android:textColor="@color/oppiaPrimaryText"
android:textSize="16sp" />
</FrameLayout>

</layout>
1 change: 0 additions & 1 deletion app/src/main/res/layout/fraction_interaction_item.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:layout_marginTop="24dp"
android:layout_marginBottom="24dp"
android:layout_marginStart="28dp"
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/selection_interaction_item.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
android:layout_marginStart="20dp"
android:layout_marginTop="32dp"
android:layout_marginEnd="20dp"
android:layout_marginBottom="20dp"
android:layout_marginBottom="16dp"
android:divider="@android:color/transparent"
app:data="@{viewModel.choiceItems}"
app:itemInputType="@{viewModel.getSelectionItemInputType()}"
Expand Down
1 change: 0 additions & 1 deletion app/src/main/res/layout/state_fragment.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
android:layout_width="0dp"
android:layout_height="0dp"
android:divider="@android:color/transparent"
android:dividerHeight="8dp"
android:overScrollMode="never"
android:scrollbars="none"
app:data="@{viewModel.itemList}"
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
<color name="oppiaLightBrown">#E76F51</color>
<color name="oppiaBackground">#F2F2F2</color>
<color name="oppiaStrokeBlue">#4D395FD0</color>
<color name="oppiaSolidBlue">#4DA5D3EC</color>
<color name="oppiaStrokeBlack">#CC333333</color>
<color name="oppiaProgressChapterFinished">#E76F51</color>
<color name="oppiaProgressChapterNotFinished">#999999</color>
Expand Down
4 changes: 2 additions & 2 deletions utility/src/main/java/org/oppia/util/parser/HtmlParser.kt
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ class HtmlParser private constructor(

val imageGetter = urlImageParserFactory.create(htmlContentTextView, entityType, entityId)
return if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.N) {
Html.fromHtml(htmlContent, Html.FROM_HTML_MODE_LEGACY, imageGetter, /* tagHandler= */ null) as Spannable
Html.fromHtml(htmlContent, Html.FROM_HTML_MODE_LEGACY, imageGetter, /* tagHandler= */ null).trim() as Spannable
veena14cs marked this conversation as resolved.
Show resolved Hide resolved
} else {
Html.fromHtml(htmlContent, imageGetter, /* tagHandler= */ null) as Spannable
Html.fromHtml(htmlContent, imageGetter, /* tagHandler= */ null).trim() as Spannable
}
}

Expand Down
6 changes: 3 additions & 3 deletions utility/src/main/java/org/oppia/util/parser/UrlImageParser.kt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class UrlImageParser private constructor(
private val context: Context,
@DefaultGcsPrefix private val gcsPrefix: String,
@DefaultGcsResource private val gcsResource: String,
@ImageDownloadUrlTemplate private var imageDownloadUrlTemplate: String,
@ImageDownloadUrlTemplate private val imageDownloadUrlTemplate: String,
private val htmlContentTextView: TextView,
private val entityType: String,
private val entityId: String,
Expand All @@ -32,11 +32,11 @@ class UrlImageParser private constructor(
* @return Drawable : Drawable representation of the image.
*/
override fun getDrawable(urlString: String): Drawable {
imageDownloadUrlTemplate = String.format(imageDownloadUrlTemplate, entityType, entityId, urlString)
val imageUrl = String.format(imageDownloadUrlTemplate, entityType, entityId, urlString)
BenHenning marked this conversation as resolved.
Show resolved Hide resolved
val urlDrawable = UrlDrawable()
val target = BitmapTarget(urlDrawable)
imageLoader.load(
gcsPrefix + gcsResource + imageDownloadUrlTemplate,
gcsPrefix + gcsResource + imageUrl,
target
)
return urlDrawable
Expand Down