-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added loading a server's root listing [#7]
* Added a logging subsystem for all platforms. * Added a dependency on Ktor to do the networking. * Changed Android to allow clear text HTTP requests.
- Loading branch information
Showing
35 changed files
with
1,052 additions
and
186 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
63 changes: 63 additions & 0 deletions
63
androidVariant/src/main/java/org/comixedproject/variant/android/ui/NavigationScreen.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,63 @@ | ||
/* | ||
* Variant - A digital comic book reading application for the iPad and Android tablets. | ||
* Copyright (C) 2024, The ComiXed Project | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses> | ||
*/ | ||
|
||
package org.comixedproject.variant.android.ui | ||
|
||
import androidx.compose.material.icons.Icons | ||
import androidx.compose.material.icons.automirrored.filled.List | ||
import androidx.compose.material.icons.filled.AccountBox | ||
import androidx.compose.material.icons.filled.Settings | ||
import androidx.compose.ui.graphics.vector.ImageVector | ||
import androidx.navigation.NamedNavArgument | ||
import androidx.navigation.NavType | ||
import androidx.navigation.navArgument | ||
import org.comixedproject.variant.android.R | ||
|
||
enum class NavigationScreen(val route: String, val navArguments: List<NamedNavArgument>) { | ||
ComicList("comics", emptyList()), | ||
Servers("servers", emptyList()), | ||
BrowserServer( | ||
"servers?serverId={serverId}&linkId={linkId}", listOf( | ||
navArgument("serverId") { | ||
type = NavType.StringType | ||
}, | ||
navArgument("linkId") { | ||
type = NavType.StringType | ||
nullable = true | ||
}) | ||
), | ||
Settings("settings", emptyList()); | ||
|
||
companion object { | ||
val all = values() | ||
} | ||
} | ||
|
||
enum class BottomBarItems(val label: Int, val icon: ImageVector, val screen: NavigationScreen) { | ||
ServerList(R.string.serverButtonLabel, Icons.Filled.AccountBox, NavigationScreen.Servers), | ||
ComicList( | ||
R.string.comicsButtonLabel, | ||
Icons.AutoMirrored.Filled.List, | ||
NavigationScreen.ComicList | ||
), | ||
Settings(R.string.settingsButtonLabel, Icons.Filled.Settings, NavigationScreen.Settings); | ||
|
||
companion object { | ||
val all = values() | ||
} | ||
} |
68 changes: 68 additions & 0 deletions
68
androidVariant/src/main/java/org/comixedproject/variant/android/ui/server/BottomBar.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,68 @@ | ||
/* | ||
* Variant - A digital comic book reading application for the iPad and Android tablets. | ||
* Copyright (C) 2024, The ComiXed Project | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses> | ||
*/ | ||
|
||
package org.comixedproject.variant.android.ui.server | ||
|
||
import androidx.compose.material3.Icon | ||
import androidx.compose.material3.NavigationBar | ||
import androidx.compose.material3.NavigationBarItem | ||
import androidx.compose.material3.Text | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.runtime.getValue | ||
import androidx.compose.runtime.mutableIntStateOf | ||
import androidx.compose.runtime.remember | ||
import androidx.compose.runtime.setValue | ||
import androidx.compose.ui.res.stringResource | ||
import androidx.compose.ui.tooling.preview.Preview | ||
import androidx.navigation.NavDestination | ||
import org.comixedproject.variant.android.VariantTheme | ||
import org.comixedproject.variant.android.ui.BottomBarItems | ||
|
||
|
||
@Composable | ||
fun BottomBar( | ||
currentDestination: NavDestination?, | ||
onScreenChange: (route: String) -> Unit | ||
) { | ||
var selectedItem by remember { mutableIntStateOf(0) } | ||
|
||
NavigationBar { | ||
BottomBarItems.all.forEachIndexed { index, item -> | ||
NavigationBarItem(selected = selectedItem == index, | ||
onClick = { | ||
selectedItem = index | ||
onScreenChange(item.screen.route) | ||
}, | ||
label = { Text(text = stringResource(id = item.label)) }, | ||
icon = { | ||
Icon( | ||
imageVector = item.icon, | ||
contentDescription = stringResource(id = item.label) | ||
) | ||
}) | ||
} | ||
} | ||
} | ||
|
||
@Preview | ||
@Composable | ||
fun BottomBarPreview() { | ||
VariantTheme { | ||
BottomBar(null, onScreenChange = {}) | ||
} | ||
} |
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.