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 part of #4865 and Fix #4986 : Move all fragment arguments, activity intent extras, and saved instance state over to protos #5248

Merged
merged 198 commits into from
Jun 24, 2024
Merged
Show file tree
Hide file tree
Changes from 191 commits
Commits
Show all changes
198 commits
Select commit Hold shift + click to select a range
454ce5d
topic fragment argument moved to proto
Vishwajith-Shettigar Nov 28, 2023
c3e6e80
topic fragment argument moved to proto
Vishwajith-Shettigar Nov 28, 2023
8ed07b6
topic fragment argument moved to proto
Vishwajith-Shettigar Nov 28, 2023
69f048c
administrator control activity state argument moved to proto
Vishwajith-Shettigar Nov 29, 2023
32be8e0
administrator control activity state argument moved to proto
Vishwajith-Shettigar Nov 29, 2023
f17f458
administrator control activity state argument moved to proto
Vishwajith-Shettigar Nov 29, 2023
181cc94
administrator control activity state argument moved to proto
Vishwajith-Shettigar Nov 29, 2023
8ed6071
administrator control fragment argument moved to proto
Vishwajith-Shettigar Nov 29, 2023
b636b3b
administrator control fragment argument moved to proto
Vishwajith-Shettigar Nov 29, 2023
6561947
lint issue fixed
Vishwajith-Shettigar Nov 29, 2023
634ca48
static issue fixed
Vishwajith-Shettigar Nov 29, 2023
5656111
completedstorylistactivity argument moved to proto
Vishwajith-Shettigar Nov 29, 2023
0532d73
CompletedStoryListFragment argument moved to proto
Vishwajith-Shettigar Nov 29, 2023
6f24a7f
CompletedStoryListFragment argument moved to proto
Vishwajith-Shettigar Nov 30, 2023
0967ca5
MarkChaptersCompletedTestActivity argument moved to proto
Vishwajith-Shettigar Nov 30, 2023
bcaa584
Merge branch 'develop' into protoshift
Vishwajith-Shettigar Nov 30, 2023
9d7edc0
MarkChaptersCompleted Activity argument moved to proto
Vishwajith-Shettigar Nov 30, 2023
eadd24d
MarkChaptersCompleted fragment argument moved to proto
Vishwajith-Shettigar Nov 30, 2023
4d2dc8f
MarkChaptersCompleted fragment state bundle moved to proto
Vishwajith-Shettigar Nov 30, 2023
360fbc0
profileeditactivitytest fix
Vishwajith-Shettigar Nov 30, 2023
8363d50
fix
Vishwajith-Shettigar Dec 1, 2023
72577ab
ProfileEditFragmentTest fix
Vishwajith-Shettigar Dec 1, 2023
99bfa77
ProfileProgressFragmentTest fix
Vishwajith-Shettigar Dec 1, 2023
ce745d1
kdoc added
Vishwajith-Shettigar Dec 1, 2023
29dcc99
MarkStoriesCompleted moved to proto
Vishwajith-Shettigar Dec 1, 2023
842a43d
MarktopicsCompleted moved to proto
Vishwajith-Shettigar Dec 1, 2023
87d12d7
MarktopicsCompleted moved to proto
Vishwajith-Shettigar Dec 1, 2023
cd8355d
MarktopicsCompleted moved to proto
Vishwajith-Shettigar Dec 1, 2023
79fe2bd
FAQSingleActivity arguments moved over proto
Vishwajith-Shettigar Dec 4, 2023
1bff061
lecence list, licenece textviewwer arguments moved over proto
Vishwajith-Shettigar Dec 4, 2023
61ecf6b
lecence list, licenece textviewwer arguments moved over proto
Vishwajith-Shettigar Dec 4, 2023
609c498
FAQSingleActivitytest fixed “
Vishwajith-Shettigar Dec 4, 2023
e516832
FAQSingleActivitytest fixed “
Vishwajith-Shettigar Dec 4, 2023
b9e9ebc
renamed keys and removed unused keys
Vishwajith-Shettigar Dec 5, 2023
60b8474
renamed keys and removed unused keys
Vishwajith-Shettigar Dec 5, 2023
4c2b08b
Addressed suggestions
Vishwajith-Shettigar Dec 5, 2023
55b65e6
fixed test
Vishwajith-Shettigar Dec 5, 2023
995fdc1
fixed test
Vishwajith-Shettigar Dec 5, 2023
e0ba62a
help activity defect
Vishwajith-Shettigar Dec 6, 2023
c5c41d3
help activity defect
Vishwajith-Shettigar Dec 6, 2023
7cb6ab4
help fargment
Vishwajith-Shettigar Dec 6, 2023
6de3ec8
Recenctly played
Vishwajith-Shettigar Dec 6, 2023
5d24566
Home
Vishwajith-Shettigar Dec 6, 2023
fbfa8b3
added decorator
Vishwajith-Shettigar Dec 6, 2023
4c818be
home and help menu passes proto
Vishwajith-Shettigar Dec 6, 2023
201c967
home and help menu passes proto
Vishwajith-Shettigar Dec 6, 2023
43e8821
drawer related activtities intent passes proto
Vishwajith-Shettigar Dec 7, 2023
0d3fa4f
drawer related activtities intent passes proto
Vishwajith-Shettigar Dec 7, 2023
1e5d565
fixed tests
Vishwajith-Shettigar Dec 7, 2023
ba914e0
fixed tests
Vishwajith-Shettigar Dec 7, 2023
7117af8
lint fix
Vishwajith-Shettigar Dec 7, 2023
9d4ebaf
added bazel dependency for CurrentUserProfileIdIntentDecorator.kt
Vishwajith-Shettigar Dec 7, 2023
591c7e6
fixed test
Vishwajith-Shettigar Dec 7, 2023
398e0fd
fixed test
Vishwajith-Shettigar Dec 7, 2023
d3a8461
KDoc added for CurrentUserProfileIdIntentDecorator.kt
Vishwajith-Shettigar Dec 7, 2023
743f855
fixed test
Vishwajith-Shettigar Dec 7, 2023
c0aa1de
fixed test
Vishwajith-Shettigar Dec 7, 2023
bae9a6a
Merge branch 'develop' into protoshift
Vishwajith-Shettigar Dec 7, 2023
7b7ff1b
fixed test
Vishwajith-Shettigar Dec 7, 2023
562a4ab
textfix
Vishwajith-Shettigar Dec 8, 2023
11e5af9
textfix
Vishwajith-Shettigar Dec 8, 2023
69177fe
textfix
Vishwajith-Shettigar Dec 8, 2023
7d2efd2
test added for CurrentUserProfileIdIntentDecorator.kt
Vishwajith-Shettigar Dec 8, 2023
0a80367
hintsandsolution passes over proto
Vishwajith-Shettigar Dec 8, 2023
61b3bb2
options passed over proto
Vishwajith-Shettigar Dec 8, 2023
0609544
OngoingTopicList arguments moved over proto
Vishwajith-Shettigar Dec 8, 2023
2369c4b
player arguments moved over proto
Vishwajith-Shettigar Dec 8, 2023
154c028
profile arguments moved over proto
Vishwajith-Shettigar Dec 9, 2023
632b80b
ProfileProgress arguments moved over proto
Vishwajith-Shettigar Dec 9, 2023
5d459f0
settings/Profile arguments moved over proto
Vishwajith-Shettigar Dec 9, 2023
c43df05
Merge branch 'develop' into protoshift
Vishwajith-Shettigar Dec 11, 2023
f3c70b1
story
Vishwajith-Shettigar Dec 11, 2023
c623413
story
Vishwajith-Shettigar Dec 11, 2023
4ea0e12
story arguments moved over proto
Vishwajith-Shettigar Dec 11, 2023
7a2a9a3
story arguments moved over proto
Vishwajith-Shettigar Dec 11, 2023
f034f0f
topic[partial] arguments moved over proto
Vishwajith-Shettigar Dec 11, 2023
14c5e23
flag1
Vishwajith-Shettigar Dec 11, 2023
f5b32ca
topicactivity and fragment arguments moved over proto
Vishwajith-Shettigar Dec 11, 2023
719f9ae
topic activity and fragment arguments moved over proto
Vishwajith-Shettigar Dec 11, 2023
6bc40fe
testing arguments moved over proto
Vishwajith-Shettigar Dec 12, 2023
b79329f
testing arguments moved over proto
Vishwajith-Shettigar Dec 12, 2023
0116af2
Merge branch 'develop' into protoshift
Vishwajith-Shettigar Dec 12, 2023
e018795
fixed tests
Vishwajith-Shettigar Dec 13, 2023
ccde8be
fixed tests
Vishwajith-Shettigar Dec 13, 2023
189e65d
fixed tests
Vishwajith-Shettigar Dec 13, 2023
1ebb5d7
fixed tests
Vishwajith-Shettigar Dec 13, 2023
155ca41
fixed test
Vishwajith-Shettigar Dec 13, 2023
f00c10b
fixed test
Vishwajith-Shettigar Dec 14, 2023
0605aac
fixed test
Vishwajith-Shettigar Dec 14, 2023
5aa7a61
fixed test
Vishwajith-Shettigar Dec 14, 2023
4788b3b
fixed test
Vishwajith-Shettigar Dec 14, 2023
ec42d8a
fixed test
Vishwajith-Shettigar Dec 14, 2023
1a5bcdf
fixed test
Vishwajith-Shettigar Dec 14, 2023
75a06ac
fixed test
Vishwajith-Shettigar Dec 14, 2023
c2c9373
fixed lint issue
Vishwajith-Shettigar Dec 14, 2023
dfdea85
fixed lint check
Vishwajith-Shettigar Dec 14, 2023
6b2be2b
fixed test
Vishwajith-Shettigar Dec 14, 2023
5f2d9c2
fixed test
Vishwajith-Shettigar Dec 14, 2023
a37df33
lint fixed
Vishwajith-Shettigar Dec 15, 2023
4d7327f
questionplayerActivity moved over proto
Vishwajith-Shettigar Dec 15, 2023
5b22ef5
test fixed
Vishwajith-Shettigar Dec 15, 2023
13276d7
test fixed
Vishwajith-Shettigar Dec 15, 2023
dfc7fe9
some changes
Vishwajith-Shettigar Dec 16, 2023
baa28ed
some changes
Vishwajith-Shettigar Dec 16, 2023
6e4d910
lint check fixed
Vishwajith-Shettigar Dec 16, 2023
47bcf05
survey
Vishwajith-Shettigar Dec 18, 2023
caef36a
walkthrough
Vishwajith-Shettigar Dec 18, 2023
e18a178
fix
Vishwajith-Shettigar Dec 19, 2023
7369bf9
Merge branch 'oppia:develop' into protoshift
Vishwajith-Shettigar Dec 19, 2023
10cb947
Merge branch 'develop' into protoshift
Vishwajith-Shettigar Dec 23, 2023
f794c4c
topic activity storyId moved over proto
Vishwajith-Shettigar Dec 29, 2023
3688984
lint issue fix
Vishwajith-Shettigar Dec 29, 2023
745f760
fix tests
Vishwajith-Shettigar Dec 29, 2023
7a83f35
lint issue fix
Vishwajith-Shettigar Dec 29, 2023
d59692b
test added
Vishwajith-Shettigar Jan 5, 2024
a81b7a5
test added
Vishwajith-Shettigar Jan 5, 2024
11d06ff
fixed test failing
Vishwajith-Shettigar Jan 5, 2024
f4a55b5
Merge branch 'develop' into protoshift
Vishwajith-Shettigar Jan 13, 2024
1f56282
Merge branch 'develop' into protoshift
Vishwajith-Shettigar Jan 23, 2024
aa21bbd
Merge branch 'develop' into protoshift
Vishwajith-Shettigar Jan 29, 2024
a0ad41a
some chnages
Vishwajith-Shettigar Jan 30, 2024
8379aba
some chnages
Vishwajith-Shettigar Jan 30, 2024
28c8448
some chnages
Vishwajith-Shettigar Jan 30, 2024
3a3c520
some chnages
Vishwajith-Shettigar Jan 30, 2024
5ce3e7c
TopicPracticeFragment.state
Vishwajith-Shettigar Jan 31, 2024
772ddc3
TopicPracticeFragment.state
Vishwajith-Shettigar Jan 31, 2024
34a22eb
revert some changes
Vishwajith-Shettigar Jan 31, 2024
3310cc8
static error fix
Vishwajith-Shettigar Feb 1, 2024
e1dac0a
Merge branch 'develop' into protoshift
Vishwajith-Shettigar Feb 9, 2024
dbbcbc3
added comments
Vishwajith-Shettigar Feb 22, 2024
e0b84ee
added comments
Vishwajith-Shettigar Feb 22, 2024
a8d2a4c
comments added
Vishwajith-Shettigar Feb 22, 2024
a49117e
fix
Vishwajith-Shettigar Feb 22, 2024
bbbf808
fix
Feb 22, 2024
5721009
added comments
Vishwajith-Shettigar Feb 22, 2024
c7c00d8
Merge branch 'develop' into protoshift
Vishwajith-Shettigar Feb 22, 2024
25eec4f
comments added
Vishwajith-Shettigar Feb 22, 2024
8bdfe8b
comments added
Vishwajith-Shettigar Feb 22, 2024
1bdde03
comments added
Vishwajith-Shettigar Feb 22, 2024
bfe2b72
comments added
Vishwajith-Shettigar Feb 22, 2024
47882a4
comments added
Vishwajith-Shettigar Feb 22, 2024
2377a15
fix
Vishwajith-Shettigar Feb 23, 2024
9bd2b7e
topic activity
Vishwajith-Shettigar Feb 23, 2024
f4c935a
QuestionPlayerActivity
Vishwajith-Shettigar Feb 23, 2024
37f49e4
MarkChaptersCompletedTestActivity
Vishwajith-Shettigar Feb 23, 2024
3d0e788
MarkChaptersCompletedActivity
Vishwajith-Shettigar Feb 23, 2024
dacd684
FAQSingleActivity
Vishwajith-Shettigar Feb 23, 2024
f525bab
LicenseListActivity
Vishwajith-Shettigar Feb 23, 2024
1432981
LicenseTextViewerActivity
Vishwajith-Shettigar Feb 23, 2024
7645f99
LicenseTextViewerActivity
Vishwajith-Shettigar Feb 23, 2024
76d4f67
HelpActivity
Vishwajith-Shettigar Feb 23, 2024
1ee3350
addressed comments
Vishwajith-Shettigar Feb 24, 2024
b94a20e
addressed comments
Vishwajith-Shettigar Feb 24, 2024
f290866
addressed comments
Vishwajith-Shettigar Feb 24, 2024
aafa18b
addressed comments
Vishwajith-Shettigar Feb 24, 2024
74edcf6
fix
Vishwajith-Shettigar Feb 24, 2024
9885085
addressed comments
Vishwajith-Shettigar Feb 24, 2024
46ae187
addressed comments
Vishwajith-Shettigar Feb 24, 2024
011209b
addressed all comments
Vishwajith-Shettigar Feb 24, 2024
07997ee
Merge branch 'develop' into protoshift
Vishwajith-Shettigar Feb 24, 2024
be2dda0
fix
Vishwajith-Shettigar Feb 24, 2024
f34d1a6
addressed comments
Vishwajith-Shettigar Apr 28, 2024
8b47fc9
addressed comments
Vishwajith-Shettigar Apr 28, 2024
a023016
removed CurrentUserProfileIdIntentDecorator.kt from kdoc_validity_exe…
Vishwajith-Shettigar Apr 28, 2024
e0622b1
Addressed comments
Vishwajith-Shettigar Apr 30, 2024
c677f44
faqlistfragmenttest
Vishwajith-Shettigar Apr 30, 2024
56cfeb6
faqlistfragmenttest
Vishwajith-Shettigar Apr 30, 2024
170ae99
faqlistfragmenttest
Vishwajith-Shettigar Apr 30, 2024
0a62023
faqlistfragmenttest
Vishwajith-Shettigar Apr 30, 2024
54f06b4
faqlistfragmenttest
Vishwajith-Shettigar Apr 30, 2024
189c9f2
faqlistfragmenttest
Vishwajith-Shettigar Apr 30, 2024
2d6d616
resolve conflicts
Vishwajith-Shettigar Apr 30, 2024
ea502b5
lint
Vishwajith-Shettigar Apr 30, 2024
5da4903
fix tests
Vishwajith-Shettigar Apr 30, 2024
7aaa499
fix tests
Vishwajith-Shettigar Apr 30, 2024
209f9e9
HomeActivityLocalTest
Vishwajith-Shettigar Apr 30, 2024
aa7aace
lint
Vishwajith-Shettigar Apr 30, 2024
02c3298
test fix
Vishwajith-Shettigar Apr 30, 2024
e8c24c8
lint
Vishwajith-Shettigar Apr 30, 2024
570ee04
Merge branch 'develop' into protoshift
Vishwajith-Shettigar May 9, 2024
ed4253e
addressed comments
Vishwajith-Shettigar May 9, 2024
49112a2
klint
Vishwajith-Shettigar May 9, 2024
4a3daf3
Addressed comment
Vishwajith-Shettigar May 15, 2024
1501241
Addressed comment
Vishwajith-Shettigar May 15, 2024
1978f5a
addressed comments
Vishwajith-Shettigar Jun 4, 2024
712c363
addressed comments
Vishwajith-Shettigar Jun 4, 2024
58e03f8
removed unnecessary spaces
Vishwajith-Shettigar Jun 4, 2024
45772a2
Resolved conflicts
Vishwajith-Shettigar Jun 5, 2024
cdee524
Resolved conflicts
Vishwajith-Shettigar Jun 5, 2024
9fe2469
Merge branch 'develop' into protoshift
Vishwajith-Shettigar Jun 13, 2024
afdf297
Merge branch 'develop' into protoshift
Vishwajith-Shettigar Jun 22, 2024
0d65e0c
Addressed comments
Vishwajith-Shettigar Jun 23, 2024
9b66717
Resolve warnings
Vishwajith-Shettigar Jun 23, 2024
b09869e
resolve warnings
Vishwajith-Shettigar Jun 23, 2024
db20e4f
Delete domain/src/main/assets/topics.json
Vishwajith-Shettigar Jun 23, 2024
cba4873
Delete domain/src/main/assets/topics.textproto
Vishwajith-Shettigar Jun 23, 2024
dfe49f1
Addressed comment
Vishwajith-Shettigar Jun 24, 2024
38b125b
Merge branch 'develop' into protoshift
Vishwajith-Shettigar Jun 24, 2024
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
1 change: 1 addition & 0 deletions app/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -804,6 +804,7 @@ kt_android_library(
"//utility/src/main/java/org/oppia/android/util/extensions:bundle_extensions",
"//utility/src/main/java/org/oppia/android/util/parser/image:image_loader",
"//utility/src/main/java/org/oppia/android/util/parser/image:image_parsing_annonations",
"//utility/src/main/java/org/oppia/android/util/profile:current_user_profile_id_intent_decorator",
"//utility/src/main/java/org/oppia/android/util/statusbar:status_bar_color",
],
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,43 +8,33 @@ import org.oppia.android.app.activity.ActivityComponentImpl
import org.oppia.android.app.activity.InjectableAutoLocalizedAppCompatActivity
import org.oppia.android.app.administratorcontrols.appversion.AppVersionActivity
import org.oppia.android.app.administratorcontrols.learneranalytics.ProfileAndDeviceIdActivity
import org.oppia.android.app.drawer.NAVIGATION_PROFILE_ID_ARGUMENT_KEY
import org.oppia.android.app.model.AdministratorControlActivityStateBundle
import org.oppia.android.app.model.ProfileId
import org.oppia.android.app.model.ScreenName.ADMINISTRATOR_CONTROLS_ACTIVITY
import org.oppia.android.app.settings.profile.ProfileEditFragment
import org.oppia.android.app.settings.profile.ProfileListActivity
import org.oppia.android.app.settings.profile.ProfileListFragment
import org.oppia.android.app.translation.AppLanguageResourceHandler
import org.oppia.android.util.extensions.getStringFromBundle
import org.oppia.android.util.extensions.getProto
import org.oppia.android.util.logging.CurrentAppScreenNameIntentDecorator.decorateWithScreenName
import org.oppia.android.util.profile.CurrentUserProfileIdIntentDecorator.decorateWithUserProfileId
import javax.inject.Inject

