Skip to content

Commit

Permalink
Merge branch 'new-onboarding-ui' of github.com:oppia/oppia-android in…
Browse files Browse the repository at this point in the history
…to onboarding-profile-configuration
  • Loading branch information
adhiamboperes committed Feb 27, 2024
2 parents 5b64119 + cc2cce0 commit 5a3ebc8
Show file tree
Hide file tree
Showing 27 changed files with 2,248 additions and 90 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package org.oppia.android.app.onboarding.onboardingv2

import android.content.res.Configuration
import android.content.res.Resources
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.ArrayAdapter
import androidx.appcompat.app.AppCompatActivity
import androidx.fragment.app.Fragment
import com.google.android.material.appbar.AppBarLayout
Expand All @@ -20,6 +21,7 @@ class AudioLanguageFragmentPresenter @Inject constructor(
private val appLanguageResourceHandler: AppLanguageResourceHandler
) {
private lateinit var binding: AudioLanguageSelectionFragmentBinding
private val orientation = Resources.getSystem().configuration.orientation

/**
* Returns a newly inflated view to render the fragment with the specified [audioLanguage] as the
Expand All @@ -42,13 +44,6 @@ class AudioLanguageFragmentPresenter @Inject constructor(
it.lifecycleOwner = fragment
}

binding.audioLanguageDropdown.adapter = ArrayAdapter(
fragment.requireContext(),
R.layout.onboarding_language_dropdown_item,
R.id.onboarding_language_text_view,
arrayOf("English")
)

binding.audioLanguageText.text = appLanguageResourceHandler.getStringInLocaleWithWrapping(
R.string.audio_language_fragment_text,
appLanguageResourceHandler.getStringInLocale(R.string.app_name)
Expand All @@ -61,6 +56,9 @@ class AudioLanguageFragmentPresenter @Inject constructor(
activity.finish()
}

binding.onboardingStepsCount?.visibility =
if (orientation == Configuration.ORIENTATION_PORTRAIT) View.VISIBLE else View.GONE

return binding.root
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package org.oppia.android.app.onboarding.onboardingv2

import android.content.Intent
import android.content.res.Configuration
import android.content.res.Resources
import android.graphics.PorterDuff
import android.graphics.drawable.Drawable
import android.provider.MediaStore
Expand Down Expand Up @@ -31,6 +33,7 @@ class NewLearnerProfileFragmentPresenter @Inject constructor(
) {
private lateinit var binding: CreateProfileFragmentBinding
private lateinit var uploadImageView: ImageView
private val orientation = Resources.getSystem().configuration.orientation

/** Initialize layout bindings. */
fun handleCreateView(inflater: LayoutInflater, container: ViewGroup?): View {
Expand Down Expand Up @@ -93,6 +96,9 @@ class NewLearnerProfileFragmentPresenter @Inject constructor(
binding.createProfilePicturePrompt.setOnClickListener { openGalleryIntent() }
binding.createProfileUserImageView.setOnClickListener { openGalleryIntent() }

binding.onboardingStepsCount.visibility =
if (orientation == Configuration.ORIENTATION_PORTRAIT) View.VISIBLE else View.GONE

return binding.root
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package org.oppia.android.app.onboarding.onboardingv2
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.ArrayAdapter
import androidx.appcompat.app.AppCompatActivity
import androidx.fragment.app.Fragment
import org.oppia.android.R
Expand Down Expand Up @@ -33,13 +32,6 @@ class OnboardingFragmentPresenter @Inject constructor(
it.lifecycleOwner = fragment
}

binding.onboardingLanguageDropdown.adapter = ArrayAdapter(
fragment.requireContext(),
R.layout.onboarding_language_dropdown_item,
R.id.onboarding_language_text_view,
arrayOf("English")
)

binding.onboardingLanguageTitle.text = appLanguageResourceHandler.getStringInLocaleWithWrapping(
R.string.onboarding_language_activity_title,
appLanguageResourceHandler.getStringInLocale(R.string.app_name)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,5 @@ class OnboardingLearnerIntroFragment :
)
}

override fun loadAudioLanguageFragment(audioLanguage: AudioLanguage) {
TODO("Not yet implemented")
}
override fun loadAudioLanguageFragment(audioLanguage: AudioLanguage) {}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package org.oppia.android.app.onboarding.onboardingv2

import android.content.res.Configuration
import android.content.res.Resources
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
Expand Down Expand Up @@ -29,6 +31,8 @@ class OnboardingLearnerIntroFragmentPresenter @Inject constructor(
private lateinit var routeToAudioLanguageListListener: RouteToAudioLanguageListListener
private lateinit var loadAudioLanguageListListener: LoadAudioLanguageListListener

private val orientation = Resources.getSystem().configuration.orientation

/** Handle creation and binding of the OnboardingLearnerIntroFragment layout. */
fun handleCreateView(
inflater: LayoutInflater,
Expand Down Expand Up @@ -63,7 +67,8 @@ class OnboardingLearnerIntroFragmentPresenter @Inject constructor(
appLanguageResourceHandler.getStringInLocale(R.string.app_name)
)

observeProfileLivedata(ProfileId.newBuilder().setInternalId(-1).build())
binding.onboardingStepsCount.visibility =
if (orientation == Configuration.ORIENTATION_PORTRAIT) View.VISIBLE else View.GONE

return binding.root
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ class OnboardingProfileTypeFragmentPresenter @Inject constructor(
binding.onboardingNavigationBack.setOnClickListener {
activity.finish()
}

return binding.root
}
}
2 changes: 1 addition & 1 deletion app/src/main/res/drawable/dropdown_background.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@
android:bottomRightRadius="@dimen/onboarding_shared_corner_radius" />
</shape>
</item>
</layer-list>
</layer-list>
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="4dp" />
<solid android:color="@color/component_color_onboarding_shared_white_color" />
</shape>
</shape>
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<TextView
android:id="@+id/onboarding_language_title"
style="@style/OnboardingHeaderStyle"
android:layout_marginTop="@dimen/onboarding_shared_margin_large"
android:layout_marginTop="@dimen/onboarding_shared_margin_medium_large"
android:text="@string/onboarding_language_activity_title"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
Expand All @@ -20,6 +20,7 @@
<TextView
android:id="@+id/onboarding_language_subtitle"
style="@style/OnboardingLanguageSubtitleStyle"
android:layout_marginTop="@dimen/onboarding_shared_margin_small"
android:text="@string/onboarding_language_activity_subtitle"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
Expand All @@ -28,6 +29,7 @@
<TextView
android:id="@+id/onboarding_language_text"
style="@style/OnboardingLanguageMessageStyle"
android:layout_marginTop="@dimen/onboarding_shared_margin_medium_small"
android:text="@string/onboarding_language_activity_text"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
Expand All @@ -51,20 +53,22 @@
<ImageView
android:id="@+id/onboarding_app_language_image"
android:layout_width="132dp"
android:layout_height="132dp"
android:layout_height="140dp"
android:layout_marginEnd="@dimen/onboarding_shared_margin_3xl"
android:contentDescription="@string/onboarding_otter_content_description"
app:layout_constraintTop_toBottomOf="@id/onboarding_language_title"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/onboarding_language_title"
app:srcCompat="@drawable/otter" />

<TextView
android:id="@+id/onboarding_language_label"
style="@style/OnboardingLanguageLabelStyle"
android:layout_marginTop="@dimen/onboarding_shared_margin_medium_large"
android:text="@string/onboarding_language_activity_select_label"
app:layout_constraintBottom_toTopOf="@id/onboarding_language_dropdown_background"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/onboarding_language_center_guide" />

<RelativeLayout
android:id="@+id/onboarding_language_dropdown_background"
Expand Down Expand Up @@ -116,6 +120,7 @@
<TextView
android:id="@+id/onboarding_language_explanation"
style="@style/OnboardingLanguageExplanationStyle"
android:layout_marginBottom="@dimen/onboarding_shared_margin_medium_small"
android:text="@string/onboarding_language_activity_explanation_text"
app:layout_constraintBottom_toTopOf="@id/onboarding_language_lets_go_button"
app:layout_constraintEnd_toEndOf="parent"
Expand Down
139 changes: 139 additions & 0 deletions app/src/main/res/layout-land/onboarding_profile_type_fragment.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
<?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">

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

<TextView
android:id="@+id/profile_type_title"
style="@style/OnboardingProfileTypeHeaderStyle"
android:layout_margin="@dimen/onboarding_shared_margin_xl"
android:text="@string/onboarding_profile_type_activity_header"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<androidx.constraintlayout.widget.Guideline
android:id="@+id/profile_type_center_guide"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintGuide_percent="0.45" />

<org.oppia.android.app.customview.OppiaCurveBackgroundView
android:id="@+id/onboarding_profile_type_background"
android:layout_width="match_parent"
android:layout_height="0dp"
app:customBackgroundColor="@color/component_color_onboarding_profile_type_background_color"
app:layout_constraintTop_toBottomOf="@id/profile_type_center_guide" />

<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/profile_type_learner_navigation_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/onboarding_shared_margin_small"
android:layout_marginBottom="@dimen/onboarding_shared_margin_small"
app:layout_constraintBottom_toTopOf="@id/onboarding_navigation_back"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/profile_type_title">

<com.google.android.material.card.MaterialCardView
android:id="@+id/profile_type_learner_navigation_card"
style="@style/OnboardingProfileTypeNavigationCardStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/onboarding_shared_margin_medium_small"
android:layout_marginEnd="@dimen/onboarding_shared_margin_medium_small"
app:layout_constraintEnd_toStartOf="@id/profile_type_supervisor_navigation_card"
app:layout_constraintHorizontal_chainStyle="packed"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">

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

<ImageView
android:id="@+id/profile_type_learner_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@string/onboarding_learner_otter_content_description"
android:scaleType="centerCrop"
app:layout_constraintBottom_toTopOf="@id/profile_type_learner_text"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/learner_otter" />

<TextView
android:id="@+id/profile_type_learner_text"
style="@style/OnboardingProfileTypeTextStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="@string/onboarding_profile_type_activity_student_text"
app:layout_constraintEnd_toEndOf="@id/profile_type_learner_image"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/profile_type_learner_image" />
</androidx.constraintlayout.widget.ConstraintLayout>
</com.google.android.material.card.MaterialCardView>

<com.google.android.material.card.MaterialCardView
android:id="@+id/profile_type_supervisor_navigation_card"
style="@style/OnboardingProfileTypeNavigationCardStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/onboarding_shared_margin_medium_small"
android:layout_marginEnd="@dimen/onboarding_shared_margin_medium_small"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/profile_type_learner_navigation_card"
app:layout_constraintTop_toTopOf="parent">

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

<ImageView
android:id="@+id/profile_type_parent_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@string/onboarding_parent_otter_content_description"
android:scaleType="centerCrop"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/parent_teacher_otter" />

<TextView
android:id="@+id/profile_type_parent_text"
style="@style/OnboardingProfileTypeTextStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="@string/onboarding_profile_type_activity_parent_text"
app:layout_constraintEnd_toEndOf="@id/profile_type_parent_image"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/profile_type_parent_image" />
</androidx.constraintlayout.widget.ConstraintLayout>
</com.google.android.material.card.MaterialCardView>
</androidx.constraintlayout.widget.ConstraintLayout>

<Button
android:id="@+id/onboarding_navigation_back"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/onboarding_shared_margin_large"
android:layout_marginBottom="@dimen/onboarding_shared_margin_medium"
android:background="@drawable/onboarding_back_button_white_background"
android:fontFamily="sans-serif-medium"
android:gravity="center"
android:minWidth="@dimen/clickable_item_min_width"
android:minHeight="@dimen/clickable_item_min_height"
android:padding="@dimen/onboarding_shared_padding_medium_small"
android:text="@string/onboarding_navigation_back"
android:textAllCaps="false"
android:textColor="@color/component_color_onboarding_shared_green_color"
android:textSize="@dimen/onboarding_shared_text_size_medium"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>
Loading

0 comments on commit 5a3ebc8

Please sign in to comment.