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 #4938: Language Selection Config and New Profile Creation Flow #5457

Merged
merged 259 commits into from
Oct 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
259 commits
Select commit Hold shift + click to select a range
5a41256
Add profile type selection UI with navigation.
adhiamboperes Apr 3, 2024
40d188f
Add tests
adhiamboperes Apr 3, 2024
434d9dc
Add test file exemptions
adhiamboperes Apr 3, 2024
5bd5239
Fix ktlint issue
adhiamboperes Apr 3, 2024
5fb890e
Addressed general feedback
adhiamboperes Apr 3, 2024
adbdbed
Fix curve background for landscape orientation
adhiamboperes Apr 3, 2024
4f0c57b
Flatten Bg drawable
adhiamboperes Apr 3, 2024
187726c
Merge branch 'develop' of github.com:oppia/oppia-android into new-onb…
adhiamboperes Apr 3, 2024
3d2313c
Merge remote-tracking branch 'upstream/new-onboarding-screen' into on…
adhiamboperes Apr 3, 2024
352bf33
Merge branch 'onboarding-profile-type-screen' into create-profile-screen
adhiamboperes Apr 9, 2024
75c39bc
Create CreateProfileActivity
adhiamboperes Apr 9, 2024
125a408
Create CreateProfileFragment
adhiamboperes Apr 9, 2024
cf1f68f
Navigate to CreateProfileActivity
adhiamboperes Apr 9, 2024
eebf64d
Fix ktlint failures
adhiamboperes Apr 9, 2024
027d912
Add tests
adhiamboperes Apr 9, 2024
0d7980f
Add tests for profile picture upload
adhiamboperes Apr 9, 2024
312fc38
Add layout for tablets
adhiamboperes Apr 9, 2024
6ccba79
Fix self review comments
adhiamboperes Apr 9, 2024
0bc5547
Merge branch 'develop' into new-onboarding-screen
adhiamboperes Apr 9, 2024
f31e23d
Create tablet layouts and darkmode bg
adhiamboperes Apr 9, 2024
3e6c7b3
Merge branch 'new-onboarding-screen' of github.com:oppia/oppia-androi…
adhiamboperes Apr 9, 2024
f1d9092
Fix formatting
adhiamboperes Apr 9, 2024
3e2166e
Fix failing test
adhiamboperes Apr 9, 2024
fc452fc
Merge remote-tracking branch 'upstream/onboarding-profile-type-screen…
adhiamboperes Apr 9, 2024
98fcfe6
Fix failing test
adhiamboperes Apr 9, 2024
ccca3a4
Fix missing bazel declaration for CreateProfileViewModel
adhiamboperes Apr 9, 2024
5d052e4
Fix missing bazel declaration for CreateProfileViewModel
adhiamboperes Apr 9, 2024
ff6488b
Create onboarding intro activity
adhiamboperes Apr 10, 2024
dae1afd
Create onboarding intro fragment
adhiamboperes Apr 10, 2024
b2c9a0c
Add navigation to intro activity
adhiamboperes Apr 10, 2024
94329f0
Create mobile landscape layout
adhiamboperes Apr 10, 2024
8a07fdd
Create tablet layouts
adhiamboperes Apr 10, 2024
b708f88
Add tests
adhiamboperes Apr 10, 2024
8aa9320
Ktlint errors
adhiamboperes Apr 10, 2024
52f81e4
Add New Audio Language UI
adhiamboperes Apr 15, 2024
0275f53
Add tests
adhiamboperes Apr 15, 2024
3b4e235
Fix paint style for OppiaCurveBackgroundView.kt
adhiamboperes Apr 17, 2024
b7935e1
Merge branch 'develop' of github.com:oppia/oppia-android into new-onb…
adhiamboperes Apr 17, 2024
b722e49
Merge branch 'new-onboarding-screen' of github.com:oppia/oppia-androi…
adhiamboperes Apr 17, 2024
8f7e355
Adjust height of the otter drawable
adhiamboperes Apr 17, 2024
b411179
Improve styling for phone layouts
adhiamboperes May 22, 2024
bad32c5
Improve styling for tablet layouts
adhiamboperes May 22, 2024
7345107
Clean up padding and text size dimensions
adhiamboperes May 22, 2024
30b26e0
Clean up padding and text size dimensions
adhiamboperes May 22, 2024
2c10cd2
Remove space
adhiamboperes May 22, 2024
3d7cf86
Fix failing test
adhiamboperes May 22, 2024
e67a2f0
Merge branch 'new-onboarding-screen' into onboarding-profile-type-screen
adhiamboperes May 23, 2024
4f53fb5
Update styling
adhiamboperes May 23, 2024
70fac4a
Remove unnecessary tests
adhiamboperes May 23, 2024
8d5c408
Fix indentation
adhiamboperes May 23, 2024
73874b8
Fix general review comments
adhiamboperes May 23, 2024
9547f8d
Create style for back navigation button
adhiamboperes May 23, 2024
cd54544
Fix mobile landscape layout
adhiamboperes May 23, 2024
16c9a97
Fix tests and add tests for mobile landscape layout
adhiamboperes May 23, 2024
0ea7456
Fix ktlint
adhiamboperes May 23, 2024
076c7f0
Fix ktlint
adhiamboperes May 23, 2024
ca2fbfe
Merge branch 'onboarding-profile-type-screen' into create-profile-screen
adhiamboperes May 23, 2024
ab2ee84
Improve phone layout styling
adhiamboperes May 23, 2024
b2bc62d
Improve tablet layout styling
adhiamboperes May 23, 2024
8e5ac97
Fix tests
adhiamboperes May 23, 2024
827afae
Flatten the activity layout
adhiamboperes May 23, 2024
114ae78
Revert formatting changes in the styles file
adhiamboperes May 23, 2024
fde105c
Merge branch 'develop' of github.com:oppia/oppia-android into new-onb…
adhiamboperes May 23, 2024
01c45af
Merge branch 'new-onboarding-screen' into onboarding-profile-type-screen
adhiamboperes May 23, 2024
0bdd447
Fix margin and update with develop
adhiamboperes May 24, 2024
1a4ae23
Merge remote-tracking branch 'upstream/onboarding-profile-type-screen…
adhiamboperes May 24, 2024
497d35b
Fix missing kdoc
adhiamboperes May 24, 2024
9dcf007
Fix kdoc
adhiamboperes May 24, 2024
72ee395
Merge branch 'create-profile-screen' into onboarding-learner-intro-sc…
adhiamboperes May 24, 2024
5452751
Sync and polish UI
adhiamboperes May 25, 2024
1031657
Flatten Layout
adhiamboperes May 25, 2024
acc6067
Fix ktlint
adhiamboperes May 25, 2024
bbe7221
Refactor existing OnboardingFragmentPresenter to OnboardingFragmentPr…
adhiamboperes May 28, 2024
05f598d
Refactor the dropdown
adhiamboperes May 31, 2024
6565d73
Refactor the dropdown in alternate layouts
adhiamboperes May 31, 2024
d67f5ed
Refactor custom background to a binding adapter
adhiamboperes Jun 2, 2024
7c69c15
Fix failing tests and set up bazel test
adhiamboperes Jun 2, 2024
0a7c600
Merge remote-tracking branch 'upstream/develop' into new-onboarding-s…
adhiamboperes Jun 2, 2024
1c0494f
Fix ktlint
adhiamboperes Jun 2, 2024
a8c207a
Replace otter png with SVG
adhiamboperes Jun 3, 2024
1172ff6
Fix failing tests and general cleanup
adhiamboperes Jun 3, 2024
4612e6b
Fix test file exemption
adhiamboperes Jun 3, 2024
d3451ab
Fix accessibility label exemption
adhiamboperes Jun 3, 2024
6095c54
Fix drawable vector hex exemption
adhiamboperes Jun 3, 2024
2540989
Fix unused exemption
adhiamboperes Jun 3, 2024
65d9f11
Fix failing test
adhiamboperes Jun 3, 2024
3bf91c3
Move files to onboarding package
adhiamboperes Jun 3, 2024
18ba375
Merge remote-tracking branch 'upstream/new-onboarding-screen' into on…
adhiamboperes Jun 3, 2024
05d05f1
Resolve merge conflicts
adhiamboperes Jun 3, 2024
1067e57
Added oxford comma
adhiamboperes Jun 3, 2024
e79b69b
Removed leftover exemption
adhiamboperes Jun 3, 2024
c694f51
Fix tests
adhiamboperes Jun 3, 2024
12fbcad
Fix static check errors
adhiamboperes Jun 4, 2024
56f2998
Move everything to onboarding package
adhiamboperes Jun 4, 2024
3fe2539
Merge remote-tracking branch 'upstream/onboarding-profile-type-screen…
adhiamboperes Jun 4, 2024
d955011
Address initial review comments + pull in changes from upstream
adhiamboperes Jun 4, 2024
7286c86
Address styling suggestions
adhiamboperes Jun 4, 2024
787c3f1
Add textwatcher to name edittext
adhiamboperes Jun 4, 2024
2d895c0
Switch to glide util
adhiamboperes Jun 4, 2024
26b7f1e
Add test for image loading
adhiamboperes Jun 4, 2024
e39cd19
Add test for image loading
adhiamboperes Jun 4, 2024
c9f4d82
Fix script check failures
adhiamboperes Jun 4, 2024
c23baab
Fix missing build input
adhiamboperes Jun 4, 2024
90d56c1
Fix script check failures
adhiamboperes Jun 4, 2024
b11d00f
Move files to onboarding package
adhiamboperes Jun 4, 2024
7c34ab9
Merge remote-tracking branch 'upstream/create-profile-screen' into on…
adhiamboperes Jun 4, 2024
b458e19
Fix forward databinding error from upstream
adhiamboperes Jun 5, 2024
1a77d9c
Add forward navigation
adhiamboperes Jun 5, 2024
b542733
Remove modules from upstream
adhiamboperes Jun 5, 2024
a6ee4f5
Add navigation tests
adhiamboperes Jun 5, 2024
fac5719
Fix alignment on tablet landscape
adhiamboperes Jun 5, 2024
93a29ab
Remove PrimeTopicAssetsControllerModule
adhiamboperes Jun 5, 2024
c18a4b1
Move files to onboarding package
adhiamboperes Jun 5, 2024
c3f922a
Merge remote-tracking branch 'upstream/onboarding-learner-intro-scree…
adhiamboperes Jun 5, 2024
b165913
Refactor layouts based on upstream changes.
adhiamboperes Jun 5, 2024
1c64112
Remove unused imports
adhiamboperes Jun 5, 2024
403a8fa
Create style for language dropdown
adhiamboperes Jun 6, 2024
539e740
Refactor tablet layout styling
adhiamboperes Jun 6, 2024
d11d221
Refactor rename AudioLanguageFragmentPresenter to V1 suffix
adhiamboperes Jun 6, 2024
52fbf56
Add tests
adhiamboperes Jun 6, 2024
f14bbb1
Merge remote-tracking branch 'upstream/develop' into new-onboarding-s…
adhiamboperes Jun 11, 2024
ea056af
Merge branch 'new-onboarding-screen' into onboarding-profile-type-screen
adhiamboperes Jun 11, 2024
5237f63
Merge remote-tracking branch 'upstream/onboarding-profile-type-screen…
adhiamboperes Jun 11, 2024
3fdf74f
Fix merge conflict
adhiamboperes Jun 11, 2024
c2c244b
Merge branch 'new-onboarding-screen' into onboarding-profile-type-screen
adhiamboperes Jun 11, 2024
b802921
Merge branch 'onboarding-profile-type-screen' into create-profile-screen
adhiamboperes Jun 11, 2024
66b664c
Merge branch 'create-profile-screen' into onboarding-learner-intro-sc…
adhiamboperes Jun 11, 2024
a435c11
Create new style for error messages
adhiamboperes Jun 11, 2024
3f3b810
Add textwatcher test
adhiamboperes Jun 11, 2024
5b3ecba
Fix small issues
adhiamboperes Jun 11, 2024
5b43705
Fix small issues
adhiamboperes Jun 11, 2024
43274da
Merge branch 'create-profile-screen' into onboarding-learner-intro-sc…
adhiamboperes Jun 11, 2024
1d7f954
Fix merge conflicts
adhiamboperes Jun 11, 2024
a3e7168
Merge remote-tracking branch 'upstream/onboarding-learner-intro-scree…
adhiamboperes Jun 11, 2024
72624f5
Merge branch 'develop' into new-onboarding-screen
adhiamboperes Jun 17, 2024
13d9ac5
Merge branch 'new-onboarding-screen' into onboarding-profile-type-screen
adhiamboperes Jun 17, 2024
f0d0c57
Merge branch 'onboarding-profile-type-screen' into create-profile-screen
adhiamboperes Jun 17, 2024
199447d
Merge branch 'create-profile-screen' into onboarding-learner-intro-sc…
adhiamboperes Jun 17, 2024
a0fc7d6
Merge branch 'onboarding-learner-intro-screen' into onboarding-audio-…
adhiamboperes Jun 17, 2024
485dc54
Replace Lifecycle.State check with activity.isFinishing
adhiamboperes Jun 18, 2024
33624d7
Flatten layout
adhiamboperes Jun 19, 2024
2b10f80
Resolve merge conflicts
adhiamboperes Jun 19, 2024
1ade253
Merge branch 'onboarding-profile-type-screen' into create-profile-screen
adhiamboperes Jun 19, 2024
49586cc
Adjust profile picture prompt
adhiamboperes Jun 19, 2024
2d5d438
Add assertions for image loaded
adhiamboperes Jun 19, 2024
41dea0b
Replace Lifecycle.State check with activity.isFinishing
adhiamboperes Jun 19, 2024
e6a1b24
Addressed reviewer comments
adhiamboperes Jun 19, 2024
85081cc
Merge branch 'create-profile-screen' into onboarding-learner-intro-sc…
adhiamboperes Jun 19, 2024
4e91b89
Merge branch 'onboarding-learner-intro-screen' into onboarding-audio-…
adhiamboperes Jun 19, 2024
66f8fac
Fix tests
adhiamboperes Jun 19, 2024
c10ba82
Fix failing tests
adhiamboperes Jun 19, 2024
c386024
Add missing test initialization
adhiamboperes Jun 19, 2024
1bb7508
Merge branch 'develop' into onboarding-profile-type-screen
adhiamboperes Jun 24, 2024
6e0401f
Update test_file_exemptions to the new format
adhiamboperes Jun 24, 2024
2f84098
Fix indent
adhiamboperes Jun 24, 2024
d979d1b
Merge branch 'onboarding-profile-type-screen' into create-profile-screen
adhiamboperes Jun 24, 2024
2d83378
Update test_file_exemptions
adhiamboperes Jun 24, 2024
3f5c8c2
Merge branch 'create-profile-screen' into onboarding-learner-intro-sc…
adhiamboperes Jun 24, 2024
e3565b5
Address reviewer comment
adhiamboperes Jun 24, 2024
3641559
Merge branch 'onboarding-learner-intro-screen' into onboarding-audio-…
adhiamboperes Jun 24, 2024
b19014c
Address reviewer comments
adhiamboperes Jun 24, 2024
2412618
Populate the language dropdown list
adhiamboperes Jun 25, 2024
04acfa9
Merge branch 'develop' into onboarding-profile-type-screen
adhiamboperes Jun 30, 2024
223150b
Replace png images with svgs
adhiamboperes Jun 30, 2024
90428af
Add exemptions for new svgs
adhiamboperes Jun 30, 2024
e248fb1
Pull upstream and fix conflicts
adhiamboperes Jun 30, 2024
9fd9fbc
Change default avatar bg in v2
adhiamboperes Jun 30, 2024
2ec249d
Fix profile prompt background
adhiamboperes Jun 30, 2024
988ab47
Merge branch 'develop' into create-profile-screen
adhiamboperes Jun 30, 2024
af6ed95
Fix deprecated api
adhiamboperes Jun 30, 2024
53e7b9b
Merge branch 'create-profile-screen' into onboarding-learner-intro-sc…
adhiamboperes Jun 30, 2024
05d02c3
Fix kdoc
adhiamboperes Jun 30, 2024
ce9660d
Merge branch 'create-profile-screen' into onboarding-learner-intro-sc…
adhiamboperes Jun 30, 2024
ce46838
Merge remote-tracking branch 'upstream/onboarding-learner-intro-scree…
adhiamboperes Jun 30, 2024
86416a1
Fix test_file_exemption
adhiamboperes Jun 30, 2024
b3b7d6c
Merge branch 'develop' into onboarding-audio-language-screen
adhiamboperes Jul 1, 2024
29eb9d5
Replace ConstraintLayout with FrameLayout
adhiamboperes Jul 1, 2024
fbe6ac3
Add dropdown view id
adhiamboperes Jun 25, 2024
264f827
Hook up app language options
adhiamboperes Jun 26, 2024
320fc14
Create language dropdown list and the default selection
adhiamboperes Jul 2, 2024
d96d29e
Make otter graphic respond to rtl layouts
adhiamboperes Jul 2, 2024
9073e8c
Add mechanisms to check if a default profile exists: wip
adhiamboperes Jul 2, 2024
31fb8f5
Pass the created profileId and update profile details
adhiamboperes Jul 2, 2024
d65b9f8
Refactored IntroFragment arguments to proto, and decorated with the p…
adhiamboperes Jul 2, 2024
cf138ab
Prime AudioLanguageActivity to receive a profileId args
adhiamboperes Jul 2, 2024
b0e47c9
Fix merge conflicts
adhiamboperes Jul 3, 2024
866fff4
Refactor to the new central hasProtoExtra
adhiamboperes Jul 3, 2024
8d96257
Remove redundant non-null assertion
adhiamboperes Jul 3, 2024
470a476
Fix duplicating default profile creation
adhiamboperes Jul 5, 2024
89d5c67
Bind audiolanguage pre-selection to the dropdown
adhiamboperes Jul 5, 2024
c901f9d
Fix persist selection on config change
adhiamboperes Jul 5, 2024
b71d6bd
Setup audio language pre-selection logic
adhiamboperes Jul 5, 2024
682355d
Fix lint errors
adhiamboperes Jul 5, 2024
185d8d4
Cleanup language selection and profile creation
adhiamboperes Jul 9, 2024
a0884c8
Fix missing kdocs
adhiamboperes Jul 9, 2024
efe460e
Update profile error message view
adhiamboperes Jul 11, 2024
0be7286
Refactor IntroActivity intent creation
adhiamboperes Jul 11, 2024
8508ea5
Update intent tests to reflect new intent extras
adhiamboperes Jul 11, 2024
beb6f7c
Add tests for language switching
adhiamboperes Jul 11, 2024
e653a7b
Add helper for creating a default empty profile
adhiamboperes Jul 11, 2024
4d2c48d
Update updateNewProfileDetails() kdocs
adhiamboperes Jul 11, 2024
002cc38
Helper for creating the default empty profile in tests
adhiamboperes Jul 11, 2024
eff4cbb
Tests for the new profile update api
adhiamboperes Jul 11, 2024
d6423c2
Additional tests for the profile creation flow
adhiamboperes Jul 11, 2024
7730225
Add tests for language selection
adhiamboperes Jul 11, 2024
af11961
Fix missing kdoc
adhiamboperes Jul 11, 2024
4d81441
Fix self-review pass issues.
adhiamboperes Jul 12, 2024
d08df8b
Exempt OnboardingFragmentTest from locale checks
adhiamboperes Jul 12, 2024
0932981
Fix failing tests
adhiamboperes Jul 12, 2024
fc85e9d
Update admin profile profileType in v2
adhiamboperes Jul 15, 2024
b00217a
General cleanup
adhiamboperes Jul 18, 2024
5f01efb
Merge branch 'develop' into onboarding-language-domain-config
adhiamboperes Jul 18, 2024
f4f652e
Merge branch 'develop' into onboarding-language-domain-config
adhiamboperes Jul 25, 2024
08f67c6
Address part of reviewer comments
adhiamboperes Aug 1, 2024
e67f67b
Fix lint errors
adhiamboperes Aug 1, 2024
ac6b501
Merge branch 'onboarding-language-domain-config' of github.com:oppia/…
adhiamboperes Aug 1, 2024
ee841fa
Merge branch 'develop' of github.com:oppia/oppia-android into onboard…
adhiamboperes Aug 5, 2024
4e6a2a6
Create test suite for TextInputLayoutBindingAdapters
adhiamboperes Aug 5, 2024
5389819
Address more reviewer comments.
adhiamboperes Aug 5, 2024
4b37f24
Fixed static check failures
adhiamboperes Aug 5, 2024
da1787b
Fix empty strings assertion
adhiamboperes Aug 12, 2024
3e068bb
Addressed test comments
adhiamboperes Aug 12, 2024
990dc5a
Use proto for app language
adhiamboperes Aug 14, 2024
30cf1db
Refactor language binding logic
adhiamboperes Aug 19, 2024
9193b4a
Allow user to progress on continue clicked.
adhiamboperes Aug 21, 2024
bc140c5
Fix failing test
adhiamboperes Aug 21, 2024
6635c0d
Fix failing audio language tests
adhiamboperes Aug 21, 2024
d604e53
Fix failing profile creation tests
adhiamboperes Aug 21, 2024
622edb3
Temporarily remove failing adapter tests
adhiamboperes Aug 22, 2024
f838bab
Merge branch 'develop' into onboarding-language-domain-config
adhiamboperes Aug 23, 2024
dd03357
Update profile creation exceptions and tests
adhiamboperes Aug 23, 2024
da2fb5f
Properly set up binding adapter tests
adhiamboperes Aug 23, 2024
7589da6
Remove unused code
adhiamboperes Aug 23, 2024
ded1640
Fix nit
adhiamboperes Aug 23, 2024
b2084e6
Merge branch 'develop' into onboarding-language-domain-config
adhiamboperes Aug 23, 2024
f89ed7a
Merge branch 'develop' into onboarding-language-domain-config
adhiamboperes Aug 27, 2024
9993552
Add test for arabic inTextInputLayoutBindingAdaptersTest
adhiamboperes Sep 9, 2024
dea8c06
Refactor formatting
adhiamboperes Sep 9, 2024
47af3d1
Address reviewer comment
adhiamboperes Sep 9, 2024
cc7147a
Cleanup language selection impl
adhiamboperes Sep 9, 2024
7c713c6
Merge branch 'develop' of github.com:oppia/oppia-android into onboard…
adhiamboperes Sep 9, 2024
fac0a95
Nit
adhiamboperes Sep 10, 2024
6d90cd2
Merge branch 'develop' of github.com:oppia/oppia-android into onboard…
adhiamboperes Sep 11, 2024
59df467
Refactor function
adhiamboperes Sep 11, 2024
45719dd
Merge branch 'develop' into onboarding-language-domain-config
adhiamboperes Sep 12, 2024
41c6a68
Merge branch 'develop' into onboarding-language-domain-config
adhiamboperes Sep 16, 2024
9961d00
Merge branch 'develop' into onboarding-language-domain-config
adhiamboperes Oct 1, 2024
4ff4680
Refactor language selection to use supported languages only
adhiamboperes Oct 1, 2024
9d60f13
Merge branch 'onboarding-language-domain-config' of github.com:oppia/…
adhiamboperes Oct 1, 2024
a6bf1a6
Merge branch 'develop' into onboarding-language-domain-config
BenHenning Oct 18, 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
3 changes: 3 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,9 @@
android:name=".app.onboarding.IntroActivity"
android:label="@string/onboarding_learner_intro_activity_title"
android:theme="@style/OppiaThemeWithoutActionBar" />
<activity
android:name=".app.testing.TextInputLayoutBindingAdaptersTestActivity"
android:theme="@style/OppiaThemeWithoutActionBar" />
<provider
android:name="androidx.work.impl.WorkManagerInitializer"
android:authorities="${applicationId}.workmanager-init"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
package org.oppia.android.app.databinding;

