Varios bugs solucionados

parent 6383f43e
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="10daeba4-0692-476d-a3da-642b4123cfdd" name="Default" comment=""> <list default="true" id="10daeba4-0692-476d-a3da-642b4123cfdd" name="Default" comment="" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/android.iml" afterPath="$PROJECT_DIR$/.idea/android.iml" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" />
</list>
<ignored path="android.iws" /> <ignored path="android.iws" />
<ignored path=".idea/workspace.xml" /> <ignored path=".idea/workspace.xml" />
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" /> <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
...@@ -42,10 +39,10 @@ ...@@ -42,10 +39,10 @@
<order /> <order />
</component> </component>
<component name="ProjectFrameBounds"> <component name="ProjectFrameBounds">
<option name="x" value="-9" /> <option name="x" value="43" />
<option name="y" value="-9" /> <option name="y" value="23" />
<option name="width" value="1938" /> <option name="width" value="1397" />
<option name="height" value="1170" /> <option name="height" value="877" />
</component> </component>
<component name="ProjectLevelVcsManager" settingsEditedManually="true"> <component name="ProjectLevelVcsManager" settingsEditedManually="true">
<OptionsSetting value="true" id="Add" /> <OptionsSetting value="true" id="Add" />
...@@ -73,12 +70,16 @@ ...@@ -73,12 +70,16 @@
<sortByType /> <sortByType />
</navigator> </navigator>
<panes> <panes>
<pane id="PackagesPane" /> <pane id="PackagesPane">
<pane id="AndroidView">
<subPane /> <subPane />
</pane> </pane>
<pane id="Scope" />
<pane id="Scratches" /> <pane id="Scratches" />
<pane id="AndroidView">
<subPane />
</pane>
<pane id="Scope">
<subPane subId="Project Files" />
</pane>
<pane id="ProjectPane"> <pane id="ProjectPane">
<subPane> <subPane>
<PATH> <PATH>
...@@ -87,30 +88,6 @@ ...@@ -87,30 +88,6 @@
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" /> <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT> </PATH_ELEMENT>
</PATH> </PATH>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="android" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="android" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="Pictogrammar" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
</PATH>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="android" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="android" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
</PATH>
</subPane> </subPane>
</pane> </pane>
</panes> </panes>
...@@ -291,39 +268,39 @@ ...@@ -291,39 +268,39 @@
<servers /> <servers />
</component> </component>
<component name="ToolWindowManager"> <component name="ToolWindowManager">
<frame x="-9" y="-9" width="1938" height="1170" extended-state="0" /> <frame x="43" y="23" width="1397" height="877" extended-state="0" />
<editor active="false" /> <editor active="false" />
<layout> <layout>
<window_info id="Palette&#9;" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" /> <window_info id="Palette&#9;" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Designer" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" /> <window_info id="Designer" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Android Model" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="true" content_ui="tabs" /> <window_info id="Capture Analysis" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
<window_info id="Capture Analysis" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
<window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" /> <window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Android Monitor" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
<window_info id="Captures" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
<window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="true" content_ui="tabs" /> <window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="true" content_ui="tabs" />
<window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" /> <window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" />
<window_info id="Capture Tool" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" /> <window_info id="Capture Tool" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Build Variants" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="true" content_ui="tabs" />
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" /> <window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" /> <window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" /> <window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.2494465" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Maven Projects" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" /> <window_info id="Maven Projects" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Application Servers" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" /> <window_info id="Application Servers" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Project" active="true" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.17524116" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" /> <window_info id="Project" active="true" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.17490774" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
<window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
<window_info id="Changes" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" /> <window_info id="Changes" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Android Monitor" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Gradle Console" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="true" content_ui="tabs" />
<window_info id="Build Variants" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="3" side_tool="true" content_ui="tabs" />
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
<window_info id="Memory Monitor" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="true" content_ui="tabs" />
<window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
<window_info id="Palette" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" /> <window_info id="Palette" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" /> <window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
<window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" /> <window_info id="Android Model" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="4" side_tool="true" content_ui="tabs" />
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" /> <window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Captures" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" /> <window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Gradle Console" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="true" content_ui="tabs" />
<window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="SLIDING" type="SLIDING" visible="false" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" /> <window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="SLIDING" type="SLIDING" visible="false" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
<window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
<window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" /> <window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Memory Monitor" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="true" content_ui="tabs" />
</layout> </layout>
</component> </component>
<component name="Vcs.Log.UiProperties"> <component name="Vcs.Log.UiProperties">
......
...@@ -51,6 +51,7 @@ public class LoginActivity extends FragmentActivity implements iRestapiListener, ...@@ -51,6 +51,7 @@ public class LoginActivity extends FragmentActivity implements iRestapiListener,
private static final String TAG_PIC = "pic"; private static final String TAG_PIC = "pic";
private static final String TAG_LANG = "lang"; private static final String TAG_LANG = "lang";
private static final String TAG_ATTRIBUTES = "attributes"; private static final String TAG_ATTRIBUTES = "attributes";
private static final String TAG_SUPERVISION = "supervision";
private int sup_id; private int sup_id;
...@@ -153,6 +154,7 @@ public class LoginActivity extends FragmentActivity implements iRestapiListener, ...@@ -153,6 +154,7 @@ public class LoginActivity extends FragmentActivity implements iRestapiListener,
public void result(JSONArray students_supervisors) { //FERNANDO public void result(JSONArray students_supervisors) { //FERNANDO
try { try {
// Saco los pares estudiante-supervisor // Saco los pares estudiante-supervisor
//Log.d(LOG_TAG, "JSON:"+students_supervisors);
Log.d(LOG_TAG, "students_supervisors size:" + students_supervisors.length()); Log.d(LOG_TAG, "students_supervisors size:" + students_supervisors.length());
// looping through All Students // looping through All Students
Vector<User> users = new Vector<User>(students_supervisors.length()); Vector<User> users = new Vector<User>(students_supervisors.length());
...@@ -189,14 +191,18 @@ public class LoginActivity extends FragmentActivity implements iRestapiListener, ...@@ -189,14 +191,18 @@ public class LoginActivity extends FragmentActivity implements iRestapiListener,
String st_lang = st.getString(TAG_LANG); String st_lang = st.getString(TAG_LANG);
//st_lang = "es-es"; //st_lang = "es-es";
String st_attributes = st.getString(TAG_ATTRIBUTES); String st_attributes = st.getString(TAG_ATTRIBUTES);
Integer st_supervision = st.getInt(TAG_SUPERVISION);
//Log.d(LOG_TAG, "student pic:" + st_pic); //Log.d(LOG_TAG, "student pic:" + st_pic);
// Añado un par <student-supervisor> // Añado un par <student-supervisor>
int st_id_int = st_id.intValue(); int st_id_int = st_id.intValue();
student = new User(st_id_int, st_name, st_surname, st_pic, st_gender, st_lang, st_attributes, int st_supervision_int = st_supervision.intValue();
sup_id, "", "", "", "M", "es-es", ""); if (st_supervision_int==2){
users.add(student); student = new User(st_id_int, st_name, st_surname, st_pic, st_gender, st_lang, st_attributes,
sup_id, "", "", "", "M", "es-es", "");
users.add(student);
}
} }
// Si sólo hay 1 estudiante, cargo el st_id // Si sólo hay 1 estudiante, cargo el st_id
......
...@@ -15,11 +15,16 @@ import android.widget.Toast; ...@@ -15,11 +15,16 @@ import android.widget.Toast;
import com.yottacode.pictogram.R; import com.yottacode.pictogram.R;
import com.yottacode.pictogram.dao.Device; import com.yottacode.pictogram.dao.Device;
import com.yottacode.pictogram.dao.PCBDBHelper; import com.yottacode.pictogram.dao.PCBDBHelper;
import com.yottacode.pictogram.dao.User;
import com.yottacode.pictogram.tools.PCBcontext; import com.yottacode.pictogram.tools.PCBcontext;
import org.json.JSONException;
import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Vector;
public class MainActivity extends Activity { public class MainActivity extends Activity {
...@@ -35,28 +40,13 @@ public class MainActivity extends Activity { ...@@ -35,28 +40,13 @@ public class MainActivity extends Activity {
// For deactivating the lock screen (just before setContentView) // For deactivating the lock screen (just before setContentView)
getWindow().addFlags(WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD); getWindow().addFlags(WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD);
// Singleton getInstance and initialization passing the Context (to create the device)
//PCBcontext pcb = PCBcontext.getInstance();
PCBcontext.init(this); PCBcontext.init(this);
Log.d(LOG_TAG, "PCBcontext iniciado"); Log.d(LOG_TAG, "PCBcontext iniciado.");
// Nota magc: al pasar ya siempre por serial no tiene sentido tener main ¿no?
//if (1==0){ // Fuerzo a que entre en serialActivity
Intent serialActivity = new Intent(this, SerialActivity.class); Intent serialActivity = new Intent(this, SerialActivity.class);
startActivity(serialActivity); startActivity(serialActivity);
/*
if (token==null || token.isEmpty()){
Intent serialActivity = new Intent(this, SerialActivity.class);
startActivity(serialActivity);
} else{
Log.d(LOG_TAG, "token leido:" + token);
Intent loginActivity = new Intent(this, LoginActivity.class);
startActivity(loginActivity);
Intent pictogramActivity = new Intent(this, PictogramActivity.class);
startActivity(pictogramActivity);
}
*/
} }
@Override @Override
......
...@@ -19,6 +19,7 @@ import android.util.Log; ...@@ -19,6 +19,7 @@ import android.util.Log;
import android.view.Display; import android.view.Display;
import android.view.DragEvent; import android.view.DragEvent;
import android.view.KeyEvent; import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.view.Window; import android.view.Window;
...@@ -78,6 +79,12 @@ public class PictogramActivity extends Activity implements iVocabularyListener, ...@@ -78,6 +79,12 @@ public class PictogramActivity extends Activity implements iVocabularyListener,
// String constant for logs // String constant for logs
private final String LOG_TAG = this.getClass().getSimpleName(); // Or .getCanonicalName() private final String LOG_TAG = this.getClass().getSimpleName(); // Or .getCanonicalName()
float xAxis = 0f;
float yAxis = 0f;
float lastXAxis = 0f;
float lastYAxis = 0f;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
...@@ -130,6 +137,43 @@ public class PictogramActivity extends Activity implements iVocabularyListener, ...@@ -130,6 +137,43 @@ public class PictogramActivity extends Activity implements iVocabularyListener,
tapeGridView.getLayoutParams().width = width - 120; tapeGridView.getLayoutParams().width = width - 120;
tapeGridView.requestLayout(); tapeGridView.requestLayout();
tapeGridView.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
final int actionPeformed = event.getAction();
switch (actionPeformed) {
case MotionEvent.ACTION_DOWN: {
final float x = event.getX();
final float y = event.getY();
lastXAxis = x;
lastYAxis = y;
Log.d(LOG_TAG, "TOUCH X:" + Float.toString(lastXAxis));
Log.d(LOG_TAG, "TOUCH Y:" + Float.toString(lastYAxis));
break;
}
case MotionEvent.ACTION_MOVE: {
final float x = event.getX();
final float y = event.getY();
final float dx = x - lastXAxis;
final float dy = y - lastYAxis;
xAxis += dx;
yAxis += dy;
Log.d(LOG_TAG, "MOVE X:" + Float.toString(xAxis));
Log.d(LOG_TAG, "MOVE Y:" + Float.toString(yAxis));
break;
}
}
return true;
}
});
final GridView panelGridView = (GridView) findViewById(R.id.panel_grid_view); final GridView panelGridView = (GridView) findViewById(R.id.panel_grid_view);
final ImageButton deleteButton = (ImageButton) findViewById(R.id.button_delete); final ImageButton deleteButton = (ImageButton) findViewById(R.id.button_delete);
//final Button deleteAllButton = (Button) findViewById(R.id.button_delete_all); //final Button deleteAllButton = (Button) findViewById(R.id.button_delete_all);
...@@ -167,64 +211,66 @@ public class PictogramActivity extends Activity implements iVocabularyListener, ...@@ -167,64 +211,66 @@ public class PictogramActivity extends Activity implements iVocabularyListener,
//rowNumberAdapter.notifyDataSetChanged(); //rowNumberAdapter.notifyDataSetChanged();
Picto p = panelAdapter.getItem(position); Picto p = panelAdapter.getItem(position);
Log.d(LOG_TAG, "Clic en picto: " + p.toString()); if (p!=null && !p.is_invisible() && p.is_enabled()){
//Log.d(LOG_TAG, "STATUS: " + p.get_status()); Log.d(LOG_TAG, "Clic en picto: " + p.toString());
//Log.d(LOG_TAG, "STATUS: " + p.get_status());
//QUITAR PARA QUE HABLE panelAdapter.ttsPicto(p, tts); //QUITAR PARA QUE HABLE panelAdapter.ttsPicto(p, tts);
// If is not the blank picto, it isn't invisible or disabled // If is not the blank picto, it isn't invisible or disabled
if(p.get_id() != 0 && if(p.get_id() != 0 &&
!p.get_status().equalsIgnoreCase("invisible") && !p.get_status().equalsIgnoreCase("invisible") &&
!p.get_status().equalsIgnoreCase("disabled")) { !p.get_status().equalsIgnoreCase("disabled")) {
LinkedList<Picto> ll = order(vocabulary.next(p)); LinkedList<Picto> ll = order(vocabulary.next(p));
//LinkedList<Picto> ll = vocabulary.next(p); //LinkedList<Picto> ll = vocabulary.next(p);
Log.d(LOG_TAG, "Lista de pictos recuperada: " + ll.toString()); Log.d(LOG_TAG, "Lista de pictos recuperada: " + ll.toString());
int maxInTape= getResources().getInteger(R.integer.maxInTape); int maxInTape= getResources().getInteger(R.integer.maxInTape);
// If the picto is a category // If the picto is a category
if (p.is_category()) { if (p.is_category()) {
panelAdapter.clear(); panelAdapter.clear();
//if (panelAdapter.isEmpty()) //if (panelAdapter.isEmpty())
// Log.d(LOG_TAG, "EMPTY !!!!"); // Log.d(LOG_TAG, "EMPTY !!!!");
//panelAdapter.deleteAll(); //panelAdapter.deleteAll();
panelAdapter.addAll(ll); panelAdapter.addAll(ll);
//panelAdapter = new PanelAdapter(ll); //panelAdapter = new PanelAdapter(ll);
// Cambio el color del fondo // Cambio el color del fondo
RelativeLayout rl = (RelativeLayout)findViewById(R.id.pictogramLayout); RelativeLayout rl = (RelativeLayout)findViewById(R.id.pictogramLayout);
//rl.setBackgroundColor(Color.RED); //rl.setBackgroundColor(Color.RED);
if (p.get_color() != -1){ if (p.get_color() != -1){
rl.setBackgroundColor(p.get_color()); rl.setBackgroundColor(p.get_color());
panelAdapter.setColor(p.get_darkner_color()); panelAdapter.setColor(p.get_darkner_color());
} }
actualCategory = p; actualCategory = p;
Toast.makeText(context, "El picto pulsado es una categoría", Toast.LENGTH_SHORT).show(); Toast.makeText(context, "El picto pulsado es una categoría", Toast.LENGTH_SHORT).show();
PCBcontext.getActionLog().log(new PictoAction(PictoAction.SELECT, p)); PCBcontext.getActionLog().log(new PictoAction(PictoAction.SELECT, p));
}else if(tapeAdapter.getCount() < maxInTape){ }else if(tapeAdapter.getCount() < maxInTape){
// If the picto selected is not a category and the tape is not full, it is placed in tape // If the picto selected is not a category and the tape is not full, it is placed in tape
tapeAdapter.addItem(p); tapeAdapter.addItem(p);
tapeAdapter.notifyDataSetChanged(); tapeAdapter.notifyDataSetChanged();
Log.d(LOG_TAG, "Picto añadido a la CINTA"); Log.d(LOG_TAG, "Picto añadido a la CINTA");
panelAdapter.clear(); panelAdapter.clear();
panelAdapter.addAll(ll); panelAdapter.addAll(ll);
panelAdapter.setColor(Color.parseColor("#AFAFAF")); panelAdapter.setColor(Color.parseColor("#AFAFAF"));
RelativeLayout rl = (RelativeLayout)findViewById(R.id.pictogramLayout); RelativeLayout rl = (RelativeLayout)findViewById(R.id.pictogramLayout);
rl.setBackgroundColor(Color.parseColor("#BDBDBD")); rl.setBackgroundColor(Color.parseColor("#BDBDBD"));
// Call to static log method // Call to static log method
PCBcontext.getActionLog().log(new PictoAction(PictoAction.ADD, p)); PCBcontext.getActionLog().log(new PictoAction(PictoAction.ADD, p));
// Send websocket notification // Send websocket notification
// when clicking a picto, the activity goes to the main category view // when clicking a picto, the activity goes to the main category view
actualCategory = null; actualCategory = null;
}
} }
} }
} }
...@@ -297,6 +343,11 @@ public class PictogramActivity extends Activity implements iVocabularyListener, ...@@ -297,6 +343,11 @@ public class PictogramActivity extends Activity implements iVocabularyListener,
tapeAdapter.deleteAll(); tapeAdapter.deleteAll();
tapeAdapter.notifyDataSetChanged(); tapeAdapter.notifyDataSetChanged();
panelAdapter.setColor(Color.parseColor("#AFAFAF"));
RelativeLayout rl = (RelativeLayout)findViewById(R.id.pictogramLayout);
rl.setBackgroundColor(Color.parseColor("#BDBDBD"));
// Load the categories // Load the categories
load_pictos(arg0); load_pictos(arg0);
} }
......
...@@ -6,6 +6,7 @@ import android.app.ProgressDialog; ...@@ -6,6 +6,7 @@ import android.app.ProgressDialog;
import android.content.Context; import android.content.Context;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences;
import android.net.ConnectivityManager; import android.net.ConnectivityManager;
import android.net.NetworkInfo; import android.net.NetworkInfo;
...@@ -80,10 +81,13 @@ public class SerialActivity extends Activity implements iRestapiListener, iImgDo ...@@ -80,10 +81,13 @@ public class SerialActivity extends Activity implements iRestapiListener, iImgDo
private final String LOG_TAG = this.getClass().getSimpleName(); // Or .getCanonicalName() private final String LOG_TAG = this.getClass().getSimpleName(); // Or .getCanonicalName()
private String username = null; private String username = null;
private String password = null;
//A ProgressDialog object //A ProgressDialog object
private ProgressDialog progressDialog; private ProgressDialog progressDialog;
public static final String PREFS_NAME = "MyPrefsFile";
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
...@@ -93,6 +97,13 @@ public class SerialActivity extends Activity implements iRestapiListener, iImgDo ...@@ -93,6 +97,13 @@ public class SerialActivity extends Activity implements iRestapiListener, iImgDo
mSerialViewMail = (EditText) findViewById(R.id.serialmail); mSerialViewMail = (EditText) findViewById(R.id.serialmail);
mSerialViewPass = (EditText) findViewById(R.id.serialpass); mSerialViewPass = (EditText) findViewById(R.id.serialpass);
SharedPreferences settings = getSharedPreferences(PREFS_NAME, 0);
username = settings.getString("username", "");
password = settings.getString("password", "");
// Escribo los últimos valores indicados
mSerialViewMail.setText(username);
//mSerialViewPass.setText(password);
// NOTA: si el Mail es un mail, es un supervisor...si no es un estudiante // NOTA: si el Mail es un mail, es un supervisor...si no es un estudiante
context = this; context = this;
...@@ -103,69 +114,110 @@ public class SerialActivity extends Activity implements iRestapiListener, iImgDo ...@@ -103,69 +114,110 @@ public class SerialActivity extends Activity implements iRestapiListener, iImgDo
SSLDummyContext.init(getResources().getBoolean(R.bool.ssl_connect)); SSLDummyContext.init(getResources().getBoolean(R.bool.ssl_connect));
PCBcontext.init(this); PCBcontext.init(this);
Log.d(LOG_TAG, "PCBcontext iniciado"); Log.d(LOG_TAG, "PCBcontext iniciado");
// Compruebo si tengo acceso a internet
//modificación FERNANDO //if (PCBcontext.getDevice().getLastStuId() != 0) {
if (!RestapiWrapper.ping(context.getResources().getString(R.string.server),"server/ping",this)) { if (!username.equals("") && !password.equals("")){
// No puedo comprobar si el serial es válido. Muestro un alertdialog de error, y cierro la aplicación // Tengo usuario, sigo con este usuario
AlertDialog alertDialog = new AlertDialog.Builder( RestapiWrapper wrapper = PCBcontext.getRestapiWrapper();
SerialActivity.this).create(); if (username.contains("@")){
alertDialog.setTitle("Mensaje del sistema"); // Es un supervisor
alertDialog.setMessage("No hay conexión a Internet. Inténtelo más tarde"); String operation = "sup/login";
//alertDialog.setIcon(R.drawable.tick); Hashtable<String, String> postDataParams = new Hashtable<String, String>();
/*
alertDialog.setButton("OK", new DialogInterface.OnClickListener() { postDataParams.put("email", username);
public void onClick(DialogInterface dialog, int which) { postDataParams.put("password", password);
Toast.makeText(getApplicationContext(), "Saliendo de la aplicación", Toast.LENGTH_SHORT).show(); /*
} postDataParams.put("idFirmware", _ANDROIDID);
}); postDataParams.put("desc", _MODEL);
*/ postDataParams.put("serial", serial);
alertDialog.show(); */
// ¿QUÉ HACEMOS CON LA APP? wrapper.ask(operation, postDataParams, "post", (iRestapiListener) context);
} else { } else{
Button mEntrarButton = (Button) findViewById(R.id.entrar_button); // Es un estudiante
mEntrarButton.setOnClickListener(new OnClickListener() { Log.d(LOG_TAG, "Entro con usuario y password");
@Override String operation = "stu/login";
public void onClick(View view) { Hashtable<String, String> postDataParams = new Hashtable<String, String>();
username = mSerialViewMail.getText().toString();
String password = mSerialViewPass.getText().toString(); postDataParams.put("username", username);
// DE PRUEBA postDataParams.put("password", password);
// Alumno /*
//username = "faf0001"; postDataParams.put("idFirmware", _ANDROIDID);
//password = "faf0001"; postDataParams.put("desc", _MODEL);
// Supervisor postDataParams.put("serial", serial);
username = "dofer@ujaen.es"; */
password = "dofer"; wrapper.ask(operation, postDataParams, "post", (iRestapiListener) context);
}
RestapiWrapper wrapper = PCBcontext.getRestapiWrapper(); } else{
if (username.contains("@")){ // Compruebo si tengo acceso a internet
// Es un supervisor //modificación FERNANDO
String operation = "sup/login"; if (!RestapiWrapper.ping(context.getResources().getString(R.string.server),"server/ping",this)) {
Hashtable<String, String> postDataParams = new Hashtable<String, String>(); // No puedo comprobar si el serial es válido. Muestro un alertdialog de error, y cierro la aplicación
AlertDialog alertDialog = new AlertDialog.Builder(
postDataParams.put("email", username); SerialActivity.this).create();
postDataParams.put("password", password); alertDialog.setTitle("Mensaje del sistema");
/* alertDialog.setMessage("No hay conexión a Internet. Inténtelo más tarde");
postDataParams.put("idFirmware", _ANDROIDID); //alertDialog.setIcon(R.drawable.tick);
postDataParams.put("desc", _MODEL); /*
postDataParams.put("serial", serial); alertDialog.setButton("OK", new DialogInterface.OnClickListener() {
*/ public void onClick(DialogInterface dialog, int which) {
wrapper.ask(operation, postDataParams, "post", (iRestapiListener) context); Toast.makeText(getApplicationContext(), "Saliendo de la aplicación", Toast.LENGTH_SHORT).show();
} else{ }
// Es un estudiante });
String operation = "stu/login"; */
Hashtable<String, String> postDataParams = new Hashtable<String, String>(); alertDialog.show();
// ¿QUÉ HACEMOS CON LA APP?
postDataParams.put("username", username); } else {
postDataParams.put("password", password); Button mEntrarButton = (Button) findViewById(R.id.entrar_button);
/* mEntrarButton.setOnClickListener(new OnClickListener() {
postDataParams.put("idFirmware", _ANDROIDID); @Override
postDataParams.put("desc", _MODEL); public void onClick(View view) {
postDataParams.put("serial", serial); String username = mSerialViewMail.getText().toString();
*/ String password = mSerialViewPass.getText().toString();
wrapper.ask(operation, postDataParams, "post", (iRestapiListener) context); // DE PRUEBA
// Alumno
username = "faf0001";
password = "faf0001";
// Supervisor
//username = "dofer@ujaen.es";
//password = "dofer";
SharedPreferences settings = getSharedPreferences(PREFS_NAME, 0);
SharedPreferences.Editor editor = settings.edit();
editor.putString("username", username);
editor.putString("password", password);
editor.commit();
RestapiWrapper wrapper = PCBcontext.getRestapiWrapper();
if (username.contains("@")){
// Es un supervisor
String operation = "sup/login";
Hashtable<String, String> postDataParams = new Hashtable<String, String>();
postDataParams.put("email", username);
postDataParams.put("password", password);
/*
postDataParams.put("idFirmware", _ANDROIDID);
postDataParams.put("desc", _MODEL);
postDataParams.put("serial", serial);
*/
wrapper.ask(operation, postDataParams, "post", (iRestapiListener) context);
} else{
// Es un estudiante
String operation = "stu/login";
Hashtable<String, String> postDataParams = new Hashtable<String, String>();
postDataParams.put("username", username);
postDataParams.put("password", password);
/*
postDataParams.put("idFirmware", _ANDROIDID);
postDataParams.put("desc", _MODEL);
postDataParams.put("serial", serial);
*/
wrapper.ask(operation, postDataParams, "post", (iRestapiListener) context);
}
} }
} });
}); }
} }
} }
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:paddingLeft="10dp" android:paddingLeft="10dp"
android:paddingRight="15dp" android:paddingRight="10dp"
android:paddingTop="10dp" android:paddingTop="10dp"
android:orientation="horizontal" android:orientation="horizontal"
android:background="#BDBDBD" android:background="#BDBDBD"
...@@ -22,16 +22,14 @@ ...@@ -22,16 +22,14 @@
android:accessibilityLiveRegion="none" android:accessibilityLiveRegion="none"
android:background="@android:color/holo_red_light" android:background="@android:color/holo_red_light"
android:clickable="false" android:clickable="false"
android:visibility="visible"
android:layout_alignParentTop="true"> android:layout_alignParentTop="true">
</GridView> </GridView>
<ImageButton <ImageButton
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingLeft="20dp" android:paddingLeft="20dp"
android:src="@drawable/ic_action_1" android:src="@drawable/play64"
android:background="@null" android:background="@null"
android:id="@+id/button_tts" android:id="@+id/button_tts"
android:layout_toRightOf="@+id/tape_grid_view" android:layout_toRightOf="@+id/tape_grid_view"
...@@ -41,11 +39,11 @@ ...@@ -41,11 +39,11 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingLeft="20dp" android:paddingLeft="20dp"
android:src="@drawable/ic_action" android:src="@drawable/back64"
android:background="@null" android:background="@null"
android:id="@+id/button_delete" android:id="@+id/button_delete"
android:layout_toRightOf="@+id/tape_grid_view" android:layout_toRightOf="@+id/tape_grid_view"
android:layout_alignParentTop="true"/> android:layout_below="@+id/button_tts"/>
<GridView <GridView
android:id="@+id/panel_grid_view" android:id="@+id/panel_grid_view"
......
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