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 #535: Material card corner white spacing[ON HOLD] #579

Closed
wants to merge 3 commits into from
Closed
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
194 changes: 105 additions & 89 deletions app/src/main/res/layout/story_chapter_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,111 +17,127 @@
android:layout_width="match_parent"
android:layout_height="wrap_content">

<com.google.android.material.card.MaterialCardView
<!--<com.google.android.material.card.MaterialCardView-->
<!--android:layout_width="match_parent"-->
<!--android:layout_height="wrap_content"-->
<!--android:layout_marginStart="16dp"-->
<!--android:layout_marginTop="28dp"-->
<!--android:layout_marginEnd="16dp"-->
<!--android:layout_marginBottom="28dp"-->
<!--android:clickable="@{viewModel.chapterSummary.chapterPlayState != ChapterPlayState.NOT_PLAYABLE_MISSING_PREREQUISITES}"-->
<!--android:onClick="@{viewModel.onExplorationClicked}"-->
<!--app:cardCornerRadius="4dp"-->
<!--app:cardElevation="@{viewModel.chapterSummary.chapterPlayState != ChapterPlayState.NOT_PLAYABLE_MISSING_PREREQUISITES ? @dimen/elevation_4dp : @dimen/elevation_0dp}"-->
<!--app:strokeColor="@{viewModel.chapterSummary.chapterPlayState != ChapterPlayState.NOT_PLAYABLE_MISSING_PREREQUISITES ? @color/colorPrimary : @color/chapterCardGreyBorder}"-->
<!--app:strokeWidth="2dp">-->
<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="28dp"
android:layout_marginEnd="16dp"
android:layout_marginBottom="28dp"
android:layout_marginStart="28dp"
android:layout_marginBottom="42dp"
android:layout_marginEnd="28dp"
app:contentPadding="2dp"
android:clickable="@{viewModel.chapterSummary.chapterPlayState != ChapterPlayState.NOT_PLAYABLE_MISSING_PREREQUISITES}"
android:onClick="@{viewModel.onExplorationClicked}"
app:cardCornerRadius="4dp"
app:cardElevation="@{viewModel.chapterSummary.chapterPlayState != ChapterPlayState.NOT_PLAYABLE_MISSING_PREREQUISITES ? @dimen/elevation_4dp : @dimen/elevation_0dp}"
app:strokeColor="@{viewModel.chapterSummary.chapterPlayState != ChapterPlayState.NOT_PLAYABLE_MISSING_PREREQUISITES ? @color/colorPrimary : @color/chapterCardGreyBorder}"
app:strokeWidth="2dp">
android:onClick="@{viewModel.onExplorationClicked}"
app:cardCornerRadius="4dp"
app:cardElevation="@{viewModel.chapterSummary.chapterPlayState != ChapterPlayState.NOT_PLAYABLE_MISSING_PREREQUISITES ? @dimen/elevation_4dp : @dimen/elevation_0dp}"
app:cardBackgroundColor="@{viewModel.chapterSummary.chapterPlayState != ChapterPlayState.NOT_PLAYABLE_MISSING_PREREQUISITES ? @color/colorPrimary : @color/chapterCardGreyBorder}"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">

<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clipToPadding="false"
android:background="@drawable/bottom_rounded_rect_white_background"
android:contentDescription="@{viewModel.name}">

<ImageView
android:id="@+id/chapter_thumbnail"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:contentDescription="@{viewModel.name}"
android:paddingStart="40dp"
android:paddingEnd="40dp"
android:scaleType="centerCrop"
android:src="@{viewModel.chapterThumbnail.thumbnailGraphic}"
app:layout_constraintDimensionRatio="H,4:3"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:rectangleDrawableWithColor="@{viewModel.chapterThumbnail.backgroundColorRgb}" />

<View
android:layout_width="match_parent"
android:layout_height="2dp"
android:background="@{viewModel.chapterSummary.chapterPlayState !=ChapterPlayState.NOT_PLAYABLE_MISSING_PREREQUISITES ? @color/colorPrimary : @color/chapterCardGreyBorder}"
app:layout_constraintBottom_toBottomOf="@id/chapter_thumbnail"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />

