Skip to content

Commit

Permalink
improvement: Move War banner to about section
Browse files Browse the repository at this point in the history
  • Loading branch information
AChep committed Apr 25, 2024
1 parent 55c441e commit 300990b
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 103 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,6 @@ class MainViewModel(application: Application) : BaseViewModel(application) {
analytics.logQuoteOpen(quote)
}

@UiThread
fun openLearnAboutWar() {
val url = getApplication<Application>().getString(R.string.war_learn_more_url)
url.let(openUrlEvent::setValue)
}

@UiThread
fun shareQuote(quote: QuoteItem) {
quote.let(shareQuoteEvent::setValue)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@ class MainFragment : BaseFragment<FragmentMainBinding>(),

viewBinding.moreBtn.setOnClickListener(this)
viewBinding.btn.setOnClickListener(this)
viewBinding.warLearnMoreBtn.setOnClickListener(this)

viewBinding.analogClock.foreground = analogClockDrawable

Expand Down Expand Up @@ -231,7 +230,6 @@ class MainFragment : BaseFragment<FragmentMainBinding>(),
when (view.id) {
R.id.btn -> mainViewModel.editTime()
R.id.moreBtn -> showMorePopUp(view)
R.id.warLearnMoreBtn -> mainViewModel.openLearnAboutWar()
}
}

Expand Down
53 changes: 52 additions & 1 deletion app/src/main/res/layout/fragment_about.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,18 +50,69 @@
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintWidth_max="@dimen/sheetMaxWidth">

<com.google.android.material.card.MaterialCardView
android:id="@+id/warContainer"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="16dp"
android:layout_marginBottom="16dp"
app:cardBackgroundColor="?colorErrorContainer"
app:cardCornerRadius="24dp"
app:cardElevation="0dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:strokeWidth="0dp">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingVertical="16dp">

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="start|center_vertical"
android:background="?selectableItemBackground"
android:gravity="center_vertical"
android:paddingStart="16dp"
android:paddingEnd="16dp"
android:text="@string/war_title"
android:textAppearance="?textAppearanceTitleMedium"
android:textColor="?colorOnErrorContainer" />

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="start|center_vertical"
android:background="?selectableItemBackground"
android:gravity="center_vertical"
android:paddingStart="16dp"
android:paddingEnd="16dp"
android:text="@string/war_text"
android:textAppearance="?textAppearanceBodyMedium"
android:textColor="?colorOnErrorContainer" />

</LinearLayout>

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

<TextView
android:id="@+id/appDescTextView"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="24dp"
android:layout_marginEnd="16dp"
android:autoLink="web"
android:text="@string/about_app_description"
android:textAppearance="?textAppearanceBodyMedium"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
app:layout_constraintTop_toBottomOf="@id/warContainer" />

<TextView
android:id="@+id/appVersionTextView"
Expand Down
99 changes: 5 additions & 94 deletions app/src/main/res/layout/fragment_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -94,105 +94,16 @@
android:layout_height="@dimen/app_bar_height__expanded"
app:layout_constraintTop_toTopOf="parent" />

<androidx.core.widget.NestedScrollView
android:id="@+id/scrollView"
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="0dp"
android:layout_height="0dp"
android:clipToPadding="false"
android:paddingTop="@dimen/frame_margin_vertical"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/barrier">

<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">

<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:clipToPadding="false"
android:orientation="vertical"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintWidth_max="@dimen/sheetMaxWidth">

<com.google.android.material.card.MaterialCardView
android:id="@+id/warContainer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="16dp"
android:layout_marginBottom="16dp"
app:cardBackgroundColor="?colorErrorContainer"
app:cardCornerRadius="24dp"
app:cardElevation="0dp"
app:strokeWidth="0dp">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingVertical="16dp">

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="start|center_vertical"
android:background="?selectableItemBackground"
android:gravity="center_vertical"
android:paddingStart="16dp"
android:paddingEnd="16dp"
android:text="@string/war_title"
android:textAppearance="?textAppearanceTitleMedium"
android:textColor="?colorOnErrorContainer" />

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="start|center_vertical"
android:background="?selectableItemBackground"
android:gravity="center_vertical"
android:paddingStart="16dp"
android:paddingEnd="16dp"
android:text="@string/war_text"
android:textAppearance="?textAppearanceBodyMedium"
android:textColor="?colorOnErrorContainer" />

<TextView
android:id="@+id/warLearnMoreBtn"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:background="?selectableItemBackground"
android:drawablePadding="16dp"
android:paddingHorizontal="16dp"
android:paddingTop="12dp"
android:paddingBottom="12dp"
android:text="@string/war_learn_more"
android:textAppearance="?textAppearanceBodyLarge"
android:textColor="?colorOnErrorContainer"
app:drawableEndCompat="@drawable/ic_chevron"
app:drawableStartCompat="@drawable/ic_outline_info"
app:drawableTint="?colorOnErrorContainer" />

</LinearLayout>

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

<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clipToPadding="false"
android:nestedScrollingEnabled="false" />

</LinearLayout>

</androidx.constraintlayout.widget.ConstraintLayout>

</androidx.core.widget.NestedScrollView>
app:layout_constraintTop_toBottomOf="@id/barrier" />

<com.google.android.material.progressindicator.LinearProgressIndicator
android:id="@+id/progressBar"
Expand Down

0 comments on commit 300990b

Please sign in to comment.