Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: settings screen #125

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions app/src/main/java/com/xinto/opencord/ui/AppActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import com.xinto.opencord.gateway.DiscordGateway
import com.xinto.opencord.ui.navigation.AppDestination
import com.xinto.opencord.ui.navigation.back
import com.xinto.opencord.ui.screens.Settings
import com.xinto.opencord.ui.screens.SettingsCategory
import com.xinto.opencord.ui.screens.home.HomeScreen
import com.xinto.opencord.ui.screens.pins.PinsScreen
import com.xinto.opencord.ui.theme.OpenCordTheme
Expand Down Expand Up @@ -96,15 +97,21 @@ class AppActivity : ComponentActivity() {
onPinsClick = { nav.navigate(AppDestination.Pins(data = it)) },
)

AppDestination.Settings -> Settings(
is AppDestination.Pins -> PinsScreen(
data = dest.data,
modifier = Modifier.fillMaxSize(),
onBackClick = { nav.back() },
)

is AppDestination.Pins -> PinsScreen(
data = dest.data,
AppDestination.Settings -> Settings(
modifier = Modifier.fillMaxSize(),
onBackClick = { nav.back() },
onCategoryClick = { nav.navigate(it) },
)

is AppDestination.Settings -> SettingsCategory(
dest = dest,
onClickBack = { nav.back() },
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ package com.xinto.opencord.ui.navigation

import android.app.Activity
import android.os.Parcelable
import androidx.annotation.DrawableRes
import androidx.annotation.StringRes
import androidx.compose.runtime.Immutable
import com.xinto.opencord.R
import com.xinto.opencord.ui.util.topDestination
import dev.olshevski.navigation.reimagined.NavController
import dev.olshevski.navigation.reimagined.pop
Expand All @@ -14,8 +17,28 @@ sealed interface AppDestination : Parcelable {
@Parcelize
object Main : AppDestination

@Suppress("PROPERTY_WONT_BE_SERIALIZED")
@Parcelize
object Settings : AppDestination
enum class Settings(
@StringRes val label: Int,
@DrawableRes val icon: Int,
) : AppDestination {
ACCOUNT(R.string.account, R.drawable.ic_account_circle),
USER_PROFILE(R.string.user_profile, R.drawable.ic_edit),
PRIVACY_SAFETY(R.string.privacy_safety, R.drawable.ic_security),
DEVICES(R.string.devices, R.drawable.ic_devices),
CONNECTIONS(R.string.connections, R.drawable.ic_link),
FRIEND_REQUESTS(R.string.friend_requests, R.drawable.ic_person_add),
VOICE_VIDEO(R.string.voice_video, R.drawable.ic_settings_voice),
APPEARANCE(R.string.appearance, R.drawable.ic_palette),
ACCESSIBILITY(R.string.accessibility, R.drawable.ic_settings_accessibility),
LANGUAGE(R.string.language, R.drawable.ic_language),
WEB_BROWSER(R.string.web_browser, R.drawable.ic_web),
NOTIFICATIONS(R.string.notifications, R.drawable.ic_notifications);

@Parcelize
companion object : AppDestination
}

@Parcelize
data class Pins(val data: PinsScreenData) : AppDestination
Expand Down
Loading