forked from openedx/openedx-app-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.
feat: [FC-0047] Full-Bleed Header + Top Navigation (openedx#278)
* feat: New header and navigation on CourseContainerFragment * feat: Changed logic of swipe to refresh, added blur for android <= 12, minor code refactoring * feat: removed COURSE_TOP_BAR_ENABLED and COURSE_BANNER_ENABLED feature flags * feat: special header style for android < 12 * fix: Fixed header image blur for android < 12. Added courseContainerTabClickedEvent * feat: auto scrolling header to collapsed and expanded states * fix: Fixed junit tests * fix: Fixed CourseContainerViewModelTest * fix: auto scroll fling fix * feat: CourseContainerFragment refactoring * fix: Removed expanded header content top padding * fix: Collapsing header and navigation tabs UI fixes * fix: Fixes according to PR feedback * refactor: Course home tabs layout * fix: Fixes according to PR feedback * fix: Fixes according to PR feedback * refactor: Refactored view models of course container screens * fix: Fixes according to PR feedback
- Loading branch information
1 parent
0494642
commit 29e1c8e
Showing
57 changed files
with
2,597 additions
and
1,667 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
@file:Suppress("DEPRECATION") | ||
|
||
package org.openedx.core | ||
|
||
import android.content.Context | ||
import android.graphics.Bitmap | ||
import android.graphics.drawable.Drawable | ||
import android.renderscript.Allocation | ||
import android.renderscript.RenderScript | ||
import android.renderscript.ScriptIntrinsicBlur | ||
import androidx.annotation.DrawableRes | ||
import coil.ImageLoader | ||
import coil.request.ImageRequest | ||
|
||
class ImageProcessor(private val context: Context) { | ||
fun loadImage( | ||
@DrawableRes | ||
defaultImage: Int, | ||
imageUrl: String, | ||
onComplete: (result: Drawable) -> Unit | ||
) { | ||
val loader = ImageLoader(context) | ||
val request = ImageRequest.Builder(context) | ||
.data(imageUrl) | ||
.target { result -> | ||
onComplete(result) | ||
} | ||
.error(defaultImage) | ||
.placeholder(defaultImage) | ||
.allowHardware(false) | ||
.build() | ||
loader.enqueue(request) | ||
} | ||
|
||
fun applyBlur( | ||
bitmap: Bitmap, | ||
blurRadio: Float | ||
): Bitmap { | ||
val renderScript = RenderScript.create(context) | ||
val bitmapAlloc = Allocation.createFromBitmap(renderScript, bitmap) | ||
ScriptIntrinsicBlur.create(renderScript, bitmapAlloc.element).apply { | ||
setRadius(blurRadio) | ||
setInput(bitmapAlloc) | ||
repeat(3) { | ||
forEach(bitmapAlloc) | ||
} | ||
} | ||
val newBitmap: Bitmap = Bitmap.createBitmap( | ||
bitmap.width, | ||
bitmap.height, | ||
Bitmap.Config.ARGB_8888 | ||
) | ||
bitmapAlloc.copyTo(newBitmap) | ||
renderScript.destroy() | ||
return newBitmap | ||
} | ||
} |
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
24 changes: 24 additions & 0 deletions
24
core/src/main/java/org/openedx/core/presentation/course/CourseContainerTab.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,24 @@ | ||
package org.openedx.core.presentation.course | ||
|
||
import androidx.annotation.StringRes | ||
import androidx.compose.material.icons.Icons | ||
import androidx.compose.material.icons.automirrored.filled.Chat | ||
import androidx.compose.material.icons.automirrored.filled.TextSnippet | ||
import androidx.compose.material.icons.filled.Home | ||
import androidx.compose.material.icons.outlined.CalendarMonth | ||
import androidx.compose.material.icons.rounded.PlayCircleFilled | ||
import androidx.compose.ui.graphics.vector.ImageVector | ||
import org.openedx.core.R | ||
import org.openedx.core.ui.TabItem | ||
|
||
enum class CourseContainerTab( | ||
@StringRes | ||
override val labelResId: Int, | ||
override val icon: ImageVector | ||
) : TabItem { | ||
HOME(R.string.core_course_container_nav_home, Icons.Default.Home), | ||
VIDEOS(R.string.core_course_container_nav_videos, Icons.Rounded.PlayCircleFilled), | ||
DATES(R.string.core_course_container_nav_dates, Icons.Outlined.CalendarMonth), | ||
DISCUSSIONS(R.string.core_course_container_nav_discussions, Icons.AutoMirrored.Filled.Chat), | ||
MORE(R.string.core_course_container_nav_more, Icons.AutoMirrored.Filled.TextSnippet) | ||
} |
5 changes: 5 additions & 0 deletions
5
core/src/main/java/org/openedx/core/system/notifier/CourseDataReady.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,5 @@ | ||
package org.openedx.core.system.notifier | ||
|
||
import org.openedx.core.domain.model.CourseStructure | ||
|
||
data class CourseDataReady(val courseStructure: CourseStructure) : CourseEvent |
3 changes: 3 additions & 0 deletions
3
core/src/main/java/org/openedx/core/system/notifier/CourseDatesShifted.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,3 @@ | ||
package org.openedx.core.system.notifier | ||
|
||
object CourseDatesShifted : CourseEvent |
3 changes: 3 additions & 0 deletions
3
core/src/main/java/org/openedx/core/system/notifier/CourseLoading.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,3 @@ | ||
package org.openedx.core.system.notifier | ||
|
||
data class CourseLoading(val isLoading: Boolean) : CourseEvent |
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
5 changes: 5 additions & 0 deletions
5
core/src/main/java/org/openedx/core/system/notifier/CourseRefresh.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,5 @@ | ||
package org.openedx.core.system.notifier | ||
|
||
import org.openedx.core.presentation.course.CourseContainerTab | ||
|
||
data class CourseRefresh(val courseContainerTab: CourseContainerTab) : CourseEvent |
3 changes: 1 addition & 2 deletions
3
core/src/main/java/org/openedx/core/system/notifier/CourseStructureUpdated.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,5 @@ | ||
package org.openedx.core.system.notifier | ||
|
||
class CourseStructureUpdated( | ||
val courseId: String, | ||
val withSwipeRefresh: Boolean, | ||
val courseId: String | ||
) : CourseEvent |
Oops, something went wrong.