-
Notifications
You must be signed in to change notification settings - Fork 529
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
dd197e2
commit 2b6a5e2
Showing
13 changed files
with
269 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
app/src/main/java/org/oppia/android/app/onboarding/onboardingv2/NewLearnerProfileActivity.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package org.oppia.android.app.onboarding.onboardingv2 | ||
|
||
import android.content.Context | ||
import android.content.Intent | ||
import android.os.Bundle | ||
import org.oppia.android.app.activity.ActivityComponentImpl | ||
import org.oppia.android.app.activity.InjectableAutoLocalizedAppCompatActivity | ||
import org.oppia.android.app.model.ScreenName | ||
import org.oppia.android.util.logging.CurrentAppScreenNameIntentDecorator.decorateWithScreenName | ||
import javax.inject.Inject | ||
|
||
/** Activity for displaying a new learner profile creation flow. */ | ||
class NewLearnerProfileActivity : InjectableAutoLocalizedAppCompatActivity() { | ||
@Inject | ||
lateinit var learnerProfileActivityPresenter: NewLearnerProfileActivityPresenter | ||
|
||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
(activityComponent as ActivityComponentImpl).inject(this) | ||
|
||
learnerProfileActivityPresenter.handleOnCreate() | ||
} | ||
|
||
companion object { | ||
/** Returns a new [Intent] open a [NewLearnerProfileActivity] with the specified params. */ | ||
fun createNewLearnerProfileActivity(context: Context): Intent { | ||
return Intent(context, NewLearnerProfileActivity::class.java).apply { | ||
decorateWithScreenName(ScreenName.CREATE_NEW_LEARNER_PROFILE_ACTIVITY) | ||
} | ||
} | ||
} | ||
} |
40 changes: 40 additions & 0 deletions
40
.../java/org/oppia/android/app/onboarding/onboardingv2/NewLearnerProfileActivityPresenter.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package org.oppia.android.app.onboarding.onboardingv2 | ||
|
||
import androidx.appcompat.app.AppCompatActivity | ||
import androidx.databinding.DataBindingUtil | ||
import org.oppia.android.R | ||
import org.oppia.android.databinding.CreateProfileActivityBinding | ||
import javax.inject.Inject | ||
|
||
private const val TAG_CREATE_PROFILE_ACTIVITY_FRAGMENT = "TAG_CREATE_PROFILE_ACTIVITY_FRAGMENT" | ||
|
||
/** Presenter for [NewLearnerProfileActivity]. */ | ||
class NewLearnerProfileActivityPresenter @Inject constructor( | ||
private val activity: AppCompatActivity | ||
) { | ||
private lateinit var binding: CreateProfileActivityBinding | ||
|
||
/** Handle creation and binding of the NewLearnerProfileActivity layout. */ | ||
fun handleOnCreate() { | ||
binding = DataBindingUtil.setContentView(activity, R.layout.create_profile_activity) | ||
binding.apply { | ||
lifecycleOwner = activity | ||
} | ||
|
||
if (getNewLearnerProfileFragment() == null) { | ||
val createLearnerProfileFragment = NewLearnerProfileFragment() | ||
activity.supportFragmentManager.beginTransaction().add( | ||
R.id.profile_fragment_placeholder, | ||
createLearnerProfileFragment, | ||
TAG_CREATE_PROFILE_ACTIVITY_FRAGMENT | ||
) | ||
.commitNow() | ||
} | ||
} | ||
|
||
private fun getNewLearnerProfileFragment(): NewLearnerProfileFragment? { | ||
return activity.supportFragmentManager.findFragmentByTag( | ||
TAG_CREATE_PROFILE_ACTIVITY_FRAGMENT | ||
) as? NewLearnerProfileFragment | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
app/src/main/java/org/oppia/android/app/onboarding/onboardingv2/NewLearnerProfileFragment.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package org.oppia.android.app.onboarding.onboardingv2 | ||
|
||
import android.content.Context | ||
import android.os.Bundle | ||
import android.view.LayoutInflater | ||
import android.view.View | ||
import android.view.ViewGroup | ||
import org.oppia.android.app.fragment.FragmentComponentImpl | ||
import org.oppia.android.app.fragment.InjectableFragment | ||
import javax.inject.Inject | ||
|
||
/** Fragment for displaying a new learner profile creation flow. */ | ||
class NewLearnerProfileFragment : InjectableFragment() { | ||
@Inject | ||
lateinit var learnerProfileFragmentPresenter: NewLearnerProfileFragmentPresenter | ||
|
||
override fun onAttach(context: Context) { | ||
super.onAttach(context) | ||
(fragmentComponent as FragmentComponentImpl).inject(this) | ||
} | ||
|
||
override fun onCreateView( | ||
inflater: LayoutInflater, | ||
container: ViewGroup?, | ||
savedInstanceState: Bundle? | ||
): View? { | ||
return learnerProfileFragmentPresenter.handleCreateView(inflater, container) | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
.../java/org/oppia/android/app/onboarding/onboardingv2/NewLearnerProfileFragmentPresenter.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package org.oppia.android.app.onboarding.onboardingv2 | ||
|
||
import android.view.LayoutInflater | ||
import android.view.View | ||
import android.view.ViewGroup | ||
import androidx.fragment.app.Fragment | ||
import org.oppia.android.databinding.CreateProfileFragmentBinding | ||
import javax.inject.Inject | ||
|
||
/** Presenter for [NewLearnerProfileFragment]. */ | ||
class NewLearnerProfileFragmentPresenter @Inject constructor( | ||
private val fragment: Fragment | ||
) { | ||
private lateinit var binding: CreateProfileFragmentBinding | ||
|
||
fun handleCreateView(inflater: LayoutInflater, container: ViewGroup?): View { | ||
binding = CreateProfileFragmentBinding.inflate( | ||
inflater, | ||
container, | ||
/* attachToRoot= */ false | ||
) | ||
binding.let { | ||
it.lifecycleOwner = fragment | ||
} | ||
|
||
return binding.root | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<layout xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:tools="http://schemas.android.com/tools"> | ||
|
||
<androidx.constraintlayout.widget.ConstraintLayout | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
tools:context=".app.onboarding.onboardingv2.NewLearnerProfileActivity"> | ||
|
||
<FrameLayout | ||
android:id="@+id/profile_fragment_placeholder" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" /> | ||
</androidx.constraintlayout.widget.ConstraintLayout> | ||
</layout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
<?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" | ||
xmlns:tools="http://schemas.android.com/tools"> | ||
|
||
<androidx.constraintlayout.widget.ConstraintLayout | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
android:background="@color/component_color_onboarding_shared_white_color"> | ||
|
||
<androidx.constraintlayout.widget.Guideline | ||
android:id="@+id/create_profile_header_guide" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:orientation="horizontal" | ||
app:layout_constraintGuide_percent="0.40" /> | ||
|
||
<TextView | ||
android:id="@+id/create_profile_title" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:fontFamily="sans-serif" | ||
android:text="@string/create_profile_activity_header" | ||
android:textColor="@color/color_palette_onboarding_black_color" | ||
android:textSize="20sp" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toBottomOf="@id/create_profile_header_guide" /> | ||
|
||
<TextView | ||
android:id="@+id/create_profile_nickname_label" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_marginStart="20dp" | ||
android:layout_marginTop="20dp" | ||
android:fontFamily="sans-serif" | ||
android:labelFor="@id/create_profile_nickname_edittext" | ||
android:text="@string/create_profile_activity_nickname_label" | ||
android:textColor="@color/component_color_shared_primary_text_color" | ||
android:textSize="12sp" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toBottomOf="@id/create_profile_title" /> | ||
|
||
<EditText | ||
android:id="@+id/create_profile_nickname_edittext" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:layout_marginStart="20dp" | ||
android:layout_marginTop="20dp" | ||
android:layout_marginEnd="20dp" | ||
android:autofillHints="false" | ||
android:background="@drawable/edit_text_background_border" | ||
android:fontFamily="sans-serif" | ||
android:inputType="text" | ||
android:padding="8dp" | ||
android:textSize="16sp" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toBottomOf="@id/create_profile_nickname_label" | ||
tools:text="John" /> | ||
|
||
<TextView | ||
android:id="@+id/create_profile_nickname_error" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_marginStart="20dp" | ||
android:layout_marginTop="12dp" | ||
android:fontFamily="sans-serif" | ||
android:labelFor="@id/create_profile_nickname_edittext" | ||
android:text="@string/create_profile_activity_nickname_error" | ||
android:textColor="@color/component_color_shared_input_error_color" | ||
android:textSize="12sp" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toBottomOf="@id/create_profile_nickname_edittext" /> | ||
|
||
<TextView | ||
android:id="@+id/onboarding_steps_count" | ||
style="@style/OnboardingStepCountStyle" | ||
android:layout_margin="@dimen/onboarding_language_text_margin" | ||
android:text="@string/onboarding_step_count_three" | ||
app:layout_constraintBottom_toTopOf="@id/onboarding_navigation_back" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintStart_toStartOf="parent" /> | ||
|
||
<Button | ||
android:id="@+id/onboarding_navigation_back" | ||
style="@style/OnboardingNavigationSecondaryButton" | ||
android:layout_width="0dp" | ||
android:layout_height="wrap_content" | ||
android:text="@string/onboarding_navigation_back" | ||
app:layout_constraintBottom_toBottomOf="parent" | ||
app:layout_constraintEnd_toStartOf="@id/onboarding_navigation_continue" | ||
app:layout_constraintStart_toStartOf="parent" /> | ||
|
||
<Button | ||
android:id="@+id/onboarding_navigation_continue" | ||
style="@style/OnboardingNavigationPrimaryButton" | ||
android:layout_width="0dp" | ||
android:layout_height="wrap_content" | ||
android:text="@string/onboarding_navigation_continue" | ||
app:layout_constraintBottom_toBottomOf="parent" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintStart_toEndOf="@id/onboarding_navigation_back" /> | ||
</androidx.constraintlayout.widget.ConstraintLayout> | ||
</layout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters