-
-
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.
Refactor: Improve UiLessonScreen state management and player lifecycle
- Removed redundant private state variables (_isPlaying, _playbackDuration, _playbackPosition). - Updated UiLessonScreen state directly within the StateFlow for playback state changes. - Ensured proper player lifecycle management. Key improvements: - Made UiLessonScreen reactive by observing state via StateFlow. - Managed isPlaying and playbackPosition updates via the ViewModel. - Fixed LaunchedEffect and improper delegation usage in the Composable.
- Loading branch information
Mihai-Cristian Condrea
committed
Dec 5, 2024
1 parent
63afa1a
commit cbe1e2d
Showing
13 changed files
with
97 additions
and
133 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
3 changes: 3 additions & 0 deletions
3
...c/main/kotlin/com/d4rk/englishwithlidia/plus/data/model/ui/screens/home/UiLessonScreen.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
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
28 changes: 28 additions & 0 deletions
28
app/src/main/kotlin/com/d4rk/englishwithlidia/plus/ui/screens/lessons/LessonActivity.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,28 @@ | ||
package com.d4rk.englishwithlidia.plus.ui.screens.lessons | ||
|
||
import android.os.Bundle | ||
import androidx.activity.compose.setContent | ||
import androidx.activity.enableEdgeToEdge | ||
import androidx.appcompat.app.AppCompatActivity | ||
import androidx.compose.foundation.layout.fillMaxSize | ||
import androidx.compose.material3.MaterialTheme | ||
import androidx.compose.material3.Surface | ||
import androidx.compose.ui.Modifier | ||
import com.d4rk.englishwithlidia.plus.ui.screens.settings.display.theme.style.AppTheme | ||
|
||
class LessonActivity : AppCompatActivity() { | ||
override fun onCreate(savedInstanceState : Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
enableEdgeToEdge() | ||
|
||
setContent { | ||
AppTheme { | ||
Surface( | ||
modifier = Modifier.fillMaxSize() , color = MaterialTheme.colorScheme.background | ||
) { | ||
LessonScreen(activity = this@LessonActivity) | ||
} | ||
} | ||
} | ||
} | ||
} |
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.