Commit 4829118e by Sebastián Collado Montañez

Merge branch 'develop' of http://scm.ujaen.es/softuno/pictogram into develop

parents ed935499 5dca384a
Showing with 1266 additions and 86 deletions
...@@ -64,7 +64,7 @@ public final class PCBcontext { ...@@ -64,7 +64,7 @@ public final class PCBcontext {
Log.i(PCBcontext.class.getCanonicalName(), "User set at student " + student.get_name_stu()); Log.i(PCBcontext.class.getCanonicalName(), "User set at student " + student.get_name_stu());
wrapper.setToken(token); wrapper.setToken(token);
pcbdb = new PCBDBHelper(null, 1, student); pcbdb = new PCBDBHelper(null, 2, student);
pcbdb.user_online(token!=null); pcbdb.user_online(token!=null);
room = new Room(); room = new Room();
actionLog = new ActionLog(); actionLog = new ActionLog();
......
...@@ -34,6 +34,9 @@ android { ...@@ -34,6 +34,9 @@ android {
resValue "string", "server", "https://pre.yottacode.com" resValue "string", "server", "https://pre.yottacode.com"
resValue "bool", "ssl_connect", "true" resValue "bool", "ssl_connect", "true"
} }
LocalFlavor {
resValue "string", "server", "http://192.168.1.35:1337"
resValue "bool", "ssl_connect", "false" }
} }
} }
......
...@@ -41,13 +41,6 @@ ...@@ -41,13 +41,6 @@
<sourceFolder url="file://$MODULE_DIR$/src/DevFlavorDebug/java" isTestSource="false" /> <sourceFolder url="file://$MODULE_DIR$/src/DevFlavorDebug/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/DevFlavorDebug/rs" isTestSource="false" /> <sourceFolder url="file://$MODULE_DIR$/src/DevFlavorDebug/rs" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/DevFlavorDebug/shaders" isTestSource="false" /> <sourceFolder url="file://$MODULE_DIR$/src/DevFlavorDebug/shaders" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/androidTest/DevFlavor/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/androidTest/DevFlavor/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/androidTest/DevFlavor/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/androidTest/DevFlavor/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/apt/androidTest/DevFlavor/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/androidTest/DevFlavor/debug" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/androidTest/DevFlavor/debug" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testDevFlavorDebug/res" type="java-test-resource" /> <sourceFolder url="file://$MODULE_DIR$/src/testDevFlavorDebug/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testDevFlavorDebug/resources" type="java-test-resource" /> <sourceFolder url="file://$MODULE_DIR$/src/testDevFlavorDebug/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testDevFlavorDebug/assets" type="java-test-resource" /> <sourceFolder url="file://$MODULE_DIR$/src/testDevFlavorDebug/assets" type="java-test-resource" />
...@@ -55,6 +48,13 @@ ...@@ -55,6 +48,13 @@
<sourceFolder url="file://$MODULE_DIR$/src/testDevFlavorDebug/java" isTestSource="true" /> <sourceFolder url="file://$MODULE_DIR$/src/testDevFlavorDebug/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDevFlavorDebug/rs" isTestSource="true" /> <sourceFolder url="file://$MODULE_DIR$/src/testDevFlavorDebug/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDevFlavorDebug/shaders" isTestSource="true" /> <sourceFolder url="file://$MODULE_DIR$/src/testDevFlavorDebug/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/androidTest/DevFlavor/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/androidTest/DevFlavor/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/androidTest/DevFlavor/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/androidTest/DevFlavor/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/apt/androidTest/DevFlavor/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/androidTest/DevFlavor/debug" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/androidTest/DevFlavor/debug" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/DevFlavor/res" type="java-resource" /> <sourceFolder url="file://$MODULE_DIR$/src/DevFlavor/res" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/DevFlavor/resources" type="java-resource" /> <sourceFolder url="file://$MODULE_DIR$/src/DevFlavor/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/DevFlavor/assets" type="java-resource" /> <sourceFolder url="file://$MODULE_DIR$/src/DevFlavor/assets" type="java-resource" />
...@@ -62,13 +62,6 @@ ...@@ -62,13 +62,6 @@
<sourceFolder url="file://$MODULE_DIR$/src/DevFlavor/java" isTestSource="false" /> <sourceFolder url="file://$MODULE_DIR$/src/DevFlavor/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/DevFlavor/rs" isTestSource="false" /> <sourceFolder url="file://$MODULE_DIR$/src/DevFlavor/rs" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/DevFlavor/shaders" isTestSource="false" /> <sourceFolder url="file://$MODULE_DIR$/src/DevFlavor/shaders" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDevFlavor/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDevFlavor/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDevFlavor/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDevFlavor/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDevFlavor/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDevFlavor/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDevFlavor/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDevFlavor/res" type="java-test-resource" /> <sourceFolder url="file://$MODULE_DIR$/src/testDevFlavor/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testDevFlavor/resources" type="java-test-resource" /> <sourceFolder url="file://$MODULE_DIR$/src/testDevFlavor/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testDevFlavor/assets" type="java-test-resource" /> <sourceFolder url="file://$MODULE_DIR$/src/testDevFlavor/assets" type="java-test-resource" />
...@@ -76,6 +69,13 @@ ...@@ -76,6 +69,13 @@
<sourceFolder url="file://$MODULE_DIR$/src/testDevFlavor/java" isTestSource="true" /> <sourceFolder url="file://$MODULE_DIR$/src/testDevFlavor/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDevFlavor/rs" isTestSource="true" /> <sourceFolder url="file://$MODULE_DIR$/src/testDevFlavor/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDevFlavor/shaders" isTestSource="true" /> <sourceFolder url="file://$MODULE_DIR$/src/testDevFlavor/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDevFlavor/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDevFlavor/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDevFlavor/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDevFlavor/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDevFlavor/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDevFlavor/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDevFlavor/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/res" type="java-resource" /> <sourceFolder url="file://$MODULE_DIR$/src/debug/res" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/resources" type="java-resource" /> <sourceFolder url="file://$MODULE_DIR$/src/debug/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/assets" type="java-resource" /> <sourceFolder url="file://$MODULE_DIR$/src/debug/assets" type="java-resource" />
...@@ -97,13 +97,6 @@ ...@@ -97,13 +97,6 @@
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" /> <sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/rs" isTestSource="false" /> <sourceFolder url="file://$MODULE_DIR$/src/main/rs" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/shaders" isTestSource="false" /> <sourceFolder url="file://$MODULE_DIR$/src/main/shaders" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/res" type="java-test-resource" /> <sourceFolder url="file://$MODULE_DIR$/src/test/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" /> <sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/assets" type="java-test-resource" /> <sourceFolder url="file://$MODULE_DIR$/src/test/assets" type="java-test-resource" />
...@@ -111,9 +104,13 @@ ...@@ -111,9 +104,13 @@
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" /> <sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/rs" isTestSource="true" /> <sourceFolder url="file://$MODULE_DIR$/src/test/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/shaders" isTestSource="true" /> <sourceFolder url="file://$MODULE_DIR$/src/test/shaders" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/blame" /> <sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/classes" /> <sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dependency-cache" /> <sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/shaders" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/animated-vector-drawable/24.2.1/jars" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/animated-vector-drawable/24.2.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/appcompat-v7/24.2.1/jars" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/appcompat-v7/24.2.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-compat/24.2.1/jars" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-compat/24.2.1/jars" />
...@@ -124,13 +121,6 @@ ...@@ -124,13 +121,6 @@
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-v4/24.2.1/jars" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-v4/24.2.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-vector-drawable/24.2.1/jars" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-vector-drawable/24.2.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-safeguard" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifests" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />
<excludeFolder url="file://$MODULE_DIR$/build/tmp" />
</content> </content>
<orderEntry type="jdk" jdkName="Android API 24 Platform" jdkType="Android SDK" /> <orderEntry type="jdk" jdkName="Android API 24 Platform" jdkType="Android SDK" />
<orderEntry type="sourceFolder" forTests="false" /> <orderEntry type="sourceFolder" forTests="false" />
......
package com.yottacode.pictogram.tabletlibrary.cropper;
import android.app.Activity;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.widget.AdapterView;
import android.widget.Button;
import android.widget.CompoundButton;
import android.widget.CompoundButton.OnCheckedChangeListener;
import android.widget.ImageView;
import android.widget.SeekBar;
import android.widget.SeekBar.OnSeekBarChangeListener;
import android.widget.Spinner;
import android.widget.TextView;
import android.widget.ToggleButton;
import com.yottacode.pictogram.tabletlibrary.cropper.CropImageView;
import com.yottacode.pictogram.tabletlibrary.R;
public class MainCropImage extends Activity {
// Private Constants ///////////////////////////////////////////////////////////////////////////
private static final int GUIDELINES_ON_TOUCH = 1;
// Activity Methods ////////////////////////////////////////////////////////////////////////////
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.crop_layout);
// Initialize Views.
//final ToggleButton fixedAspectRatioToggleButton = (ToggleButton) findViewById(R.id.fixedAspectRatioToggle);
//final TextView aspectRatioXTextView = (TextView) findViewById(R.id.aspectRatioX);
//final SeekBar aspectRatioXSeekBar = (SeekBar) findViewById(R.id.aspectRatioXSeek);
//final TextView aspectRatioYTextView = (TextView) findViewById(R.id.aspectRatioY);
//final SeekBar aspectRatioYSeekBar = (SeekBar) findViewById(R.id.aspectRatioYSeek);
//final Spinner guidelinesSpinner = (Spinner) findViewById(R.id.showGuidelinesSpin);
final CropImageView cropImageView = (CropImageView) findViewById(R.id.CropImageView);
final ImageView croppedImageView = (ImageView) findViewById(R.id.croppedImageView);
final Button cropButton = (Button) findViewById(R.id.Button_crop);
cropImageView.setGuidelines(CropImageView.GUIDELINES_ON); //To show the guidelines
cropImageView.setAspectRatio(1,1);
// Initializes fixedAspectRatio toggle button.
/*fixedAspectRatioToggleButton.setOnCheckedChangeListener(new OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
cropImageView.setFixedAspectRatio(isChecked);
cropImageView.setAspectRatio(aspectRatioXSeekBar.getProgress(), aspectRatioYSeekBar.getProgress());
aspectRatioXSeekBar.setEnabled(isChecked);
aspectRatioYSeekBar.setEnabled(isChecked);
}
});*/
// Set seek bars to be disabled until toggle button is checked.
/*aspectRatioXSeekBar.setEnabled(false);
aspectRatioYSeekBar.setEnabled(false);
aspectRatioXTextView.setText(String.valueOf(aspectRatioXSeekBar.getProgress()));
aspectRatioYTextView.setText(String.valueOf(aspectRatioXSeekBar.getProgress()));*/
// Initialize aspect ratio X SeekBar.
/*aspectRatioXSeekBar.setOnSeekBarChangeListener(new OnSeekBarChangeListener() {
@Override
public void onProgressChanged(SeekBar aspectRatioXSeekBar, int progress, boolean fromUser) {
if (progress < 1) {
aspectRatioXSeekBar.setProgress(1);
}
cropImageView.setAspectRatio(aspectRatioXSeekBar.getProgress(), aspectRatioYSeekBar.getProgress());
aspectRatioXTextView.setText(String.valueOf(aspectRatioXSeekBar.getProgress()));
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
// Do nothing.
}
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
// Do nothing.
}
});*/
// Initialize aspect ratio Y SeekBar.
/*aspectRatioYSeekBar.setOnSeekBarChangeListener(new OnSeekBarChangeListener() {
@Override
public void onProgressChanged(SeekBar aspectRatioYSeekBar, int progress, boolean fromUser) {
if (progress < 1) {
aspectRatioYSeekBar.setProgress(1);
}
cropImageView.setAspectRatio(aspectRatioXSeekBar.getProgress(), aspectRatioYSeekBar.getProgress());
aspectRatioYTextView.setText(String.valueOf(aspectRatioYSeekBar.getProgress()));
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
// Do nothing.
}
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
// Do nothing.
}
});*/
// Set up the Guidelines Spinner.
/*guidelinesSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {
cropImageView.setGuidelines(i);
}
public void onNothingSelected(AdapterView<?> adapterView) {
// Do nothing.
}
});
guidelinesSpinner.setSelection(GUIDELINES_ON_TOUCH);*/
// Initialize the Crop button.
cropButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
final Bitmap croppedImage = cropImageView.getCroppedImage();
croppedImageView.setImageBitmap(croppedImage);
}
});
}
}
package com.yottacode.pictogram.tabletlibrary.cropper.cropwindow.edge;
/**
* Simple class to hold a pair of Edges.
*/
public class EdgePair {
// Member Variables ////////////////////////////////////////////////////////
public Edge primary;
public Edge secondary;
// Constructor /////////////////////////////////////////////////////////////
public EdgePair(Edge edge1, Edge edge2) {
primary = edge1;
secondary = edge2;
}
}
package com.yottacode.pictogram.tabletlibrary.cropper.cropwindow.handle;
import android.graphics.RectF;
import android.support.annotation.NonNull;
import com.yottacode.pictogram.tabletlibrary.cropper.cropwindow.edge.Edge;
/**
* HandleHelper class to handle the center handle.
*/
class CenterHandleHelper extends HandleHelper {
// Constructor /////////////////////////////////////////////////////////////////////////////////
CenterHandleHelper() {
super(null, null);
}
// HandleHelper Methods ////////////////////////////////////////////////////////////////////////
@Override
void updateCropWindow(float x,
float y,
@NonNull RectF imageRect,
float snapRadius) {
float left = Edge.LEFT.getCoordinate();
float top = Edge.TOP.getCoordinate();
float right = Edge.RIGHT.getCoordinate();
float bottom = Edge.BOTTOM.getCoordinate();
final float currentCenterX = (left + right) / 2;
final float currentCenterY = (top + bottom) / 2;
final float offsetX = x - currentCenterX;
final float offsetY = y - currentCenterY;
// Adjust the crop window.
Edge.LEFT.offset(offsetX);
Edge.TOP.offset(offsetY);
Edge.RIGHT.offset(offsetX);
Edge.BOTTOM.offset(offsetY);
// Check if we have gone out of bounds on the sides, and fix.
if (Edge.LEFT.isOutsideMargin(imageRect, snapRadius)) {
final float offset = Edge.LEFT.snapToRect(imageRect);
Edge.RIGHT.offset(offset);
} else if (Edge.RIGHT.isOutsideMargin(imageRect, snapRadius)) {
final float offset = Edge.RIGHT.snapToRect(imageRect);
Edge.LEFT.offset(offset);
}
// Check if we have gone out of bounds on the top or bottom, and fix.
if (Edge.TOP.isOutsideMargin(imageRect, snapRadius)) {
final float offset = Edge.TOP.snapToRect(imageRect);
Edge.BOTTOM.offset(offset);
} else if (Edge.BOTTOM.isOutsideMargin(imageRect, snapRadius)) {
final float offset = Edge.BOTTOM.snapToRect(imageRect);
Edge.TOP.offset(offset);
}
}
@Override
void updateCropWindow(float x,
float y,
float targetAspectRatio,
@NonNull RectF imageRect,
float snapRadius) {
updateCropWindow(x, y, imageRect, snapRadius);
}
}
package com.yottacode.pictogram.tabletlibrary.cropper.cropwindow.handle;
import android.graphics.RectF;
import android.support.annotation.NonNull;
import com.yottacode.pictogram.tabletlibrary.cropper.cropwindow.edge.Edge;
import com.yottacode.pictogram.tabletlibrary.cropper.cropwindow.edge.EdgePair;
/**
* HandleHelper class to handle corner Handles (i.e. top-left, top-right, bottom-left, and
* bottom-right handles).
*/
class CornerHandleHelper extends HandleHelper {
// Constructor /////////////////////////////////////////////////////////////////////////////////
CornerHandleHelper(Edge horizontalEdge, Edge verticalEdge) {
super(horizontalEdge, verticalEdge);
}
// HandleHelper Methods ////////////////////////////////////////////////////////////////////////
@Override
void updateCropWindow(float x,
float y,
float targetAspectRatio,
@NonNull RectF imageRect,
float snapRadius) {
final EdgePair activeEdges = getActiveEdges(x, y, targetAspectRatio);
final Edge primaryEdge = activeEdges.primary;
final Edge secondaryEdge = activeEdges.secondary;
primaryEdge.adjustCoordinate(x, y, imageRect, snapRadius, targetAspectRatio);
secondaryEdge.adjustCoordinate(targetAspectRatio);
if (secondaryEdge.isOutsideMargin(imageRect, snapRadius)) {
secondaryEdge.snapToRect(imageRect);
primaryEdge.adjustCoordinate(targetAspectRatio);
}
}
}
package com.yottacode.pictogram.tabletlibrary.cropper.cropwindow.handle;
import android.graphics.RectF;
import android.support.annotation.NonNull;
import com.yottacode.pictogram.tabletlibrary.cropper.cropwindow.edge.Edge;
/**
* Enum representing a pressable, draggable Handle on the crop window.
*/
public enum Handle {
TOP_LEFT(new CornerHandleHelper(Edge.TOP, Edge.LEFT)),
TOP_RIGHT(new CornerHandleHelper(Edge.TOP, Edge.RIGHT)),
BOTTOM_LEFT(new CornerHandleHelper(Edge.BOTTOM, Edge.LEFT)),
BOTTOM_RIGHT(new CornerHandleHelper(Edge.BOTTOM, Edge.RIGHT)),
LEFT(new VerticalHandleHelper(Edge.LEFT)),
TOP(new HorizontalHandleHelper(Edge.TOP)),
RIGHT(new VerticalHandleHelper(Edge.RIGHT)),
BOTTOM(new HorizontalHandleHelper(Edge.BOTTOM)),
CENTER(new CenterHandleHelper());
// Member Variables ////////////////////////////////////////////////////////////////////////////
private HandleHelper mHelper;
// Constructors ////////////////////////////////////////////////////////////////////////////////
Handle(HandleHelper helper) {
mHelper = helper;
}
// Public Methods //////////////////////////////////////////////////////////
public void updateCropWindow(float x,
float y,
@NonNull RectF imageRect,
float snapRadius) {
mHelper.updateCropWindow(x, y, imageRect, snapRadius);
}
public void updateCropWindow(float x,
float y,
float targetAspectRatio,
@NonNull RectF imageRect,
float snapRadius) {
mHelper.updateCropWindow(x, y, targetAspectRatio, imageRect, snapRadius);
}
}
package com.yottacode.pictogram.tabletlibrary.cropper.cropwindow.handle;
import android.graphics.RectF;
import android.support.annotation.NonNull;
import com.yottacode.pictogram.tabletlibrary.cropper.cropwindow.edge.Edge;
import com.yottacode.pictogram.tabletlibrary.cropper.cropwindow.edge.EdgePair;
import com.yottacode.pictogram.tabletlibrary.cropper.util.AspectRatioUtil;
/**
* Abstract helper class to handle operations on a crop window Handle.
*/
abstract class HandleHelper {
// Member Variables ////////////////////////////////////////////////////////
private static final float UNFIXED_ASPECT_RATIO_CONSTANT = 1;
private Edge mHorizontalEdge;
private Edge mVerticalEdge;
// Save the Pair object as a member variable to avoid having to instantiate
// a new Object every time getActiveEdges() is called.
private EdgePair mActiveEdges;
// Constructor /////////////////////////////////////////////////////////////////////////////////
/**
* Constructor.
*
* @param horizontalEdge the horizontal edge associated with this handle; may be null
* @param verticalEdge the vertical edge associated with this handle; may be null
*/
HandleHelper(Edge horizontalEdge, Edge verticalEdge) {
mHorizontalEdge = horizontalEdge;
mVerticalEdge = verticalEdge;
mActiveEdges = new EdgePair(mHorizontalEdge, mVerticalEdge);
}
// Package-Private Methods /////////////////////////////////////////////////////////////////////
/**
* Updates the crop window by directly setting the Edge coordinates.
*
* @param x the new x-coordinate of this handle
* @param y the new y-coordinate of this handle
* @param imageRect the bounding rectangle of the image
* @param snapRadius the maximum distance (in pixels) at which the crop window should snap to
* the image
*/
void updateCropWindow(float x,
float y,
@NonNull RectF imageRect,
float snapRadius) {
final EdgePair activeEdges = getActiveEdges();
final Edge primaryEdge = activeEdges.primary;
final Edge secondaryEdge = activeEdges.secondary;
if (primaryEdge != null)
primaryEdge.adjustCoordinate(x, y, imageRect, snapRadius, UNFIXED_ASPECT_RATIO_CONSTANT);
if (secondaryEdge != null)
secondaryEdge.adjustCoordinate(x, y, imageRect, snapRadius, UNFIXED_ASPECT_RATIO_CONSTANT);
}
/**
* Updates the crop window by directly setting the Edge coordinates; this method maintains a
* given aspect ratio.
*
* @param x the new x-coordinate of this handle
* @param y the new y-coordinate of this handle
* @param targetAspectRatio the aspect ratio to maintain
* @param imageRect the bounding rectangle of the image
* @param snapRadius the maximum distance (in pixels) at which the crop window should
* snap to the image
*/
abstract void updateCropWindow(float x,
float y,
float targetAspectRatio,
@NonNull RectF imageRect,
float snapRadius);
/**
* Gets the Edges associated with this handle (i.e. the Edges that should be moved when this
* handle is dragged). This is used when we are not maintaining the aspect ratio.
*
* @return the active edge as a pair (the pair may contain null values for the
* <code>primary</code>, <code>secondary</code> or both fields)
*/
EdgePair getActiveEdges() {
return mActiveEdges;
}
/**
* Gets the Edges associated with this handle as an ordered Pair. The <code>primary</code> Edge
* in the pair is the determining side. This method is used when we need to maintain the aspect
* ratio.
*
* @param x the x-coordinate of the touch point
* @param y the y-coordinate of the touch point
* @param targetAspectRatio the aspect ratio that we are maintaining
*
* @return the active edges as an ordered pair
*/
EdgePair getActiveEdges(float x, float y, float targetAspectRatio) {
// Calculate the aspect ratio if this handle were dragged to the given x-y coordinate.
final float potentialAspectRatio = getAspectRatio(x, y);
// If the touched point is wider than the aspect ratio, then x is the determining side. Else, y is the determining side.
if (potentialAspectRatio > targetAspectRatio) {
mActiveEdges.primary = mVerticalEdge;
mActiveEdges.secondary = mHorizontalEdge;
} else {
mActiveEdges.primary = mHorizontalEdge;
mActiveEdges.secondary = mVerticalEdge;
}
return mActiveEdges;
}
// Private Methods /////////////////////////////////////////////////////////////////////////////
/**
* Gets the aspect ratio of the resulting crop window if this handle were dragged to the given
* point.
*
* @param x the x-coordinate
* @param y the y-coordinate
*
* @return the aspect ratio
*/
private float getAspectRatio(float x, float y) {
// Replace the active edge coordinate with the given touch coordinate.
final float left = (mVerticalEdge == Edge.LEFT) ? x : Edge.LEFT.getCoordinate();
final float top = (mHorizontalEdge == Edge.TOP) ? y : Edge.TOP.getCoordinate();
final float right = (mVerticalEdge == Edge.RIGHT) ? x : Edge.RIGHT.getCoordinate();
final float bottom = (mHorizontalEdge == Edge.BOTTOM) ? y : Edge.BOTTOM.getCoordinate();
return AspectRatioUtil.calculateAspectRatio(left, top, right, bottom);
}
}
package com.yottacode.pictogram.tabletlibrary.cropper.cropwindow.handle;
import android.graphics.RectF;
import android.support.annotation.NonNull;
import com.yottacode.pictogram.tabletlibrary.cropper.cropwindow.edge.Edge;
import com.yottacode.pictogram.tabletlibrary.cropper.util.AspectRatioUtil;
/**
* Handle helper class to handle horizontal handles (i.e. top and bottom handles).
*/
class HorizontalHandleHelper extends HandleHelper {
// Member Variables ////////////////////////////////////////////////////////////////////////////
private Edge mEdge;
// Constructor /////////////////////////////////////////////////////////////////////////////////
HorizontalHandleHelper(Edge edge) {
super(edge, null);
mEdge = edge;
}
// HandleHelper Methods ////////////////////////////////////////////////////////////////////////
@Override
void updateCropWindow(float x,
float y,
float targetAspectRatio,
@NonNull RectF imageRect,
float snapRadius) {
// Adjust this Edge accordingly.
mEdge.adjustCoordinate(x, y, imageRect, snapRadius, targetAspectRatio);
float left = Edge.LEFT.getCoordinate();
float right = Edge.RIGHT.getCoordinate();
// After this Edge is moved, our crop window is now out of proportion.
final float targetWidth = AspectRatioUtil.calculateWidth(Edge.getHeight(), targetAspectRatio);
// Adjust the crop window so that it maintains the given aspect ratio by
// moving the adjacent edges symmetrically in or out.
final float difference = targetWidth - Edge.getWidth();
final float halfDifference = difference / 2;
left -= halfDifference;
right += halfDifference;
Edge.LEFT.setCoordinate(left);
Edge.RIGHT.setCoordinate(right);
// Check if we have gone out of bounds on the sides, and fix.
if (Edge.LEFT.isOutsideMargin(imageRect, snapRadius)
&& !mEdge.isNewRectangleOutOfBounds(Edge.LEFT, imageRect, targetAspectRatio)) {
final float offset = Edge.LEFT.snapToRect(imageRect);
Edge.RIGHT.offset(-offset);
mEdge.adjustCoordinate(targetAspectRatio);
}
if (Edge.RIGHT.isOutsideMargin(imageRect, snapRadius)
&& !mEdge.isNewRectangleOutOfBounds(Edge.RIGHT, imageRect, targetAspectRatio)) {
final float offset = Edge.RIGHT.snapToRect(imageRect);
Edge.LEFT.offset(-offset);
mEdge.adjustCoordinate(targetAspectRatio);
}
}
}
package com.yottacode.pictogram.tabletlibrary.cropper.cropwindow.handle;
import android.graphics.RectF;
import android.support.annotation.NonNull;
import com.yottacode.pictogram.tabletlibrary.cropper.cropwindow.edge.Edge;
import com.yottacode.pictogram.tabletlibrary.cropper.util.AspectRatioUtil;
/**
* HandleHelper class to handle vertical handles (i.e. left and right handles).
*/
class VerticalHandleHelper extends HandleHelper {
// Member Variables ////////////////////////////////////////////////////////////////////////////
private Edge mEdge;
// Constructor /////////////////////////////////////////////////////////////////////////////////
VerticalHandleHelper(Edge edge) {
super(null, edge);
mEdge = edge;
}
// HandleHelper Methods ////////////////////////////////////////////////////////////////////////
@Override
void updateCropWindow(float x,
float y,
float targetAspectRatio,
@NonNull RectF imageRect,
float snapRadius) {
// Adjust this Edge accordingly.
mEdge.adjustCoordinate(x, y, imageRect, snapRadius, targetAspectRatio);
float top = Edge.TOP.getCoordinate();
float bottom = Edge.BOTTOM.getCoordinate();
// After this Edge is moved, our crop window is now out of proportion.
final float targetHeight = AspectRatioUtil.calculateHeight(Edge.getWidth(), targetAspectRatio);
// Adjust the crop window so that it maintains the given aspect ratio by
// moving the adjacent edges symmetrically in or out.
final float difference = targetHeight - Edge.getHeight();
final float halfDifference = difference / 2;
top -= halfDifference;
bottom += halfDifference;
Edge.TOP.setCoordinate(top);
Edge.BOTTOM.setCoordinate(bottom);
// Check if we have gone out of bounds on the top or bottom, and fix.
if (Edge.TOP.isOutsideMargin(imageRect, snapRadius)
&& !mEdge.isNewRectangleOutOfBounds(Edge.TOP, imageRect, targetAspectRatio)) {
final float offset = Edge.TOP.snapToRect(imageRect);
Edge.BOTTOM.offset(-offset);
mEdge.adjustCoordinate(targetAspectRatio);
}
if (Edge.BOTTOM.isOutsideMargin(imageRect, snapRadius)
&& !mEdge.isNewRectangleOutOfBounds(Edge.BOTTOM, imageRect, targetAspectRatio)) {
final float offset = Edge.BOTTOM.snapToRect(imageRect);
Edge.TOP.offset(-offset);
mEdge.adjustCoordinate(targetAspectRatio);
}
}
}
package com.yottacode.pictogram.tabletlibrary.cropper.util;
import android.graphics.RectF;
import android.support.annotation.NonNull;
/**
* Utility class for handling calculations involving a fixed aspect ratio.
*/
public class AspectRatioUtil {
/**
* Calculates the aspect ratio given a rectangle.
*/
public static float calculateAspectRatio(float left, float top, float right, float bottom) {
final float width = right - left;
final float height = bottom - top;
return width / height;
}
/**
* Calculates the aspect ratio given a rectangle.
*/
public static float calculateAspectRatio(@NonNull RectF rect) {
return rect.width() / rect.height();
}
/**
* Calculates the x-coordinate of the left edge given the other sides of the rectangle and an
* aspect ratio.
*/
public static float calculateLeft(float top, float right, float bottom, float targetAspectRatio) {
final float height = bottom - top;
// targetAspectRatio = width / height
// width = targetAspectRatio * height
// right - left = targetAspectRatio * height
return right - (targetAspectRatio * height);
}
/**
* Calculates the y-coordinate of the top edge given the other sides of the rectangle and an
* aspect ratio.
*/
public static float calculateTop(float left, float right, float bottom, float targetAspectRatio) {
final float width = right - left;
// targetAspectRatio = width / height
// width = targetAspectRatio * height
// height = width / targetAspectRatio
// bottom - top = width / targetAspectRatio
return bottom - (width / targetAspectRatio);
}
/**
* Calculates the x-coordinate of the right edge given the other sides of the rectangle and an
* aspect ratio.
*/
public static float calculateRight(float left, float top, float bottom, float targetAspectRatio) {
final float height = bottom - top;
// targetAspectRatio = width / height
// width = targetAspectRatio * height
// right - left = targetAspectRatio * height
return (targetAspectRatio * height) + left;
}
/**
* Calculates the y-coordinate of the bottom edge given the other sides of the rectangle and an
* aspect ratio.
*/
public static float calculateBottom(float left, float top, float right, float targetAspectRatio) {
final float width = right - left;
// targetAspectRatio = width / height
// width = targetAspectRatio * height
// height = width / targetAspectRatio
// bottom - top = width / targetAspectRatio
return (width / targetAspectRatio) + top;
}
/**
* Calculates the width of a rectangle given the top and bottom edges and an aspect ratio.
*/
public static float calculateWidth(float height, float targetAspectRatio) {
return targetAspectRatio * height;
}
/**
* Calculates the height of a rectangle given the left and right edges and an aspect ratio.
*/
public static float calculateHeight(float width, float targetAspectRatio) {
return width / targetAspectRatio;
}
}
package com.yottacode.pictogram.tabletlibrary.cropper.util;
import android.graphics.PointF;
import android.support.annotation.NonNull;
import com.yottacode.pictogram.tabletlibrary.cropper.cropwindow.handle.Handle;
/**
* Utility class to perform basic operations with Handles.
*/
public class HandleUtil {
// Public Methods //////////////////////////////////////////////////////////////////////////////
/**
* Determines which, if any, of the handles are pressed given the touch coordinates, the
* bounding box, and the touch radius.
*
* @param x the x-coordinate of the touch point
* @param y the y-coordinate of the touch point
* @param left the x-coordinate of the left bound
* @param top the y-coordinate of the top bound
* @param right the x-coordinate of the right bound
* @param bottom the y-coordinate of the bottom bound
* @param targetRadius the target radius in pixels
*
* @return the Handle that was pressed; null if no Handle was pressed
*/
public static Handle getPressedHandle(float x,
float y,
float left,
float top,
float right,
float bottom,
float targetRadius) {
// Find the closest corner handle to the touch point.
// If the touch point is in the target zone of this closest handle, then this is the pressed handle.
// Else, check if any of the edges are in the target zone of the touch point.
// Else, check if the touch point is within the crop window bounds; if so, then choose the center handle.
Handle closestHandle = null;
float closestDistance = Float.POSITIVE_INFINITY;
final float distanceToTopLeft = MathUtil.calculateDistance(x, y, left, top);
if (distanceToTopLeft < closestDistance) {
closestDistance = distanceToTopLeft;
closestHandle = Handle.TOP_LEFT;
}
final float distanceToTopRight = MathUtil.calculateDistance(x, y, right, top);
if (distanceToTopRight < closestDistance) {
closestDistance = distanceToTopRight;
closestHandle = Handle.TOP_RIGHT;
}
final float distanceToBottomLeft = MathUtil.calculateDistance(x, y, left, bottom);
if (distanceToBottomLeft < closestDistance) {
closestDistance = distanceToBottomLeft;
closestHandle = Handle.BOTTOM_LEFT;
}
final float distanceToBottomRight = MathUtil.calculateDistance(x, y, right, bottom);
if (distanceToBottomRight < closestDistance) {
closestDistance = distanceToBottomRight;
closestHandle = Handle.BOTTOM_RIGHT;
}
if (closestDistance <= targetRadius) {
return closestHandle;
}
// If we get to this point, none of the corner handles were in the touch target zone, so then we check the edges.
if (HandleUtil.isInHorizontalTargetZone(x, y, left, right, top, targetRadius)) {
return Handle.TOP;
} else if (HandleUtil.isInHorizontalTargetZone(x, y, left, right, bottom, targetRadius)) {
return Handle.BOTTOM;
} else if (HandleUtil.isInVerticalTargetZone(x, y, left, top, bottom, targetRadius)) {
return Handle.LEFT;
} else if (HandleUtil.isInVerticalTargetZone(x, y, right, top, bottom, targetRadius)) {
return Handle.RIGHT;
}
// If we get to this point, none of the corners or edges are in the touch target zone.
// Check to see if the touch point is within the bounds of the crop window. If so, choose the center handle.
if (isWithinBounds(x, y, left, top, right, bottom)) {
return Handle.CENTER;
}
return null;
}
/**
* Calculates the offset of the touch point from the precise location of the specified handle.
* <p/>
* The offset will be returned in the 'touchOffsetOutput' parameter; the x-offset will be the
* first value and the y-offset will be the second value.
*/
public static void getOffset(@NonNull Handle handle,
float x,
float y,
float left,
float top,
float right,
float bottom,
@NonNull PointF touchOffsetOutput) {
float touchOffsetX = 0;
float touchOffsetY = 0;
// Calculate the offset from the appropriate handle.
switch (handle) {
case TOP_LEFT:
touchOffsetX = left - x;
touchOffsetY = top - y;
break;
case TOP_RIGHT:
touchOffsetX = right - x;
touchOffsetY = top - y;
break;
case BOTTOM_LEFT:
touchOffsetX = left - x;
touchOffsetY = bottom - y;
break;
case BOTTOM_RIGHT:
touchOffsetX = right - x;
touchOffsetY = bottom - y;
break;
case LEFT:
touchOffsetX = left - x;
touchOffsetY = 0;
break;
case TOP:
touchOffsetX = 0;
touchOffsetY = top - y;
break;
case RIGHT:
touchOffsetX = right - x;
touchOffsetY = 0;
break;
case BOTTOM:
touchOffsetX = 0;
touchOffsetY = bottom - y;
break;
case CENTER:
final float centerX = (right + left) / 2;
final float centerY = (top + bottom) / 2;
touchOffsetX = centerX - x;
touchOffsetY = centerY - y;
break;
}
touchOffsetOutput.x = touchOffsetX;
touchOffsetOutput.y = touchOffsetY;
}
// Private Methods /////////////////////////////////////////////////////////////////////////////
/**
* Determines if the specified coordinate is in the target touch zone for a horizontal bar
* handle.
*
* @param x the x-coordinate of the touch point
* @param y the y-coordinate of the touch point
* @param handleXStart the left x-coordinate of the horizontal bar handle
* @param handleXEnd the right x-coordinate of the horizontal bar handle
* @param handleY the y-coordinate of the horizontal bar handle
* @param targetRadius the target radius in pixels
*
* @return true if the touch point is in the target touch zone; false otherwise
*/
private static boolean isInHorizontalTargetZone(float x,
float y,
float handleXStart,
float handleXEnd,
float handleY,
float targetRadius) {
return (x > handleXStart && x < handleXEnd && Math.abs(y - handleY) <= targetRadius);
}
/**
* Determines if the specified coordinate is in the target touch zone for a vertical bar
* handle.
*
* @param x the x-coordinate of the touch point
* @param y the y-coordinate of the touch point
* @param handleX the x-coordinate of the vertical bar handle
* @param handleYStart the top y-coordinate of the vertical bar handle
* @param handleYEnd the bottom y-coordinate of the vertical bar handle
* @param targetRadius the target radius in pixels
*
* @return true if the touch point is in the target touch zone; false otherwise
*/
private static boolean isInVerticalTargetZone(float x,
float y,
float handleX,
float handleYStart,
float handleYEnd,
float targetRadius) {
return (Math.abs(x - handleX) <= targetRadius && y > handleYStart && y < handleYEnd);
}
private static boolean isWithinBounds(float x, float y, float left, float top, float right, float bottom) {
return x >= left && x <= right && y >= top && y <= bottom;
}
}
package com.yottacode.pictogram.tabletlibrary.cropper.util;
public class MathUtil {
/**
* Calculates the distance between two points (x1, y1) and (x2, y2).
*/
public static float calculateDistance(float x1, float y1, float x2, float y2) {
final float side1 = x2 - x1;
final float side2 = y2 - y1;
return (float) Math.sqrt(side1 * side1 + side2 * side2);
}
}
package com.yottacode.pictogram.tabletlibrary.cropper.util;
import android.content.res.Resources;
import android.graphics.Paint;
import android.support.annotation.NonNull;
import com.yottacode.pictogram.tabletlibrary.R;
/**
* Utility class for handling all of the Paint used to draw the CropOverlayView.
*/
public class PaintUtil {
// Public Methods //////////////////////////////////////////////////////////
/**
* Creates the Paint object for drawing the crop window border.
*/
public static Paint newBorderPaint(@NonNull Resources resources) {
final Paint paint = new Paint();
paint.setStyle(Paint.Style.STROKE);
paint.setStrokeWidth(resources.getDimension(R.dimen.border_thickness));
paint.setColor(resources.getColor(R.color.border));
return paint;
}
/**
* Creates the Paint object for drawing the crop window guidelines.
*/
public static Paint newGuidelinePaint(@NonNull Resources resources) {
final Paint paint = new Paint();
paint.setStyle(Paint.Style.STROKE);
paint.setStrokeWidth(resources.getDimension(R.dimen.guideline_thickness));
paint.setColor(resources.getColor(R.color.guideline));
return paint;
}
/**
* Creates the Paint object for drawing the translucent overlay outside the crop window.
*
* @return the new Paint object
*/
public static Paint newSurroundingAreaOverlayPaint(@NonNull Resources resources) {
final Paint paint = new Paint();
paint.setStyle(Paint.Style.FILL);
paint.setColor(resources.getColor(R.color.surrounding_area));
return paint;
}
/**
* Creates the Paint object for drawing the corners of the border
*/
public static Paint newCornerPaint(@NonNull Resources resources) {
final Paint paint = new Paint();
paint.setStyle(Paint.Style.STROKE);
paint.setStrokeWidth(resources.getDimension(R.dimen.corner_thickness));
paint.setColor(resources.getColor(R.color.corner));
return paint;
}
}
...@@ -6,12 +6,14 @@ import android.content.Context; ...@@ -6,12 +6,14 @@ import android.content.Context;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.content.Intent; import android.content.Intent;
import android.database.Cursor; import android.database.Cursor;
import android.graphics.Bitmap;
import android.net.Uri; import android.net.Uri;
import android.provider.MediaStore; import android.provider.MediaStore;
import android.text.InputType; import android.text.InputType;
import android.util.Log; import android.util.Log;
import android.view.View; import android.view.View;
import android.view.inputmethod.InputMethodManager; import android.view.inputmethod.InputMethodManager;
import android.widget.Button;
import android.widget.EditText; import android.widget.EditText;
import android.widget.ImageButton; import android.widget.ImageButton;
import android.widget.ImageView; import android.widget.ImageView;
...@@ -24,6 +26,7 @@ import com.yottacode.pictogram.grammar.Vocabulary; ...@@ -24,6 +26,7 @@ import com.yottacode.pictogram.grammar.Vocabulary;
import com.yottacode.pictogram.grammar.iLocalPicto; import com.yottacode.pictogram.grammar.iLocalPicto;
import com.yottacode.pictogram.net.PictoUploader; import com.yottacode.pictogram.net.PictoUploader;
import com.yottacode.pictogram.tabletlibrary.R; import com.yottacode.pictogram.tabletlibrary.R;
import com.yottacode.pictogram.tabletlibrary.cropper.CropImageView;
import com.yottacode.pictogram.tools.PCBcontext; import com.yottacode.pictogram.tools.PCBcontext;
import java.io.IOException; import java.io.IOException;
...@@ -417,8 +420,29 @@ public class PictoMenu { ...@@ -417,8 +420,29 @@ public class PictoMenu {
public List<RadialMenuWidget.RadialMenuEntry> getChildren() { return children; } public List<RadialMenuWidget.RadialMenuEntry> getChildren() { return children; }
public void menuActiviated() public void menuActiviated()
{ {
ll.getChildAt(1).setX(ll.getChildAt(1).getX() + 30); /*ll.getChildAt(1).setX(ll.getChildAt(1).getX() + 30);
children = new ArrayList<>(Arrays.asList(new EditTextPicto(p),new EditImage(p))); children = new ArrayList<>(Arrays.asList(new EditTextPicto(p),new EditImage(p)));*/
activity.setContentView(R.layout.crop_layout);
final CropImageView cropImageView = (CropImageView) activity.findViewById(R.id.CropImageView);
cropImageView.setImageResource(R.drawable.descarga);
final ImageView croppedImageView = (ImageView) activity.findViewById(R.id.croppedImageView);
final Button cropButton = (Button) activity.findViewById(R.id.Button_crop);
cropImageView.setGuidelines(CropImageView.GUIDELINES_ON); //To show the guidelines
cropImageView.setFixedAspectRatio(true);
cropImageView.setAspectRatio(1,1);
cropButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
final Bitmap croppedImage = cropImageView.getCroppedImage();
croppedImageView.setImageBitmap(croppedImage);
}
});
} }
public void menuDisabled(){ public void menuDisabled(){
ll.getChildAt(1).setX(ll.getChildAt(1).getX() - 30); ll.getChildAt(1).setX(ll.getChildAt(1).getX() - 30);
......
<?xml version="1.0" encoding="utf-8"?>
<!--<ScrollView
android:id="@+id/scrollview"
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"
tools:context=".cropper.MainCropImage"
android:background="@color/black_translucent">
-->
<ScrollView
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:background="@color/black_translucent"
android:layout_alignParentTop="true"
android:layout_alignParentStart="true"
android:id="@+id/ScrollView">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:id="@+id/TotalLayout">
<TextView
android:id="@+id/title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/titleCropper"
android:textSize="24sp"
android:textStyle="bold"
android:textColor="@color/common_google_signin_btn_text_dark_pressed"
android:layout_weight="1"
android:textAlignment="center"
android:layout_gravity="top"
android:layout_alignParentTop="true"
android:layout_alignParentStart="true" />
<com.yottacode.pictogram.tabletlibrary.cropper.CropImageView
android:id="@+id/CropImageView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:adjustViewBounds="true"
android:scaleType="centerInside"
android:layout_below="@+id/title"
android:layout_alignParentStart="true" />
<Button
android:id="@+id/Button_crop"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:minWidth="120dp"
android:text="@string/crop"
android:textColor="#33B5E5"
android:textSize="20sp"
android:layout_gravity="center_vertical"
android:layout_marginTop="2dp"
android:layout_below="@+id/title"
android:layout_centerHorizontal="true" />
<ImageView
android:id="@+id/croppedImageView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:adjustViewBounds="true"
android:contentDescription="@string/croppedImageDesc"
android:scaleType="centerInside"/>
</RelativeLayout>
</ScrollView>
<resources>
<declare-styleable name="CropImageView">
<attr name="guidelines">
<enum name="off" value="0"/>
<enum name="onTouch" value="1"/>
<enum name="on" value="2"/>
</attr>
<attr name="fixAspectRatio" format="boolean"/>
<attr name="aspectRatioX" format="integer"/>
<attr name="aspectRatioY" format="integer"/>
</declare-styleable>
</resources>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="white_translucent">#AAFFFFFF</color>
<color name="black_translucent">#b0000000</color>
<color name="border">@color/white_translucent</color>
<color name="guideline">@color/white_translucent</color>
<color name="corner">@android:color/white</color>
<color name="surrounding_area">@color/black_translucent</color>
</resources>
<?xml version="1.0" encoding="utf-8"?>
<resources>
<dimen name="border_thickness">3dp</dimen>
<dimen name="corner_thickness">5dp</dimen>
<dimen name="guideline_thickness">1px</dimen>
<dimen name="target_radius">24dp</dimen>
<dimen name="snap_radius">3dp</dimen>
<dimen name="corner_length">20dp</dimen>
<dimen name="content_padding">16dp</dimen>
<dimen name="content_padding_half">8dp</dimen>
</resources>
...@@ -37,4 +37,20 @@ ...@@ -37,4 +37,20 @@
<string name="session_eval_notevuated">no evaluado</string> <string name="session_eval_notevuated">no evaluado</string>
<string name="session_eval_discarded">inválido</string> <string name="session_eval_discarded">inválido</string>
<!-- Cropper -->
<string name="titleCropper">Cropper</string>
<string name="fixedAspectRatio">fixedAspectRatio =\u0020</string>
<string name="aspectRatioXHeader">aspectRatioX =\u0020</string>
<string name="aspectRatioYHeader">aspectRatioY =\u0020</string>
<string name="showGuidelines">showGuidelines =\u0020</string>
<string name="crop">Crop</string>
<string name="croppedImageDesc">The cropped image.</string>
<string-array name="showGuidelinesArray">
<item>Off</item>
<item>On Touch</item>
<item>On</item>
</string-array>
</resources> </resources>
...@@ -69,13 +69,6 @@ ...@@ -69,13 +69,6 @@
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" /> <sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/rs" isTestSource="false" /> <sourceFolder url="file://$MODULE_DIR$/src/main/rs" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/shaders" isTestSource="false" /> <sourceFolder url="file://$MODULE_DIR$/src/main/shaders" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/res" type="java-test-resource" /> <sourceFolder url="file://$MODULE_DIR$/src/test/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" /> <sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/assets" type="java-test-resource" /> <sourceFolder url="file://$MODULE_DIR$/src/test/assets" type="java-test-resource" />
...@@ -83,7 +76,13 @@ ...@@ -83,7 +76,13 @@
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" /> <sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/rs" isTestSource="true" /> <sourceFolder url="file://$MODULE_DIR$/src/test/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/shaders" isTestSource="true" /> <sourceFolder url="file://$MODULE_DIR$/src/test/shaders" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/annotations" /> <sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/shaders" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/blame" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/blame" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/bundles" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/bundles" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/classes" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/classes" />
...@@ -99,16 +98,10 @@ ...@@ -99,16 +98,10 @@
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-vector-drawable/24.2.1/jars" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-vector-drawable/24.2.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-safeguard" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-safeguard" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/jniLibs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/lint" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/lint" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifests" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifests" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/shaders" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/transforms" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/typedefs.txt" />
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />
<excludeFolder url="file://$MODULE_DIR$/build/tmp" /> <excludeFolder url="file://$MODULE_DIR$/build/tmp" />
</content> </content>
<orderEntry type="jdk" jdkName="Android API 24 Platform" jdkType="Android SDK" /> <orderEntry type="jdk" jdkName="Android API 24 Platform" jdkType="Android SDK" />
......
...@@ -25,6 +25,9 @@ android { ...@@ -25,6 +25,9 @@ android {
DefaultFlavor { DefaultFlavor {
resValue "string", "server", "https://dev.yottacode.com" resValue "string", "server", "https://dev.yottacode.com"
} }
LocalFlavor {
resValue "string", "server", "http://192.168.1.35:1337"
}
} }
} }
......
...@@ -111,9 +111,6 @@ ...@@ -111,9 +111,6 @@
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" /> <sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/rs" isTestSource="true" /> <sourceFolder url="file://$MODULE_DIR$/src/test/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/shaders" isTestSource="true" /> <sourceFolder url="file://$MODULE_DIR$/src/test/shaders" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/blame" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/classes" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dependency-cache" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/recyclerview-v7/23.0.1/jars" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/recyclerview-v7/23.0.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-v4/23.0.1/jars" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-v4/23.0.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.google.android.gms/play-services-base/9.2.1/jars" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.google.android.gms/play-services-base/9.2.1/jars" />
...@@ -122,13 +119,6 @@ ...@@ -122,13 +119,6 @@
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.google.android.gms/play-services-wearable/9.2.1/jars" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.google.android.gms/play-services-wearable/9.2.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.google.android.support/wearable/2.0.0-alpha2/jars" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.google.android.support/wearable/2.0.0-alpha2/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-safeguard" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifests" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />
<excludeFolder url="file://$MODULE_DIR$/build/tmp" />
</content> </content>
<orderEntry type="jdk" jdkName="Android API 24 Platform" jdkType="Android SDK" /> <orderEntry type="jdk" jdkName="Android API 24 Platform" jdkType="Android SDK" />
<orderEntry type="sourceFolder" forTests="false" /> <orderEntry type="sourceFolder" forTests="false" />
......
...@@ -111,10 +111,6 @@ ...@@ -111,10 +111,6 @@
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" isTestSource="true" /> <sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" /> <sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/shaders" isTestSource="true" /> <sourceFolder url="file://$MODULE_DIR$/src/androidTest/shaders" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/assets" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/blame" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/classes" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dependency-cache" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/animated-vector-drawable/24.2.1/jars" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/animated-vector-drawable/24.2.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/appcompat-v7/24.2.1/jars" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/appcompat-v7/24.2.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-compat/24.2.1/jars" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-compat/24.2.1/jars" />
...@@ -125,17 +121,6 @@ ...@@ -125,17 +121,6 @@
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-v4/24.2.1/jars" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-v4/24.2.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-vector-drawable/24.2.1/jars" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-vector-drawable/24.2.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-safeguard" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/jniLibs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifests" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/pre-dexed" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/shaders" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/transforms" />
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />
<excludeFolder url="file://$MODULE_DIR$/build/tmp" />
</content> </content>
<orderEntry type="jdk" jdkName="Android API 24 Platform" jdkType="Android SDK" /> <orderEntry type="jdk" jdkName="Android API 24 Platform" jdkType="Android SDK" />
<orderEntry type="sourceFolder" forTests="false" /> <orderEntry type="sourceFolder" forTests="false" />
......
...@@ -179,6 +179,10 @@ module.exports = { ...@@ -179,6 +179,10 @@ module.exports = {
size: 'large', size: 'large',
picto_background: '#0000ff', picto_background: '#0000ff',
tape_background: '#00ffff', tape_background: '#00ffff',
delivery: 0
// 0 -> delete strip after delivery
// 1 -> keep strip and on delivery
// 2 --> keep strip and several deliveries
}; };
sails.log.verbose('Requested attributes for Student', attributes); sails.log.verbose('Requested attributes for Student', attributes);
...@@ -213,6 +217,13 @@ module.exports = { ...@@ -213,6 +217,13 @@ module.exports = {
if (typeof validAttributes.legend !== 'boolean') { if (typeof validAttributes.legend !== 'boolean') {
delete validAttributes.legend; delete validAttributes.legend;
} }
if (typeof validAttributes.delivery !== 'number') {
delete validAttributes.delivery;
} else {
if (validAttributes.delivery != 0 && validAttributes.delivery != 1 && validAttributes.delivery != 2) {
delete validAttributes.delivery;
}
}
if (!((/^(small|normal|large)$/).test(validAttributes.legend_size))) { if (!((/^(small|normal|large)$/).test(validAttributes.legend_size))) {
delete validAttributes.legend_size; delete validAttributes.legend_size;
} }
......
...@@ -77,6 +77,8 @@ ...@@ -77,6 +77,8 @@
"delete": "Delete", "delete": "Delete",
"delete_strip_after_delivery": "Empty strip after delivery", "delete_strip_after_delivery": "Empty strip after delivery",
"delete_template": "Delete from templates", "delete_template": "Delete from templates",
"delivery_behavior": "Strip delivery",
"delivery_note": "A <i>strip delivery</i> occurs when the kid runs the speech of the pictograms on it",
"description": "Description", "description": "Description",
"device": "Device", "device": "Device",
"device_setup": "Device setup", "device_setup": "Device setup",
...@@ -146,6 +148,8 @@ ...@@ -146,6 +148,8 @@
"January": "January", "January": "January",
"July": "July", "July": "July",
"June": "June", "June": "June",
"keep_strip_and_deliveries": "Keep strip and allow several deliveries",
"keep_strip_and_one_delivery": "Keep strip and allow only one delivery",
"language": "Language", "language": "Language",
"large": "Large", "large": "Large",
"large_picto": "Large pictograms", "large_picto": "Large pictograms",
...@@ -204,6 +208,7 @@ ...@@ -204,6 +208,7 @@
"no_students_for_user": "You are not associated to any students. Please ask your office to link your account to a Pictogram student.", "no_students_for_user": "You are not associated to any students. Please ask your office to link your account to a Pictogram student.",
"no_space_in_category": "No space left in category", "no_space_in_category": "No space left in category",
"normal": "Normal", "normal": "Normal",
"note": "Note",
"notes": "Notes", "notes": "Notes",
"November": "November", "November": "November",
"num_peers": "Peers", "num_peers": "Peers",
......
...@@ -77,6 +77,8 @@ ...@@ -77,6 +77,8 @@
"delete": "Eliminar", "delete": "Eliminar",
"delete_strip_after_delivery": "Limpiar cinta tras entrega", "delete_strip_after_delivery": "Limpiar cinta tras entrega",
"delete_template": "Eliminar de plantillas", "delete_template": "Eliminar de plantillas",
"delivery_behavior": "Entrega de tira",
"delivery_note": "Se considera una <i>entrega</i> la locución de los pictogramas en la cinta de frase",
"description": "Descripción", "description": "Descripción",
"device": "Dispositivo", "device": "Dispositivo",
"device_setup": "Configuración del dispositivo", "device_setup": "Configuración del dispositivo",
...@@ -146,6 +148,8 @@ ...@@ -146,6 +148,8 @@
"January": "Enero", "January": "Enero",
"July": "Julio", "July": "Julio",
"June": "Junio", "June": "Junio",
"keep_strip_and_deliveries": "Mantener cinta y permitir varias entregas",
"keep_strip_and_one_delivery": "Mantener cinta y permitir sólo una entrega",
"language": "Idioma", "language": "Idioma",
"large": "Grande", "large": "Grande",
"large_picto": "Pictogramas grandes", "large_picto": "Pictogramas grandes",
...@@ -204,6 +208,7 @@ ...@@ -204,6 +208,7 @@
"no_subscribed": "Sin conexión a la cuenta del estudiante", "no_subscribed": "Sin conexión a la cuenta del estudiante",
"nobegin": "Sin iniciar", "nobegin": "Sin iniciar",
"normal": "Normal", "normal": "Normal",
"note": "Nota",
"notes": "Notas", "notes": "Notas",
"November": "Noviembre", "November": "Noviembre",
"num_peers": "Conectados", "num_peers": "Conectados",
......
...@@ -89,11 +89,6 @@ dashboardApp.config(function ($stateProvider, $urlRouterProvider) { ...@@ -89,11 +89,6 @@ dashboardApp.config(function ($stateProvider, $urlRouterProvider) {
templateUrl: 'modules/login/views/login_setting_password.html', templateUrl: 'modules/login/views/login_setting_password.html',
controller: 'LoginSettingPasswordCtrl' controller: 'LoginSettingPasswordCtrl'
}) })
.state('loginadmin', {
url: '/loginadmin',
templateUrl: 'modules/login/views/login_admin.html',
controller: 'LoginAdminCtrl',
})
.state('signin', { .state('signin', {
url: '/signin', url: '/signin',
templateUrl: 'modules/login/views/signin.html', templateUrl: 'modules/login/views/signin.html',
...@@ -128,7 +123,7 @@ dashboardApp.config(function ($stateProvider, $urlRouterProvider) { ...@@ -128,7 +123,7 @@ dashboardApp.config(function ($stateProvider, $urlRouterProvider) {
controller: 'InstructionsCtrl', controller: 'InstructionsCtrl',
}) })
.state('supervisors_list', { .state('supervisors_list', {
url: '/supervisors_list', url: '/supervisor/list',
parent: 'supervisor', parent: 'supervisor',
templateUrl: 'modules/supervisor/views/supervisors_list.html', templateUrl: 'modules/supervisor/views/supervisors_list.html',
controller: 'SupervisorsCtrl', controller: 'SupervisorsCtrl',
...@@ -177,19 +172,24 @@ dashboardApp.config(function ($stateProvider, $urlRouterProvider) { ...@@ -177,19 +172,24 @@ dashboardApp.config(function ($stateProvider, $urlRouterProvider) {
controller: 'AdminCtrl', controller: 'AdminCtrl',
abstract: true, abstract: true,
}) })
.state('licenses', { .state('admin_login', {
url: '/admin/login',
templateUrl: 'modules/login/views/login_admin.html', // TODO: habría que mover esta vista a modules/admin/views
controller: 'LoginAdminCtrl', // TODO: y el controlador, también
})
.state('admin_licenses', {
url: '/admin/licenses', url: '/admin/licenses',
parent: 'admin', parent: 'admin',
templateUrl: 'modules/admin/views/licenses.html', templateUrl: 'modules/admin/views/licenses.html',
controller: 'AdminLicensesCtrl', controller: 'AdminLicensesCtrl',
}) })
.state('offices', { .state('admin_offices', {
url: '/admin/offices', url: '/admin/offices',
parent: 'admin', parent: 'admin',
templateUrl: 'modules/admin/views/offices.html', templateUrl: 'modules/admin/views/offices.html',
controller: 'AdminOfficesCtrl', controller: 'AdminOfficesCtrl',
}) })
.state('supervisors', { .state('admin_supervisors', {
url: '/admin/supervisors', url: '/admin/supervisors',
parent: 'admin', parent: 'admin',
templateUrl: 'modules/admin/views/supervisors.html', templateUrl: 'modules/admin/views/supervisors.html',
......
...@@ -236,18 +236,57 @@ ...@@ -236,18 +236,57 @@
{{ 'highlight' | translate }} {{ 'highlight' | translate }}
</span> </span>
</div> </div>
</fieldset>
</div>
<div class="col-md-5">
<fieldset>
<label translate>delivery_behavior</label>
<div class="input-group"> <div class="input-group">
<span class="input-group-addon"> <span class="input-group-addon">
<input type="checkbox" <input type="radio"
id="studentSetupDeleteStripAfterDelivery" id="delivery0"
ng-model="studentData.attributes.input_feedback.delete_strip_after_delivery" ng-model="studentData.attributes.delivery"
ng-value="0"
ng-change="update_attributes()"> ng-change="update_attributes()">
</span> </span>
<span class="form-control" for="studentSetupDeleteStripAfterDelivery"> <span class="form-control" for="delivery0">
{{ 'delete_strip_after_delivery' | translate }} {{ 'delete_strip_after_delivery' | translate }}
</span> </span>
</div> </div>
<div class="input-group">
<span class="input-group-addon">
<input type="radio"
id="delivery1"
ng-model="studentData.attributes.delivery"
ng-value="1"
ng-change="update_attributes()">
</span>
<span class="form-control" for="delivery1">
{{ 'keep_strip_and_one_delivery' | translate }}
</span>
</div>
<div class="input-group">
<span class="input-group-addon">
<input type="radio"
id="delivery2"
ng-model="studentData.attributes.delivery"
ng-value="2"
ng-change="update_attributes()">
</span>
<span class="form-control" for="delivery2">
{{ 'keep_strip_and_deliveries' | translate }}
</span>
</div>
</fieldset> </fieldset>
<div class="alert alert-warning" role="alert">
<p>
<strong translate> note </strong>
</p>
<p translate>
delivery_note
</p>
</div>
</div> </div>
</form> </form>
</div> </div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment