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 #745 : Highfi StoryActivity #758

Merged
merged 13 commits into from
Mar 13, 2020
34 changes: 20 additions & 14 deletions app/src/main/res/layout-land/story_chapter_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
xmlns:app="http://schemas.android.com/apk/res-auto">

<data>

<import type="android.view.View" />

<import type="org.oppia.app.model.ChapterPlayState" />

<variable
Expand All @@ -18,10 +20,10 @@
<com.google.android.material.card.MaterialCardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="28dp"
android:layout_marginStart="76dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="28dp"
android:layout_marginBottom="16dp"
android:layout_marginEnd="72dp"
android:layout_marginBottom="8dp"
android:clickable="@{viewModel.chapterSummary.chapterPlayState != ChapterPlayState.NOT_PLAYABLE_MISSING_PREREQUISITES}"
android:onClick="@{(v) -> viewModel.onExplorationClicked()}"
app:cardCornerRadius="4dp"
Expand All @@ -38,6 +40,7 @@
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="116dp"
android:orientation="vertical"
android:padding="8dp"
app:layout_constraintBottom_toBottomOf="parent"
Expand All @@ -54,7 +57,7 @@
android:layout_marginEnd="8dp"
android:ellipsize="end"
android:fontFamily="sans-serif-medium"
android:maxLines="2"
android:maxLines="1"
android:text="@{String.format(@string/chapter_name, (viewModel.index + 1), viewModel.name)}"
android:textColor="@color/oppiaPrimaryText"
android:textSize="18sp"
Expand All @@ -65,20 +68,22 @@
<TextView
android:id="@+id/chapter_summary"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:layout_marginBottom="4dp"
android:ellipsize="end"
android:fontFamily="sans-serif"
android:maxLines="4"
android:maxLines="3"
android:text="@{viewModel.summary}"
android:textColor="@color/oppiaPrimaryText"
android:textSize="16sp"
app:layout_constraintBottom_toTopOf="@id/chapter_completed_tick"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/chapter_title" />
app:layout_constraintTop_toBottomOf="@id/chapter_title"
app:layout_constraintVertical_bias="0.0" />

<ImageView
android:id="@+id/chapter_completed_tick"
Expand All @@ -90,21 +95,22 @@
android:src="@drawable/ic_check_24dp"
android:visibility="@{viewModel.chapterSummary.chapterPlayState == ChapterPlayState.COMPLETED ? View.VISIBLE : View.GONE}"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" />

app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/chapter_summary"
app:layout_constraintVertical_bias="1.0" />
</androidx.constraintlayout.widget.ConstraintLayout>

</androidx.constraintlayout.widget.ConstraintLayout>

</com.google.android.material.card.MaterialCardView>

<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="16dp"
android:layout_marginStart="76dp"
rt4914 marked this conversation as resolved.
Show resolved Hide resolved
android:layout_marginTop="16dp"
android:layout_marginEnd="72dp"
android:layout_marginBottom="8dp"
android:background="@color/chapterCardShadow"
android:padding="8dp"
android:visibility="@{viewModel.chapterSummary.chapterPlayState == ChapterPlayState.NOT_PLAYABLE_MISSING_PREREQUISITES ? View.VISIBLE : View.INVISIBLE}" />
</FrameLayout>

</layout>
2 changes: 1 addition & 1 deletion app/src/main/res/layout-land/story_fragment.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
android:layout_height="match_parent"
android:clipToPadding="false"
android:overScrollMode="never"
android:paddingBottom="@dimen/bottom_white_space"
android:paddingBottom="60dp"
android:scrollbars="none"
app:data="@{viewModel.storyChapterLiveData}"
tools:listitem="@layout/story_chapter_view" />
Expand Down
26 changes: 26 additions & 0 deletions app/src/main/res/layout-land/story_header_view.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">

<data>

<variable
name="viewModel"
type="org.oppia.app.story.storyitemviewmodel.StoryHeaderViewModel" />
</data>

<TextView
android:id="@+id/story_progress_chapter_completed_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="76dp"
android:layout_marginTop="32dp"
android:layout_marginEnd="72dp"
android:layout_marginBottom="8dp"
android:fontFamily="sans-serif-medium"
android:text="@{@plurals/story_total_chapters(viewModel.totalChapters, viewModel.completedChapters, viewModel.totalChapters)}"
android:textColor="@color/oppiaPrimaryText"
android:textSize="18sp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</layout>
12 changes: 8 additions & 4 deletions app/src/main/res/layout/story_chapter_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -88,20 +88,22 @@
<TextView
android:id="@+id/chapter_summary"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:layout_marginBottom="4dp"
android:ellipsize="end"
android:fontFamily="sans-serif"
android:maxLines="4"
android:text="@{viewModel.summary}"
android:textColor="@color/oppiaPrimaryText"
android:textSize="16sp"
app:layout_constraintBottom_toTopOf="@id/chapter_completed_tick"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/chapter_title" />
app:layout_constraintTop_toBottomOf="@id/chapter_title"
app:layout_constraintVertical_bias="0.0" />

<ImageView
android:id="@+id/chapter_completed_tick"
Expand All @@ -113,7 +115,9 @@
android:src="@drawable/ic_check_24dp"
android:visibility="@{viewModel.chapterSummary.chapterPlayState == ChapterPlayState.COMPLETED ? View.VISIBLE : View.GONE}"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/chapter_summary"
app:layout_constraintVertical_bias="1.0" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</com.google.android.material.card.MaterialCardView>
Expand Down