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 #1587 Make intent/bundle/saved/tags instance keys consistent #2056

Closed
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Klint style issues fix
  • Loading branch information
janewaitara committed Oct 29, 2020
commit 7fcdfb6cc4954610d40e90598f280a83ff536355
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,10 @@ import org.oppia.android.util.logging.ConsoleLogger
import javax.inject.Inject

const val EXPLORATION_FRAGMENT_EXTRA_KEY = "ExplorationActivityPresenter.exploration_fragment"
const val EXPLORATION_MANAGER_FRAGMENT_EXTRA_KEY = "ExplorationActivityPresenter.exploration_manager_fragment"
const val HINTS_AND_SOLUTION_EXPLORATION_MANAGER_EXTRA_KEY = "ExplorationActivityPresenter.hints_and_solution_exploration_manager"
const val EXPLORATION_MANAGER_FRAGMENT_EXTRA_KEY =
"ExplorationActivityPresenter.exploration_manager_fragment"
const val HINTS_AND_SOLUTION_EXPLORATION_MANAGER_EXTRA_KEY =
"ExplorationActivityPresenter.hints_and_solution_exploration_manager"

/** The Presenter for [ExplorationActivity]. */
@ActivityScope
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const val STATE_FRAGMENT_PROFILE_ID_ARGUMENT_KEY = "STATE_FRAGMENT_PROFILE_ID_AR
const val STATE_FRAGMENT_TOPIC_ID_ARGUMENT_KEY = "STATE_FRAGMENT_TOPIC_ID_ARGUMENT_KEY"
const val STATE_FRAGMENT_STORY_ID_ARGUMENT_KEY = "STATE_FRAGMENT_STORY_ID_ARGUMENT_KEY"
const val STATE_FRAGMENT_EXPLORATION_ID_ARGUMENT_KEY = "STATE_FRAGMENT_EXPLORATION_ID_ARGUMENT_KEY"
private const val AUDIO_FRAGMENT_ARGUMENT_KEY = "StateFragmentPresenter.audio_fragment"
private const val TAG_AUDIO_FRAGMENT = "AUDIO_FRAGMENT"

/** The presenter for [StateFragment]. */
@FragmentScope
Expand Down Expand Up @@ -260,14 +260,14 @@ class StateFragmentPresenter @Inject constructor(
}

private fun getAudioFragment(): Fragment? {
return fragment.childFragmentManager.findFragmentByTag(AUDIO_FRAGMENT_ARGUMENT_KEY)
return fragment.childFragmentManager.findFragmentByTag(TAG_AUDIO_FRAGMENT)
}

