Skip to content

Follow-up: YiR entry dialog code optimization #5479

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

Merged
merged 1 commit into from
Apr 17, 2025
Merged
Show file tree
Hide file tree
Changes from all 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
4 changes: 2 additions & 2 deletions app/src/main/java/org/wikipedia/main/MainFragment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ import org.wikipedia.util.TabUtil
import org.wikipedia.views.NotificationButtonView
import org.wikipedia.views.TabCountsView
import org.wikipedia.watchlist.WatchlistActivity
import org.wikipedia.yearinreview.YearInReviewDialog
import org.wikipedia.yearinreview.YearInReviewEntryDialog
import java.io.File
import java.util.concurrent.TimeUnit

Expand Down Expand Up @@ -473,7 +473,7 @@ class MainFragment : Fragment(), BackPressedHandler, MenuProvider, FeedFragment.
}

override fun yearInReviewClick() {
ExclusiveBottomSheetPresenter.show(childFragmentManager, YearInReviewDialog.newInstance())
ExclusiveBottomSheetPresenter.show(childFragmentManager, YearInReviewEntryDialog.newInstance())
}

fun setBottomNavVisible(visible: Boolean) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import com.google.android.material.bottomsheet.BottomSheetDialog
import org.wikipedia.compose.theme.BaseTheme
import org.wikipedia.page.ExtendedBottomSheetDialogFragment

class YearInReviewDialog : ExtendedBottomSheetDialogFragment() {
class YearInReviewEntryDialog : ExtendedBottomSheetDialogFragment() {

override fun onCreateView(
inflater: LayoutInflater,
Expand All @@ -23,15 +23,15 @@ class YearInReviewDialog : ExtendedBottomSheetDialogFragment() {
return ComposeView(requireContext()).apply {
setContent {
BaseTheme {
YearInReviewBottomSheet()
YearInReviewEntryDialogScreen()
}
}
}
}

companion object {
fun newInstance(): YearInReviewDialog {
return YearInReviewDialog()
fun newInstance(): YearInReviewEntryDialog {
return YearInReviewEntryDialog()
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package org.wikipedia.yearinreview
import android.widget.ImageView
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.aspectRatio
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.heightIn
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.wrapContentHeight
import androidx.compose.foundation.rememberScrollState
Expand All @@ -19,7 +19,9 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.input.nestedscroll.nestedScroll
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.platform.rememberNestedScrollInteropConnection
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.tooling.preview.Preview
Expand All @@ -31,34 +33,34 @@ import org.wikipedia.compose.theme.WikipediaTheme

@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun YearInReviewBottomSheet() {
fun YearInReviewEntryDialogScreen() {
val context = LocalContext.current
val scrollState = rememberScrollState()
Column(
modifier = Modifier
.fillMaxWidth()
.wrapContentHeight()
.clip(RoundedCornerShape(topStart = 20.dp, topEnd = 20.dp))
.padding(20.dp)
.verticalScroll(scrollState),
.padding(vertical = 16.dp)
.nestedScroll(rememberNestedScrollInteropConnection())
.verticalScroll(rememberScrollState()),
horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.spacedBy(10.dp)
) {
Text(
modifier = Modifier.padding(
horizontal = 30.dp
horizontal = 32.dp
),
text = stringResource(R.string.year_in_review_explore_screen_title),
text = stringResource(R.string.year_in_review_entry_dialog_title),
color = WikipediaTheme.colors.primaryColor,
style = MaterialTheme.typography.headlineSmall,
textAlign = TextAlign.Center

)
Text(
modifier = Modifier.padding(
horizontal = 45.dp
horizontal = 16.dp
),
text = stringResource(R.string.year_in_review_explore_screen_bodytext),
text = stringResource(R.string.year_in_review_entry_dialog_bodytext),
color = WikipediaTheme.colors.primaryColor,
style = MaterialTheme.typography.bodyMedium,
textAlign = TextAlign.Center
Expand All @@ -69,13 +71,12 @@ fun YearInReviewBottomSheet() {
Glide.with(this)
.asGif()
.load(R.drawable.wyir_puzzle_4_v2)
.centerCrop()
.into(this)
}
},
modifier = Modifier
.fillMaxWidth()
.aspectRatio(3f / 2f)
.heightIn(max = 240.dp)
.clip(RoundedCornerShape(16.dp))
)
Button(
Expand All @@ -91,16 +92,16 @@ fun YearInReviewBottomSheet() {
)
) {
Text(
text = stringResource(R.string.year_in_review_explore_screen_continue),
text = stringResource(R.string.year_in_review_entry_dialog_continue),
color = WikipediaTheme.colors.paperColor,
style = MaterialTheme.typography.labelLarge
)
}
}
}

@Preview
@Preview(showBackground = true)
@Composable
fun PreviewBottomSheet() {
YearInReviewBottomSheet()
YearInReviewEntryDialogScreen()
}
6 changes: 3 additions & 3 deletions app/src/main/res/values-qq/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1793,7 +1793,7 @@
<string name="year_in_review_read_count_bodytext">Body text for the year in review readcount page. \"%d\" represents the total number of articles in the HistoryEntry table for the current year</string>
<string name="year_in_review_edit_count_headline">Headline text for the year in review editcount page. \"%d\" represents the total number of userContribs for the current year</string>
<string name="year_in_review_edit_count_bodytext">Body text for the year in review editcount page. \"%d\" represents the total number of userContribs for the current year</string>
<string name="year_in_review_explore_screen_title">Headline for the year in review Explore Screen</string>
<string name="year_in_review_explore_screen_bodytext">Body text for the year in review Explore Screen</string>
<string name="year_in_review_explore_screen_continue">Button text for the year in review Explore Screen</string>
<string name="year_in_review_entry_dialog_title">Headline for the year in review Explore Screen</string>
<string name="year_in_review_entry_dialog_bodytext">Body text for the year in review Explore Screen</string>
<string name="year_in_review_entry_dialog_continue">Button text for the year in review Explore Screen</string>
</resources>
6 changes: 3 additions & 3 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1876,7 +1876,7 @@
<string name="year_in_review_read_count_bodytext">This year, you read %d articles, including Climate change, Dogs, and Cats. Wikipedia had more than 63 million articles available across over 300 languages. You joined millions in expanding knowledge and exploring diverse topics.</string>
<string name="year_in_review_edit_count_headline">You edited Wikipedia %d times</string>
<string name="year_in_review_edit_count_bodytext">You edited Wikipedia %d times. Thank you for being one of the volunteer editors making a difference on Wikimedia projects around the world.</string>
<string name="year_in_review_explore_screen_title">Explore your Wikipedia in Review</string>
<string name="year_in_review_explore_screen_bodytext">See insights about what articles we read and edited, and share highlights from our year on Wikipedia.</string>
<string name="year_in_review_explore_screen_continue">Continue</string>
<string name="year_in_review_entry_dialog_title">Explore your Wikipedia in Review</string>
<string name="year_in_review_entry_dialog_bodytext">See insights about what articles we read and edited, and share highlights from our year on Wikipedia.</string>
<string name="year_in_review_entry_dialog_continue">Continue</string>
</resources>
Loading