Skip to content

Commit

Permalink
Ui added
Browse files Browse the repository at this point in the history
  • Loading branch information
iampranabray committed Oct 14, 2023
1 parent 9f8de81 commit f59dba4
Show file tree
Hide file tree
Showing 4 changed files with 218 additions and 94 deletions.
176 changes: 119 additions & 57 deletions android/NewsAN/app/src/main/java/com/djupbyte/newsan/MasterPage.kt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

//import androidx.compose.material3.Scaffold
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.ExperimentalLayoutApi
Expand All @@ -12,10 +11,14 @@ import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.safeDrawing
import androidx.compose.foundation.layout.windowInsetsPadding
import androidx.compose.material3.BottomAppBar
import androidx.compose.material3.Divider
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.Icon
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.ModalDrawerSheet
import androidx.compose.material3.ModalNavigationDrawer
import androidx.compose.material3.NavigationBarItem
import androidx.compose.material3.NavigationDrawerItem
import androidx.compose.material3.Scaffold
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
Expand All @@ -28,6 +31,8 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.semantics.testTagsAsResourceId
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.dp
import androidx.navigation.compose.rememberNavController
import com.djupbyte.newsan.BottomItems
import com.djupbyte.newsan.features.SettingsDialog
Expand All @@ -46,7 +51,8 @@ import com.example.anNews.component.ANTopAppBar
@ExperimentalMaterial3Api
fun MasterPage(

modifier: Modifier = Modifier) {
modifier: Modifier = Modifier
) {

val navController = rememberNavController()

Expand Down Expand Up @@ -77,16 +83,67 @@ fun MasterPage(
SettingsDialog(
onDismiss = {
//settingViewModel.settingsUiState
showSettingsDialog = false
showSettingsDialog = false
}
)
}
Scaffold(
modifier = Modifier.semantics {
testTagsAsResourceId = true
},
ModalNavigationDrawer(
drawerContent = {
ModalDrawerSheet {
Text("Settings", modifier = Modifier.padding(16.dp))
Divider()
NavigationDrawerItem(
icon = {Icon(
NiaIcons.Info,
contentDescription = "Theme",
tint = MaterialTheme.colorScheme.primary
)},
label = { Text(text = "Theme") },
selected = false,
onClick = { /*TODO*/ }
)
NavigationDrawerItem(
icon = {Icon(
NiaIcons.Star,
contentDescription = "Saved Favorites",
tint = MaterialTheme.colorScheme.primary
)},
label = { Text(text = "Saved Favorites") },
selected = false,
onClick = { /*TODO*/ }
)
Text("Help and Support", modifier = Modifier.padding(16.dp), fontWeight = FontWeight.Bold)
NavigationDrawerItem(
icon = {Icon(
NiaIcons.Info,
contentDescription = "Terms & Condition",
tint = MaterialTheme.colorScheme.primary
)},
label = { Text(text = "Terms & Conditions") },
selected = false,
onClick = { /*TODO*/ }
)
NavigationDrawerItem(
icon = {Icon(
NiaIcons.Feedback,
contentDescription = "Give App Feedback",
tint = MaterialTheme.colorScheme.primary
)},
label = { Text(text = "Give App Feedback") },
selected = false,
onClick = { /*TODO*/ }
)

}
}
) {
Scaffold(
modifier = Modifier.semantics {
testTagsAsResourceId = true
},

contentColor = MaterialTheme.colorScheme.onBackground,

contentColor = MaterialTheme.colorScheme.onBackground,
// topBar = { TopAppBar(
// colors = TopAppBarDefaults.topAppBarColors(
// containerColor = MaterialTheme.colorScheme.primaryContainer,
Expand All @@ -96,64 +153,69 @@ fun MasterPage(
// Text("Small Top App Bar")
// }
// ) },
contentWindowInsets = WindowInsets(0, 0, 0, 0),
containerColor = Color.Transparent,

bottomBar = {
BottomAppBar {
BottomItems().bottomItems.forEachIndexed { index, bottomNavItem ->
NavigationBarItem(
selected = selectedItem.value == bottomNavItem.name,
icon = {
Icon(
imageVector = bottomNavItem.icon,
contentDescription = bottomNavItem.name
)
},
onClick = {
selectedItem.value = bottomNavItem.name
navController.navigate(bottomNavItem.route) {

}

},
label = {
Text(text = bottomNavItem.name)
},
enabled = true
contentWindowInsets = WindowInsets(0, 0, 0, 0),
containerColor = Color.Transparent,


bottomBar = {
BottomAppBar {
BottomItems().bottomItems.forEachIndexed { index, bottomNavItem ->
NavigationBarItem(
selected = selectedItem.value == bottomNavItem.name,
icon = {
Icon(
imageVector = bottomNavItem.icon,
contentDescription = bottomNavItem.name
)
},
onClick = {
selectedItem.value = bottomNavItem.name
navController.navigate(bottomNavItem.route) {

}

},
label = {
Text(text = bottomNavItem.name)
},
enabled = true
)
}

}
},

) { padding ->
Row(
Modifier
.fillMaxSize()
.consumeWindowInsets(padding)
.padding(padding)
.windowInsetsPadding(
WindowInsets.safeDrawing.only(
WindowInsetsSides.Horizontal,
),
),
) {

Column(
Modifier.fillMaxSize()
) {
ANTopAppBar(
text = "NewsAN",
onActionClick = { showSettingsDialog = true },
onNavigationIconClick = {},
)
NavigationGraph(navController)
}

}
}) { padding ->
Row(
Modifier
.fillMaxSize()
.consumeWindowInsets(padding)
.padding(padding)
.windowInsetsPadding(
WindowInsets.safeDrawing.only(
WindowInsetsSides.Horizontal,
),
),
) {

Column(
Modifier.fillMaxSize()
) {
ANTopAppBar(
text = "NewsAN",
onActionClick = { showSettingsDialog = true },
onNavigationIconClick = {},
)
NavigationGraph(navController)
}


}


}

}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@

import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.MoreVert
import androidx.compose.material.icons.rounded.Add
import androidx.compose.material.icons.rounded.ArrowBack
import androidx.compose.material.icons.rounded.Check
import androidx.compose.material.icons.rounded.Close
import androidx.compose.material.icons.rounded.Person
import androidx.compose.material.icons.rounded.Search
import androidx.compose.material.icons.rounded.Settings
import androidx.compose.material.icons.outlined.Bookmarks
import androidx.compose.material.icons.outlined.Upcoming
import androidx.compose.material.icons.rounded.Add
import androidx.compose.material.icons.rounded.ArrowBack
import androidx.compose.material.icons.rounded.Bookmark
import androidx.compose.material.icons.rounded.BookmarkBorder
import androidx.compose.material.icons.rounded.Bookmarks
import androidx.compose.material.icons.rounded.CalendarMonth
import androidx.compose.material.icons.rounded.Check
import androidx.compose.material.icons.rounded.Close
import androidx.compose.material.icons.rounded.Feedback
import androidx.compose.material.icons.rounded.Grid3x3
import androidx.compose.material.icons.rounded.Info
import androidx.compose.material.icons.rounded.Newspaper
import androidx.compose.material.icons.rounded.Person
import androidx.compose.material.icons.rounded.Search
import androidx.compose.material.icons.rounded.Settings
import androidx.compose.material.icons.rounded.ShortText
import androidx.compose.material.icons.rounded.Star
import androidx.compose.material.icons.rounded.StarOutline
Expand Down Expand Up @@ -43,4 +46,6 @@ object NiaIcons{
val Newspaper = Icons.Rounded.Newspaper
val Star = Icons.Rounded.Star
val StarOutline = Icons.Rounded.StarOutline
val Info = Icons.Rounded.Info
val Feedback = Icons.Rounded.Feedback
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,53 @@ package com.example.anNews.pages


//import com.designsystem.uicomponent.ANTopAppBar
import NiaIcons
import android.annotation.SuppressLint
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.material3.Card
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.Icon
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.saveable.rememberSaveable
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp

@SuppressLint("UnusedMaterial3ScaffoldPaddingParameter")
@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun HomePage(onHome: () -> Unit, name: String, modifier: Modifier = Modifier) {
Column(modifier= Modifier
.fillMaxSize()
.padding(top = 16.dp, start = 8.dp, end = 8.dp)) {
Card (
modifier= Modifier.size(width = 100.dp, height = 100.dp ),
){

Column (horizontalAlignment = Alignment.CenterHorizontally, verticalArrangement = Arrangement.Center){
Icon(
imageVector = NiaIcons.Newspaper,
contentDescription = "News"
)
Text(
text = "Aug 12,2023",
// modifier = Modifier
// .padding(16.dp),
// textAlign = TextAlign.Center,
)
}

}
}

HostState()


}
Expand Down
Loading

0 comments on commit f59dba4

Please sign in to comment.