Git Product home page Git Product logo

blockly-android's Introduction

The blockly-android project is no longer actively developed by the Google Blockly team. We will continue to review and accept pull requests. If you are looking to create a new Blockly-based app, we recommend using the web version in a WebView. We have also create an Android Studio demonstration project that does exactly this.

Blockly is a library for building drag-and-drop visual editors for JavaScript and other programming languages. Blockly for Android is a developer preview of Blockly's editor built with standard Android views and fragments, offering more responsive touch performance and easier integration in Android apps.

Blockly Turtle demo running on an Android tablet.

Get started building your own Android app using Blockly.

Google is proud to offer Blockly for Android for free and open source under the Apache License, version 2.0.

Blockly has an active developer forum. Please drop by and say hello. Show us your prototypes early; collectively we have a lot of experience and can offer hints which will save you time.

Help us focus our development efforts by telling us what you are doing with Blockly. The questionnaire only takes a few minutes and will help us better support the Blockly community.

Want to contribute? Great! First, read our guidelines for contributors.

How To Use

Add one of the following dependencies to your application's build.gradle.

dependencies {
    // Default (Lite)
    implementation 'com.google.blockly.android:blocklylib-vertical:<Blockly Version>'
    // Full Version (All code lanuage generators)
    implementation 'com.google.blockly.android:blocklylib-vertical:<Blockly Version>:full@aar'
    // Lite Version (Only JavaScript)
    implementation 'com.google.blockly.android:blocklylib-vertical:<Blockly Version>:lite@aar'
}

blockly-android's People

Contributors

aidayounesi avatar anmatanm avatar broder avatar chriscancompute avatar fenichel avatar geppy avatar mingway426 avatar picklesrus avatar rachel-fenichel avatar roboerikg avatar rohlfingt avatar sdierauf avatar shirletan avatar surinder83singh avatar thebrokenrail avatar traviho avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

blockly-android's Issues

Adapt highlight border width to zoom

Currently implemented with 9-patch files that scale with zoom. When the user zooms out, the border width scales down, making it harder to see potential connections when dragging.

Handle shadow blocks

Shadow blocks are supported.

  • Need UI assets
  • Need to add shadows to the turtle demo

Crash in Dragger.java line 246

We're somehow finding a connection candidate without a view associated with its block. This shouldn't be possible but it seems our view and model hierarchy can get out of sync.

02-29 17:14:54.574 5518-5518/com.google.blockly.demo D/AndroidRuntime: Shutting down VM
02-29 17:14:54.584 5518-5518/com.google.blockly.demo E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.google.blockly.demo, PID: 5518
java.lang.NullPointerException: Attempt to invoke virtual method 'void com.google.blockly.ui.BlockView.setHighlightedConnection(com.google.blockly.model.Connection)' on a null object reference
at com.google.blockly.control.Dragger.continueDragging(Dragger.java:246)
at com.google.blockly.control.Dragger$1.onDrag(Dragger.java:102)
at android.view.View.dispatchDragEvent(View.java:18321)
at android.view.ViewGroup.dispatchDragEvent(ViewGroup.java:1492)
at android.view.ViewGroup.dispatchDragEvent(ViewGroup.java:1441)
at android.view.ViewGroup.dispatchDragEvent(ViewGroup.java:1441)
at android.view.ViewGroup.dispatchDragEvent(ViewGroup.java:1441)
at android.view.ViewGroup.dispatchDragEvent(ViewGroup.java:1441)
at android.view.ViewGroup.dispatchDragEvent(ViewGroup.java:1441)
at android.view.ViewGroup.dispatchDragEvent(ViewGroup.java:1441)
at android.view.ViewGroup.dispatchDragEvent(ViewGroup.java:1441)
at android.view.ViewGroup.dispatchDragEvent(ViewGroup.java:1441)
at android.view.ViewGroup.dispatchDragEvent(ViewGroup.java:1441)
at android.view.ViewGroup.dispatchDragEvent(ViewGroup.java:1441)
at android.view.ViewGroup.dispatchDragEvent(ViewGroup.java:1441)
at android.view.ViewGroup.dispatchDragEvent(ViewGroup.java:1441)
at android.view.ViewRootImpl.handleDragEvent(ViewRootImpl.java:5073)
at android.view.ViewRootImpl.access$700(ViewRootImpl.java:99)
at android.view.ViewRootImpl$ViewRootHandler.handleMessage(ViewRootImpl.java:3271)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5221)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)

