From 12e755130c56882436f7531d411fc193db7b6832 Mon Sep 17 00:00:00 2001 From: Helena Rodriguez Date: Thu, 26 Apr 2012 09:31:43 +0000 Subject: [PATCH] git-svn-id: https://forja.rediris.es/svn/cusl6-swadroid/trunk@289 5bc14d19-1e4b-4ba2-aa50-860af135f48c --- SWADroid/src/es/ugr/swad/swadroid/Global.java | 4 +-- .../src/es/ugr/swad/swadroid/SWADMain.java | 35 +++++++++++++------ 2 files changed, 27 insertions(+), 12 deletions(-) diff --git a/SWADroid/src/es/ugr/swad/swadroid/Global.java b/SWADroid/src/es/ugr/swad/swadroid/Global.java index 92d9f141..d17a4e43 100644 --- a/SWADroid/src/es/ugr/swad/swadroid/Global.java +++ b/SWADroid/src/es/ugr/swad/swadroid/Global.java @@ -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 */ diff --git a/SWADroid/src/es/ugr/swad/swadroid/SWADMain.java b/SWADroid/src/es/ugr/swad/swadroid/SWADMain.java index 567598d2..24758c97 100644 --- a/SWADroid/src/es/ugr/swad/swadroid/SWADMain.java +++ b/SWADroid/src/es/ugr/swad/swadroid/SWADMain.java @@ -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 adapter = new ArrayAdapter(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 courses = new HashMap(); courses.put(NAME, getString(R.string.course)); courses.put(IMAGE, getResources().getDrawable(R.drawable.blackboard)); - headerData.add(courses); + headerData.add(courses);*/ final ArrayList>> childData = new ArrayList>>(); @@ -467,8 +478,9 @@ public class SWADMain extends MenuExpandableListActivity { final ArrayList> evaluationData = new ArrayList>(); childData.add(evaluationData); + /*//DISABLE until it will be functional final ArrayList> documentsData = new ArrayList>(); - childData.add(documentsData); + childData.add(documentsData);*/ //Messages category HashMap map = new HashMap(); @@ -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(); map.put(NAME, getString(R.string.documentsDownloadModuleLabel)); @@ -496,7 +509,7 @@ public class SWADMain extends MenuExpandableListActivity { map = new HashMap(); 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 users = new HashMap(); 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);*/ }