Initial code commit
This commit is contained in:
1 parent
6a535a40d2
commit
b12f84cb66
12 files changed
+637
-1
No files matched your search
@@ -0,0 +1,7 @@
|
||||
---
|
||||
BasedOnStyle: LLVM
|
||||
TabWidth: 4
|
||||
IndentWidth: 4
|
||||
UseTab: ForIndentation
|
||||
ColumnLimit: 0
|
||||
...
|
||||
@@ -0,0 +1,5 @@
|
||||
/build
|
||||
/.clangd
|
||||
/.lock-waf*
|
||||
/package-lock.json
|
||||
/node_modules
|
||||
@@ -1,3 +1,23 @@
|
||||
# JellyPod
|
||||
Control Jellyfin music playback from your Pebble with an iPod-like interface.
|
||||
|
||||
Control Jellyfin music playback from your Pebble with an iPod-like interface. Even works on iOS!
|
||||
# Supported Phone Clients
|
||||
JellyPod requires a Jellyfin client to be running on your phone to handle playback. Not all clients support all features of JellyPod. Tested clients are detailed below.
|
||||
## Legend
|
||||
- ✅ = verified (supports all features of JellyPod and prefers offline playback of local media over online streaming)
|
||||
- ⚠️ = usable (functional with missing features/bugs detailed below)
|
||||
- ⛔ = unsupported (does not work well or at all with JellyPod)
|
||||
## iOS
|
||||
- ✅ [Finamp Beta/Redesign](https://github.com/finamp-app/finamp/tree/redesign) (last tested release: 1.0.1)
|
||||
|
||||
# Special Features
|
||||
- True sequential playback
|
||||
- Your music continues to play in order even after you exhaust the tracks on the selected album and by the current artist
|
||||
- The next album is chosen by release date and the next artist is chosen alphanumerically
|
||||
- Multi-client/device support
|
||||
- JellyPod is not just a remote for your phone
|
||||
- Determines which client to control based on the most recently active session under your Jellyfin user
|
||||
- Classic design
|
||||
- Inspired by the 4th generation iPod
|
||||
- Support for ALL Pebbles
|
||||
- Absolutely NO AI was used in the creation of this application
|
||||
@@ -0,0 +1,56 @@
|
||||
{
|
||||
"name": "jellypod",
|
||||
"author": "RandyTheSilly",
|
||||
"version": "0.1.0",
|
||||
"keywords": [
|
||||
"music",
|
||||
"remote",
|
||||
"jellyfin",
|
||||
"finamp",
|
||||
"ipod",
|
||||
"playback",
|
||||
"ios"
|
||||
],
|
||||
"capabilities": [
|
||||
"configurable"
|
||||
],
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"@rebble/clay": "^1.0.10"
|
||||
},
|
||||
"pebble": {
|
||||
"displayName": "JellyPod",
|
||||
"uuid": "b135c5a1-ddeb-4278-9da5-3ac68b718f0c",
|
||||
"sdkVersion": "3",
|
||||
"enableMultiJS": true,
|
||||
"targetPlatforms": [
|
||||
"aplite",
|
||||
"basalt",
|
||||
"chalk",
|
||||
"diorite",
|
||||
"emery",
|
||||
"flint",
|
||||
"gabbro"
|
||||
],
|
||||
"watchapp": {
|
||||
"watchface": false
|
||||
},
|
||||
"messageKeys": [
|
||||
"IN_CURRENT_LEVEL",
|
||||
"IN_VANITY_LIST",
|
||||
"IN_ID_LIST",
|
||||
"OUT_TRACK_ID",
|
||||
"OUT_PLAYBACK_MODE",
|
||||
"OUT_PLAYBACK_ACTION"
|
||||
],
|
||||
"resources": {
|
||||
"media": [
|
||||
{
|
||||
"file": "ChicagoFLF.ttf",
|
||||
"name": "FONT_CHICAGO_16",
|
||||
"type": "font"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
https://fontsarena.com/chicago-flf-by-robin-casady/
|
||||
Binary file not shown.
@@ -0,0 +1,86 @@
|
||||
#include "custom_status_bar.h"
|
||||
#include <pebble.h>
|
||||
|
||||
// layer-age
|
||||
static Window *s_main_window;
|
||||
static CustomStatusBarLayer *s_status_bar_layer;
|
||||
static Layer *s_divider_layer;
|
||||
static MenuLayer *s_menu_layer;
|
||||
|
||||
// globals
|
||||
static int s_current_menu_rows = 3;
|
||||
|
||||
// resources
|
||||
static GFont s_font_chicago;
|
||||
|
||||
// constants
|
||||
#define BAR_HEIGHT 20
|
||||
#define MARGIN 4
|
||||
static const GRect s_menu_grect = GRect(MARGIN, BAR_HEIGHT + MARGIN, PBL_DISPLAY_WIDTH - (MARGIN * 2), PBL_DISPLAY_HEIGHT - (MARGIN * 2));
|
||||
static const char *s_main_menu_options[3] = {"Artists >", "Playlists >", "Now Playing >"};
|
||||
|
||||
static uint16_t menu_get_num_rows(MenuLayer *menu_layer, uint16_t section_index, void *context) {
|
||||
return s_current_menu_rows;
|
||||
}
|
||||
|
||||
static void menu_draw_row(GContext *ctx, const Layer *cell_layer, MenuIndex *cell_index, void *context) {
|
||||
menu_cell_basic_draw(ctx, cell_layer, s_main_menu_options[cell_index->row], NULL, NULL);
|
||||
}
|
||||
|
||||
static void menu_selection_changed(struct MenuLayer *menu_layer, MenuIndex new_index, MenuIndex old_index, void *callback_context) {
|
||||
speaker_play_tone(200, 10, 80, SpeakerWaveformSine);
|
||||
}
|
||||
|
||||
static void divider_layer_update_proc(Layer *layer, GContext *ctx) {
|
||||
graphics_context_set_fill_color(ctx, GColorBlack);
|
||||
graphics_fill_rect(ctx, layer_get_bounds(layer), 0, GCornerNone);
|
||||
}
|
||||
|
||||
static void main_window_load() {
|
||||
Layer *main_window_layer = window_get_root_layer(s_main_window);
|
||||
|
||||
s_menu_layer = menu_layer_create(s_menu_grect);
|
||||
menu_layer_set_callbacks(s_menu_layer, NULL, (MenuLayerCallbacks){.get_num_rows = menu_get_num_rows, .draw_row = menu_draw_row, .selection_changed = menu_selection_changed});
|
||||
menu_layer_pad_bottom_enable(s_menu_layer, false);
|
||||
menu_layer_set_click_config_onto_window(s_menu_layer, s_main_window);
|
||||
layer_add_child(main_window_layer, menu_layer_get_layer(s_menu_layer));
|
||||
|
||||
s_status_bar_layer = custom_status_bar_layer_create(BAR_HEIGHT, GColorWhite, 15);
|
||||
custom_status_bar_layer_set_text(s_status_bar_layer, CSB_TEXT_CENTER, "pebble");
|
||||
custom_status_bar_layer_set_text(s_status_bar_layer, CSB_TEXT_LEFT, " | |");
|
||||
custom_status_bar_layer_set_text(s_status_bar_layer, CSB_TEXT_RIGHT, "[// ]- ");
|
||||
custom_status_bar_layer_set_text_font(s_status_bar_layer, CSB_TEXT_CENTER, s_font_chicago);
|
||||
layer_add_child(main_window_layer, s_status_bar_layer);
|
||||
|
||||
s_divider_layer = layer_create(GRect(MARGIN, BAR_HEIGHT + (MARGIN / 2), PBL_DISPLAY_WIDTH - (MARGIN * 2), 1));
|
||||
layer_set_update_proc(s_divider_layer, divider_layer_update_proc);
|
||||
layer_add_child(main_window_layer, s_divider_layer);
|
||||
}
|
||||
|
||||
static void main_window_unload() {
|
||||
layer_destroy(s_divider_layer);
|
||||
custom_status_bar_layer_destroy(s_status_bar_layer);
|
||||
menu_layer_destroy(s_menu_layer);
|
||||
}
|
||||
|
||||
static void init() {
|
||||
s_font_chicago = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_CHICAGO_16));
|
||||
|
||||
s_main_window = window_create();
|
||||
window_set_window_handlers(
|
||||
s_main_window,
|
||||
(WindowHandlers){.load = main_window_load, .unload = main_window_unload});
|
||||
window_stack_push(s_main_window, false);
|
||||
app_touch_navigation_enable(true);
|
||||
}
|
||||
|
||||
static void deinit() {
|
||||
window_destroy(s_main_window);
|
||||
fonts_unload_custom_font(s_font_chicago);
|
||||
}
|
||||
|
||||
int main(void) {
|
||||
init();
|
||||
app_event_loop();
|
||||
deinit();
|
||||
}
|
||||
@@ -0,0 +1,289 @@
|
||||
#include "custom_status_bar.h"
|
||||
#include "pebble.h"
|
||||
|
||||
typedef struct {
|
||||
uint8_t height;
|
||||
uint8_t icon_width;
|
||||
GColor bar_colour;
|
||||
GColor text_colour;
|
||||
TextLayer *left_text;
|
||||
TextLayer *center_text;
|
||||
TextLayer *right_text;
|
||||
BitmapLayer *icon_0;
|
||||
BitmapLayer *icon_1;
|
||||
BitmapLayer *icon_2;
|
||||
BitmapLayer *icon_3;
|
||||
BitmapLayer *icon_4;
|
||||
} CustomStatusBarLayerHidden;
|
||||
|
||||
static void update_proc(Layer *layer, GContext *context);
|
||||
|
||||
CustomStatusBarLayer *custom_status_bar_layer_create(uint8_t height, GColor bar_colour, uint8_t icon_width) {
|
||||
|
||||
if (icon_width > MAX_ICON_WIDTH) {
|
||||
APP_LOG(APP_LOG_LEVEL_ERROR, "ERROR: ICON WIDTH TOO LARGE. SEE MAX_ICON_WIDTH. STATUS BAR NOT CREATED. RETURNING NULL.");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// Status bar frame
|
||||
GRect frame = (GRect){.origin = GPointZero,
|
||||
.size = {
|
||||
.h = height,
|
||||
.w = PBL_DISPLAY_WIDTH}};
|
||||
|
||||
CustomStatusBarLayer *status_bar = layer_create_with_data(frame, sizeof(CustomStatusBarLayerHidden));
|
||||
if (status_bar == NULL) {
|
||||
APP_LOG(APP_LOG_LEVEL_ERROR, "OOM Couldn't create custom status bar.");
|
||||
}
|
||||
|
||||
// Get status hidden pointer
|
||||
CustomStatusBarLayerHidden *status_hidden = (CustomStatusBarLayerHidden *)layer_get_data(status_bar);
|
||||
|
||||
layer_set_update_proc(status_bar, update_proc);
|
||||
|
||||
// Set up bar variables
|
||||
status_hidden->height = height;
|
||||
status_hidden->icon_width = icon_width;
|
||||
status_hidden->bar_colour = bar_colour;
|
||||
// TextColor
|
||||
if (bar_colour.argb == GColorBlack.argb) {
|
||||
status_hidden->text_colour = GColorWhite;
|
||||
} else {
|
||||
status_hidden->text_colour = GColorBlack;
|
||||
}
|
||||
|
||||
status_hidden->left_text = NULL;
|
||||
status_hidden->center_text = NULL;
|
||||
status_hidden->right_text = NULL;
|
||||
status_hidden->icon_0 = NULL;
|
||||
status_hidden->icon_1 = NULL;
|
||||
status_hidden->icon_2 = NULL;
|
||||
status_hidden->icon_3 = NULL;
|
||||
status_hidden->icon_4 = NULL;
|
||||
|
||||
return status_bar;
|
||||
}
|
||||
|
||||
void custom_status_bar_layer_destroy(CustomStatusBarLayer *custom_status_bar_layer) {
|
||||
|
||||
CustomStatusBarLayerHidden *status_hidden = (CustomStatusBarLayerHidden *)layer_get_data(custom_status_bar_layer);
|
||||
|
||||
if (status_hidden->left_text != NULL)
|
||||
text_layer_destroy(status_hidden->left_text);
|
||||
if (status_hidden->right_text != NULL)
|
||||
text_layer_destroy(status_hidden->right_text);
|
||||
if (status_hidden->center_text != NULL)
|
||||
text_layer_destroy(status_hidden->center_text);
|
||||
if (status_hidden->icon_0 != NULL)
|
||||
bitmap_layer_destroy(status_hidden->icon_0);
|
||||
if (status_hidden->icon_1 != NULL)
|
||||
bitmap_layer_destroy(status_hidden->icon_1);
|
||||
if (status_hidden->icon_2 != NULL)
|
||||
bitmap_layer_destroy(status_hidden->icon_2);
|
||||
if (status_hidden->icon_3 != NULL)
|
||||
bitmap_layer_destroy(status_hidden->icon_3);
|
||||
if (status_hidden->icon_4 != NULL)
|
||||
bitmap_layer_destroy(status_hidden->icon_4);
|
||||
|
||||
if (custom_status_bar_layer != NULL)
|
||||
layer_destroy(custom_status_bar_layer);
|
||||
}
|
||||
|
||||
void custom_status_bar_layer_set_height(CustomStatusBarLayer *custom_status_bar_layer, uint32_t height) {
|
||||
CustomStatusBarLayerHidden *status_hidden = (CustomStatusBarLayerHidden *)layer_get_data(custom_status_bar_layer);
|
||||
status_hidden->height = height;
|
||||
layer_mark_dirty(custom_status_bar_layer);
|
||||
}
|
||||
|
||||
void custom_status_bar_layer_set_text(CustomStatusBarLayer *custom_status_bar_layer, CsbTextPosition position, char *status_bar_text) {
|
||||
|
||||
CustomStatusBarLayerHidden *status_hidden = (CustomStatusBarLayerHidden *)layer_get_data(custom_status_bar_layer);
|
||||
|
||||
switch (position) {
|
||||
case CSB_TEXT_LEFT:
|
||||
if (status_hidden->left_text == NULL) {
|
||||
status_hidden->left_text = text_layer_create(GRect(0, 0, PBL_DISPLAY_WIDTH, status_hidden->height));
|
||||
text_layer_set_text_alignment(status_hidden->left_text, GTextAlignmentLeft);
|
||||
text_layer_set_font(status_hidden->left_text, fonts_get_system_font(FONT_KEY_GOTHIC_14));
|
||||
text_layer_set_text_color(status_hidden->left_text, status_hidden->text_colour);
|
||||
text_layer_set_background_color(status_hidden->left_text, GColorClear);
|
||||
layer_add_child(custom_status_bar_layer, text_layer_get_layer(status_hidden->left_text));
|
||||
}
|
||||
text_layer_set_text(status_hidden->left_text, status_bar_text);
|
||||
break;
|
||||
|
||||
case CSB_TEXT_RIGHT:
|
||||
if (status_hidden->right_text == NULL) {
|
||||
status_hidden->right_text = text_layer_create(GRect(0, 0, PBL_DISPLAY_WIDTH, status_hidden->height));
|
||||
text_layer_set_text_alignment(status_hidden->right_text, GTextAlignmentRight);
|
||||
text_layer_set_font(status_hidden->right_text, fonts_get_system_font(FONT_KEY_GOTHIC_14));
|
||||
text_layer_set_text_color(status_hidden->right_text, status_hidden->text_colour);
|
||||
text_layer_set_background_color(status_hidden->right_text, GColorClear);
|
||||
layer_add_child(custom_status_bar_layer, text_layer_get_layer(status_hidden->right_text));
|
||||
}
|
||||
text_layer_set_text(status_hidden->right_text, status_bar_text);
|
||||
break;
|
||||
|
||||
case CSB_TEXT_CENTER:
|
||||
if (status_hidden->center_text == NULL) {
|
||||
status_hidden->center_text = text_layer_create(GRect(0, 0, PBL_DISPLAY_WIDTH, status_hidden->height));
|
||||
text_layer_set_text_alignment(status_hidden->center_text, GTextAlignmentCenter);
|
||||
text_layer_set_font(status_hidden->center_text, fonts_get_system_font(FONT_KEY_GOTHIC_14));
|
||||
text_layer_set_text_color(status_hidden->center_text, status_hidden->text_colour);
|
||||
text_layer_set_background_color(status_hidden->center_text, GColorClear);
|
||||
layer_add_child(custom_status_bar_layer, text_layer_get_layer(status_hidden->center_text));
|
||||
}
|
||||
text_layer_set_text(status_hidden->center_text, status_bar_text);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void custom_status_bar_layer_set_text_font(CustomStatusBarLayer *custom_status_bar_layer, CsbTextPosition position, GFont font) {
|
||||
|
||||
CustomStatusBarLayerHidden *status_hidden = (CustomStatusBarLayerHidden *)layer_get_data(custom_status_bar_layer);
|
||||
|
||||
switch (position) {
|
||||
case CSB_TEXT_LEFT:
|
||||
text_layer_set_font(status_hidden->left_text, font);
|
||||
break;
|
||||
|
||||
case CSB_TEXT_RIGHT:
|
||||
text_layer_set_font(status_hidden->right_text, font);
|
||||
break;
|
||||
|
||||
case CSB_TEXT_CENTER:
|
||||
text_layer_set_font(status_hidden->center_text, font);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void custom_status_bar_layer_set_text_hidden(CustomStatusBarLayer *custom_status_bar_layer, CsbTextPosition position, bool hidden) {
|
||||
|
||||
CustomStatusBarLayerHidden *status_hidden = (CustomStatusBarLayerHidden *)layer_get_data(custom_status_bar_layer);
|
||||
|
||||
switch (position) {
|
||||
case CSB_TEXT_LEFT:
|
||||
layer_set_hidden(text_layer_get_layer(status_hidden->left_text), hidden);
|
||||
break;
|
||||
|
||||
case CSB_TEXT_RIGHT:
|
||||
layer_set_hidden(text_layer_get_layer(status_hidden->right_text), hidden);
|
||||
break;
|
||||
|
||||
case CSB_TEXT_CENTER:
|
||||
layer_set_hidden(text_layer_get_layer(status_hidden->center_text), hidden);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void custom_status_bar_layer_set_bitmap(CustomStatusBarLayer *custom_status_bar_layer, CsbIconPosition position, GBitmap *gbitmap) {
|
||||
|
||||
CustomStatusBarLayerHidden *status_hidden = (CustomStatusBarLayerHidden *)layer_get_data(custom_status_bar_layer);
|
||||
|
||||
uint8_t icon_width = status_hidden->icon_width;
|
||||
uint8_t height = status_hidden->height;
|
||||
|
||||
switch (position) {
|
||||
case CSB_ICON_0:
|
||||
if (status_hidden->icon_0 == NULL) {
|
||||
status_hidden->icon_0 = bitmap_layer_create(GRect(PBL_DISPLAY_WIDTH / 10 - icon_width / 2, height / 2 - icon_width / 2, icon_width, icon_width));
|
||||
bitmap_layer_set_background_color(status_hidden->icon_0, GColorClear);
|
||||
layer_add_child(custom_status_bar_layer, bitmap_layer_get_layer(status_hidden->icon_0));
|
||||
}
|
||||
bitmap_layer_set_bitmap(status_hidden->icon_0, gbitmap);
|
||||
break;
|
||||
|
||||
case CSB_ICON_1:
|
||||
if (status_hidden->icon_1 == NULL) {
|
||||
status_hidden->icon_1 = bitmap_layer_create(GRect(PBL_DISPLAY_WIDTH * 3 / 10 - icon_width / 2, height / 2 - icon_width / 2, icon_width, icon_width));
|
||||
bitmap_layer_set_background_color(status_hidden->icon_1, GColorClear);
|
||||
layer_add_child(custom_status_bar_layer, bitmap_layer_get_layer(status_hidden->icon_1));
|
||||
}
|
||||
bitmap_layer_set_bitmap(status_hidden->icon_1, gbitmap);
|
||||
break;
|
||||
|
||||
case CSB_ICON_2:
|
||||
if (status_hidden->icon_2 == NULL) {
|
||||
status_hidden->icon_2 = bitmap_layer_create(GRect(PBL_DISPLAY_WIDTH / 2 - icon_width / 2, height / 2 - icon_width / 2, icon_width, icon_width));
|
||||
bitmap_layer_set_background_color(status_hidden->icon_2, GColorClear);
|
||||
layer_add_child(custom_status_bar_layer, bitmap_layer_get_layer(status_hidden->icon_2));
|
||||
}
|
||||
bitmap_layer_set_bitmap(status_hidden->icon_2, gbitmap);
|
||||
break;
|
||||
|
||||
case CSB_ICON_3:
|
||||
if (status_hidden->icon_3 == NULL) {
|
||||
status_hidden->icon_3 = bitmap_layer_create(GRect(PBL_DISPLAY_WIDTH * 7 / 10 - icon_width / 2, height / 2 - icon_width / 2, icon_width, icon_width));
|
||||
bitmap_layer_set_background_color(status_hidden->icon_3, GColorClear);
|
||||
layer_add_child(custom_status_bar_layer, bitmap_layer_get_layer(status_hidden->icon_3));
|
||||
}
|
||||
bitmap_layer_set_bitmap(status_hidden->icon_3, gbitmap);
|
||||
break;
|
||||
|
||||
case CSB_ICON_4:
|
||||
if (status_hidden->icon_4 == NULL) {
|
||||
status_hidden->icon_4 = bitmap_layer_create(GRect(PBL_DISPLAY_WIDTH * 9 / 10 - icon_width / 2, height / 2 - icon_width / 2, icon_width, icon_width));
|
||||
bitmap_layer_set_background_color(status_hidden->icon_4, GColorClear);
|
||||
layer_add_child(custom_status_bar_layer, bitmap_layer_get_layer(status_hidden->icon_4));
|
||||
}
|
||||
bitmap_layer_set_bitmap(status_hidden->icon_4, gbitmap);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void custom_status_bar_layer_set_bitmap_hidden(CustomStatusBarLayer *custom_status_bar_layer, CsbIconPosition position, bool hidden) {
|
||||
|
||||
CustomStatusBarLayerHidden *status_hidden = (CustomStatusBarLayerHidden *)layer_get_data(custom_status_bar_layer);
|
||||
|
||||
switch (position) {
|
||||
case CSB_ICON_0:
|
||||
layer_set_hidden(bitmap_layer_get_layer(status_hidden->icon_0), hidden);
|
||||
break;
|
||||
|
||||
case CSB_ICON_1:
|
||||
layer_set_hidden(bitmap_layer_get_layer(status_hidden->icon_1), hidden);
|
||||
break;
|
||||
|
||||
case CSB_ICON_2:
|
||||
layer_set_hidden(bitmap_layer_get_layer(status_hidden->icon_2), hidden);
|
||||
break;
|
||||
|
||||
case CSB_ICON_3:
|
||||
layer_set_hidden(bitmap_layer_get_layer(status_hidden->icon_3), hidden);
|
||||
break;
|
||||
|
||||
case CSB_ICON_4:
|
||||
layer_set_hidden(bitmap_layer_get_layer(status_hidden->icon_4), hidden);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void custom_status_bar_layer_set_all_text_hidden(CustomStatusBarLayer *custom_status_bar_layer, bool hidden) {
|
||||
|
||||
CustomStatusBarLayerHidden *status_hidden = (CustomStatusBarLayerHidden *)layer_get_data(custom_status_bar_layer);
|
||||
|
||||
layer_set_hidden(text_layer_get_layer(status_hidden->left_text), hidden);
|
||||
layer_set_hidden(text_layer_get_layer(status_hidden->right_text), hidden);
|
||||
layer_set_hidden(text_layer_get_layer(status_hidden->center_text), hidden);
|
||||
}
|
||||
|
||||
void custom_status_bar_layer_set_all_bitmaps_hidden(CustomStatusBarLayer *custom_status_bar_layer, bool hidden) {
|
||||
|
||||
CustomStatusBarLayerHidden *status_hidden = (CustomStatusBarLayerHidden *)layer_get_data(custom_status_bar_layer);
|
||||
|
||||
layer_set_hidden(bitmap_layer_get_layer(status_hidden->icon_0), hidden);
|
||||
layer_set_hidden(bitmap_layer_get_layer(status_hidden->icon_1), hidden);
|
||||
layer_set_hidden(bitmap_layer_get_layer(status_hidden->icon_2), hidden);
|
||||
layer_set_hidden(bitmap_layer_get_layer(status_hidden->icon_3), hidden);
|
||||
layer_set_hidden(bitmap_layer_get_layer(status_hidden->icon_4), hidden);
|
||||
}
|
||||
|
||||
static void update_proc(Layer *layer, GContext *context) {
|
||||
|
||||
CustomStatusBarLayerHidden *status_hidden = (CustomStatusBarLayerHidden *)layer_get_data(layer);
|
||||
|
||||
GRect bounds = layer_get_bounds(layer);
|
||||
|
||||
graphics_context_set_fill_color(context, status_hidden->bar_colour);
|
||||
graphics_fill_rect(context, bounds, 0, GCornersAll);
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
#include "pebble.h"
|
||||
|
||||
typedef struct Layer CustomStatusBarLayer;
|
||||
|
||||
#define MAX_ICON_WIDTH 28
|
||||
|
||||
typedef enum {
|
||||
CSB_TEXT_LEFT,
|
||||
CSB_TEXT_RIGHT,
|
||||
CSB_TEXT_CENTER,
|
||||
} CsbTextPosition;
|
||||
|
||||
//ICON positions start left to right, 0 indexed
|
||||
typedef enum {
|
||||
CSB_ICON_0,
|
||||
CSB_ICON_1,
|
||||
CSB_ICON_2,
|
||||
CSB_ICON_3,
|
||||
CSB_ICON_4,
|
||||
} CsbIconPosition;
|
||||
|
||||
//icon_width determines both the width and height of the BitmapLayers being created in the status bar
|
||||
CustomStatusBarLayer * custom_status_bar_layer_create(uint8_t height, GColor bar_colour, uint8_t icon_width);
|
||||
void custom_status_bar_layer_destroy(CustomStatusBarLayer* custom_status_bar_layer);
|
||||
void custom_status_bar_layer_set_text(CustomStatusBarLayer* custom_status_bar_layer, CsbTextPosition position, char* status_bar_text);
|
||||
void custom_status_bar_layer_set_text_font(CustomStatusBarLayer* custom_status_bar_layer, CsbTextPosition position, GFont font);
|
||||
void custom_status_bar_layer_set_text_hidden(CustomStatusBarLayer* custom_status_bar_layer, CsbTextPosition position, bool hidden);
|
||||
void custom_status_bar_layer_set_bitmap(CustomStatusBarLayer* custom_status_bar_layer, CsbIconPosition position, GBitmap* gbitmap);
|
||||
void custom_status_bar_layer_set_bitmap_hidden(CustomStatusBarLayer* custom_status_bar_layer, CsbIconPosition position, bool hidden);
|
||||
void custom_status_bar_layer_set_all_text_hidden(CustomStatusBarLayer* custom_status_bar_layer, bool hidden);
|
||||
void custom_status_bar_layer_set_all_bitmaps_hidden(CustomStatusBarLayer* custom_status_bar_layer, bool hidden);
|
||||
@@ -0,0 +1,33 @@
|
||||
module.exports = [
|
||||
{
|
||||
"type": "heading",
|
||||
"defaultValue": "JellyPod | Settings"
|
||||
},
|
||||
{
|
||||
"type": "section",
|
||||
"items": [
|
||||
{
|
||||
"id": "base_url",
|
||||
"type": "input",
|
||||
"messageKey": "PRIV_BASE_URL",
|
||||
"label": "Base URL"
|
||||
},
|
||||
{
|
||||
"id": "api_key",
|
||||
"type": "input",
|
||||
"messageKey": "PRIV_API_KEY",
|
||||
"label": "API Key"
|
||||
},
|
||||
{
|
||||
"id": "username",
|
||||
"type": "input",
|
||||
"messageKey": "PRIV_USERNAME",
|
||||
"label": "Username"
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
"type": "submit",
|
||||
"defaultValue": "Save/Sync Library"
|
||||
}
|
||||
];
|
||||
@@ -0,0 +1,54 @@
|
||||
var Clay = require('@rebble/clay');
|
||||
var clayConfig = require('./config');
|
||||
new Clay(clayConfig);
|
||||
|
||||
Pebble.addEventListener("ready", function () {
|
||||
Pebble.sendAppMessage({ PKJS_READY: 1 });
|
||||
});
|
||||
|
||||
function callAPI(method, endpoint) {
|
||||
const xhr = new XMLHttpRequest();
|
||||
|
||||
xhr.onload = function () {
|
||||
switch (xhr.status) {
|
||||
case 200:
|
||||
return this.responseText;
|
||||
default:
|
||||
reportAPIFailure(); // TODO
|
||||
}
|
||||
};
|
||||
xhr.onerror = function () {
|
||||
reportAPIFailure(); // TODO
|
||||
};
|
||||
xhr.ontimeout = function () {
|
||||
reportAPIFailure(); // TODO
|
||||
};
|
||||
|
||||
xhr.open(method, endpoint, true);
|
||||
xhr.timeout = 8000;
|
||||
xhr.setRequestHeader("Accept", "application/json");
|
||||
xhr.setRequestHeader("Authorization", 'MediaBrowser Token="' + apiKey + '"'); // TODO
|
||||
xhr.send();
|
||||
}
|
||||
|
||||
// On Settings Save/Sync Button Press
|
||||
//// Get User ID
|
||||
|
||||
//curl -H "Authorization: MediaBrowser Token=\"TOKEN\"" -X GET 'BASEURL/Users'
|
||||
|
||||
// Get Track List Using Logic From JellyPod Server
|
||||
|
||||
// On Every Startup
|
||||
//// Get Session ID
|
||||
|
||||
//curl -H "Authorization: MediaBrowser Token=\"TOKEN\"" -X GET 'BASEURL/Sessions'
|
||||
|
||||
// Filter by:
|
||||
// UserId
|
||||
// Sort by:
|
||||
// LastActivityDate
|
||||
|
||||
// Controls
|
||||
//// Select Track (pass through a queue)
|
||||
|
||||
//curl - H "Authorization: MediaBrowser Token=\"TOKEN\"" - X POST 'BASEURL/Sessions/SESSIONID/Playing?playCommand=PlayNow&itemIds=XXX,YYY'
|
||||
@@ -0,0 +1,54 @@
|
||||
#
|
||||
# This file is the default set of rules to compile a Pebble application.
|
||||
#
|
||||
# Feel free to customize this to your needs.
|
||||
#
|
||||
import os.path
|
||||
|
||||
top = '.'
|
||||
out = 'build'
|
||||
|
||||
|
||||
def options(ctx):
|
||||
ctx.load('pebble_sdk')
|
||||
|
||||
|
||||
def configure(ctx):
|
||||
"""
|
||||
This method is used to configure your build. ctx.load(`pebble_sdk`) automatically configures
|
||||
a build for each valid platform in `targetPlatforms`. Platform-specific configuration: add your
|
||||
change after calling ctx.load('pebble_sdk') and make sure to set the correct environment first.
|
||||
Universal configuration: add your change prior to calling ctx.load('pebble_sdk').
|
||||
"""
|
||||
ctx.load('pebble_sdk')
|
||||
|
||||
|
||||
def build(ctx):
|
||||
ctx.load('pebble_sdk')
|
||||
|
||||
build_worker = os.path.exists('worker_src')
|
||||
binaries = []
|
||||
|
||||
cached_env = ctx.env
|
||||
for platform in ctx.env.TARGET_PLATFORMS:
|
||||
ctx.env = ctx.all_envs[platform]
|
||||
ctx.set_group(ctx.env.PLATFORM_NAME)
|
||||
app_elf = '{}/pebble-app.elf'.format(ctx.env.BUILD_DIR)
|
||||
ctx.pbl_build(source=ctx.path.ant_glob('src/c/**/*.c'), target=app_elf, bin_type='app')
|
||||
|
||||
if build_worker:
|
||||
worker_elf = '{}/pebble-worker.elf'.format(ctx.env.BUILD_DIR)
|
||||
binaries.append({'platform': platform, 'app_elf': app_elf, 'worker_elf': worker_elf})
|
||||
ctx.pbl_build(source=ctx.path.ant_glob('worker_src/c/**/*.c'),
|
||||
target=worker_elf,
|
||||
bin_type='worker')
|
||||
else:
|
||||
binaries.append({'platform': platform, 'app_elf': app_elf})
|
||||
ctx.env = cached_env
|
||||
|
||||
ctx.set_group('bundle')
|
||||
ctx.pbl_bundle(binaries=binaries,
|
||||
js=ctx.path.ant_glob(['src/pkjs/**/*.js',
|
||||
'src/pkjs/**/*.json',
|
||||
'src/common/**/*.js']),
|
||||
js_entry_file='src/pkjs/index.js')
|
||||
Reference in new issue
Block a user