This repository has been archived by the owner on May 18, 2018. It is now read-only.
-
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.
- Loading branch information
0 parents
commit 6b21622
Showing
9 changed files
with
458 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# Ignore build generated files | ||
build/ | ||
dist/ | ||
dist.zip | ||
|
||
# Ignore waf lock file | ||
.lock-waf* | ||
|
||
# Ignore installed node modules | ||
node_modules/ |
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,10 @@ | ||
# Ignore build generated files | ||
build/ | ||
dist/ | ||
dist.zip | ||
|
||
# Ignore waf lock file | ||
.lock-waf* | ||
|
||
# Ignore installed node modules | ||
node_modules/ |
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,28 @@ | ||
{ | ||
"name": "activity-indicator-layer-demo", | ||
"author": "Alexsander Akers", | ||
"version": "1.0.0", | ||
"keywords": ["pebble-app"], | ||
"private": true, | ||
"dependencies": { | ||
"pebble-activity-indicator-layer": "1.0.0" | ||
}, | ||
"pebble": { | ||
"displayName": "Activity Indicator Demo", | ||
"uuid": "5b603423-eaad-4186-b504-c14ed2dcd2cd", | ||
"sdkVersion": "3", | ||
"enableMultiJS": true, | ||
"targetPlatforms": [ | ||
"aplite", | ||
"basalt", | ||
"chalk" | ||
], | ||
"watchapp": { | ||
"watchface": false | ||
}, | ||
"messageKeys": [], | ||
"resources": { | ||
"media": [] | ||
} | ||
} | ||
} |
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,71 @@ | ||
#include <pebble.h> | ||
#include <pebble-activity-indicator-layer/activity-indicator-layer.h> | ||
|
||
static Window *s_window; | ||
static ActivityIndicatorLayer *s_activity_indicator_layer; | ||
|
||
static void select_click_handler(ClickRecognizerRef recognizer, void *context) { | ||
bool animating = activity_indicator_layer_get_animating(s_activity_indicator_layer); | ||
activity_indicator_layer_set_animating(s_activity_indicator_layer, !animating); | ||
} | ||
|
||
static void up_click_handler(ClickRecognizerRef recognizer, void *context) { | ||
uint8_t thickness = activity_indicator_layer_get_thickness(s_activity_indicator_layer); | ||
if (thickness >= 10) { | ||
return; | ||
} | ||
|
||
activity_indicator_layer_set_thickness(s_activity_indicator_layer, thickness + 1); | ||
} | ||
|
||
static void down_click_handler(ClickRecognizerRef recognizer, void *context) { | ||
uint8_t thickness = activity_indicator_layer_get_thickness(s_activity_indicator_layer); | ||
if (thickness <= 1) { | ||
return; | ||
} | ||
|
||
activity_indicator_layer_set_thickness(s_activity_indicator_layer, thickness - 1); | ||
} | ||
|
||
static void click_config_provider(void *context) { | ||
window_single_click_subscribe(BUTTON_ID_SELECT, select_click_handler); | ||
window_single_click_subscribe(BUTTON_ID_UP, up_click_handler); | ||
window_single_click_subscribe(BUTTON_ID_DOWN, down_click_handler); | ||
} | ||
|
||
static void window_load(Window *window) { | ||
Layer *window_layer = window_get_root_layer(window); | ||
const GRect bounds = layer_get_bounds(window_layer); | ||
|
||
GRect frame = GRect(0, 0, 50, 50); | ||
grect_align(&frame, &bounds, GAlignCenter, false); | ||
|
||
s_activity_indicator_layer = activity_indicator_layer_create(frame); | ||
activity_indicator_layer_set_animating(s_activity_indicator_layer, true); | ||
layer_add_child(window_layer, (Layer *)s_activity_indicator_layer); | ||
} | ||
|
||
static void window_unload(Window *window) { | ||
activity_indicator_layer_destroy(s_activity_indicator_layer); | ||
} | ||
|
||
static void init(void) { | ||
s_window = window_create(); | ||
window_set_click_config_provider(s_window, click_config_provider); | ||
window_set_window_handlers(s_window, (WindowHandlers) { | ||
.load = window_load, | ||
.unload = window_unload, | ||
}); | ||
const bool animated = true; | ||
window_stack_push(s_window, animated); | ||
} | ||
|
||
static void deinit(void) { | ||
window_destroy(s_window); | ||
} | ||
|
||
int main(void) { | ||
init(); | ||
app_event_loop(); | ||
deinit(); | ||
} |
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,50 @@ | ||
# | ||
# 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_program(source=ctx.path.ant_glob('src/**/*.c'), target=app_elf) | ||
|
||
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_worker(source=ctx.path.ant_glob('worker_src/**/*.c'), target=worker_elf) | ||
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/js/**/*.js', 'src/js/**/*.json']), | ||
js_entry_file='src/js/app.js') |
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,20 @@ | ||
#pragma once | ||
|
||
#include <pebble.h> | ||
|
||
struct ActivityIndicatorLayer; | ||
typedef struct ActivityIndicatorLayer ActivityIndicatorLayer; | ||
|
||
ActivityIndicatorLayer *activity_indicator_layer_create(GRect frame); | ||
void activity_indicator_layer_destroy(ActivityIndicatorLayer *activity_indicator_layer); | ||
|
||
Layer *activity_indicator_layer_get_layer(const ActivityIndicatorLayer *activity_indicator_layer); | ||
|
||
bool activity_indicator_layer_get_animating(const ActivityIndicatorLayer *activity_indicator_layer); | ||
void activity_indicator_layer_set_animating(ActivityIndicatorLayer *activity_indicator_layer, bool animating); | ||
|
||
GColor activity_indicator_layer_get_color(const ActivityIndicatorLayer *activity_indicator_layer); | ||
void activity_indicator_layer_set_color(ActivityIndicatorLayer *activity_indicator_layer, GColor color); | ||
|
||
uint8_t activity_indicator_layer_get_thickness(const ActivityIndicatorLayer *activity_indicator_layer); | ||
void activity_indicator_layer_set_thickness(ActivityIndicatorLayer *activity_indicator_layer, uint8_t thickness); |
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,30 @@ | ||
{ | ||
"name": "pebble-activity-indicator-layer", | ||
"description": "A \"material design\"-style activity indicator for Pebble.", | ||
"author": "Alexsander Akers <[email protected]>", | ||
"version": "1.0.0", | ||
"license": "MIT", | ||
"homepage": "https://github.com/a2/pebble-activity-indicator-layer", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/a2/pebble-activity-indicator-layer.git" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/a2/pebble-activity-indicator-layer/issues" | ||
}, | ||
"files": ["dist.zip"], | ||
"keywords": ["pebble-package"], | ||
"dependencies": {}, | ||
"pebble": { | ||
"projectType": "package", | ||
"sdkVersion": "3", | ||
"targetPlatforms": [ | ||
"aplite", | ||
"basalt", | ||
"chalk" | ||
], | ||
"resources": { | ||
"media": [] | ||
} | ||
} | ||
} |
Oops, something went wrong.