Skip to content

Commit

Permalink
Split blocklylib into three modules:
Browse files Browse the repository at this point in the history
  blocklylib: the core of the code that is not dependent on block
rendering.
  blocklylib-vertical: BlockViewFactory with views for vertical stacking
blocks.  Developers wanting to make new block render algorithms should
start here.  It includes all the necessary resources.
  blocklytest: All test class. Because vertical is our only block
rendering implementation, almost all tests depend on it, for now.

Additionally, the root package is now com.google.blockly.android.  Some
classes changed classes within that.

TODO: Replace broken styles with styled layout XML.
  • Loading branch information
AnmAtAnm committed Mar 25, 2016
1 parent af59295 commit 8ca2390
Show file tree
Hide file tree
Showing 252 changed files with 2,967 additions and 1,811 deletions.
3 changes: 1 addition & 2 deletions blocklydemo/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ android {
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
Expand All @@ -38,5 +37,5 @@ dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.0'
compile project(':blocklylib')
compile project(':blocklylib-vertical')
}
4 changes: 2 additions & 2 deletions blocklydemo/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!--
~ Copyright 2015 Google Inc. All Rights Reserved.
~ Copyright 2015 Google Inc. All Rights Reserved.
~ 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
Expand All @@ -14,7 +14,7 @@
-->

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.google.blockly.demo"
package="com.google.blockly.android.demo"
xmlns:tools="http://schemas.android.com/tools">
<application
tools:replace="android:theme"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,22 @@
* limitations under the License.
*/

package com.google.blockly.demo;
package com.google.blockly.android.demo;

import android.support.annotation.NonNull;
import android.view.MenuItem;
import android.widget.ArrayAdapter;
import android.widget.ListAdapter;
import android.widget.Toast;

import com.google.blockly.BlocklySectionsActivity;
import com.google.blockly.LoggingCodeGeneratorCallback;
import com.google.blockly.MockBlocksProvider;
import com.google.blockly.android.BlocklySectionsActivity;
import com.google.blockly.android.codegen.CodeGenerationRequest;
import com.google.blockly.android.codegen.LoggingCodeGeneratorCallback;
import com.google.blockly.android.MockBlocksProvider;
import com.google.blockly.android.ui.BlockViewFactory;
import com.google.blockly.android.ui.WorkspaceHelper;
import com.google.blockly.android.ui.vertical.VerticalBlockViewFactory;
import com.google.blockly.model.Block;
import com.google.blockly.utils.CodeGenerationRequest;

import java.io.IOException;
import java.util.ArrayList;
Expand Down Expand Up @@ -110,7 +113,7 @@ private void loadSpaghetti() {
"sample_sections/workspace_spaghetti.xml"));
} catch (IOException e) {
Toast.makeText(getApplicationContext(),
com.google.blockly.R.string.toast_workspace_file_not_found,
R.string.toast_workspace_file_not_found,
Toast.LENGTH_LONG).show();
}
}
Expand Down Expand Up @@ -141,6 +144,11 @@ protected List<String> getGeneratorsJsPaths() {
return paths;
}

@Override
public BlockViewFactory onCreateBlockViewFactory(WorkspaceHelper helper) {
return new VerticalBlockViewFactory(this, helper);
}

@NonNull
@Override
protected void onLoadInitialWorkspace() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,16 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.blockly.demo;
package com.google.blockly.android.demo;

import android.support.annotation.NonNull;

import com.google.blockly.AbstractBlocklyActivity;
import com.google.blockly.LoggingCodeGeneratorCallback;
import com.google.blockly.utils.CodeGenerationRequest;
import com.google.blockly.android.AbstractBlocklyActivity;
import com.google.blockly.android.codegen.CodeGenerationRequest;
import com.google.blockly.android.codegen.LoggingCodeGeneratorCallback;
import com.google.blockly.android.ui.BlockViewFactory;
import com.google.blockly.android.ui.WorkspaceHelper;
import com.google.blockly.android.ui.vertical.VerticalBlockViewFactory;

import java.util.Arrays;
import java.util.List;
Expand Down Expand Up @@ -61,6 +64,11 @@ protected List<String> getGeneratorsJsPaths() {
return JAVASCRIPT_GENERATORS;
}

@Override
public BlockViewFactory onCreateBlockViewFactory(WorkspaceHelper helper) {
return new VerticalBlockViewFactory(this, helper);
}

@NonNull
@Override
protected CodeGenerationRequest.CodeGeneratorCallback getCodeGenerationCallback() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,19 @@
* limitations under the License.
*/

package com.google.blockly.demo;
package com.google.blockly.android.demo;

import android.os.Bundle;
import android.os.Handler;
import android.support.annotation.NonNull;
import android.view.View;
import android.widget.TextView;

import com.google.blockly.AbstractBlocklyActivity;
import com.google.blockly.utils.CodeGenerationRequest;
import com.google.blockly.android.AbstractBlocklyActivity;
import com.google.blockly.android.codegen.CodeGenerationRequest;
import com.google.blockly.android.ui.BlockViewFactory;
import com.google.blockly.android.ui.WorkspaceHelper;
import com.google.blockly.android.ui.vertical.VerticalBlockViewFactory;

import java.util.ArrayList;
import java.util.List;
Expand Down Expand Up @@ -85,6 +88,11 @@ protected List<String> getGeneratorsJsPaths() {
return paths;
}

