issues #740 y #741 cerrados

parent d034abc7
Showing with 95 additions and 29 deletions
......@@ -15,6 +15,7 @@ import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.UnknownHostException;
import java.nio.charset.Charset;
import java.util.Hashtable;
import javax.net.ssl.HttpsURLConnection;
......@@ -195,7 +196,9 @@ public class RestapiWrapper {
if (json_params) {
urlConnection.setRequestProperty("Content-Type", "application/json;charset=utf-8");
urlConnection.setRequestProperty("Accept", "application/json, text/plain, */*");
}
} else
urlConnection.setRequestProperty("Content-Type","application/x-www-form-urlencoded; charset=utf-8");
String sparams;
if (json_params) {
sparams = params.get("json");
......@@ -216,7 +219,7 @@ public class RestapiWrapper {
//Send request
DataOutputStream wr = new DataOutputStream (
urlConnection.getOutputStream ());
wr.writeBytes(sparams);
wr.write(sparams.getBytes(Charset.forName("UTF-8")));
wr.flush();
wr.close();
......
......@@ -148,9 +148,9 @@ public class Vocabulary implements Iterable<Picto> {
public void synchronize() {
synchronize_upload();
synchronize_upload(); // (i) uploading
//download
// and (ii) downloading
final String picto_str="/pictos";
String operation=PCBcontext.getPcbdb().getCurrentUser().get_restapi_operation_stu()+picto_str;
PCBcontext.getRestapiWrapper().ask(operation, new RestapiWrapper.iRestapiListener() {
......
......@@ -156,7 +156,9 @@ public class PictoUploader {
params.put("picto", Integer.toString(id_picto));
params.put("lang", PCBcontext.getPcbdb().getCurrentUser().get_lang_stu());
params.put("text", picto.get_translation());
PCBcontext.getRestapiWrapper().ask("picto/exp", params, "post", new RestapiWrapper.iRestapiListener() {
Log.i(this.getClass().getCanonicalName(), "Uploading translation: " + picto.get_translation());
PCBcontext.getRestapiWrapper().ask("picto/exp", params, "post", new RestapiWrapper.iRestapiListener() {
@Override
public void preExecute() {
}
......
......@@ -49,9 +49,9 @@ public class BitmapTools {
return resize(width,height);
}
public BitmapTools paintSquare(int thickness, int color ) {
for (int i = 0; i < this.bitmap.getWidth(); i++)
for (int t = 1; t <= thickness; t++) {
public BitmapTools paintSquare(int thickness, int color, int step ) {
for (int i = 0; i < this.bitmap.getWidth(); i+=step)
for (int t = 1; t <= thickness; t+=step) {
this.bitmap.setPixel(i, 0 + t-1, color);
this.bitmap.setPixel(i, this.bitmap.getHeight() - t, color);
}
......@@ -138,10 +138,23 @@ public class BitmapTools {
}
public void disableBitmap() {
public BitmapTools disableBitmap() {
Canvas canvas = new Canvas(bitmap);
Paint alphaPaint = new Paint();
alphaPaint.setAlpha(30);
canvas.drawBitmap(bitmap, 0, 0, alphaPaint);
return this;
}
public BitmapTools paintPause( ) {
int thickness=8;
int color=Color.DKGRAY;
for (int i = this.bitmap.getWidth()/2; i < this.bitmap.getWidth()/2+thickness; i++)
for (int t = this.bitmap.getHeight()/8; t <= this.bitmap.getHeight()-this.bitmap.getHeight()/8; t++) {
this.bitmap.setPixel(i-8, t, color);
this.bitmap.setPixel(i+8, t, color);
}
return this;
}
}
......@@ -1056,7 +1056,8 @@ public class PictogramActivity extends Activity implements VocabularyTalk.iVocab
public void saved(Picto localPicto) {
PictogramActivity.this.refresh();
try {
new PictoUploader(localPicto).upload(PictogramActivity.this);
if (PCBcontext.is_user_online())
new PictoUploader(localPicto).upload(PictogramActivity.this);
} catch (IOException e) {
Log.e(Vocabulary.class.getCanonicalName(), e.getMessage());
}
......@@ -1139,6 +1140,7 @@ public class PictogramActivity extends Activity implements VocabularyTalk.iVocab
Intent sessionActivity = new Intent(this, SessionActivity.class);
sessionActivity.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
startActivity(sessionActivity);
overridePendingTransition(R.anim.leftin, R.anim.leftout);
}
}
break;
......
......@@ -95,7 +95,6 @@ public class ListInstructionsFragment extends Fragment{
GUITools.show_alert(PCBcontext.getContext(), R.string.session_error, error);
}
});
progressDialog = ProgressDialog.show(getActivity(), getString(R.string.session_instruction), getString(R.string.session_loading));
}
else
initAdapters();
......@@ -104,6 +103,7 @@ public class ListInstructionsFragment extends Fragment{
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_instructions_session, container, false);
progressDialog = ProgressDialog.show(getActivity(), getString(R.string.session_instruction), getString(R.string.session_loading));
checkStudent();
initMethods(view);
initInstructions(view);
......
......@@ -223,9 +223,10 @@ public class SessionActivity extends FragmentActivity implements ListInstruction
break;
case MotionEvent.ACTION_MOVE:
if (event.getX()> firstTouchX +100) {
if (firstTouchX> event.getX()+100) {
Intent pictogramActivity = new Intent(this, PictogramActivity.class);
startActivity(pictogramActivity);
overridePendingTransition(R.anim.leftin, R.anim.leftout);
}
break;
case MotionEvent.ACTION_UP:
......
......@@ -3,6 +3,7 @@ package com.yottacode.pictogram.tabletlibrary.gui.session;
import android.app.Activity;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
......@@ -117,7 +118,7 @@ public class SessionFragment extends Fragment implements ActionTalk.iActionListe
if (paused) {
bmp=bmp.copy(bmp.getConfig(),true);
new BitmapTools(bmp).disableBitmap();
new BitmapTools(bmp).paintPause();
}
this.adapter_pictomsg.addItem(bmp,picto.get_translation());
getActivity().runOnUiThread(new Runnable() {
......
<?xml version="1.0" encoding="utf-8"?>
<set
xmlns:android="http://schemas.android.com/apk/res/android"
android:shareInterpolator="false">
<translate
android:duration="500"
android:fromXDelta="100%p"
android:toXDelta="0"
android:interpolator="@android:anim/linear_interpolator" />
</set>
<?xml version="1.0" encoding="utf-8"?>
<set
xmlns:android="http://schemas.android.com/apk/res/android"
android:shareInterpolator="false">
<translate
android:duration="500"
android:fromXDelta="0"
android:toXDelta="-100%p"
android:interpolator="@android:anim/linear_interpolator" />
</set>
<?xml version="1.0" encoding="utf-8"?>
<set
xmlns:android="http://schemas.android.com/apk/res/android"
android:shareInterpolator="false">
<translate
android:duration="500"
android:fromXDelta="100%"
android:toXDelta="0%"
android:fromYDelta="0%"
android:toYDelta="0%"
android:interpolator="@android:anim/linear_interpolator" />
</set>
<?xml version="1.0" encoding="utf-8"?>
<set
xmlns:android="http://schemas.android.com/apk/res/android"
android:shareInterpolator="false">
<translate
android:duration="500"
android:fromXDelta="0%"
android:toXDelta="-100%"
android:fromYDelta="0%"
android:toYDelta="0%"
android:interpolator="@android:anim/linear_interpolator" />
</set>
......@@ -73,14 +73,6 @@
<sourceFolder url="file://$MODULE_DIR$/src/main/jni" 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/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/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/jni" 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/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" />
......@@ -89,6 +81,14 @@
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/jni" 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/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/shaders" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/annotations" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/blame" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/bundles" />
......
......@@ -18,7 +18,7 @@
<option name="ALLOW_USER_CONFIGURATION" value="false" />
<option name="MANIFEST_FILE_RELATIVE_PATH" value="/src/main/AndroidManifest.xml" />
<option name="RES_FOLDER_RELATIVE_PATH" value="/src/main/res" />
<option name="RES_FOLDERS_RELATIVE_PATH" value="" />
<option name="RES_FOLDERS_RELATIVE_PATH" value="file://$MODULE_DIR$/src/main/res" />
<option name="ASSETS_FOLDER_RELATIVE_PATH" value="/src/main/assets" />
</configuration>
</facet>
......@@ -43,13 +43,6 @@
<sourceFolder url="file://$MODULE_DIR$/src/DevFlavorDebug/jni" 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$/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/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testDevFlavorDebug/assets" type="java-test-resource" />
......@@ -58,6 +51,13 @@
<sourceFolder url="file://$MODULE_DIR$/src/testDevFlavorDebug/jni" 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$/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/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/DevFlavor/assets" type="java-resource" />
......
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