Skip to content

Commit

Permalink
Improved the appearance and behavior of the "play" button
Browse files Browse the repository at this point in the history
  • Loading branch information
windows-server-2003 committed Nov 28, 2021
1 parent edeff32 commit b70cb49
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
1 change: 1 addition & 0 deletions romfs/gfx/msg/string_resources_en.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<CANCEL>Cancel</CANCEL>
<OK>OK</OK>
<PLAY>Play</PLAY>
<PLAYING>Playing</PLAYING>
<URL>URL</URL>
<SETTINGS>Settings</SETTINGS>
<WATCH_HISTORY>Watch History</WATCH_HISTORY>
Expand Down
1 change: 1 addition & 0 deletions romfs/gfx/msg/string_resources_ja.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<CANCEL>キャンセル</CANCEL>
<OK>OK</OK>
<PLAY>再生</PLAY>
<PLAYING>再生中</PLAYING>
<URL>URL</URL>
<SETTINGS>設定</SETTINGS>
<WATCH_HISTORY>履歴</WATCH_HISTORY>
Expand Down
11 changes: 7 additions & 4 deletions source/scenes/video_player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -758,15 +758,18 @@ static void load_video_page(void *arg) {
{
TextView *play_button = (new TextView(0, 0, 160 - SMALL_MARGIN, 20));
play_button
->set_text((std::function<std::string ()>) [] () { return LOCALIZED(PLAY); })
->set_text((std::function<std::string ()>) [] () { return cur_video_info.id == playing_video_info.id ? LOCALIZED(PLAYING) : LOCALIZED(PLAY); })
->set_x_alignment(TextView::XAlign::CENTER);
if (tmp_video_info.is_playable()) {
play_button
->set_on_view_released([url] (View &) {
send_change_video_request_wo_lock(url, true, false, false);
if (cur_video_info.id != playing_video_info.id) send_change_video_request_wo_lock(url, true, false, false);
})
->set_get_background_color(View::STANDARD_BACKGROUND);
} else play_button->set_get_background_color([] (const View &) { return LIGHT2_BACK_COLOR; });
->set_get_background_color([] (const View &view) -> u32 {
if (cur_video_info.id == playing_video_info.id) return 0xFFFFBBBB;
return View::STANDARD_BACKGROUND(view);
});
} else play_button->set_get_background_color([] (const View &) { return LIGHT1_BACK_COLOR; });

TextView *reload_button = (new TextView(0, 0, 160 - SMALL_MARGIN, 20));
reload_button
Expand Down

0 comments on commit b70cb49

Please sign in to comment.