/** Argument key for of title for selected controls in [AdministratorControlsActivity]. */
const val SELECTED_CONTROLS_TITLE_SAVED_KEY =
"AdministratorControlsActivity.selected_controls_title"

/** Argument key for of selected profile for selected controls in [AdministratorControlsActivity]. */
const val SELECTED_PROFILE_ID_SAVED_KEY =
"AdministratorControlsActivity.selected_profile_id"

/** Argument key for last loaded fragment in [AdministratorControlsActivity]. */
const val LAST_LOADED_FRAGMENT_EXTRA_KEY = "AdministratorControlsActivity.last_loaded_fragment"

/** Argument key used to identify [ProfileListFragment] in the backstack. */
const val PROFILE_LIST_FRAGMENT = "PROFILE_LIST_FRAGMENT"

/** Argument key used to identify [ProfileEditFragment] in the backstack. */
const val PROFILE_EDIT_FRAGMENT = "PROFILE_EDIT_FRAGMENT"

/** Argument key for the Profile deletion confirmation in [ProfileEditActivity]. */
const val IS_PROFILE_DELETION_DIALOG_VISIBLE_KEY =
"ProfileEditActivity.is_profile_deletion_dialog_visible"

/** Argument key used to identify [AppVersionFragment] in the backstack. */
const val APP_VERSION_FRAGMENT = "APP_VERSION_FRAGMENT"

