forked from oppia/oppia-android
-
Notifications
You must be signed in to change notification settings - Fork 0
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 kavyanshkhandelwal/oppia#5273/fix-unused-…
…attribute-warning
- Loading branch information
Showing
53 changed files
with
2,432 additions
and
262 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
46 changes: 46 additions & 0 deletions
46
app/src/main/java/org/oppia/android/app/classroom/ThumbnailImage.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,46 @@ | ||
package org.oppia.android.app.classroom | ||
|
||
import androidx.compose.foundation.layout.fillMaxSize | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.viewinterop.AndroidView | ||
import org.oppia.android.app.customview.LessonThumbnailImageView | ||
import org.oppia.android.app.model.LessonThumbnail | ||
|
||
/** | ||
* A composable function that displays a lesson thumbnail image using a custom Android view. | ||
* | ||
* This function integrates the [LessonThumbnailImageView] within a Compose layout, allowing it | ||
* to render a lesson thumbnail image based on the provided parameters. The implementation | ||
* currently relies on a traditional Android View approach due to compatibility issues with the | ||
* Glide Compose library. | ||
* | ||
* @param entityId the unique identifier for the entity associated with the thumbnail | ||
* @param entityType the type of the entity (e.g., classroom, topic, story) | ||
* @param lessonThumbnail the [LessonThumbnail] containing metadata required to load the image | ||
* @param modifier the [Modifier] to be applied to the layout, defaulting to [Modifier] | ||
*/ | ||
@Composable | ||
fun ThumbnailImage( | ||
entityId: String, | ||
entityType: String, | ||
lessonThumbnail: LessonThumbnail?, | ||
modifier: Modifier = Modifier, | ||
) { | ||
// TODO(#5422): Migrate to Jetpack Compose once the Glide Compose library becomes compatible. | ||
AndroidView( | ||
modifier = modifier.fillMaxSize(), | ||
factory = { context -> | ||
LessonThumbnailImageView(context).apply { | ||
setLessonThumbnail(lessonThumbnail) | ||
setEntityId(entityId) | ||
setEntityType(entityType) | ||
} | ||
}, | ||
update = { view -> | ||
view.setLessonThumbnail(lessonThumbnail) | ||
view.setEntityId(entityId) | ||
view.setEntityType(entityType) | ||
} | ||
) | ||
} |
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
Oops, something went wrong.