-
Notifications
You must be signed in to change notification settings - Fork 534
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into multiple-classrooms-event-logs
- Loading branch information
Showing
114 changed files
with
7,025 additions
and
506 deletions.
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
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
10 changes: 10 additions & 0 deletions
10
app/src/main/java/org/oppia/android/app/hintsandsolution/ViewHintListener.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,10 @@ | ||
package org.oppia.android.app.hintsandsolution | ||
|
||
/** Callback listener for when the user wishes to view a hint. */ | ||
interface ViewHintListener { | ||
/** | ||
* Called when the user indicates they want to view the hint corresponding to the specified | ||
* index. | ||
*/ | ||
fun viewHint(hintIndex: Int) | ||
} |
9 changes: 9 additions & 0 deletions
9
app/src/main/java/org/oppia/android/app/hintsandsolution/ViewSolutionInterface.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,9 @@ | ||
package org.oppia.android.app.hintsandsolution | ||
|
||
/** Interface to check the preference regarding alert for [HintsAndSolutionDialogFragment]. */ | ||
interface ViewSolutionInterface { | ||
/** | ||
* Called when the user indicates they want to view the solution. | ||
*/ | ||
fun viewSolution() | ||
} |
73 changes: 73 additions & 0 deletions
73
app/src/main/java/org/oppia/android/app/onboarding/AudioLanguageFragmentPresenter.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,73 @@ | ||
package org.oppia.android.app.onboarding | ||
|
||
import android.view.LayoutInflater | ||
import android.view.View | ||
import android.view.ViewGroup | ||
import android.view.inputmethod.EditorInfo | ||
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.options.AudioLanguageSelectionViewModel | ||
import org.oppia.android.app.translation.AppLanguageResourceHandler | ||
import org.oppia.android.databinding.AudioLanguageSelectionFragmentBinding | ||
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 lateinit var binding: AudioLanguageSelectionFragmentBinding | ||
|
||
/** | ||
* 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? | ||
): 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 | ||
|
||
binding = AudioLanguageSelectionFragmentBinding.inflate( | ||
inflater, | ||
container, | ||
/* attachToRoot= */ false | ||
) | ||
binding.lifecycleOwner = fragment | ||
|
||
binding.audioLanguageText.text = appLanguageResourceHandler.getStringInLocaleWithWrapping( | ||
R.string.audio_language_fragment_text, | ||
appLanguageResourceHandler.getStringInLocale(R.string.app_name) | ||
) | ||
|
||
binding.onboardingNavigationBack.setOnClickListener { | ||
activity.finish() | ||
} | ||
|
||
val adapter = ArrayAdapter( | ||
fragment.requireContext(), | ||
R.layout.onboarding_language_dropdown_item, | ||
R.id.onboarding_language_text_view, | ||
audioLanguageSelectionViewModel.availableAudioLanguages | ||
) | ||
|
||
binding.audioLanguageDropdownList.apply { | ||
setAdapter(adapter) | ||
setText( | ||
audioLanguageSelectionViewModel.defaultLanguageSelection, | ||
false | ||
) | ||
setRawInputType(EditorInfo.TYPE_NULL) | ||
} | ||
|
||
return binding.root | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
app/src/main/java/org/oppia/android/app/onboarding/CreateProfileActivity.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 | ||
|
||
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.CREATE_PROFILE_ACTIVITY | ||
import org.oppia.android.util.logging.CurrentAppScreenNameIntentDecorator.decorateWithScreenName | ||
import javax.inject.Inject | ||
|
||
/** Activity for displaying a new learner profile creation flow. */ | ||
class CreateProfileActivity : InjectableAutoLocalizedAppCompatActivity() { | ||
@Inject | ||
lateinit var learnerProfileActivityPresenter: CreateProfileActivityPresenter | ||
|
||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
(activityComponent as ActivityComponentImpl).inject(this) | ||
|
||
learnerProfileActivityPresenter.handleOnCreate() | ||
} | ||
|
||
companion object { | ||
/** Returns a new [Intent] open a [CreateProfileActivity] with the specified params. */ | ||
fun createProfileActivityIntent(context: Context): Intent { | ||
return Intent(context, CreateProfileActivity::class.java).apply { | ||
decorateWithScreenName(CREATE_PROFILE_ACTIVITY) | ||
} | ||
} | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
app/src/main/java/org/oppia/android/app/onboarding/CreateProfileActivityPresenter.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,39 @@ | ||
package org.oppia.android.app.onboarding | ||
|
||
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 [CreateProfileActivity]. */ | ||
class CreateProfileActivityPresenter @Inject constructor( | ||
private val activity: AppCompatActivity | ||
) { | ||
private lateinit var binding: CreateProfileActivityBinding | ||
|
||
/** Handle creation and binding of the CreateProfileActivity layout. */ | ||
fun handleOnCreate() { | ||
binding = DataBindingUtil.setContentView(activity, R.layout.create_profile_activity) | ||
binding.apply { | ||
lifecycleOwner = activity | ||
} | ||
|
||
if (getNewLearnerProfileFragment() == null) { | ||
val createLearnerProfileFragment = CreateProfileFragment() | ||
activity.supportFragmentManager.beginTransaction().add( | ||
R.id.profile_fragment_placeholder, | ||
createLearnerProfileFragment, | ||
TAG_CREATE_PROFILE_ACTIVITY_FRAGMENT | ||
).commitNow() | ||
} | ||
} | ||
|
||
private fun getNewLearnerProfileFragment(): CreateProfileFragment? { | ||
return activity.supportFragmentManager.findFragmentByTag( | ||
TAG_CREATE_PROFILE_ACTIVITY_FRAGMENT | ||
) as? CreateProfileFragment | ||
} | ||
} |
38 changes: 38 additions & 0 deletions
38
app/src/main/java/org/oppia/android/app/onboarding/CreateProfileFragment.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,38 @@ | ||
package org.oppia.android.app.onboarding | ||
|
||
import android.app.Activity | ||
import android.content.Context | ||
import android.os.Bundle | ||
import android.view.LayoutInflater | ||
import android.view.View | ||
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 javax.inject.Inject | ||
|
||
/** Fragment for displaying a new learner profile creation flow. */ | ||
class CreateProfileFragment : InjectableFragment() { | ||
@Inject | ||
lateinit var createProfileFragmentPresenter: CreateProfileFragmentPresenter | ||
|
||
override fun onAttach(context: Context) { | ||
super.onAttach(context) | ||
(fragmentComponent as FragmentComponentImpl).inject(this) | ||
} | ||
|
||
override fun onCreateView( | ||
inflater: LayoutInflater, | ||
container: ViewGroup?, | ||
savedInstanceState: Bundle? | ||
): View? { | ||
createProfileFragmentPresenter.activityResultLauncher = registerForActivityResult( | ||
ActivityResultContracts.StartActivityForResult() | ||
) { result -> | ||
if (result.resultCode == Activity.RESULT_OK) { | ||
createProfileFragmentPresenter.handleOnActivityResult(result.data) | ||
} | ||
} | ||
return createProfileFragmentPresenter.handleCreateView(inflater, container) | ||
} | ||
} |
Oops, something went wrong.