Narrow the available connections on floating/dragged block

In order to limit errant connections from occurring, especially in crowded workspaces, limit the connections available connections to the block's output, previous, first statement input, and any external inputs before the first statement. (This is a rough heuristic worthy of discussion.)

Dropdown options appear in a random order

The following JSON created options ordered 4, 2, 5, 3, 1. It should appear in the same order as the JSON.

{
"id": "move_up",
"message0": "move up %1",
"args0": [
{
"type": "field_dropdown",
"name": "SPACES",
"options": [
[
"1 space",
"1"
],
[
"2 spaces",
"2"
],
[
"3 spaces",
"3"
],
[
"4 spaces",
"4"
],
[
"5 spaces",
"5"
]
]
}
],
"previousStatement": null,
"nextStatement": null,
"colour": 160
}

Coordinate touch slop, max snap, and bump distances with zoom scale

"To clarify, this issue is to consider bumping blocks further when zoomed out to make it easier to figure out that it was bumped." - @RoboErikG

Example:
If zoomed out (i.e., all blocks render smaller), the touch size is effectively a larger number of workspace units. Thus, the workspace unit values of touch slop (distance before a drag is started) and snap/bump distance should also be inversely scaled by zoom. This ensures the sizes are relative to a touch size on the current view.

If zoomed in (i.e., all blocks render larger), the touch slop and snap distances should be short (in workspace units). However, the bump distance might remain the same as a zoom 1.0 bump, so it doesn't snap into place when dragged at zoom 1.0.

Drop location for trash does not account for zoom.

  1. Zoom out.
  2. Drag a block to the trash. The block drops behind the trash.
  3. Drag block to center of screen (while still zoomed in). Sometimes the block disappears into trash.

"We should have a dragEventListener on the trashView instead of doing screen location comparisons in the dragger code." - @rachel-fenichel

Views never release models.

All Block related view models currently have final references to their matching model object. As such view objects can never be reused with other models. (There are also edge concerns with old views accessing models, but the app developer would have to jump through some pretty significant hoops to access / re-add such views.)

Until any side effects are seen (assuming good programming practices in the host app), this is an extremely low-priority bug.

  • Blocks
  • Inputs
  • Fields

Support TrashFragment that doesn't close.

If the trash fragment is always visible, it should be drop location. This alleviates the need for a trash can on the workspace. This, in turn, affects the placement of the zoom buttons.

Probably depends on a drag shadow for dragging outside the workspace, first.

Make all model classes Observable

If models are observable, then views wouldn't rely on the controller for changes. Apps could manipulate the model objects more directly, without the view getting out of sync.

Remove FieldWorkspaceParams

We aren't actually using FieldWorkspaceParams for everything and they were a premature optimization. We should remove them and all other WorkspaceParams.

Support variables in the toolbox

Full spec fleshed out here google/blockly#446

  • Support custom VARIABLES toolbox category.
  • Support creating variables.
  • Support deleting variables.
  • Support renaming variables.
  • Support dynamic creation of variable blocks when they're added/removed.

Refactor field views to inflate from a layout

To make it easier to customize fields we should refactor so that they can be inflated from a layout (through methods on the WorkspaceHelper). The field can then be passed in to the view after inflation to bind it to the data.

Refactor generator into client Class and Service class

The Generator code should be refactored into BlocklyGenerator and BlocklyGeneratorService.

BlocklyGenerator is the client side class and should be responsible for connecting to the service and wrapping calls to the service (and contains the callback classes). This code is currently part of BlocklySectionsActivity but should be pulled out into its own class.

BlocklyGeneratorService is currently named CodeGeneratorService and shouldn't need many changes.

Create test Activity with Toolbox that does not overlap the workspace.

Add a demo Activity without a hideable Toolbox.

  • Verify clicking on blocks that do not overlap the workspace create their duplicates in the closest available workspace location. Ideally with animation.
  • Verify dragging blocks to parts of the screen that are not the Workspace results in a cancelled action.

Move save/load bottlenecks off the main thread

  • Pull disk IO out into a separate helper class (explicit save and load)
  • Make disk IO happen in an AsyncTask
  • Stress test (de)serialization of workspace
    • If this can take too long consider options for moving serialization off the main thread.
      • Potential option is once events are in send all events to the background service and perform serialization on a copy there.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.