diff --git a/app/src/main/java/org/oppia/android/app/home/HomeActivity.kt b/app/src/main/java/org/oppia/android/app/home/HomeActivity.kt index 71d56ef00b7..a0ce5607f6d 100644 --- a/app/src/main/java/org/oppia/android/app/home/HomeActivity.kt +++ b/app/src/main/java/org/oppia/android/app/home/HomeActivity.kt @@ -80,22 +80,6 @@ class HomeActivity : ) } - override fun onBackPressed() { - val previousFragment = - supportFragmentManager.findFragmentByTag(TAG_SWITCH_PROFILE_DIALOG) - if (previousFragment != null) { - supportFragmentManager.beginTransaction().remove(previousFragment).commitNow() - } - val exitProfileDialogArguments = - ExitProfileDialogArguments - .newBuilder() - .setHighlightItem(HighlightItem.NONE) - .build() - val dialogFragment = ExitProfileDialogFragment - .newInstance(exitProfileDialogArguments = exitProfileDialogArguments) - dialogFragment.showNow(supportFragmentManager, TAG_SWITCH_PROFILE_DIALOG) - } - override fun routeToTopicPlayStory( internalProfileId: Int, classroomId: String, diff --git a/app/src/main/java/org/oppia/android/app/onboarding/CreateProfileActivityPresenter.kt b/app/src/main/java/org/oppia/android/app/onboarding/CreateProfileActivityPresenter.kt index 0e08900253a..6afc7902b58 100644 --- a/app/src/main/java/org/oppia/android/app/onboarding/CreateProfileActivityPresenter.kt +++ b/app/src/main/java/org/oppia/android/app/onboarding/CreateProfileActivityPresenter.kt @@ -1,7 +1,6 @@ package org.oppia.android.app.onboarding import android.os.Bundle -import android.view.Gravity.apply import androidx.appcompat.app.AppCompatActivity import androidx.databinding.DataBindingUtil import org.oppia.android.R @@ -13,8 +12,10 @@ import org.oppia.android.util.extensions.putProto import org.oppia.android.util.profile.CurrentUserProfileIdIntentDecorator.decorateWithUserProfileId import javax.inject.Inject -private const val TAG_CREATE_PROFILE_ACTIVITY_FRAGMENT = "TAG_CREATE_PROFILE_ACTIVITY_FRAGMENT" -private const val CREATE_PROFILE_FRAGMENT_ARGS = "CreateProfileFragment.args" +private const val TAG_CREATE_PROFILE_FRAGMENT = "TAG_CREATE_PROFILE_FRAGMENT" + +/** Arguments key for [CreateProfileFragment] args. */ +const val CREATE_PROFILE_FRAGMENT_ARGS = "CreateProfileFragment.args" /** Presenter for [CreateProfileActivity]. */ class CreateProfileActivityPresenter @Inject constructor( @@ -44,14 +45,14 @@ class CreateProfileActivityPresenter @Inject constructor( activity.supportFragmentManager.beginTransaction().add( R.id.profile_fragment_placeholder, createLearnerProfileFragment, - TAG_CREATE_PROFILE_ACTIVITY_FRAGMENT + TAG_CREATE_PROFILE_FRAGMENT ).commitNow() } } private fun getNewLearnerProfileFragment(): CreateProfileFragment? { return activity.supportFragmentManager.findFragmentByTag( - TAG_CREATE_PROFILE_ACTIVITY_FRAGMENT + TAG_CREATE_PROFILE_FRAGMENT ) as? CreateProfileFragment } } diff --git a/app/src/main/java/org/oppia/android/app/onboarding/CreateProfileFragment.kt b/app/src/main/java/org/oppia/android/app/onboarding/CreateProfileFragment.kt index 99d53907238..7e308004cf1 100644 --- a/app/src/main/java/org/oppia/android/app/onboarding/CreateProfileFragment.kt +++ b/app/src/main/java/org/oppia/android/app/onboarding/CreateProfileFragment.kt @@ -9,7 +9,7 @@ import android.view.ViewGroup import androidx.activity.result.contract.ActivityResultContracts import org.oppia.android.app.fragment.FragmentComponentImpl import org.oppia.android.app.fragment.InjectableFragment -import org.oppia.android.app.model.CreateProfileActivityParams +import org.oppia.android.app.model.CreateProfileFragmentArguments import org.oppia.android.util.extensions.getProto import org.oppia.android.util.profile.CurrentUserProfileIdIntentDecorator.extractCurrentUserProfileId import javax.inject.Inject @@ -42,7 +42,7 @@ class CreateProfileFragment : InjectableFragment() { } val profileType = checkNotNull( arguments?.getProto( - CREATE_PROFILE_PARAMS_KEY, CreateProfileActivityParams.getDefaultInstance() + CREATE_PROFILE_FRAGMENT_ARGS, CreateProfileFragmentArguments.getDefaultInstance() )?.profileType ) { "Expected CreateProfileFragment to have a profileType argument."