Skip to content

Commit

Permalink
hideo-avplayer: Initial UI mockup.
Browse files Browse the repository at this point in the history
  • Loading branch information
sleepy-monax committed Nov 1, 2024
1 parent 5d01c1c commit bee19ec
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 1 deletion.
69 changes: 68 additions & 1 deletion src/apps/hideo-avplayer/app.cpp
Original file line number Diff line number Diff line change
@@ -1,16 +1,83 @@
#include <karm-image/loader.h>
#include <karm-kira/scaffold.h>
#include <karm-kira/slider.h>
#include <karm-ui/input.h>
#include <karm-ui/layout.h>
#include <karm-ui/scroll.h>
#include <mdi/cog.h>
#include <mdi/fullscreen.h>
#include <mdi/pause.h>
#include <mdi/play-circle.h>
#include <mdi/play.h>
#include <mdi/skip-next.h>
#include <mdi/skip-previous.h>
#include <mdi/volume-high.h>

#include "app.h"

namespace Hideo::Avplayer {

Ui::Child player() {
auto mediaContent =
Ui::image(
Image::load("bundle://hideo-avplayer/images/bunny.qoi"_url).unwrap()
) |
Ui::cover() |
Ui::vhclip();

auto mediaControls =
Ui::hflow(
6,
Math::Align::VCENTER | Math::Align::HFILL | Math::Align::TOP_START,
Ui::hflow(
Ui::button(Ui::NOP, Ui::ButtonStyle::subtle(), Mdi::SKIP_PREVIOUS),
Ui::separator(),
Ui::button(Ui::NOP, Ui::ButtonStyle::subtle(), Mdi::PLAY),
Ui::separator(),
Ui::button(Ui::NOP, Ui::ButtonStyle::subtle(), Mdi::SKIP_NEXT)
) | Ui::box({
.borderRadii = 4,
.borderFill = Ui::GRAY700,
.backgroundFill = Ui::GRAY800,
}),
Ui::empty(4),
Ui::labelMedium("00:00"),
Ui::empty(8) |
Ui::box({
.margin = {0, 8},
.borderRadii = 99,
.borderWidth = 1,
.borderFill = Ui::ACCENT600,
.backgroundFill = Ui::ACCENT500,
}) |
Ui::grow(),
Ui::labelMedium("00:00"),
Ui::empty(4),
Ui::button(Ui::NOP, Ui::ButtonStyle::regular(), Mdi::VOLUME_HIGH),
Ui::button(Ui::NOP, Ui::ButtonStyle::regular(), Mdi::FULLSCREEN),
Ui::button(Ui::NOP, Ui::ButtonStyle::regular(), Mdi::COG)
) |
Ui::insets(8) |
Ui::box({
.backgroundFill = Ui::GRAY900.withOpacity(0.6),
}) |
Ui::backgroundFilter(Gfx::BlurFilter{16});

return Ui::stack(
mediaContent,
Ui::vflow(
Ui::grow(NONE),
mediaControls
)
) |
Ui::grow();
}

Ui::Child app() {
return Kr::scaffold({
.icon = Mdi::PLAY_CIRCLE,
.title = "Media Player"s,
.body = slot$(Ui::empty()),
.body = slot$(player()),
});
}

Expand Down
Binary file added src/apps/hideo-avplayer/res/images/bunny.qoi
Binary file not shown.

0 comments on commit bee19ec

Please sign in to comment.