-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
wip(home): Rework home screen for dynamic content
Reworked the home screen to support more dynamic content and layouts. This includes changes to data structures and UI components to enable greater flexibility. This work is still in progress and further enhancements are planned.
- Loading branch information
Mihai-Cristian Condrea
committed
Dec 5, 2024
1 parent
ce4525f
commit 2cbaecb
Showing
18 changed files
with
1,083 additions
and
877 deletions.
There are no files selected for viewing
11 changes: 11 additions & 0 deletions
11
app/src/main/kotlin/com/d4rk/englishwithlidia/plus/constants/ui/lessons/LessonConstants.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,11 @@ | ||
package com.d4rk.englishwithlidia.plus.constants.ui.lessons | ||
|
||
object LessonConstants { | ||
const val TYPE_FULL_IMAGE_BANNER = "full_banner" | ||
const val TYPE_BANNER_IMAGE_LOCAL = "banner_image_local" | ||
const val TYPE_ROW_BUTTONS_LOCAL = "row_buttons_local" | ||
const val TYPE_AD_VIEW_BANNER = "ad_view_banner" | ||
const val TYPE_AD_VIEW_BANNER_LARGE = "ad_view_banner_large" | ||
const val TYPE_SQUARE_IMAGE = "square_image" | ||
const val TYPE_TEXT = "text" | ||
} |
12 changes: 12 additions & 0 deletions
12
...src/main/kotlin/com/d4rk/englishwithlidia/plus/constants/ui/lessons/LessonContentTypes.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 com.d4rk.englishwithlidia.plus.constants.ui.lessons | ||
|
||
object LessonContentTypes { | ||
const val TEXT = "content_text" | ||
const val HEADER = "header" | ||
const val CODE = "content_code" | ||
const val IMAGE = "image" | ||
const val AD_BANNER = "ad_banner" | ||
const val AD_BANNER_FULL = "ad_banner_full" | ||
const val AD_LARGE_BANNER = "ad_large_banner" | ||
const val FULL_IMAGE_BANNER = "full_image_banner" | ||
} |
18 changes: 18 additions & 0 deletions
18
app/src/main/kotlin/com/d4rk/englishwithlidia/plus/data/model/api/ApiHomeResponse.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,18 @@ | ||
package com.d4rk.englishwithlidia.plus.data.model.api | ||
|
||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
data class ApiHomeResponse( | ||
@SerialName("data") val data : List<ApiHomeLessons> = ArrayList() | ||
) | ||
|
||
@Serializable | ||
data class ApiHomeLessons( | ||
@SerialName("lesson_id") val lessonId : String = "" , | ||
@SerialName("lesson_title") val lessonTitle : String = "" , | ||
@SerialName("lesson_type") val lessonType : String = "" , | ||
@SerialName("lesson_thumbnail_image_url") var lessonThumbnailImageUrl : String = "" , | ||
@SerialName("lesson_deep_link_path") val lessonDeepLinkPath : String = "" , | ||
) |
24 changes: 24 additions & 0 deletions
24
app/src/main/kotlin/com/d4rk/englishwithlidia/plus/data/model/api/ApiLessonResponse.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 com.d4rk.englishwithlidia.plus.data.model.api | ||
|
||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
data class ApiLessonResponse( | ||
@SerialName("data") val data : List<ApiLesson> = ArrayList() | ||
) | ||
|
||
@Serializable | ||
data class ApiLesson( | ||
@SerialName("lesson_title") val lessonTitle : String = "" , | ||
@SerialName("lesson_content") val lessonContent : List<ApiLessonContent> = emptyList() | ||
) | ||
|
||
@Serializable | ||
data class ApiLessonContent( | ||
@SerialName("content_id") val contentId : String = "" , | ||
@SerialName("content_type") val contentType : String = "" , | ||
@SerialName("content_text") val contentText : String = "" , | ||
@SerialName("content_audio_url") val contentAudioUrl : String = "" , | ||
@SerialName("content_image_url") val contentImageUrl : String = "" | ||
) |
25 changes: 0 additions & 25 deletions
25
app/src/main/kotlin/com/d4rk/englishwithlidia/plus/data/model/api/ApiResponse.kt
This file was deleted.
Oops, something went wrong.
13 changes: 0 additions & 13 deletions
13
app/src/main/kotlin/com/d4rk/englishwithlidia/plus/data/model/ui/screens/UiLesson.kt
This file was deleted.
Oops, something went wrong.
12 changes: 0 additions & 12 deletions
12
app/src/main/kotlin/com/d4rk/englishwithlidia/plus/data/model/ui/screens/UiLessonDetails.kt
This file was deleted.
Oops, something went wrong.
13 changes: 13 additions & 0 deletions
13
...src/main/kotlin/com/d4rk/englishwithlidia/plus/data/model/ui/screens/home/UiHomeScreen.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,13 @@ | ||
package com.d4rk.englishwithlidia.plus.data.model.ui.screens.home | ||
|
||
data class UiHomeScreen( | ||
val lessons : ArrayList<UiHomeLesson> = ArrayList() | ||
) | ||
|
||
data class UiHomeLesson( | ||
val lessonId : String = "" , | ||
val lessonTitle : String = "" , | ||
val lessonType : String = "" , | ||
var lessonThumbnailImageUrl : String = "" , | ||
val lessonDeepLinkPath : String = "" , | ||
) |
50 changes: 50 additions & 0 deletions
50
...rc/main/kotlin/com/d4rk/englishwithlidia/plus/ui/components/buttons/OutlinedUrlButtons.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,50 @@ | ||
package com.d4rk.englishwithlidia.plus.ui.components.buttons | ||
|
||
import android.content.Context | ||
import androidx.compose.foundation.layout.Spacer | ||
import androidx.compose.foundation.layout.size | ||
import androidx.compose.material3.ButtonDefaults | ||
import androidx.compose.material3.Icon | ||
import androidx.compose.material3.OutlinedButton | ||
import androidx.compose.material3.Text | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.graphics.painter.Painter | ||
import androidx.compose.ui.graphics.vector.ImageVector | ||
import androidx.compose.ui.res.stringResource | ||
import com.d4rk.englishwithlidia.plus.utils.IntentUtils | ||
|
||
@Composable | ||
fun OutlinedUrlButtons( | ||
url : String , | ||
vectorIcon : ImageVector? = null , | ||
painterIcon : Painter? = null, | ||
text : Int , | ||
context : Context , | ||
modifier : Modifier | ||
) { | ||
OutlinedButton(onClick = { | ||
IntentUtils.openUrl( | ||
context , url = url | ||
) | ||
} , modifier = modifier) { | ||
|
||
if (painterIcon != null) { | ||
Icon( | ||
painter = painterIcon , | ||
contentDescription = null , | ||
modifier = Modifier.size(ButtonDefaults.IconSize) | ||
) | ||
} | ||
else if (vectorIcon != null) { | ||
Icon( | ||
imageVector = vectorIcon , | ||
contentDescription = null , | ||
modifier = Modifier.size(ButtonDefaults.IconSize) | ||
) | ||
} | ||
|
||
Spacer(Modifier.size(ButtonDefaults.IconSpacing)) | ||
Text(stringResource(id = text)) | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
app/src/main/kotlin/com/d4rk/englishwithlidia/plus/ui/components/dialogs/ErrorAlertDialog.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,21 @@ | ||
package com.d4rk.englishwithlidia.plus.ui.components.dialogs | ||
|
||
import androidx.compose.material3.AlertDialog | ||
import androidx.compose.material3.Text | ||
import androidx.compose.material3.TextButton | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.res.stringResource | ||
|
||
@Composable | ||
fun ErrorAlertDialog( | ||
errorMessage : String , onDismiss : () -> Unit | ||
) { | ||
AlertDialog(onDismissRequest = onDismiss , | ||
title = { Text(text = "Error") } , | ||
text = { Text(text = errorMessage) } , | ||
confirmButton = { | ||
TextButton(onClick = onDismiss) { | ||
Text(text = stringResource(id = android.R.string.ok)) | ||
} | ||
}) | ||
} |
Oops, something went wrong.