/** Argument key used to identify [ProfileAndDeviceIdFragment] in the backstack. */
const val PROFILE_AND_DEVICE_ID_FRAGMENT = "PROFILE_AND_DEVICE_ID_FRAGMENT"

/** Argument key for Administrator Controls Activity saved state. */
const val ADMINISTRATOR_CONTROLS_ACTIVITY_STATE_KEY = "ADMINISTRATOR_CONTROLS_ACTIVITY_STATE_KEY"

/** Activity [AdministratorControlsActivity] that allows user to change admin controls. */
class AdministratorControlsActivity :
InjectableAutoLocalizedAppCompatActivity(),
Expand All @@ -68,17 +58,24 @@ class AdministratorControlsActivity :
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
(activityComponent as ActivityComponentImpl).inject(this)
val extraControlsTitle =
savedInstanceState?.getStringFromBundle(SELECTED_CONTROLS_TITLE_SAVED_KEY)

val args = savedInstanceState?.getProto(
ADMINISTRATOR_CONTROLS_ACTIVITY_STATE_KEY,
AdministratorControlActivityStateBundle.getDefaultInstance()
)

val extraControlsTitle = args?.selectedControlsTitle

isProfileDeletionDialogVisible =
savedInstanceState?.getBoolean(IS_PROFILE_DELETION_DIALOG_VISIBLE_KEY) ?: false
args?.isProfileDeletionDialogVisible ?: false
lastLoadedFragment = if (savedInstanceState != null) {
savedInstanceState.getStringFromBundle(LAST_LOADED_FRAGMENT_EXTRA_KEY) as String
args?.lastLoadedFragment as String
} else {
// TODO(#661): Change the default fragment in the right hand side to be EditAccount fragment in the case of multipane controls.
PROFILE_LIST_FRAGMENT
}
val selectedProfileId = savedInstanceState?.getInt(SELECTED_PROFILE_ID_SAVED_KEY) ?: -1
val selectedProfileId = args?.selectedProfileId ?: -1