import android.app.Activity;
import android.content.Context;
import android.content.ContextWrapper;
import android.view.View;
import android.widget.AutoCompleteTextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.databinding.BindingAdapter;
import com.google.android.material.textfield.TextInputLayout;
import org.oppia.android.app.model.OppiaLanguage;
import org.oppia.android.app.translation.AppLanguageActivityInjectorProvider;
import org.oppia.android.app.translation.AppLanguageResourceHandler;

/** Holds all custom binding adapters that bind to [TextInputLayout]. */
public final class TextInputLayoutBindingAdapters {
Expand All @@ -15,4 +24,37 @@ public static void setErrorMessage(
) {
textInputLayout.setError(errorMessage);
}

/** Binding adapter for setting the text of an [AutoCompleteTextView]. */
@BindingAdapter({"languageSelection", "filter"})
public static void setLanguageSelection(
@NonNull AutoCompleteTextView textView,
@Nullable OppiaLanguage selectedItem,
Boolean filter) {
textView.setText(getAppLanguageResourceHandler(textView)
.computeLocalizedDisplayName(selectedItem), filter);
}

private static AppLanguageResourceHandler getAppLanguageResourceHandler(View view) {
AppLanguageActivityInjectorProvider provider =
(AppLanguageActivityInjectorProvider) getAttachedActivity(view);
return provider.getAppLanguageActivityInjector().getAppLanguageResourceHandler();
}

private static Activity getAttachedActivity(View view) {
Context context = view.getContext();
while (context != null && !(context instanceof Activity)) {
if (!(context instanceof ContextWrapper)) {
throw new IllegalStateException(
"Encountered context in view (" + view + ") that doesn't wrap a parent context: "
+ context
);
}
context = ((ContextWrapper) context).getBaseContext();
}
if (context == null) {
throw new IllegalStateException("Failed to find base Activity for view: " + view);
}
return (Activity) context;
}
}
Original file line number Diff line number Diff line change
@@ -1,37 +1,56 @@
package org.oppia.android.app.onboarding

