working on several issues

parent 326246e4
......@@ -133,21 +133,15 @@ public class UserLogin {
try {
Vector<User> localUsers = PCBcontext.getDevice().findUser(email, password);
Log.i(this.getClass().getCanonicalName(), "Offline login request for supervisor "+email+localUsers.elementAt(0).get_email_sup()+localUsers.elementAt(0).is_supervisor());
Intent loginActivity = new Intent(activity, LoginActivity);
loginActivity.putExtra("sup_id", localUsers.elementAt(0).get_id_sup());
loginActivity.putExtra("name", localUsers.elementAt(0).get_name_sup());
loginActivity.putExtra("surname", localUsers.elementAt(0).get_surname_sup());
loginActivity.putExtra("pic", localUsers.elementAt(0).get_url_img_sup());
loginActivity.putExtra("office", localUsers.elementAt(0).get_office());
loginActivity.putExtra("offline", true);
activity.startActivity(loginActivity);
if (localUsers.size() == 1) {
PCBcontext.set_user(localUsers.elementAt(0), null, null);
Intent pictogramActivity = new Intent(activity, PictogramActivity);
activity.startActivity(pictogramActivity);
} else {
Intent loginActivity = new Intent(activity, LoginActivity);
loginActivity.putExtra("sup_id", localUsers.elementAt(0).get_id_sup());
loginActivity.putExtra("name", localUsers.elementAt(0).get_name_sup());
loginActivity.putExtra("surname", localUsers.elementAt(0).get_surname_sup());
loginActivity.putExtra("pic", localUsers.elementAt(0).get_url_img_sup());
loginActivity.putExtra("office", localUsers.elementAt(0).get_office());
loginActivity.putExtra("offline", true);
activity.startActivity(loginActivity);
}
} catch (JSONException e) {
e.printStackTrace();
} catch (LoginException e) {
......
......@@ -46,6 +46,7 @@
<string name="noInternetConnection">There is no Internet connection. Try again later</string>
<string name="exitingApp">Exiting the app</string>
<string name="serverError">There is a server error. Try again later</string>
<string name="firstlogin">Login by using your user and password. In other case, register as new user on the website </string>
<!--Semantic grammar -->
<string name="loadingGrammar">Please wait, loading vocabulary</string>
......
......@@ -48,6 +48,7 @@
<string name="noInternetConnection">No hay acceso al Servidor. Inténtelo más tarde</string>
<string name="exitingApp">Saliendo de la aplicación</string>
<string name="serverError">Fallo accediendo al Servidor. Inténtelo más tarde</string>
<string name="firstlogin">Por favor, introduzca su usuario y clave, o bien registrese en </string>
<!--Semantic grammar -->
<string name="loadingGrammar">Por favor espere, cargando vocabulario</string>
......
......@@ -49,7 +49,7 @@
<string name="noInternetConnection">No hay conexión a internet. Inténtelo más tarde</string>
<string name="exitingApp">Saliendo de la aplicación</string>
<string name="serverError">Error en el servidor de datos. Inténtelo más tarde</string>
<string name="firstlogin">Por favor, introduzca su usuario y clave, o bien registrese en </string>
<!--Semantic grammar -->
<string name="loadingGrammar">Please wait, loading vocabulary</string>
......
package com.yottacode.pictogram.tabletlibrary.gui.communicator;
import android.net.Uri;
import android.os.Bundle;
import android.app.Fragment;
import android.provider.ContactsContract;
import android.support.annotation.NonNull;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.LinearLayout;
import com.yottacode.pictogram.tabletlibrary.R;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;
public class Message_Fragment extends Fragment {
LinearLayout layout = null;
ArrayList<ImageView> pictos = null;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.fragment_message, null);
Button button = (Button) v.findViewById(R.id.aceptar);
button.setOnClickListener(new View.OnClickListener()
{
@Override
public void onClick(View v)
{
Log.i("TAG_PRUEBAS","Hace click");
// do something
getActivity().getFragmentManager().beginTransaction().remove(Message_Fragment.this).commit();
}
});
/*layout = (LinearLayout) v.findViewById(R.id.layoutImages);
pictos = new ArrayList<>();
for(int i = 0;i<layout.getChildCount();i++){
pictos.add((ImageView) layout.getChildAt(i));
}*/
// Inflate the layout for this fragment
return v;
}
public void cargar_pictos(JSONArray arrayPictos){
for(int i = 0; i < arrayPictos.length(); i++) {
//ImageView imagen = (ImageView) layout.getChildAt(i);
JSONObject picto = null;
try {
picto = arrayPictos.getJSONObject(i).getJSONObject("attributes");
Log.i("TAG_PRUEBAS", "picto :" + i);
//pictos.get(i).setImageResource(R.drawable.anonymous_student);
//pictos.get(i).setImageURI(Uri.parse(picto.getString("uri")));
Log.i("TAG_PRUEBAS", "picto received:" + picto.getString("expression").toString());
} catch (JSONException e) {
e.printStackTrace();
}
}
}
}
package com.yottacode.pictogram.tabletlibrary.gui.communicator;
import android.content.Context;
import android.util.Log;
import android.view.MotionEvent;
import android.view.ViewGroup;
public class customViewGroup extends ViewGroup {
public customViewGroup(Context context) {
super(context);
}
@Override
protected void onLayout(boolean changed, int l, int t, int r, int b) {
}
@Override
public boolean onInterceptTouchEvent(MotionEvent ev) {
Log.i(this.getClass().getCanonicalName(), "**********Intercepted");
return false;
}
}
......@@ -26,6 +26,7 @@ import com.yottacode.pictogram.tabletlibrary.R;
import com.yottacode.pictogram.tabletlibrary.gui.communicator.VOCA;
import com.yottacode.pictogram.tabletlibrary.net.NetServiceTablet;
import com.yottacode.pictogram.tools.PCBcontext;
import com.yottacode.tools.GUITools;
import org.json.JSONException;
......@@ -201,6 +202,8 @@ public class SerialActivity extends Activity {
users = PCBcontext.getDevice().getUsers();
createListSup(users);
createListStu(users);
if (username.equals("") && users.size()==0)
GUITools.show_alert(this, R.string.firstlogin,this.getString(R.string.server));
} catch (JSONException e) {
e.printStackTrace();
Log.e(this.getClass().getCanonicalName(), e.getMessage());
......
......@@ -47,7 +47,7 @@ public class StudentFragmentGrid extends Fragment{
final String TAG_PIC = "pic";
final String TAG_LANG = "lang";
final String TAG_ATTRIBUTES = "attributes";
final String TAG_SUPERVISION="supervision";
//TODO: para qué sirve: final String TAG_SUPERVISION="supervision";
ProgressDialog progressDialog;
Vector<Integer> idStudents;
String nameStudents[];
......@@ -308,7 +308,7 @@ public class StudentFragmentGrid extends Fragment{
JSONObject student;
try {
student = students.getJSONObject(i);
if (student.getInt(TAG_SUPERVISION)>0)
//if (student.getInt(TAG_SUPERVISION)>0)
StudentFragmentGrid.this.downloaded_students.add(student);
} catch (JSONException e) {
e.printStackTrace();
......@@ -324,9 +324,6 @@ public class StudentFragmentGrid extends Fragment{
});
break;
case 1:
new_user(0);
break;
default:
show_student_list_online();
}
......
......@@ -76,16 +76,22 @@
<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/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" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/classes" />
<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/lint" />
<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/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>
<orderEntry type="jdk" jdkName="Android API 24 Platform" jdkType="Android SDK" />
<orderEntry type="sourceFolder" forTests="false" />
......@@ -115,6 +121,7 @@
<orderEntry type="library" exported="" name="play-services-ads-9.2.1" level="project" />
<orderEntry type="library" exported="" name="play-services-ads-lite-9.2.1" level="project" />
<orderEntry type="module" module-name="commonlibrary" exported="" />
<orderEntry type="library" exported="" name="android-android-24" level="project" />
<orderEntry type="library" exported="" name="okhttp-ws-2.3.0" level="project" />
<orderEntry type="library" exported="" name="socket.io-client-0.5.0" level="project" />
<orderEntry type="library" exported="" name="okhttp-2.3.0" level="project" />
......
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