-
-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #28 from UmairKhalid786/develop
Profile and About me added
- Loading branch information
Showing
20 changed files
with
468 additions
and
75 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
23 changes: 0 additions & 23 deletions
23
app/src/main/java/com/techlads/composetv/settings/SearchScreen.kt
This file was deleted.
Oops, something went wrong.
33 changes: 33 additions & 0 deletions
33
app/src/main/java/com/techlads/composetv/settings/SettingsMenu.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,33 @@ | ||
package com.techlads.composetv.settings | ||
|
||
import androidx.compose.foundation.layout.width | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.runtime.remember | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.tooling.preview.Preview | ||
import androidx.compose.ui.unit.dp | ||
import androidx.tv.foundation.lazy.list.TvLazyColumn | ||
import com.techlads.composetv.settings.data.SettingsMenuModel | ||
|
||
@Composable | ||
fun SettingsMenu(modifier: Modifier = Modifier, onMenuSelected: (SettingsMenuModel) -> Unit) { | ||
val settingsMenu = remember { | ||
SettingsMenuData.menu | ||
} | ||
TvLazyColumn(modifier = modifier.width(200.dp)) { | ||
items(settingsMenu.size) { | ||
val item = settingsMenu[it] | ||
SettingsMenuItem(item) { | ||
onMenuSelected(item) | ||
} | ||
} | ||
} | ||
} | ||
|
||
@Preview | ||
@Composable | ||
fun SettingsMenuPrev() { | ||
SettingsMenu { | ||
|
||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
app/src/main/java/com/techlads/composetv/settings/SettingsMenuData.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,14 @@ | ||
package com.techlads.composetv.settings | ||
|
||
import com.techlads.composetv.settings.data.SettingsMenuModel | ||
import com.techlads.composetv.settings.navigation.SettingsScreens | ||
|
||
|
||
object SettingsMenuData { | ||
val menu by lazy { | ||
listOf( | ||
SettingsMenuModel("Profile", SettingsScreens.Profile.title), | ||
SettingsMenuModel("About Me", SettingsScreens.AboutMe.title) | ||
) | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
app/src/main/java/com/techlads/composetv/settings/SettingsMenuItem.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,30 @@ | ||
package com.techlads.composetv.settings | ||
|
||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.tooling.preview.Preview | ||
import androidx.compose.ui.unit.dp | ||
import androidx.tv.material3.Text | ||
import com.techlads.composetv.settings.data.SettingsMenuModel | ||
import com.techlads.composetv.widgets.FocusableItem | ||
|
||
@Composable | ||
fun SettingsMenuItem(item: SettingsMenuModel, onMenuSelected: (SettingsMenuModel) -> Unit) { | ||
FocusableItem( | ||
modifier = Modifier.padding(horizontal = 16.dp, vertical = 8.dp), | ||
onClick = { onMenuSelected(item) }) { | ||
Text( | ||
text = item.text, | ||
modifier = Modifier.padding(horizontal = 12.dp, vertical = 8.dp) | ||
) | ||
} | ||
} | ||
|
||
@Preview | ||
@Composable | ||
fun SettingsMenuItemPrev() { | ||
SettingsMenuItem(SettingsMenuModel("Menu", "")){ | ||
|
||
} | ||
} |
45 changes: 45 additions & 0 deletions
45
app/src/main/java/com/techlads/composetv/settings/SettingsScreen.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,45 @@ | ||
package com.techlads.composetv.settings | ||
|
||
import androidx.compose.animation.ExperimentalAnimationApi | ||
import androidx.compose.foundation.background | ||
import androidx.compose.foundation.layout.* | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.tooling.preview.Preview | ||
import androidx.compose.ui.unit.dp | ||
import androidx.navigation.NavHostController | ||
import com.google.accompanist.navigation.animation.rememberAnimatedNavController | ||
import com.techlads.composetv.settings.navigation.NestedSettingsScreenNavigation | ||
import com.techlads.composetv.theme.AppTheme | ||
|
||
@OptIn(ExperimentalAnimationApi::class) | ||
@Composable | ||
fun SettingsScreen() { | ||
val navController = rememberAnimatedNavController() | ||
|
||
Row( | ||
Modifier | ||
.fillMaxSize()) { | ||
SettingsMenu( | ||
Modifier | ||
.fillMaxHeight() | ||
.background(AppTheme.surface.copy(alpha = 0.2f)) | ||
.padding(vertical = 32.dp, horizontal = 16.dp) | ||
) { | ||
navController.navigate(it.navigation) | ||
} | ||
SettingsNavigation(navController) | ||
} | ||
} | ||
|
||
@Composable | ||
fun SettingsNavigation(navController: NavHostController) { | ||
NestedSettingsScreenNavigation(navController = navController) | ||
} | ||
|
||
|
||
@Preview | ||
@Composable | ||
fun SettingsScreenPrev() { | ||
SettingsScreen() | ||
} |
3 changes: 3 additions & 0 deletions
3
app/src/main/java/com/techlads/composetv/settings/data/SettingsMenuModel.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 com.techlads.composetv.settings.data | ||
|
||
data class SettingsMenuModel(val text: String, val navigation: String) |
31 changes: 31 additions & 0 deletions
31
app/src/main/java/com/techlads/composetv/settings/navigation/NestedHomeScreenNavigation.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,31 @@ | ||
package com.techlads.composetv.settings.navigation | ||
|
||
import androidx.compose.animation.ExperimentalAnimationApi | ||
import androidx.compose.runtime.Composable | ||
import androidx.navigation.NavHostController | ||
import com.google.accompanist.navigation.animation.AnimatedNavHost | ||
import com.google.accompanist.navigation.animation.composable | ||
import com.techlads.composetv.navigation.tabEnterTransition | ||
import com.techlads.composetv.navigation.tabExitTransition | ||
import com.techlads.composetv.settings.screens.about.AboutScreen | ||
import com.techlads.composetv.settings.screens.profile.ProfileScreen | ||
|
||
@OptIn(ExperimentalAnimationApi::class) | ||
@Composable | ||
fun NestedSettingsScreenNavigation(navController: NavHostController) { | ||
AnimatedNavHost(navController = navController, startDestination = SettingsScreens.Profile.title) { | ||
// e.g will add auth routes here if when we will extend project | ||
composable( | ||
SettingsScreens.Profile.title, | ||
enterTransition = { tabEnterTransition() }, | ||
exitTransition = { tabExitTransition() }) { | ||
ProfileScreen() | ||
} | ||
composable( | ||
SettingsScreens.AboutMe.title, | ||
enterTransition = { tabEnterTransition() }, | ||
exitTransition = { tabExitTransition() }) { | ||
AboutScreen() | ||
} | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
app/src/main/java/com/techlads/composetv/settings/navigation/NestedSettingsNavigation.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,19 @@ | ||
package com.techlads.composetv.settings.navigation | ||
|
||
import androidx.compose.animation.ExperimentalAnimationApi | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.tooling.preview.Preview | ||
import androidx.navigation.NavHostController | ||
import com.google.accompanist.navigation.animation.rememberAnimatedNavController | ||
|
||
@Composable | ||
fun NestedHomeNavigation(navController: NavHostController) { | ||
NestedSettingsScreenNavigation(navController) | ||
} | ||
|
||
@OptIn(ExperimentalAnimationApi::class) | ||
@Preview | ||
@Composable | ||
fun NestedHomeNavigationPrev() { | ||
NestedHomeNavigation(rememberAnimatedNavController()) | ||
} |
6 changes: 6 additions & 0 deletions
6
app/src/main/java/com/techlads/composetv/settings/navigation/SettingsScreens.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,6 @@ | ||
package com.techlads.composetv.settings.navigation | ||
|
||
sealed class SettingsScreens(val title: String) { | ||
object Profile : SettingsScreens("profile") | ||
object AboutMe : SettingsScreens("about_me") | ||
} |
Oops, something went wrong.