import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.view.inputmethod.EditorInfo
import android.widget.AdapterView
import android.widget.ArrayAdapter
import androidx.appcompat.app.AppCompatActivity
import androidx.fragment.app.Fragment
import com.google.android.material.appbar.AppBarLayout
import org.oppia.android.R
import org.oppia.android.app.home.HomeActivity
import org.oppia.android.app.model.AudioLanguageFragmentStateBundle
import org.oppia.android.app.model.AudioTranslationLanguageSelection
import org.oppia.android.app.model.OppiaLanguage
import org.oppia.android.app.model.ProfileId
import org.oppia.android.app.options.AudioLanguageFragment.Companion.FRAGMENT_SAVED_STATE_KEY
import org.oppia.android.app.options.AudioLanguageSelectionViewModel
import org.oppia.android.app.translation.AppLanguageResourceHandler
import org.oppia.android.databinding.AudioLanguageSelectionFragmentBinding
import org.oppia.android.domain.oppialogger.OppiaLogger
import org.oppia.android.domain.translation.TranslationController
import org.oppia.android.util.data.AsyncResult
import org.oppia.android.util.data.DataProviders.Companion.toLiveData
import org.oppia.android.util.extensions.getProto
import org.oppia.android.util.extensions.putProto
import javax.inject.Inject

