-
Notifications
You must be signed in to change notification settings - Fork 528
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 introduce-exploration-progress-controller
Conflicts: domain/build.gradle domain/src/main/java/org/oppia/domain/exploration/ExplorationDataController.kt Also, migrate the data controller to the retriever.
- Loading branch information
Showing
34 changed files
with
3,660 additions
and
162 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
47 changes: 47 additions & 0 deletions
47
app/src/main/java/org/oppia/app/player/audio/CellularDataDialogFragment.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,47 @@ | ||
package org.oppia.app.player.audio | ||
|
||
import android.app.Dialog | ||
import android.content.Context | ||
import android.os.Bundle | ||
import androidx.appcompat.app.AlertDialog | ||
import androidx.fragment.app.DialogFragment | ||
import android.widget.CheckBox | ||
import org.oppia.app.R | ||
import org.oppia.app.player.state.StateFragment | ||
|
||
/** | ||
* DialogFragment that indicates to the user they are on cellular when trying to play an audio voiceover. | ||
*/ | ||
class CellularDataDialogFragment : DialogFragment() { | ||
companion object { | ||
/** | ||
* This function is responsible for displaying content in DialogFragment. | ||
* | ||
* @return [CellularDataDialogFragment]: DialogFragment | ||
*/ | ||
fun newInstance(): CellularDataDialogFragment { | ||
return CellularDataDialogFragment() | ||
} | ||
} | ||
|
||
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { | ||
val view = activity!!.layoutInflater.inflate(R.layout.cellular_data_dialog, null) | ||
val checkBox = view.findViewById<CheckBox>(R.id.cellular_data_dialog_checkbox) | ||
|
||
val cellularDataInterface: CellularDataInterface = parentFragment as StateFragment | ||
|
||
return AlertDialog.Builder(activity as Context) | ||
.setTitle(R.string.cellular_data_alert_dialog_title) | ||
.setView(view) | ||
.setMessage(R.string.cellular_data_alert_dialog_description) | ||
.setPositiveButton(R.string.cellular_data_alert_dialog_okay_button) { dialog, whichButton -> | ||
cellularDataInterface.enableAudioWhileOnCellular(checkBox.isChecked) | ||
dismiss() | ||
} | ||
.setNegativeButton(R.string.cellular_data_alert_dialog_cancel_button) { dialog, whichButton -> | ||
cellularDataInterface.disableAudioWhileOnCellular(checkBox.isChecked) | ||
dismiss() | ||
} | ||
.create() | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
app/src/main/java/org/oppia/app/player/audio/CellularDataInterface.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,16 @@ | ||
package org.oppia.app.player.audio | ||
|
||
/** Interface to check the preference regarding alert for [CellularDataDialogFragment]. */ | ||
interface CellularDataInterface { | ||
/** | ||
* If saveUserChoice is true, show audio-player and save preference do not show dialog again. | ||
* If saveUserChoice is false, show audio-player and do not save preference and show this dialog next time too. | ||
*/ | ||
fun enableAudioWhileOnCellular(saveUserChoice: Boolean) | ||
|
||
/** | ||
* If saveUserChoice is true, do not show audio-player on cellular network and save preference. | ||
* If saveUserChoice is false, do not show audio-player and do not save preference. | ||
*/ | ||
fun disableAudioWhileOnCellular(saveUserChoice: Boolean) | ||
} |
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
3 changes: 2 additions & 1 deletion
3
app/src/main/java/org/oppia/app/player/audio/LanguageInterface.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 |
---|---|---|
@@ -1,6 +1,7 @@ | ||
package org.oppia.app.player.audio | ||
|
||
/** Interface to receive selected language from [LanguageDialogFragment] */ | ||
/** Interface to receive selected language from [LanguageDialogFragment]. */ | ||
interface LanguageInterface { | ||
/** Play the audio corresponding to the language-selected. */ | ||
fun onLanguageSelected(currentLanguageCode: String) | ||
} |
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
16 changes: 16 additions & 0 deletions
16
app/src/main/java/org/oppia/app/player/state/StateViewModel.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,16 @@ | ||
package org.oppia.app.player.state | ||
|
||
import androidx.databinding.ObservableField | ||
import androidx.lifecycle.ViewModel | ||
import org.oppia.app.fragment.FragmentScope | ||
import javax.inject.Inject | ||
|
||
/** [ViewModel] for state-fragment. */ | ||
@FragmentScope | ||
class StateViewModel @Inject constructor() : ViewModel() { | ||
var isAudioFragmentVisible = ObservableField<Boolean>(false) | ||
|
||
fun setAudioFragmentVisible(isVisible: Boolean) { | ||
isAudioFragmentVisible.set(isVisible) | ||
} | ||
} |
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,14 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<RelativeLayout | ||
xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:padding="@dimen/cellular_data_dialog_padding"> | ||
<CheckBox | ||
android:id="@+id/cellular_data_dialog_checkbox" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:orientation="vertical" | ||
android:text="@string/cellular_data_alert_dialog_checkbox"> | ||
</CheckBox> | ||
</RelativeLayout> |
Oops, something went wrong.