private fun getAudioUiManager(): AudioUiManager? {
if (getAudioFragment() == null) {
val audioFragment: AudioFragment = AudioFragment.newInstance(profileId.internalId)
fragment.childFragmentManager.beginTransaction()
.add(R.id.audio_fragment_placeholder, audioFragment, AUDIO_FRAGMENT_ARGUMENT_KEY).commitNow()
.add(R.id.audio_fragment_placeholder, audioFragment, TAG_AUDIO_FRAGMENT).commitNow()
}
return getAudioFragment() as? AudioUiManager
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ import org.oppia.android.util.data.DataProviders.Companion.toLiveData
import org.oppia.android.util.statusbar.StatusBarColor
import javax.inject.Inject

private const val ADMIN_SETTINGS_DIALOG_EXTRA_KEY = "PinPasswordActivityPresenter.admin_settings_dialog"
private const val ADMIN_SETTINGS_DIALOG_EXTRA_KEY =
"PinPasswordActivityPresenter.admin_settings_dialog"
private const val RESET_PIN_DIALOG_EXTRA_KEY = "PinPasswordActivityPresenter.reset_pin_dialog"

/** The presenter for [PinPasswordActivity]. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ import org.oppia.android.databinding.ProfileProgressHeaderBinding
import org.oppia.android.databinding.ProfileProgressRecentlyPlayedStoryCardBinding
import javax.inject.Inject

private const val PROFILE_PICTURE_EDIT_DIALOG_ARGUMENT_KEY = "ProfileProgressFragmentPresenter.profile_picture_edit_dialog"
private const val PROFILE_PICTURE_EDIT_DIALOG_ARGUMENT_KEY =
"ProfileProgressFragmentPresenter.profile_picture_edit_dialog"

/** The presenter for [ProfileProgressFragment]. */
@FragmentScope
Expand Down Expand Up @@ -105,6 +106,9 @@ class ProfileProgressFragmentPresenter @Inject constructor(
activity.supportFragmentManager.beginTransaction().remove(previousFragment).commitNow()
}
val dialogFragment = ProfilePictureEditDialogFragment.newInstance()
dialogFragment.showNow(activity.supportFragmentManager, PROFILE_PICTURE_EDIT_DIALOG_ARGUMENT_KEY)
dialogFragment.showNow(
activity.supportFragmentManager,
PROFILE_PICTURE_EDIT_DIALOG_ARGUMENT_KEY
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ private const val INTERNAL_PROFILE_ID = 0
private const val TOPIC_ID = TEST_TOPIC_ID_0
private const val STORY_ID = TEST_STORY_ID_0
private const val EXPLORATION_ID = TEST_EXPLORATION_ID_2
private const val EXPLORATION_TEST_ACTIVITY_EXTRA_KEY = "ExplorationTestActivityPresenter.exploration_test_activity"
private const val EXPLORATION_TEST_ACTIVITY_EXTRA_KEY =
"ExplorationTestActivityPresenter.exploration_test_activity"

/** The presenter for [ExplorationTestActivityPresenter]. */
@ActivityScope
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ import org.oppia.android.app.fragment.InjectableFragment
import org.oppia.android.app.utility.ClickableAreasImage
import javax.inject.Inject

const val IMAGE_REGION_SELECTION_TEST_FRAGMENT_ARGUMENT_KEY = "ImageRegionSelectionTestFragment.image_region_selection_test_fragment"
const val IMAGE_REGION_SELECTION_TEST_FRAGMENT_ARGUMENT_KEY =
"ImageRegionSelectionTestFragment.image_region_selection_test_fragment"

// TODO(#59): Make this fragment only included in relevant tests instead of all prod builds.
/** Test Fragment used for testing [ClickableAreasImage] functionality */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ import javax.inject.Inject

const val QUESTION_PLAYER_ACTIVITY_SKILL_ID_LIST_ARGUMENT_KEY =
"QuestionPlayerActivity.skill_id_list"
private const val STOP_TRAINING_SESSION_DIALOG_EXTRA_KEY = "QuestionPlayerActivity.stop_training_session_dialog"
private const val STOP_TRAINING_SESSION_DIALOG_EXTRA_KEY =
"QuestionPlayerActivity.stop_training_session_dialog"

/** Activity for QuestionPlayer in train mode. */
class QuestionPlayerActivity :
Expand Down Expand Up @@ -110,7 +111,10 @@ class QuestionPlayerActivity :
allHintsExhausted
)
hintsAndSolutionDialogFragment.loadState(state)
hintsAndSolutionDialogFragment.showNow(supportFragmentManager, HINTS_AND_SOLUTION_DIALOG_EXTRA_KEY)
hintsAndSolutionDialogFragment.showNow(
supportFragmentManager,
HINTS_AND_SOLUTION_DIALOG_EXTRA_KEY
)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@ import org.oppia.android.util.data.AsyncResult
import org.oppia.android.util.logging.ConsoleLogger
import javax.inject.Inject

const val QUESTION_PLAYER_FRAGMENT_EXTRA_KEY = "QuestionPlayerActivityPresenter_question_player_fragment"
private const val HINTS_AND_SOLUTION_QUESTION_MANAGER_EXTRA_KEY = "QuestionPlayerActivityPresenter_hints_and_solution_question_manager"
const val QUESTION_PLAYER_FRAGMENT_EXTRA_KEY =
"QuestionPlayerActivityPresenter_question_player_fragment"
private const val HINTS_AND_SOLUTION_QUESTION_MANAGER_EXTRA_KEY =
"QuestionPlayerActivityPresenter_hints_and_solution_question_manager"

/** The presenter for [QuestionPlayerActivity]. */
@ActivityScope
Expand Down