administratorControlsActivityPresenter.handleOnCreate(
extraControlsTitle,
lastLoadedFragment,
Expand Down Expand Up @@ -111,18 +108,17 @@ class AdministratorControlsActivity :
}

companion object {

/** Returns an [Intent] to start this activity. */
fun createAdministratorControlsActivityIntent(context: Context, profileId: Int?): Intent {
fun createAdministratorControlsActivityIntent(context: Context, profileId: ProfileId?): Intent {

val intent = Intent(context, AdministratorControlsActivity::class.java)
intent.putExtra(NAVIGATION_PROFILE_ID_ARGUMENT_KEY, profileId)
intent.decorateWithScreenName(ADMINISTRATOR_CONTROLS_ACTIVITY)
if (profileId != null) {
intent.decorateWithUserProfileId(profileId)
}
return intent
}

/** Returns the argument key used to specify the user's internal profile ID. */
fun getIntentKey(): String {
return NAVIGATION_PROFILE_ID_ARGUMENT_KEY
}
}

override fun onBackPressed() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@ import org.oppia.android.app.activity.ActivityScope
import org.oppia.android.app.administratorcontrols.appversion.AppVersionFragment
import org.oppia.android.app.administratorcontrols.learneranalytics.ProfileAndDeviceIdFragment
import org.oppia.android.app.drawer.NavigationDrawerFragment
import org.oppia.android.app.model.AdministratorControlActivityStateBundle
import org.oppia.android.app.settings.profile.LoadProfileEditDeletionDialogListener
import org.oppia.android.app.settings.profile.ProfileEditFragment
import org.oppia.android.app.settings.profile.ProfileListFragment
import org.oppia.android.app.translation.AppLanguageResourceHandler
import org.oppia.android.databinding.AdministratorControlsActivityBinding
import org.oppia.android.util.extensions.putProto
import javax.inject.Inject

/** The presenter for [AdministratorControlsActivity]. */
Expand Down Expand Up @@ -198,13 +200,18 @@ class AdministratorControlsActivityPresenter @Inject constructor(
/** Saves the state of the views on configuration changes. */
fun handleOnSaveInstanceState(outState: Bundle) {
val titleTextView = binding.extraControlsTitle
if (titleTextView != null) {
outState.putString(SELECTED_CONTROLS_TITLE_SAVED_KEY, titleTextView.text.toString())
}
outState.putString(LAST_LOADED_FRAGMENT_EXTRA_KEY, lastLoadedFragment)
isProfileDeletionDialogVisible.let {
outState.putBoolean(IS_PROFILE_DELETION_DIALOG_VISIBLE_KEY, it)
}
selectedProfileId.let { outState.putInt(SELECTED_PROFILE_ID_SAVED_KEY, it) }
val args = AdministratorControlActivityStateBundle.newBuilder()
.apply {
if (titleTextView != null) {
selectedControlsTitle = titleTextView.text.toString()
}
lastLoadedFragment = [email protected]
this@AdministratorControlsActivityPresenter.isProfileDeletionDialogVisible.let {
isProfileDeletionDialogVisible = it
}
selectedProfileId = [email protected]
}
.build()
outState.putProto(ADMINISTRATOR_CONTROLS_ACTIVITY_STATE_KEY, args)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,30 @@ import android.view.View
import android.view.ViewGroup
import org.oppia.android.app.fragment.FragmentComponentImpl
import org.oppia.android.app.fragment.InjectableFragment
import org.oppia.android.app.model.AdministratorControlsFragmentArguments
import org.oppia.android.util.extensions.getProto
import org.oppia.android.util.extensions.putProto
import javax.inject.Inject

/** Argument key for Administrator Controls Fragment. */
const val ADMINISTRATOR_CONTROLS_FRAGMENT_ARGUMENTS_KEY = "AdministratorControlsFragment.arguments"

/** Fragment that contains Administrator Controls of the application. */
class AdministratorControlsFragment : InjectableFragment() {
@Inject
lateinit var administratorControlsFragmentPresenter: AdministratorControlsFragmentPresenter

companion object {
private const val IS_MULTIPANE_ARGUMENT_KEY = "AdministratorControlsFragment.is_multipane"

/** Creates a new instance of [AdministratorControlsFragment]. */
fun newInstance(isMultipane: Boolean): AdministratorControlsFragment {
val args = Bundle()
args.putBoolean(IS_MULTIPANE_ARGUMENT_KEY, isMultipane)
val fragment = AdministratorControlsFragment()
fragment.arguments = args
return fragment
val args =
AdministratorControlsFragmentArguments.newBuilder().setIsMultipane(isMultipane).build()
return AdministratorControlsFragment().apply {
arguments = Bundle().apply {
putProto(ADMINISTRATOR_CONTROLS_FRAGMENT_ARGUMENTS_KEY, args)
}
}
}
}

Expand All @@ -37,11 +44,15 @@ class AdministratorControlsFragment : InjectableFragment() {
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
val args =
val arguments =
checkNotNull(arguments) {
"Expected arguments to be passed to AdministratorControlsFragment"
}
val isMultipane = args.getBoolean(IS_MULTIPANE_ARGUMENT_KEY)
val args = arguments.getProto(
ADMINISTRATOR_CONTROLS_FRAGMENT_ARGUMENTS_KEY,
AdministratorControlsFragmentArguments.getDefaultInstance()
)
val isMultipane = args.isMultipane
return administratorControlsFragmentPresenter
.handleCreateView(inflater, container, isMultipane)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import org.oppia.android.app.administratorcontrols.administratorcontrolsitemview
import org.oppia.android.app.administratorcontrols.administratorcontrolsitemviewmodel.AdministratorControlsItemViewModel
import org.oppia.android.app.administratorcontrols.administratorcontrolsitemviewmodel.AdministratorControlsProfileAndDeviceIdViewModel
import org.oppia.android.app.administratorcontrols.administratorcontrolsitemviewmodel.AdministratorControlsProfileViewModel
import org.oppia.android.app.drawer.NAVIGATION_PROFILE_ID_ARGUMENT_KEY
import org.oppia.android.app.fragment.FragmentScope
import org.oppia.android.app.model.ProfileId
import org.oppia.android.app.recyclerview.BindableAdapter
Expand All @@ -24,6 +23,7 @@ import org.oppia.android.databinding.AdministratorControlsFragmentBinding
import org.oppia.android.databinding.AdministratorControlsGeneralViewBinding
import org.oppia.android.databinding.AdministratorControlsLearnerAnalyticsViewBinding
import org.oppia.android.databinding.AdministratorControlsProfileViewBinding
import org.oppia.android.util.profile.CurrentUserProfileIdIntentDecorator.extractCurrentUserProfileId
import java.security.InvalidParameterException
import javax.inject.Inject

Expand Down Expand Up @@ -56,7 +56,7 @@ class AdministratorControlsFragmentPresenter @Inject constructor(
/* attachToRoot= */ false
)

internalProfileId = activity.intent.getIntExtra(NAVIGATION_PROFILE_ID_ARGUMENT_KEY, -1)
internalProfileId = activity.intent.extractCurrentUserProfileId().internalId
profileId = ProfileId.newBuilder().setInternalId(internalProfileId).build()
administratorControlsViewModel.setProfileId(profileId)

Expand Down Expand Up @@ -193,14 +193,19 @@ class AdministratorControlsFragmentPresenter @Inject constructor(
private enum class ViewType {
/** Represents [View] for the general section. */
VIEW_TYPE_GENERAL,

/** Represents [View] for the profile section. */
VIEW_TYPE_PROFILE,

/** Represents [View] for the download permissions section. */
VIEW_TYPE_DOWNLOAD_PERMISSIONS,

/** Represents [View] for the app information section. */
VIEW_TYPE_APP_INFORMATION,

/** Represents [View] for the account actions section. */
VIEW_TYPE_ACCOUNT_ACTIONS,

/** Represents [View] for the learner analytics section. */
VIEW_TYPE_LEARNER_ANALYTICS
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@ 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.ProfileId
import org.oppia.android.app.model.ScreenName.COMPLETED_STORY_LIST_ACTIVITY
import org.oppia.android.util.logging.CurrentAppScreenNameIntentDecorator.decorateWithScreenName
import org.oppia.android.util.profile.CurrentUserProfileIdIntentDecorator.decorateWithUserProfileId
import org.oppia.android.util.profile.CurrentUserProfileIdIntentDecorator.extractCurrentUserProfileId
import javax.inject.Inject

/** Activity for completed stories. */
Expand All @@ -17,21 +20,22 @@ class CompletedStoryListActivity : InjectableAutoLocalizedAppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
(activityComponent as ActivityComponentImpl).inject(this)
val internalProfileId: Int =
intent.getIntExtra(PROFILE_ID_EXTRA_KEY, -1)

val internalProfileId: Int = intent?.extractCurrentUserProfileId()?.internalId ?: -1
completedStoryListActivityPresenter.handleOnCreate(internalProfileId)
}

companion object {
// TODO(#1655): Re-restrict access to fields in tests post-Gradle.
const val PROFILE_ID_EXTRA_KEY =
"CompletedStoryListActivity.profile_id"

/** Returns a new [Intent] to route to [CompletedStoryListActivity] for a specified profile ID. */
fun createCompletedStoryListActivityIntent(context: Context, internalProfileId: Int): Intent {
val intent = Intent(context, CompletedStoryListActivity::class.java)
intent.putExtra(PROFILE_ID_EXTRA_KEY, internalProfileId)
intent.decorateWithScreenName(COMPLETED_STORY_LIST_ACTIVITY)
val profileId = ProfileId.newBuilder().setInternalId(internalProfileId).build()
val intent = Intent(context, CompletedStoryListActivity::class.java).apply {
decorateWithUserProfileId(profileId)
decorateWithScreenName(COMPLETED_STORY_LIST_ACTIVITY)
}

return intent
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ import android.view.View
import android.view.ViewGroup
import org.oppia.android.app.fragment.FragmentComponentImpl
import org.oppia.android.app.fragment.InjectableFragment
import org.oppia.android.app.model.ProfileId
import org.oppia.android.util.profile.CurrentUserProfileIdIntentDecorator.decorateWithUserProfileId
import org.oppia.android.util.profile.CurrentUserProfileIdIntentDecorator.extractCurrentUserProfileId
import javax.inject.Inject

/** Fragment for displaying completed stories. */
Expand All @@ -15,17 +18,15 @@ class CompletedStoryListFragment : InjectableFragment() {
// TODO(#1655): Re-restrict access to fields in tests post-Gradle.
/** Key for accessing [CompletedStoryListFragment]. */
const val COMPLETED_STORY_LIST_FRAGMENT_TAG = "COMPLETED_STORY_LIST_FRAGMENT_TAG"
/** [String] key for mapping internalProfileId in [Bundle]. */
internal const val COMPLETED_STORY_LIST_FRAGMENT_PROFILE_ID_KEY =
"CompletedStoryListFragment.profile_id"

/** Returns a new [CompletedStoryListFragment] to display corresponding to the specified profile ID. */
fun newInstance(internalProfileId: Int): CompletedStoryListFragment {
val completedStoryListFragment = CompletedStoryListFragment()
val args = Bundle()
args.putInt(COMPLETED_STORY_LIST_FRAGMENT_PROFILE_ID_KEY, internalProfileId)
completedStoryListFragment.arguments = args
return completedStoryListFragment
val profileId = ProfileId.newBuilder().setInternalId(internalProfileId).build()
return CompletedStoryListFragment().apply {
arguments = Bundle().apply {
decorateWithUserProfileId(profileId)
}
}
}
}

Expand All @@ -42,12 +43,11 @@ class CompletedStoryListFragment : InjectableFragment() {
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
val args = checkNotNull(arguments) {
val arguments = checkNotNull(arguments) {
"Expected arguments to be passed to CompletedStoryListFragment"
}
val internalProfileId = args.getInt(
COMPLETED_STORY_LIST_FRAGMENT_PROFILE_ID_KEY, -1
)
val profileId = arguments.extractCurrentUserProfileId()
val internalProfileId = profileId.internalId
return completedStoryListFragmentPresenter.handleCreateView(
inflater,
container,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@ import org.oppia.android.app.devoptions.markstoriescompleted.MarkStoriesComplete
import org.oppia.android.app.devoptions.marktopicscompleted.MarkTopicsCompletedActivity
import org.oppia.android.app.devoptions.mathexpressionparser.MathExpressionParserActivity
import org.oppia.android.app.devoptions.vieweventlogs.ViewEventLogsActivity
import org.oppia.android.app.drawer.NAVIGATION_PROFILE_ID_ARGUMENT_KEY
import org.oppia.android.app.model.ProfileId
import org.oppia.android.app.model.ScreenName.DEVELOPER_OPTIONS_ACTIVITY
import org.oppia.android.app.translation.AppLanguageResourceHandler
import org.oppia.android.util.logging.CurrentAppScreenNameIntentDecorator.decorateWithScreenName
import org.oppia.android.util.profile.CurrentUserProfileIdIntentDecorator.decorateWithUserProfileId
import org.oppia.android.util.profile.CurrentUserProfileIdIntentDecorator.extractCurrentUserProfileId
import javax.inject.Inject

/** Activity for Developer Options. */
Expand All @@ -40,7 +42,7 @@ class DeveloperOptionsActivity :
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
(activityComponent as ActivityComponentImpl).inject(this)
internalProfileId = intent.getIntExtra(NAVIGATION_PROFILE_ID_ARGUMENT_KEY, -1)
internalProfileId = intent.extractCurrentUserProfileId().internalId
developerOptionsActivityPresenter.handleOnCreate()
title = resourceHandler.getStringInLocale(R.string.developer_options_activity_title)
}
Expand Down Expand Up @@ -80,11 +82,13 @@ class DeveloperOptionsActivity :
}

companion object {

/** Function to create intent for DeveloperOptionsActivity. */
fun createDeveloperOptionsActivityIntent(context: Context, internalProfileId: Int): Intent {
fun createDeveloperOptionsActivityIntent(context: Context, profileId: ProfileId): Intent {

return Intent(context, DeveloperOptionsActivity::class.java).apply {
putExtra(NAVIGATION_PROFILE_ID_ARGUMENT_KEY, internalProfileId)
decorateWithScreenName(DEVELOPER_OPTIONS_ACTIVITY)
decorateWithUserProfileId(profileId)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ package org.oppia.android.app.devoptions

import android.content.Context
import android.content.Intent
import org.oppia.android.app.model.ProfileId

/** Interface to create intent for [DeveloperOptionsActivity]. */
interface DeveloperOptionsStarter {
fun createIntent(context: Context, internalProfileId: Int): Intent
fun createIntent(context: Context, profileId: ProfileId): Intent
}
Loading
Loading