Updated gradle build files
Project: http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/commit/962c8154 Tree: http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/tree/962c8154 Diff: http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/diff/962c8154 Branch: refs/heads/master Commit: 962c815496587c7416955a63f7543a197a2b1907 Parents: 1e9c5cf Author: larrytech7 <larrya...@gmail.com> Authored: Thu Aug 13 18:11:39 2015 +0100 Committer: larrytech7 <larrya...@gmail.com> Committed: Thu Aug 13 18:11:39 2015 +0100 ---------------------------------------------------------------------- app/build.gradle | 8 +- .../com/tavernamobile/ApplicationTest.java | 39 --- .../customviews/WorkflowPreviewImageView.java | 292 ++++++++++++++++++- build/intermediates/dex-cache/cache.xml | 32 +- build/intermediates/model_data.bin | Bin 116572 -> 118988 bytes libs/MaterialDesignLib/MaterialDesignLib.iml | 16 - 6 files changed, 319 insertions(+), 68 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/blob/962c8154/app/build.gradle ---------------------------------------------------------------------- diff --git a/app/build.gradle b/app/build.gradle index 60d4b2d..66d1e2d 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -21,11 +21,15 @@ android { } } } - +repositories { + jcenter() +} dependencies { - compile fileTree(dir: 'libs', include: ['*.jar']) + compile fileTree(include: ['*.jar'], dir: 'libs') compile 'com.android.support:appcompat-v7:22.0.0' compile 'com.android.support:cardview-v7:22.0.0' compile 'com.android.support:recyclerview-v7:22.0.0' compile 'com.android.support:support-v4:22.0.0' + compile files('libs/dropbox-android-sdk-1.6.3.jar') + } http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/blob/962c8154/app/src/androidTest/java/mobile/taverna/apache/com/tavernamobile/ApplicationTest.java ---------------------------------------------------------------------- diff --git a/app/src/androidTest/java/mobile/taverna/apache/com/tavernamobile/ApplicationTest.java b/app/src/androidTest/java/mobile/taverna/apache/com/tavernamobile/ApplicationTest.java deleted file mode 100644 index ae2557f..0000000 --- a/app/src/androidTest/java/mobile/taverna/apache/com/tavernamobile/ApplicationTest.java +++ /dev/null @@ -1,39 +0,0 @@ -package mobile.taverna.apache.com.tavernamobile; - -/* -* Apache Taverna Mobile -* Copyright 2015 The Apache Software Foundation - -* This product includes software developed at -* The Apache Software Foundation (http://www.apache.org/). - -* Licensed to the Apache Software Foundation (ASF) under one -* or more contributor license agreements. See the NOTICE file -* distributed with this work for additional information -* regarding copyright ownership. The ASF licenses this file -* to you 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. -*/ - - -import android.app.Application; -import android.test.ApplicationTestCase; - -/** - * <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a> - */ -public class ApplicationTest extends ApplicationTestCase<Application> { - public ApplicationTest() { - super(Application.class); - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/blob/962c8154/app/src/main/java/org/apache/taverna/mobile/customviews/WorkflowPreviewImageView.java ---------------------------------------------------------------------- diff --git a/app/src/main/java/org/apache/taverna/mobile/customviews/WorkflowPreviewImageView.java b/app/src/main/java/org/apache/taverna/mobile/customviews/WorkflowPreviewImageView.java index c34c680..5f5276e 100644 --- a/app/src/main/java/org/apache/taverna/mobile/customviews/WorkflowPreviewImageView.java +++ b/app/src/main/java/org/apache/taverna/mobile/customviews/WorkflowPreviewImageView.java @@ -1,7 +1,295 @@ package org.apache.taverna.mobile.customviews; +/** + * Apache Taverna Mobile + * Copyright 2015 The Apache Software Foundation + + * This product includes software developed at + * The Apache Software Foundation (http://www.apache.org/). + + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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. + */ + +import android.content.Context; +import android.graphics.Bitmap; +import android.graphics.Matrix; +import android.graphics.PointF; +import android.util.AttributeSet; +import android.view.MotionEvent; +import android.view.ScaleGestureDetector; +import android.view.View; +import android.widget.ImageView; /** - * Created by root on 6/29/15. + * Created by Akah Harvey on 6/29/15. */ -public class WorkflowPreviewImageView { +public class WorkflowPreviewImageView extends ImageView{ + Matrix matrix = new Matrix(); + + static final int NONE = 0; + static final int DRAG = 1; + static final int ZOOM = 2; + static final int CLICK = 3; + int mode = NONE; + + PointF last = new PointF(); + PointF start = new PointF(); + float minScale = 1f; + float maxScale = 4f; + float[] m; + + float redundantXSpace, redundantYSpace; + float width, height; + float saveScale = 1f; + float right, bottom, origWidth, origHeight, bmWidth, bmHeight; + + ScaleGestureDetector mScaleDetector; + Context context; + + public WorkflowPreviewImageView(Context context, AttributeSet attr) + { + super(context, attr); + super.setClickable(true); + this.context = context; + mScaleDetector = new ScaleGestureDetector(context, new ScaleListener()); + matrix.setTranslate(1f, 1f); + m = new float[9]; + setImageMatrix(matrix); + setScaleType(ScaleType.MATRIX); + + setOnTouchListener(new OnTouchListener() + { + + @Override + public boolean onTouch(View v, MotionEvent event) + { + mScaleDetector.onTouchEvent(event); + + matrix.getValues(m); + float x = m[Matrix.MTRANS_X]; + float y = m[Matrix.MTRANS_Y]; + PointF curr = new PointF(event.getX(), event.getY()); + + switch (event.getAction()) + { + //when one finger is touching + //set the mode to DRAG + case MotionEvent.ACTION_DOWN: + last.set(event.getX(), event.getY()); + start.set(last); + mode = DRAG; + break; + //when two fingers are touching + //set the mode to ZOOM + case MotionEvent.ACTION_POINTER_DOWN: + last.set(event.getX(), event.getY()); + start.set(last); + mode = ZOOM; + break; + //when a finger moves + //If mode is applicable move image + case MotionEvent.ACTION_MOVE: + //if the mode is ZOOM or + //if the mode is DRAG and already zoomed + if (mode == ZOOM || (mode == DRAG && saveScale > minScale)) + { + float deltaX = curr.x - last.x;// x difference + float deltaY = curr.y - last.y;// y difference + float scaleWidth = Math.round(origWidth * saveScale);// width after applying current scale + float scaleHeight = Math.round(origHeight * saveScale);// height after applying current scale + //if scaleWidth is smaller than the views width + //in other words if the image width fits in the view + //limit left and right movement + if (scaleWidth < width) + { + deltaX = 0; + if (y + deltaY > 0) + deltaY = -y; + else if (y + deltaY < -bottom) + deltaY = -(y + bottom); + } + //if scaleHeight is smaller than the views height + //in other words if the image height fits in the view + //limit up and down movement + else if (scaleHeight < height) + { + deltaY = 0; + if (x + deltaX > 0) + deltaX = -x; + else if (x + deltaX < -right) + deltaX = -(x + right); + } + //if the image doesnt fit in the width or height + //limit both up and down and left and right + else + { + if (x + deltaX > 0) + deltaX = -x; + else if (x + deltaX < -right) + deltaX = -(x + right); + + if (y + deltaY > 0) + deltaY = -y; + else if (y + deltaY < -bottom) + deltaY = -(y + bottom); + } + //move the image with the matrix + matrix.postTranslate(deltaX, deltaY); + //set the last touch location to the current + last.set(curr.x, curr.y); + } + break; + //first finger is lifted + case MotionEvent.ACTION_UP: + mode = NONE; + int xDiff = (int) Math.abs(curr.x - start.x); + int yDiff = (int) Math.abs(curr.y - start.y); + if (xDiff < CLICK && yDiff < CLICK) + performClick(); + break; + // second finger is lifted + case MotionEvent.ACTION_POINTER_UP: + mode = NONE; + break; + } + setImageMatrix(matrix); + invalidate(); + return true; + } + + }); + } + + @Override + public void setImageBitmap(Bitmap bm) + { + super.setImageBitmap(bm); + bmWidth = bm.getWidth(); + bmHeight = bm.getHeight(); + } + + public void setMaxZoom(float x) + { + maxScale = x; + } + + private class ScaleListener extends ScaleGestureDetector.SimpleOnScaleGestureListener + { + + @Override + public boolean onScaleBegin(ScaleGestureDetector detector) + { + mode = ZOOM; + return true; + } + + @Override + public boolean onScale(ScaleGestureDetector detector) + { + float mScaleFactor = detector.getScaleFactor(); + float origScale = saveScale; + saveScale *= mScaleFactor; + if (saveScale > maxScale) + { + saveScale = maxScale; + mScaleFactor = maxScale / origScale; + } + else if (saveScale < minScale) + { + saveScale = minScale; + mScaleFactor = minScale / origScale; + } + right = width * saveScale - width - (2 * redundantXSpace * saveScale); + bottom = height * saveScale - height - (2 * redundantYSpace * saveScale); + if (origWidth * saveScale <= width || origHeight * saveScale <= height) + { + matrix.postScale(mScaleFactor, mScaleFactor, width / 2, height / 2); + if (mScaleFactor < 1) + { + matrix.getValues(m); + float x = m[Matrix.MTRANS_X]; + float y = m[Matrix.MTRANS_Y]; + if (mScaleFactor < 1) + { + if (Math.round(origWidth * saveScale) < width) + { + if (y < -bottom) + matrix.postTranslate(0, -(y + bottom)); + else if (y > 0) + matrix.postTranslate(0, -y); + } + else + { + if (x < -right) + matrix.postTranslate(-(x + right), 0); + else if (x > 0) + matrix.postTranslate(-x, 0); + } + } + } + } + else + { + matrix.postScale(mScaleFactor, mScaleFactor, detector.getFocusX(), detector.getFocusY()); + matrix.getValues(m); + float x = m[Matrix.MTRANS_X]; + float y = m[Matrix.MTRANS_Y]; + if (mScaleFactor < 1) { + if (x < -right) + matrix.postTranslate(-(x + right), 0); + else if (x > 0) + matrix.postTranslate(-x, 0); + if (y < -bottom) + matrix.postTranslate(0, -(y + bottom)); + else if (y > 0) + matrix.postTranslate(0, -y); + } + } + return true; + } + } + + @Override + protected void onMeasure (int widthMeasureSpec, int heightMeasureSpec) + { + super.onMeasure(widthMeasureSpec, heightMeasureSpec); + width = MeasureSpec.getSize(widthMeasureSpec); + height = MeasureSpec.getSize(heightMeasureSpec); + //Fit to screen. + float scale; + float scaleX = width / bmWidth; + float scaleY = height / bmHeight; + scale = Math.min(scaleX, scaleY); + matrix.setScale(scale, scale); + setImageMatrix(matrix); + saveScale = 1f; + + // Center the image + redundantYSpace = height - (scale * bmHeight) ; + redundantXSpace = width - (scale * bmWidth); + redundantYSpace /= 2; + redundantXSpace /= 2; + + matrix.postTranslate(redundantXSpace, redundantYSpace); + + origWidth = width - 2 * redundantXSpace; + origHeight = height - 2 * redundantYSpace; + right = width * saveScale - width - (2 * redundantXSpace * saveScale); + bottom = height * saveScale - height - (2 * redundantYSpace * saveScale); + setImageMatrix(matrix); + } } http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/blob/962c8154/build/intermediates/dex-cache/cache.xml ---------------------------------------------------------------------- diff --git a/build/intermediates/dex-cache/cache.xml b/build/intermediates/dex-cache/cache.xml index ab3a83d..8c5384d 100644 --- a/build/intermediates/dex-cache/cache.xml +++ b/build/intermediates/dex-cache/cache.xml @@ -2,25 +2,25 @@ <items version="2" > <item - jar="/root/Desktop/AndroidLab/TavernaMobile2/app/build/intermediates/exploded-aar/com.android.support/support-v4/22.0.0/libs/internal_impl-22.0.0.jar" + jar="/root/Desktop/AndroidLab/TavernaMobile2/app/build/intermediates/exploded-aar/com.android.support/support-v4/22.0.0/classes.jar" jumboMode="false" revision="21.1.2" - sha1="b5b92f469d515a13d778900f6d50c03d12f35504"> - <dex dex="/root/Desktop/AndroidLab/TavernaMobile2/app/build/intermediates/pre-dexed/debug/internal_impl-22.0.0-ab39a2263976cb0fd278360818acc6d173a8d8e0.jar" /> + sha1="4e86306289ace4aa0cfec44a05ed2b410d36989d"> + <dex dex="/root/Desktop/AndroidLab/TavernaMobile2/app/build/intermediates/pre-dexed/debug/classes-be9904e841d6b70d2ec429ffa7d3732bb544b8ab.jar" /> </item> <item - jar="/root/Desktop/android-studio/sdk/extras/android/m2repository/com/android/support/support-annotations/22.0.0/support-annotations-22.0.0.jar" + jar="/root/Desktop/AndroidLab/TavernaMobile2/app/libs/dropbox-android-sdk-1.6.3.jar" jumboMode="false" revision="21.1.2" - sha1="685d0b2c590447e85284ed84712cb363ba04eff8"> - <dex dex="/root/Desktop/AndroidLab/TavernaMobile2/app/build/intermediates/pre-dexed/debug/support-annotations-22.0.0-2f3cb2807dead79ef0327bdd9269035b879fdd27.jar" /> + sha1="986e7a58e925c6f91b88ae8d3224a0550b65acc7"> + <dex dex="/root/Desktop/AndroidLab/TavernaMobile2/app/build/intermediates/pre-dexed/debug/dropbox-android-sdk-1.6.3-49f85fff2c0dd0aeb7ee59e23d24ce3535e37e81.jar" /> </item> <item - jar="/root/Desktop/AndroidLab/TavernaMobile2/app/build/intermediates/exploded-aar/com.android.support/support-v4/22.0.0/classes.jar" + jar="/root/Desktop/AndroidLab/TavernaMobile2/app/build/intermediates/exploded-aar/com.android.support/support-v4/22.0.0/libs/internal_impl-22.0.0.jar" jumboMode="false" revision="21.1.2" - sha1="4e86306289ace4aa0cfec44a05ed2b410d36989d"> - <dex dex="/root/Desktop/AndroidLab/TavernaMobile2/app/build/intermediates/pre-dexed/debug/classes-be9904e841d6b70d2ec429ffa7d3732bb544b8ab.jar" /> + sha1="b5b92f469d515a13d778900f6d50c03d12f35504"> + <dex dex="/root/Desktop/AndroidLab/TavernaMobile2/app/build/intermediates/pre-dexed/debug/internal_impl-22.0.0-ab39a2263976cb0fd278360818acc6d173a8d8e0.jar" /> </item> <item jar="/root/Desktop/AndroidLab/TavernaMobile2/app/build/intermediates/exploded-aar/com.android.support/recyclerview-v7/22.0.0/classes.jar" @@ -44,6 +44,13 @@ <dex dex="/root/Desktop/AndroidLab/TavernaMobile2/app/build/intermediates/pre-dexed/debug/simple-xml-2.7.1-0337a02c2c7a819ce7d4f1cb9e7af39ace3fc996.jar" /> </item> <item + jar="/root/Desktop/android-studio/sdk/extras/android/m2repository/com/android/support/support-annotations/22.0.0/support-annotations-22.0.0.jar" + jumboMode="false" + revision="21.1.2" + sha1="685d0b2c590447e85284ed84712cb363ba04eff8"> + <dex dex="/root/Desktop/AndroidLab/TavernaMobile2/app/build/intermediates/pre-dexed/debug/support-annotations-22.0.0-2f3cb2807dead79ef0327bdd9269035b879fdd27.jar" /> + </item> + <item jar="/root/Desktop/AndroidLab/TavernaMobile2/app/build/intermediates/exploded-aar/com.android.support/appcompat-v7/22.0.0/classes.jar" jumboMode="false" revision="21.1.2" @@ -57,5 +64,12 @@ sha1="11842de6a309c447b3a3d60d73ad637a87c58994"> <dex dex="/root/Desktop/AndroidLab/TavernaMobile2/app/build/intermediates/pre-dexed/debug/classes-2dbcae8b037134953fc4e3eb3645a66e2931661a.jar" /> </item> + <item + jar="/root/Desktop/AndroidLab/TavernaMobile2/app/libs/json_simple-1.1.jar" + jumboMode="false" + revision="21.1.2" + sha1="5e303a03d04e6788dddfa3655272580ae0fc13bb"> + <dex dex="/root/Desktop/AndroidLab/TavernaMobile2/app/build/intermediates/pre-dexed/debug/json_simple-1.1-c6f2833f7d87dc082af9be3e409fbd98def079fd.jar" /> + </item> </items> http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/blob/962c8154/build/intermediates/model_data.bin ---------------------------------------------------------------------- diff --git a/build/intermediates/model_data.bin b/build/intermediates/model_data.bin index 31c35f8..79693db 100644 Binary files a/build/intermediates/model_data.bin and b/build/intermediates/model_data.bin differ http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/blob/962c8154/libs/MaterialDesignLib/MaterialDesignLib.iml ---------------------------------------------------------------------- diff --git a/libs/MaterialDesignLib/MaterialDesignLib.iml b/libs/MaterialDesignLib/MaterialDesignLib.iml deleted file mode 100644 index 7b035b9..0000000 --- a/libs/MaterialDesignLib/MaterialDesignLib.iml +++ /dev/null @@ -1,16 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<module external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/../.." external.system.id="GRADLE" external.system.module.group="TavernaMobile2" external.system.module.version="unspecified" type="JAVA_MODULE" version="4"> - <component name="FacetManager"> - <facet type="android-gradle" name="Android-Gradle"> - <configuration> - <option name="GRADLE_PROJECT_PATH" value=":MaterialDesignLib" /> - </configuration> - </facet> - </component> - <component name="NewModuleRootManager" inherit-compiler-output="true"> - <exclude-output /> - <orderEntry type="inheritedJdk" /> - <orderEntry type="sourceFolder" forTests="false" /> - </component> -</module> -