Git Product home page Git Product logo

blockly-android's Issues

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)

Remove FieldWorkspaceParams

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

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

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.

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.

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.

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.

Handle shadow blocks

Shadow blocks are supported.

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

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.

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.

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.

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.)

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

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.

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.