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 #3930 Greeting text on home screen should be a single TextView #5131

Merged
merged 16 commits into from
Oct 6, 2023
Merged
Show file tree
Hide file tree
Changes from 3 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
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,19 @@ class WelcomeViewModel(
dateTimeUtil: DateTimeUtil
) : HomeItemViewModel() {

/** Text [String] to greet the learner and display on-screen when launching the home activity. */
/** Text [String] to greet the learner. */
val greeting: String = dateTimeUtil.getGreetingMessage()

/**
* Returns the user-readable portion of the welcome screen greeting that contains the user's name.
* Returns the string which contains greeting message with user's name and display on-screen when launching the home activity.
*/
fun computeProfileNameText(): String {
return resourceHandler.getStringInLocaleWithWrapping(R.string.welcome_profile_name, profileName)
fun welcomeText(): String {
return "$greeting ${
resourceHandler.getStringInLocaleWithWrapping(
R.string.welcome_profile_name,
profileName
)
}"
}

// Overriding equals is needed so that DataProvider combine functions used in the HomeViewModel
Expand Down
11 changes: 1 addition & 10 deletions app/src/main/res/layout/welcome.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,7 @@
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/home_welcome_text_view_margin_end"
android:fontFamily="sans-serif"
android:text="@{viewModel.greeting}"
android:textColor="@color/component_color_shared_primary_text_color"
android:textSize="24sp" />

<TextView
android:id="@+id/profile_name_text_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="sans-serif"
android:text="@{viewModel.computeProfileNameText()}"
android:text="@{viewModel.welcomeText}"
adhiamboperes marked this conversation as resolved.
Show resolved Hide resolved
android:textColor="@color/component_color_shared_primary_text_color"
android:textSize="24sp" />
</com.google.android.flexbox.FlexboxLayout>
Expand Down
Loading