/** The presenter for [AudioLanguageFragment]. */
class AudioLanguageFragmentPresenter @Inject constructor(
private val fragment: Fragment,
private val activity: AppCompatActivity,
private val appLanguageResourceHandler: AppLanguageResourceHandler,
private val audioLanguageSelectionViewModel: AudioLanguageSelectionViewModel
private val audioLanguageSelectionViewModel: AudioLanguageSelectionViewModel,
private val translationController: TranslationController,
private val oppiaLogger: OppiaLogger
) {
private lateinit var binding: AudioLanguageSelectionFragmentBinding
private lateinit var selectedLanguage: OppiaLanguage
private lateinit var supportedLanguages: List<OppiaLanguage>

/**
* Returns a newly inflated view to render the fragment with an evaluated audio language as the
* initial selected language, based on current locale.
*/
fun handleCreateView(
inflater: LayoutInflater,
container: ViewGroup?
container: ViewGroup?,
profileId: ProfileId,
outState: Bundle?
): View {

// Hide toolbar as it's not needed in this layout. The toolbar is created by a shared activity
// and is required in OptionsFragment.
activity.findViewById<AppBarLayout>(R.id.reading_list_app_bar_layout).visibility = View.GONE
Expand All @@ -41,33 +60,110 @@ class AudioLanguageFragmentPresenter @Inject constructor(
container,
/* attachToRoot= */ false
)
binding.lifecycleOwner = fragment

val savedSelectedLanguage = outState?.getProto(
FRAGMENT_SAVED_STATE_KEY,
AudioLanguageFragmentStateBundle.getDefaultInstance()
)?.selectedLanguage

binding.apply {
lifecycleOwner = fragment
viewModel = audioLanguageSelectionViewModel
}

audioLanguageSelectionViewModel.updateProfileId(profileId)

savedSelectedLanguage?.let {
if (it != OppiaLanguage.LANGUAGE_UNSPECIFIED) {
setSelectedLanguage(it)
} else {
observePreselectedLanguage()
}
} ?: observePreselectedLanguage()

binding.audioLanguageText.text = appLanguageResourceHandler.getStringInLocaleWithWrapping(
R.string.audio_language_fragment_text,
appLanguageResourceHandler.getStringInLocale(R.string.app_name)
)

binding.onboardingNavigationBack.setOnClickListener {
activity.finish()
}
binding.onboardingNavigationBack.setOnClickListener { activity.finish() }

val adapter = ArrayAdapter(
fragment.requireContext(),
R.layout.onboarding_language_dropdown_item,
R.id.onboarding_language_text_view,
audioLanguageSelectionViewModel.availableAudioLanguages
audioLanguageSelectionViewModel.supportedOppiaLanguagesLiveData.observe(
fragment,
{ languages ->
supportedLanguages = languages
val adapter = ArrayAdapter(
fragment.requireContext(),
R.layout.onboarding_language_dropdown_item,
R.id.onboarding_language_text_view,
languages.map { appLanguageResourceHandler.computeLocalizedDisplayName(it) }
)
binding.audioLanguageDropdownList.setAdapter(adapter)
}
)

binding.audioLanguageDropdownList.apply {
setAdapter(adapter)
setText(
audioLanguageSelectionViewModel.defaultLanguageSelection,
false
)
setRawInputType(EditorInfo.TYPE_NULL)

onItemClickListener =
AdapterView.OnItemClickListener { _, _, position, _ ->
val selectedItem = adapter.getItem(position) as? String
selectedItem?.let {
selectedLanguage = supportedLanguages.associateBy { oppiaLanguage ->
appLanguageResourceHandler.computeLocalizedDisplayName(oppiaLanguage)
}[it] ?: OppiaLanguage.ENGLISH
}
}
}

binding.onboardingNavigationContinue.setOnClickListener {
updateSelectedAudioLanguage(selectedLanguage, profileId).also {
val intent = HomeActivity.createHomeActivity(fragment.requireContext(), profileId)
fragment.startActivity(intent)
// Finish this activity as well as all activities immediately below it in the current
// task so that the user cannot navigate back to the onboarding flow by pressing the
// back button once onboarding is complete
fragment.activity?.finishAffinity()
}
}

return binding.root
}

private fun observePreselectedLanguage() {
audioLanguageSelectionViewModel.languagePreselectionLiveData.observe(
fragment,
{ selectedLanguage -> setSelectedLanguage(selectedLanguage) }
)
}

private fun setSelectedLanguage(selectedLanguage: OppiaLanguage) {
this.selectedLanguage = selectedLanguage
audioLanguageSelectionViewModel.selectedAudioLanguage.set(selectedLanguage)
}

private fun updateSelectedAudioLanguage(selectedLanguage: OppiaLanguage, profileId: ProfileId) {
val audioLanguageSelection =
AudioTranslationLanguageSelection.newBuilder().setSelectedLanguage(selectedLanguage).build()
translationController.updateAudioTranslationContentLanguage(profileId, audioLanguageSelection)
.toLiveData().observe(fragment) {
when (it) {
is AsyncResult.Failure ->
oppiaLogger.e(
"AudioLanguageFragment",
"Failed to set the selected language.",
it.error
)
else -> {} // Do nothing.
}
}
}

/** Save the current dropdown selection to be retrieved on configuration change. */
fun handleSavedState(outState: Bundle) {
outState.putProto(
FRAGMENT_SAVED_STATE_KEY,
AudioLanguageFragmentStateBundle.newBuilder().setSelectedLanguage(selectedLanguage).build()
)
}
}
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.CreateProfileActivityParams
import org.oppia.android.app.model.ScreenName.CREATE_PROFILE_ACTIVITY
import org.oppia.android.util.extensions.getProtoExtra
import org.oppia.android.util.logging.CurrentAppScreenNameIntentDecorator.decorateWithScreenName
import org.oppia.android.util.profile.CurrentUserProfileIdIntentDecorator.extractCurrentUserProfileId
import javax.inject.Inject

/** Activity for displaying a new learner profile creation flow. */
Expand All @@ -18,7 +21,13 @@ class CreateProfileActivity : InjectableAutoLocalizedAppCompatActivity() {
super.onCreate(savedInstanceState)
(activityComponent as ActivityComponentImpl).inject(this)

learnerProfileActivityPresenter.handleOnCreate()
val profileId = intent.extractCurrentUserProfileId()
val profileType = intent.getProtoExtra(
CREATE_PROFILE_PARAMS_KEY,
CreateProfileActivityParams.getDefaultInstance()
).profileType

learnerProfileActivityPresenter.handleOnCreate(profileId, profileType)
}

companion object {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
package org.oppia.android.app.onboarding

import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import androidx.databinding.DataBindingUtil
import org.oppia.android.R
import org.oppia.android.app.model.CreateProfileFragmentArguments
import org.oppia.android.app.model.ProfileId
import org.oppia.android.app.model.ProfileType
import org.oppia.android.databinding.CreateProfileActivityBinding
import org.oppia.android.util.extensions.putProto
import org.oppia.android.util.profile.CurrentUserProfileIdIntentDecorator.decorateWithUserProfileId
import javax.inject.Inject

/** Argument key for [CreateProfileFragment] arguments. */
const val CREATE_PROFILE_FRAGMENT_ARGS = "CreateProfileFragment.args"

private const val TAG_CREATE_PROFILE_ACTIVITY_FRAGMENT = "TAG_CREATE_PROFILE_ACTIVITY_FRAGMENT"

/** Presenter for [CreateProfileActivity]. */
Expand All @@ -15,14 +24,24 @@ class CreateProfileActivityPresenter @Inject constructor(
private lateinit var binding: CreateProfileActivityBinding

/** Handle creation and binding of the CreateProfileActivity layout. */
fun handleOnCreate() {
fun handleOnCreate(profileId: ProfileId, profileType: ProfileType) {
binding = DataBindingUtil.setContentView(activity, R.layout.create_profile_activity)
binding.apply {
lifecycleOwner = activity
}

if (getNewLearnerProfileFragment() == null) {
val createLearnerProfileFragment = CreateProfileFragment()

val args = Bundle().apply {
val fragmentArgs =
CreateProfileFragmentArguments.newBuilder().setProfileType(profileType).build()
putProto(CREATE_PROFILE_FRAGMENT_ARGS, fragmentArgs)
decorateWithUserProfileId(profileId)
}

createLearnerProfileFragment.arguments = args

activity.supportFragmentManager.beginTransaction().add(
R.id.profile_fragment_placeholder,
createLearnerProfileFragment,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ 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.CreateProfileFragmentArguments
import org.oppia.android.util.extensions.getProto
import org.oppia.android.util.profile.CurrentUserProfileIdIntentDecorator.extractCurrentUserProfileId
import javax.inject.Inject

/** Fragment for displaying a new learner profile creation flow. */
Expand All @@ -33,6 +36,23 @@ class CreateProfileFragment : InjectableFragment() {
createProfileFragmentPresenter.handleOnActivityResult(result.data)
}
}
return createProfileFragmentPresenter.handleCreateView(inflater, container)

val profileId = checkNotNull(arguments?.extractCurrentUserProfileId()) {
"Expected CreateProfileFragment to have a profileId argument."
}
val profileType = checkNotNull(
arguments?.getProto(
CREATE_PROFILE_FRAGMENT_ARGS, CreateProfileFragmentArguments.getDefaultInstance()
)?.profileType
) {
"Expected CreateProfileFragment to have a profileType argument."
}

return createProfileFragmentPresenter.handleCreateView(
inflater,
container,
profileId,
profileType
)
}
}
Loading
Loading