git-svn-id: https://forja.rediris.es/svn/cusl6-swadroid/trunk@289 5bc14d19-1e4b-4ba2-aa50-860af135f48c

This commit is contained in:
Helena Rodriguez 2012-04-26 09:31:43 +00:00
parent cd6ec7b2d4
commit 12e755130c
2 changed files with 27 additions and 12 deletions

View File

@ -31,11 +31,11 @@ public class Global {
/**
* SWAD application key
*/
private static final String AppKey = "";
private static final String AppKey = "HTC-Desire";
/**
* Server URL
*/
private static final String DEFAULT_SERVER = "swad.ugr.es";
private static final String DEFAULT_SERVER = "";
/**
* User logged flag
*/

View File

@ -91,7 +91,7 @@ public class SWADMain extends MenuExpandableListActivity {
/**
* Tests tag name for Logcat
*/
public static final String TAG = Global.APP_TAG + " SwadMain";
public static final String TAG = Global.APP_TAG;
/**
* Indicates if it is the first run
* */
@ -310,6 +310,7 @@ public class SWADMain extends MenuExpandableListActivity {
Global.setSelectedCourseCode(c.getId());
}else{
Global.setSelectedCourseCode(-1);
if(!firstRun && Module.connectionAvailable(this)) getActualCourses(); //at the first run, this will be launched after the preferences menu
}
currentRole = -1;
} catch (Exception ex) {
@ -351,6 +352,19 @@ public class SWADMain extends MenuExpandableListActivity {
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spinner.setAdapter(adapter);
spinner.setOnItemSelectedListener(new onItemSelectedListener());
if(Global.getSelectedCourseCode()!=-1){
boolean found = false;
int i=0;
while(!found && i <listCourses.size()){
if(listCourses.get(i).getId() == Global.getSelectedCourseCode()){
found=true;
}else{
++i;
}
}
if(i<listCourses.size())
spinner.setSelection(i);
}
} else {
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, new String[]{getString(R.string.clickToGetCourses)});
spinner.setAdapter(adapter);
@ -406,8 +420,6 @@ public class SWADMain extends MenuExpandableListActivity {
}
private void createMenu(){
Log.i(TAG, String.valueOf(Global.getSelectedCourseCode()));
if(listCourses.size() != 0){
Course courseSelected;
if(Global.getSelectedCourseCode()!=-1){
@ -423,8 +435,6 @@ public class SWADMain extends MenuExpandableListActivity {
if(getExpandableListAdapter() == null)
createBaseMenu();
int userRole = courseSelected.getUserRole();
Log.i(TAG, "userRole" +String.valueOf(userRole));
Log.i(TAG, "actual" + String.valueOf(currentRole));
if(userRole == Global.TEACHER_TYPE_CODE && currentRole != Global.TEACHER_TYPE_CODE)
changeToTeacherMenu();
if(userRole == Global.STUDENT_TYPE_CODE && currentRole != Global.STUDENT_TYPE_CODE)
@ -454,10 +464,11 @@ public class SWADMain extends MenuExpandableListActivity {
evaluation.put(IMAGE, getResources().getDrawable(R.drawable.grades));
headerData.add( evaluation);
/*//DISABLE until it will be functional
final HashMap<String, Object> courses = new HashMap<String,Object>();
courses.put(NAME, getString(R.string.course));
courses.put(IMAGE, getResources().getDrawable(R.drawable.blackboard));
headerData.add(courses);
headerData.add(courses);*/
final ArrayList<ArrayList<HashMap<String, Object>>> childData = new ArrayList<ArrayList<HashMap<String, Object>>>();
@ -467,8 +478,9 @@ public class SWADMain extends MenuExpandableListActivity {
final ArrayList<HashMap<String, Object>> evaluationData = new ArrayList<HashMap<String, Object>>();
childData.add(evaluationData);
/*//DISABLE until it will be functional
final ArrayList<HashMap<String,Object>> documentsData = new ArrayList<HashMap<String, Object>>();
childData.add(documentsData);
childData.add(documentsData);*/
//Messages category
HashMap<String, Object> map = new HashMap<String,Object>();
@ -487,6 +499,7 @@ public class SWADMain extends MenuExpandableListActivity {
map.put(IMAGE, getResources().getDrawable(R.drawable.test));
evaluationData.add(map);
/*//DISABLE until it will be functional
//Documents category
map = new HashMap<String,Object>();
map.put(NAME, getString(R.string.documentsDownloadModuleLabel));
@ -496,7 +509,7 @@ public class SWADMain extends MenuExpandableListActivity {
map = new HashMap<String,Object>();
map.put(NAME, getString(R.string.sharedsDownloadModuleLabel));
map.put(IMAGE, getResources().getDrawable(R.drawable.folderusers));
documentsData.add(map);
documentsData.add(map);*/
setListAdapter( new ImageExpandableListAdapter(
this,
headerData,
@ -522,7 +535,8 @@ public class SWADMain extends MenuExpandableListActivity {
//Removes Publish Note from messages menu
((ImageExpandableListAdapter) getExpandableListAdapter()).removeChild(MESSAGES_GROUP, PUBLISH_NOTE_CHILD);
//Removes completely users menu
((ImageExpandableListAdapter) getExpandableListAdapter()).removeGroup(USERS_GROUP);
/*//DISABLE until it will be functional
((ImageExpandableListAdapter) getExpandableListAdapter()).removeGroup(USERS_GROUP);*/
}
currentRole = Global.STUDENT_TYPE_CODE;
@ -538,6 +552,7 @@ public class SWADMain extends MenuExpandableListActivity {
map.put(IMAGE, getResources().getDrawable(R.drawable.note));
((ImageExpandableListAdapter) getExpandableListAdapter()).addChild(MESSAGES_GROUP,PUBLISH_NOTE_CHILD, map);
/*//DISABLE until it will be functional
final HashMap<String, Object> users = new HashMap<String, Object>();
users.put(NAME, getString(R.string.users));
users.put(IMAGE, getResources().getDrawable(R.drawable.users));
@ -546,7 +561,7 @@ public class SWADMain extends MenuExpandableListActivity {
map.put(NAME, getString(R.string.attendanceModuleLabel));
map.put(IMAGE, getResources().getDrawable(R.drawable.rollcall));
child.add(map);
((ImageExpandableListAdapter) getExpandableListAdapter()).addGroup(USERS_GROUP, users, child);
((ImageExpandableListAdapter) getExpandableListAdapter()).addGroup(USERS_GROUP, users, child);*/
}