Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion AccessRobot/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
android:normalScreens="false"
android:largeScreens="true"
android:xlargeScreens="true"
android:requiresSmallestWidthDp="600"
android:anyDensity="true"
/>

<uses-permission android:name="android.permission.BLUETOOTH" />
Expand Down
2 changes: 1 addition & 1 deletion AccessRobot/app/src/main/assets/blockly/blockly.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<!DOCTYPE html><html><head> <meta charset="utf-8"> <title>Mozi</title> <link rel="stylesheet" type="text/css" href="blocklyAreaCSS.css"> <script src="blockly_compressed.js"></script> <script src="blocks_compressed.js"></script> <script src="bitlash_compressed.js"></script> <script src="en.js"></script></head><body><table> <tr> <td id="blocklyArea"> </td> </tr></table><div id="blocklyDiv" style="position: absolute"></div><xml id="toolbox" style="display: none"> <category name="1"> <block type="move_forward"></block> <block type="move_backward"></block> <block type="turn_left"></block> <block type="turn_right"></block> <block type="blink_left_light"></block> <block type="blink_right_light"></block> </category> <category name="2"> <block type="controls_if"></block> <block type="logic_compare"></block> <block type="logic_operation"></block> <block type="logic_negate"></block> </category> <category name="3"> <block type="base_delay"></block> <block type="controls_for"></block> <block type="controls_whileUntil"></block> </category> <category name="4"> <block type="math_number_digits"></block> <block type="math_number_tens"></block> <block type="math_arithmetic"></block> </block> </category> <category name="5" custom="VARIABLE"></category> <category name="6" custom="PROCEDURE"></category></xml><script> var blocklyArea = document.getElementById('blocklyArea'); var blocklyDiv = document.getElementById('blocklyDiv'); var workspace = Blockly.inject(blocklyDiv, {media: 'media/', toolbox: document.getElementById('toolbox')}); var onresize = function(e) { // Compute the absolute coordinates and dimensions of blocklyArea. var element = blocklyArea; var x = 0; var y = 0; do { x += element.offsetLeft; y += element.offsetTop; element = element.offsetParent; } while (element); // Position blocklyDiv over blocklyArea. blocklyDiv.style.left = x + 'px'; blocklyDiv.style.top = y + 'px'; blocklyDiv.style.width = blocklyArea.offsetWidth + 'px'; blocklyDiv.style.height = blocklyArea.offsetHeight + 'px'; }; window.addEventListener('resize', onresize, false); onresize(); function runCode() { // Generate Bitlash code and run it. var code = Blockly.Bitlash.workspaceToCode(workspace); try { Android.talkToArduino(code); } catch (e) { alert(e); } } <!--Functions for local backup and local restore. Used for rotation in future--> function backup_blocks(){ var xml = Blockly.Xml.workspaceToDom(Blockly.mainWorkspace); window.localStorage.setItem('data', Blockly.Xml.domToText(xml)); } function restore_blocks(){ if(localStorage.data != null){ var xml = Blockly.Xml.textToDom(window.localStorage.getItem('data')); Blockly.Xml.domToWorkspace(Blockly.mainWorkspace,xml); } } </script></body></html>
<!DOCTYPE html><html><head> <meta charset="utf-8"> <title>Mozi</title> <link rel="stylesheet" type="text/css" href="blocklyAreaCSS.css"> <script src="blockly_compressed.js"></script> <script src="blocks_compressed.js"></script> <script src="bitlash_compressed.js"></script> <script src="en.js"></script></head><body><table> <tr> <td id="blocklyArea"> </td> </tr></table><div id="blocklyDiv" style="position: relative"></div><xml id="toolbox" style="display: none"> <category name="1"> <block type="move_forward"></block> <block type="move_backward"></block> <block type="turn_left"></block> <block type="turn_right"></block> <block type="blink_left_light"></block> <block type="blink_right_light"></block> </category> <category name="2"> <block type="controls_if"></block> <block type="logic_compare"></block> <block type="logic_operation"></block> <block type="logic_negate"></block> </category> <category name="3"> <block type="base_delay"></block> <block type="controls_for"></block> <block type="controls_whileUntil"></block> </category> <category name="4"> <block type="math_number_digits"></block> <block type="math_number_tens"></block> <block type="math_arithmetic"></block> </block> </category> <category name="5" custom="VARIABLE"></category> <category name="6" custom="PROCEDURE"></category></xml><script> var blocklyArea = document.getElementById('blocklyArea'); var blocklyDiv = document.getElementById('blocklyDiv'); var workspace = Blockly.inject(blocklyDiv, {media: 'media/', toolbox: document.getElementById('toolbox')}); var onresize = function(e) { // Compute the absolute coordinates and dimensions of blocklyArea. var element = blocklyArea; var x = 0; var y = 0; do { x += element.offsetLeft; y += element.offsetTop; element = element.offsetParent; } while (element); // Position blocklyDiv over blocklyArea. blocklyDiv.style.left = x + 'px'; blocklyDiv.style.top = y + 'px'; blocklyDiv.style.width = blocklyArea.offsetWidth + 'px'; blocklyDiv.style.height = blocklyArea.offsetHeight + 'px'; }; window.addEventListener('resize', onresize, false); onresize(); function runCode() { // Generate Bitlash code and run it. var code = Blockly.Bitlash.workspaceToCode(workspace); try { Android.talkToArduino(code); } catch (e) { alert(e); } } <!--Functions for local backup and local restore. Used for rotation in future--> function backup_blocks(){ var xml = Blockly.Xml.workspaceToDom(Blockly.mainWorkspace); window.localStorage.setItem('data', Blockly.Xml.domToText(xml)); } function restore_blocks(){ if(localStorage.data != null){ var xml = Blockly.Xml.textToDom(window.localStorage.getItem('data')); Blockly.Xml.domToWorkspace(Blockly.mainWorkspace,xml); } } </script></body></html>
Expand Down
1 change: 1 addition & 0 deletions AccessRobot/app/src/main/assets/blockly/blocklyAreaCSS.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
html, body {
height: 100%;
width:100%;
margin: 0;
}
body {
Expand Down
4 changes: 3 additions & 1 deletion AccessRobot/app/src/main/res/drawable/mozi_bg.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
android:src="@drawable/mozi_app_bg"
android:tileMode="disabled" android:gravity="top" >
android:tileMode="disabled"
android:gravity="top"
>
</bitmap>
29 changes: 29 additions & 0 deletions AccessRobot/app/src/main/res/layout-sw320dp/activity_bluetooth.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<!--
Copyright 2013 The Android Open Source Project

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/sample_main_layout">

<FrameLayout
android:id="@+id/sample_content_fragment"
android:layout_weight="2"
android:layout_width="match_parent"
android:layout_height="0px" />

</LinearLayout>
24 changes: 24 additions & 0 deletions AccessRobot/app/src/main/res/layout-sw320dp/activity_build.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:background="#ffffff"
android:layout_height="match_parent"
android:orientation="vertical">

<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal|top"
android:gravity="center_horizontal|top"
android:scaleType="fitXY"
android:adjustViewBounds="true"
android:background="#ffffff"
android:src="@drawable/mozi_header_multi"/>

<VideoView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#ffffff"
android:id="@+id/videoView" />

</LinearLayout>
16 changes: 16 additions & 0 deletions AccessRobot/app/src/main/res/layout-sw320dp/activity_code.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="ksmaragh.c4q.nyc.accessrobot.Code">

<WebView
android:id="@+id/webView"
android:layout_width="match_parent"
android:layout_height="match_parent"/>

</RelativeLayout>
134 changes: 134 additions & 0 deletions AccessRobot/app/src/main/res/layout-sw320dp/activity_demo.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="8dp"
android:layout_marginLeft="4dp"
android:layout_marginRight="4dp"
android:layout_marginTop="28dp"
android:orientation="vertical">

<TextView
android:id="@+id/tv_instructions"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginBottom="40dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:gravity="center"
android:text="@string/instructions"
android:textColor="#0CABA1"
android:textSize="20sp" />

<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">

<at.markushi.ui.CircleButton
android:id="@+id/btn_connect"
android:layout_width="150dp"
android:layout_height="150dp"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_margin="8dp"
android:src="@drawable/robot"
app:cb_color="#0CABA1"
app:cb_pressedRingWidth="8dip" />

<net.steamcrafted.materialiconlib.MaterialIconView
android:id="@+id/btn_light_left"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_alignParentStart="true"
android:layout_marginStart="20dp"
android:layout_marginTop="4dp"
android:scaleType="center"
app:materialIcon="lightbulb"
app:materialIconColor="#0CABA1"
app:materialIconSize="20dp" />

<net.steamcrafted.materialiconlib.MaterialIconView
android:id="@+id/btn_move_forward"
android:layout_width="28dp"
android:layout_height="28dp"
android:layout_above="@id/btn_connect"
android:layout_centerHorizontal="true"
android:scaleType="center"
app:materialIcon="chevron_up"
app:materialIconColor="#0CABA1"
app:materialIconSize="28dp" />

<net.steamcrafted.materialiconlib.MaterialIconView
android:id="@+id/btn_light_right"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_alignParentEnd="true"
android:layout_marginEnd="20dp"
android:layout_marginTop="4dp"
android:scaleType="center"
app:materialIcon="lightbulb"
app:materialIconColor="#0CABA1"
app:materialIconSize="20dp" />

<net.steamcrafted.materialiconlib.MaterialIconView
android:id="@+id/btn_move_left"
android:layout_width="28dp"
android:layout_height="28dp"
android:layout_centerVertical="true"
android:layout_toStartOf="@id/btn_connect"
android:scaleType="center"
app:materialIcon="chevron_left"
app:materialIconColor="#0CABA1"
app:materialIconSize="28dp" />

<net.steamcrafted.materialiconlib.MaterialIconView
android:id="@+id/btn_move_right"
android:layout_width="28dp"
android:layout_height="28dp"
android:layout_centerVertical="true"
android:layout_toEndOf="@id/btn_connect"
android:scaleType="center"
app:materialIcon="chevron_right"
app:materialIconColor="#0CABA1"
app:materialIconSize="28dp" />

<net.steamcrafted.materialiconlib.MaterialIconView
android:id="@+id/btn_look_cute"
android:layout_width="28dp"
android:layout_height="28dp"
android:layout_alignParentStart="true"
android:layout_below="@id/btn_connect"
android:layout_marginStart="16dp"
android:scaleType="center"
app:materialIcon="emoticon_tongue"
app:materialIconColor="#0CABA1"
app:materialIconSize="20dp" />

<net.steamcrafted.materialiconlib.MaterialIconView
android:id="@+id/btn_move_backward"
android:layout_width="28dp"
android:layout_height="28dp"
android:layout_below="@id/btn_connect"
android:layout_centerHorizontal="true"
android:scaleType="center"
app:materialIcon="chevron_down"
app:materialIconColor="#0CABA1"
app:materialIconSize="28dp" />

<net.steamcrafted.materialiconlib.MaterialIconView
android:id="@+id/btn_stop"
android:layout_width="28dp"
android:layout_height="28dp"
android:layout_alignParentEnd="true"
android:layout_below="@id/btn_connect"
android:layout_marginEnd="16dp"
android:scaleType="center"
app:materialIcon="stop"
app:materialIconColor="#f44336"
app:materialIconSize="28dp" />

</RelativeLayout>

</LinearLayout>
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2014 The Android Open Source Project

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ffffff"
android:orientation="vertical"
>

<ListView
android:id="@+id/paired_devices"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="24dp"
android:background="#ffffff"
android:layout_weight="1"
/>


<ListView
android:id="@+id/new_devices"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#ffffff"
android:layout_weight="2"
/>

<Button
android:id="@+id/button_scan"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Scan for Mozi"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginTop="16dp"
android:layout_marginBottom="16dp"
android:textAllCaps="false"
android:textColor="#DF3A7C"
android:background="@drawable/button_pink"
android:textSize="20sp"/>

</LinearLayout>
71 changes: 71 additions & 0 deletions AccessRobot/app/src/main/res/layout-sw320dp/activity_learn.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
<?xml version="1.0" encoding="utf-8"?>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">

<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/mozi_app_bg">

<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="@drawable/dialog_bg"
android:orientation="vertical"
android:padding="12dp">

<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:src="@drawable/mozi_logo_type"
android:layout_marginBottom="18dp"
android:scaleType="fitCenter"/>

<Button
android:id="@+id/btn_learn_mozi_components"
style="@style/learn_buttons"
android:layout_width="200dp"
android:layout_height="36dp"
android:background="@drawable/button_pink"
android:stateListAnimator="@null"
android:text="@string/btn_mozi" />

<Button
android:id="@+id/btn_order_parts"
style="@style/learn_buttons"
android:layout_width="200dp"
android:layout_height="36dp"
android:layout_marginTop="12dp"
android:background="@drawable/button_orange"
android:stateListAnimator="@null"
android:text="@string/btn_order" />

<Button
android:id="@+id/btn_learn_assembly"
style="@style/learn_buttons"
android:layout_width="200dp"
android:layout_height="36dp"
android:layout_marginTop="12dp"
android:background="@drawable/button_yellow"
android:stateListAnimator="@null"
android:text="@string/btn_build" />

<Button
android:id="@+id/btn_learn_blockly"
style="@style/learn_buttons"
android:layout_width="200dp"
android:layout_height="36dp"
android:layout_marginTop="12dp"
android:background="@drawable/button_blue"
android:stateListAnimator="@null"
android:text="@string/btn_program" />

</LinearLayout>

</FrameLayout>

</LinearLayout>
Loading