-
Notifications
You must be signed in to change notification settings - Fork 527
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Introduce first pass interface for ExplorationProgressController. * Fill in the stubbed logic for ExplorationProgressController. Still no tests to verify correctness. Also, added a method to facilitate notifying of DataProvider changes on the UI thread. * Fix lateinit issue in ExplorationProgressController due to wrongly ordered initialization. * Fix a variaty of issues in the exp progress controller, properly hook it up to the data controller, and start adding tests. * Created a separate ExplorationRetriever, hooked up AnswerClassificationController, and attempted to make ExplorationProgressController thread-safe. The thread-safety led to significant interface changes in the progress controller, and led to discovering some issues with the mediator live data approach to interop coroutines and LiveData. This locking mechanism will need to change since the optimal solution requires resolving #90. * Change the locking mechanism for ExplorationProgressController to work with the current MediatorLiveData implementation (see #90 for more context). Fix existing progress controller tests and add a few more. All current progress controller tests are passing. * Finish tests for ExplorationProgressController and add test classification support for the second test exploration (about_oppia). * craeted image parser * ObservableViewModel * Load exploration and open ExplorationActivity * Test case for load exploration * fetch exploration * Connection with StateFragment * update * update * working on fetching customization_args * Update StateFragmentPresenter.kt * Separated this in its own PR * Delete UrlImageParser.kt Separated this in its own PR. * Update StateFragmentPresenter.kt * Update build.gradle * Create HtmlParser.kt * Update HtmlParser.kt * Update HtmlParser.kt * Update HtmlParser.kt * working on testcases * Update HtmlParserTestActivty.kt * Update HtmlParserTestActivty.kt * added testcases. * Update AndroidManifest.xml * Update InteractionAdapter.kt * Update InteractionAdapter.kt * Update HtmlParser.kt * corrected variable names. * updated variables. * Update HtmlParser.kt * Update HtmlParser.kt * Update HtmlParserTestActivty.kt * Update HtmlParser.kt * Delete InteractionAdapter.kt * deteted unused xml files * merged html code. * Update HtmlParser.kt * Delete UrlImageParserTest.kt * used dagger injection for UrlImageParser. * Update HtmlParserTestActivty.kt * Update HtmlParserTestActivty.kt * Update HtmlParser.kt * Update HtmlParserTestActivty.kt * updated tests * updated test * moved to testing package * Update HtmlParserTestActivty.kt * Update HtmlParserTestActivty.kt * fix issues * fix issues. * fixed issues * fixed issues. * Update activity_test_html_parser.xml * fixes * Update HtmlParserTest.kt * Update HtmlParserTest.kt * fixed issues. * fixing issues. * made use of factory * Update HtmlParserTest.kt * Update UrlImageParser.kt * Update AndroidManifest.xml * Update HtmlParserTestActivity.kt * nit * Update AudioFragmentTest.kt * updated * fixes * Update UrlImageParser.kt * Not used in this. * fixes * Not used. * Update CellularDataDialogFragmentTest.kt * reverted * Update CellularDataDialogFragmentTest.kt * fixes * Update ImageLoader.kt * Update HtmlParser.kt * Update HtmlParser.kt * Update build.gradle * fixed issues. * Update UrlImageParser.kt * Update UrlImageParser.kt * Update UrlImageParser.kt * Update ImageParsingAnnotations.kt * working on image loader * Injected ImageLoader * updated image loader. * Update ActivityComponent.kt * Update HtmlParserTestActivity.kt * Update GlideImageLoader.kt * removed annotation * Update HtmlParser.kt * line break * fix * fix comments * Update UrlImageParser.kt * Update UrlImageParser.kt * injected context * working on testcase. * testcase added * added test case * testcases * Update build.gradle * Update AndroidManifest.xml * fixes * Update UrlImageParserTest.kt * changed to CutomTarget * Update UrlImageParserTest.kt * updated. * Update UrlImageParserTest.kt * Update HtmlParserTestActivity.kt * Update misc.xml * Update GlideImageLoaderModule.kt * updated with image parser * Update StateFragmentContentCardTest.kt * Update HtmlParserTest.kt * deleted test class for loading image and added todo * updated * Update build.gradle * Update GlideImageLoader.kt * Update build.gradle * Update UrlImageParser.kt * updated. * update * update * Update StateFragmentPresenter.kt * ContentCardTestActivity introduced * updated test. * Update AndroidManifest.xml * Update AndroidManifest.xml * Update StateFragmentContentCardTest.kt * renamed file. * Update state_fragment.xml * moved test case to stateFragmentTest * Update StateFragmentTest.kt * changes. * Update content_item.xml * Update ContentViewModel.kt * Update StateFragmentTest.kt * KDoc added
- Loading branch information
Showing
13 changed files
with
221 additions
and
9 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
12 changes: 12 additions & 0 deletions
12
app/src/main/java/org/oppia/app/player/state/itemviewmodel/ContentViewModel.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,12 @@ | ||
package org.oppia.app.player.state.itemviewmodel | ||
|
||
import androidx.lifecycle.ViewModel | ||
import org.oppia.app.fragment.FragmentScope | ||
import javax.inject.Inject | ||
|
||
/** [ViewModel] for content-card state. */ | ||
@FragmentScope | ||
class ContentViewModel @Inject constructor() : ViewModel() { | ||
var contentId = "" | ||
var htmlContent = "" | ||
} |
17 changes: 17 additions & 0 deletions
17
app/src/main/java/org/oppia/app/testing/ContentCardTestActivity.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,17 @@ | ||
package org.oppia.app.testing | ||
|
||
import android.os.Bundle | ||
import org.oppia.app.activity.InjectableAppCompatActivity | ||
import javax.inject.Inject | ||
|
||
/** Activity to test the functionality of content-card used in [StateFragment]. */ | ||
class ContentCardTestActivity : InjectableAppCompatActivity() { | ||
@Inject | ||
lateinit var contentCardTestPresenter: ContentCardTestActivityPresenter | ||
|
||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
activityComponent.inject(this) | ||
contentCardTestPresenter.handleOnCreate() | ||
} | ||
} |
53 changes: 53 additions & 0 deletions
53
app/src/main/java/org/oppia/app/testing/ContentCardTestActivityPresenter.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,53 @@ | ||
package org.oppia.app.testing | ||
|
||
import androidx.appcompat.app.AppCompatActivity | ||
import androidx.lifecycle.Observer | ||
import org.oppia.app.R | ||
import org.oppia.app.activity.ActivityScope | ||
import org.oppia.app.player.state.StateFragment | ||
import org.oppia.domain.exploration.ExplorationDataController | ||
import org.oppia.domain.exploration.TEST_EXPLORATION_ID_5 | ||
import org.oppia.util.data.AsyncResult | ||
import org.oppia.util.logging.Logger | ||
import javax.inject.Inject | ||
|
||
private const val EXPLORATION_ID = TEST_EXPLORATION_ID_5 | ||
|
||
/** The presenter for [ContentCardTestActivity]. */ | ||
@ActivityScope | ||
class ContentCardTestActivityPresenter @Inject constructor( | ||
private val activity: AppCompatActivity, | ||
private val explorationDataController: ExplorationDataController, | ||
private val logger: Logger | ||
) { | ||
fun handleOnCreate() { | ||
activity.setContentView(R.layout.content_card_test_activity) | ||
loadDummyExplorationAtStart() | ||
} | ||
|
||
private fun getStateFragment(): StateFragment? { | ||
return activity.supportFragmentManager.findFragmentById(R.id.state_fragment_placeholder) as StateFragment? | ||
} | ||
|
||
private fun loadDummyExplorationAtStart() { | ||
explorationDataController.startPlayingExploration( | ||
EXPLORATION_ID | ||
).observe(activity, Observer<AsyncResult<Any?>> { result -> | ||
when { | ||
result.isPending() -> logger.d("ContentCardTest", "Loading exploration") | ||
result.isFailure() -> logger.e("ContentCardTest", "Failed to load exploration", result.getErrorOrNull()!!) | ||
else -> { | ||
logger.d("ContentCardTest", "Successfully loaded exploration") | ||
|
||
if (getStateFragment() == null) { | ||
val stateFragment = StateFragment.newInstance(EXPLORATION_ID) | ||
activity.supportFragmentManager.beginTransaction().add( | ||
R.id.state_fragment_placeholder, | ||
stateFragment | ||
).commitNow() | ||
} | ||
} | ||
} | ||
}) | ||
} | ||
} |
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,7 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
android:id="@+id/state_fragment_placeholder" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
tools:context=".testing.ContentCardTestActivity" /> |
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,28 @@ | ||
<layout xmlns:android="http://schemas.android.com/apk/res/android"> | ||
|
||
<data> | ||
|
||
<variable | ||
name="htmlContent" | ||
type="String" /> | ||
</data> | ||
|
||
<FrameLayout | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:layout_margin="4dp" | ||
android:paddingStart="8dp" | ||
android:paddingEnd="8dp"> | ||
|
||
<TextView | ||
android:id="@+id/content_text_view" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:layout_margin="4dp" | ||
android:background="@drawable/content_blue_background" | ||
android:padding="12dp" | ||
android:text="@{htmlContent}" | ||
android:textColor="@color/oppiaPrimaryText" | ||
android:textSize="16sp" /> | ||
</FrameLayout> | ||
</layout> |
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
7 changes: 7 additions & 0 deletions
7
utility/src/main/java/org/oppia/util/parser/ExplorationHtmlParserEntityType.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,7 @@ | ||
package org.oppia.util.parser | ||
|
||
import javax.inject.Qualifier | ||
|
||
/** Qualifier for injecting the entity type for exploration. */ | ||
@Qualifier | ||
annotation class ExplorationHtmlParserEntityType |
Oops, something went wrong.