@Override
public BlockViewFactory onCreateBlockViewFactory(WorkspaceHelper helper) {
return new VerticalBlockViewFactory(this, helper);
}

@NonNull
@Override
protected CodeGenerationRequest.CodeGeneratorCallback getCodeGenerationCallback() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,16 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.blockly.demo;
package com.google.blockly.android.demo;

import android.support.annotation.NonNull;

import com.google.blockly.AbstractBlocklyActivity;
import com.google.blockly.LoggingCodeGeneratorCallback;
import com.google.blockly.utils.CodeGenerationRequest;
import com.google.blockly.android.AbstractBlocklyActivity;
import com.google.blockly.android.codegen.CodeGenerationRequest;
import com.google.blockly.android.codegen.LoggingCodeGeneratorCallback;
import com.google.blockly.android.ui.BlockViewFactory;
import com.google.blockly.android.ui.WorkspaceHelper;
import com.google.blockly.android.ui.vertical.VerticalBlockViewFactory;

import java.util.ArrayList;
import java.util.List;
Expand Down Expand Up @@ -54,6 +57,11 @@ protected List<String> getGeneratorsJsPaths() {
return paths;
}

@Override
public BlockViewFactory onCreateBlockViewFactory(WorkspaceHelper helper) {
return new VerticalBlockViewFactory(this, helper);
}

@NonNull
@Override
protected CodeGenerationRequest.CodeGeneratorCallback getCodeGenerationCallback() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* limitations under the License.
*/

package com.google.blockly.demo;
package com.google.blockly.android.demo;

import android.os.Build;
import android.os.Handler;
Expand All @@ -26,9 +26,12 @@
import android.widget.ListAdapter;
import android.widget.Toast;

import com.google.blockly.BlocklySectionsActivity;
import com.google.blockly.android.BlocklySectionsActivity;
import com.google.blockly.android.codegen.CodeGenerationRequest;
import com.google.blockly.android.ui.BlockViewFactory;
import com.google.blockly.android.ui.WorkspaceHelper;
import com.google.blockly.android.ui.vertical.VerticalBlockViewFactory;
import com.google.blockly.util.JavascriptUtil;
import com.google.blockly.utils.CodeGenerationRequest;

import java.util.Arrays;
import java.util.List;
Expand Down Expand Up @@ -110,6 +113,11 @@ protected String getToolboxContentsXmlPath() {
return "turtle/" + LEVEL_TOOLBOX[getCurrentSectionIndex()];
}

@Override
public BlockViewFactory onCreateBlockViewFactory(WorkspaceHelper helper) {
return new VerticalBlockViewFactory(this, helper);
}

@Override
protected void onInitBlankWorkspace() {
// TODO: (#22) Remove this override when variables are supported properly
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +13,24 @@
* limitations under the License.
*/

package com.google.blockly.demo;
package com.google.blockly.android.demo;

import android.os.Build;
import android.os.Handler;
import android.support.annotation.NonNull;
import android.util.Log;
import android.view.View;
import android.webkit.WebChromeClient;
import android.webkit.WebView;
import android.widget.Toast;

import com.google.blockly.AbstractBlocklyActivity;
import com.google.blockly.LoggingCodeGeneratorCallback;
import com.google.blockly.util.JavascriptUtil;
import com.google.blockly.utils.CodeGenerationRequest;
import com.google.blockly.android.AbstractBlocklyActivity;
import com.google.blockly.android.codegen.CodeGenerationRequest;
import com.google.blockly.android.codegen.LoggingCodeGeneratorCallback;
import com.google.blockly.android.ui.BlockViewFactory;
import com.google.blockly.android.ui.WorkspaceHelper;
import com.google.blockly.android.ui.vertical.VerticalBlockViewFactory;

import java.util.Arrays;
import java.util.List;


/**
* Demo app with the Blockly Games turtle game in a webview.
*/
Expand Down Expand Up @@ -85,6 +83,11 @@ protected String getToolboxContentsXmlPath() {
return "sample_sections/level_3/toolbox.xml";
}

@Override
public BlockViewFactory onCreateBlockViewFactory(WorkspaceHelper helper) {
return new VerticalBlockViewFactory(this, helper);
}

@Override
protected View onCreateContentView(int parentId) {
View root = getLayoutInflater().inflate(R.layout.turtle_content, null);
Expand Down
File renamed without changes.
7 changes: 0 additions & 7 deletions blocklylib/build.gradle → blocklylib-core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ android {
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
// To generate code coverage run './gradlew connectedCheck'.
Expand All @@ -33,10 +32,4 @@ dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.android.support:recyclerview-v7:23.0.+'
androidTestCompile 'com.google.dexmaker:dexmaker:1.2'
androidTestCompile 'com.google.dexmaker:dexmaker-mockito:1.2'

// For UI testing with Espresso.
androidTestCompile 'com.android.support.test:runner:0.4.1'
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.1'
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.google.blockly">
package="com.google.blockly.android">

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
Expand All @@ -13,16 +13,8 @@
android:supportsRtl="true" >

<service
android:name=".CodeGeneratorService"
android:name=".codegen.CodeGeneratorService"
android:exported="false"/>

<!-- Used for testing. TODO(#42): Move to testing specific manifest. -->
<activity
android:name=".BlocklyTestActivity"
android:label="@string/app_name" />
<activity
android:name=".TestWorkspaceViewActivity"
android:label="@string/app_name" />
</application>

</manifest>
File renamed without changes.
Loading

0 comments on commit 8ca2390

Please sign in to comment.