<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clipToPadding="true"
android:contentDescription="@{viewModel.name}">
android:minHeight="140dp"
android:orientation="vertical"
android:padding="8dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/chapter_thumbnail">

<ImageView
android:id="@+id/chapter_thumbnail"
android:layout_width="match_parent"
<TextView
android:id="@+id/chapter_title"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:contentDescription="@{viewModel.name}"
android:paddingStart="40dp"
android:paddingEnd="40dp"
android:scaleType="centerCrop"
android:src="@{viewModel.chapterThumbnail.thumbnailGraphic}"
app:layout_constraintDimensionRatio="H,4:3"
android:layout_marginStart="8dp"
android:layout_marginEnd="8dp"
android:fontFamily="sans-serif-medium"
android:text="@{String.format(@string/chapter_name, (viewModel.index + 1), viewModel.name)}"
android:textColor="@color/oppiaPrimaryText"
android:textSize="18sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:roundedRectDrawableWithColor="@{viewModel.chapterThumbnail.backgroundColorRgb}" />
app:layout_constraintTop_toTopOf="parent" />

<View
android:layout_width="match_parent"
android:layout_height="2dp"
android:background="@{viewModel.chapterSummary.chapterPlayState !=ChapterPlayState.NOT_PLAYABLE_MISSING_PREREQUISITES ? @color/colorPrimary : @color/chapterCardGreyBorder}"
app:layout_constraintBottom_toBottomOf="@id/chapter_thumbnail"
<TextView
android:id="@+id/chapter_summary"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:fontFamily="sans-serif"
android:text="@{viewModel.summary}"
android:textColor="@color/oppiaPrimaryText"
android:textSize="16sp"
app:layout_constraintBottom_toTopOf="@id/chapter_completed_tick"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/chapter_title" />

<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
<ImageView
android:id="@+id/chapter_completed_tick"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:minHeight="140dp"
android:orientation="vertical"
android:padding="8dp"
android:layout_marginEnd="12dp"
android:layout_marginBottom="8dp"
android:contentDescription="@{String.format(@string/chapter_completed, (viewModel.index + 1), viewModel.name)}"
android:src="@drawable/ic_check_primary"
android:visibility="@{viewModel.chapterSummary.chapterPlayState == ChapterPlayState.COMPLETED ? View.VISIBLE : View.INVISIBLE}"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/chapter_thumbnail">

<TextView
android:id="@+id/chapter_title"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginEnd="8dp"
android:fontFamily="sans-serif-medium"
android:text="@{String.format(@string/chapter_name, (viewModel.index + 1), viewModel.name)}"
android:textColor="@color/oppiaPrimaryText"
android:textSize="18sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<TextView
android:id="@+id/chapter_summary"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:fontFamily="sans-serif"
android:text="@{viewModel.summary}"
android:textColor="@color/oppiaPrimaryText"
android:textSize="16sp"
app:layout_constraintBottom_toTopOf="@id/chapter_completed_tick"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/chapter_title" />

<ImageView
android:id="@+id/chapter_completed_tick"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="12dp"
android:layout_marginBottom="8dp"
android:contentDescription="@{String.format(@string/chapter_completed, (viewModel.index + 1), viewModel.name)}"
android:src="@drawable/ic_check_primary"
android:visibility="@{viewModel.chapterSummary.chapterPlayState == ChapterPlayState.COMPLETED ? View.VISIBLE : View.INVISIBLE}"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
app:layout_constraintEnd_toEndOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
</com.google.android.material.card.MaterialCardView>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.cardview.widget.CardView>

<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="16dp"
android:background="@color/chapterCardShadow"
android:padding="8dp"
android:visibility="@{viewModel.chapterSummary.chapterPlayState == ChapterPlayState.NOT_PLAYABLE_MISSING_PREREQUISITES ? View.VISIBLE : View.INVISIBLE}" />
</FrameLayout>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="16dp"
android:background="@color/chapterCardShadow"
android:padding="8dp"
android:visibility="@{viewModel.chapterSummary.chapterPlayState == ChapterPlayState.NOT_PLAYABLE_MISSING_PREREQUISITES ? View.VISIBLE : View.INVISIBLE}" />
</FrameLayout>
</layout>