Merge branch 'release/0.4.5'

This commit is contained in:
Juan Miguel Boyero Corral 2011-07-08 12:06:21 +02:00
commit 888f8ba162
8 changed files with 52 additions and 38 deletions

View File

@ -1,3 +1,7 @@
## 0.4.5 (2011-07-08)
* Optimized questions syncronization
## 0.4.4 (2011-07-05)
* Added Write message function on main menu

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="es.ugr.swad.swadroid"
android:installLocation="auto" android:versionName="0.4.4" android:versionCode="21">
android:installLocation="auto" android:versionName="0.4.5" android:versionCode="22">
<application android:label="@string/app_name" android:icon="@drawable/ic_launcher_swadroid" android:debuggable="true">
<activity android:name=".SWADMain"
android:label="@string/app_name"

View File

@ -293,8 +293,7 @@ public class SWADMain extends ExpandableListActivity {
prefs.setLastVersion(currentVersion);
//If this is an upgrade, show upgrade dialog
} else if(lastVersion < 17) {
dbHelper.upgradeDB(this);
} else if(lastVersion < currentVersion) {
prefs.setLastVersion(currentVersion);
}
} catch (Exception ex) {

View File

@ -27,6 +27,7 @@ import org.xmlpull.v1.XmlPullParserException;
import android.content.Context;
import android.database.Cursor;
import android.database.SQLException;
import android.util.Log;
import com.android.dataframework.DataFramework;
@ -322,17 +323,22 @@ public class DataBaseHelper {
*/
public void insertTestTag(TestTag t)
{
Entity ent = new Entity(Global.DB_TABLE_TEST_TAGS);
ent.setValue("id", t.getId());
ent.setValue("tagTxt", t.getTagTxt());
ent.save();
ent = new Entity(Global.DB_TABLE_TEST_QUESTION_TAGS);
ent.setValue("qstCod", t.getQstCod());
ent.setValue("tagCod", t.getId());
ent.setValue("tagInd", t.getTagInd());
ent.save();
List<Entity> rows = db.getEntityList(Global.DB_TABLE_TEST_TAGS, "id = " + t.getId());
if(rows.isEmpty()) {
Entity ent = new Entity(Global.DB_TABLE_TEST_TAGS);
ent.setValue("id", t.getId());
ent.setValue("tagTxt", t.getTagTxt());
ent.save();
ent = new Entity(Global.DB_TABLE_TEST_QUESTION_TAGS);
ent.setValue("qstCod", t.getQstCod());
ent.setValue("tagCod", t.getId());
ent.setValue("tagInd", t.getTagInd());
ent.save();
} else {
throw new SQLException();
}
}
/**

View File

@ -196,9 +196,9 @@ public class Notifications extends Module {
Vector res = (Vector) result;
SoapObject soap = (SoapObject) res.get(1);
int csSize = soap.getPropertyCount();
Integer lastId = new Integer(dbHelper.getFieldOfLastNotification("id"));
for (int i = 0; i < csSize; i++) {
SoapObject pii = (SoapObject)soap.getProperty(i);
Long notificationCode = new Long(pii.getProperty("notificationCode").toString());
String eventType = pii.getProperty("eventType").toString();
Long eventTime = new Long(pii.getProperty("eventTime").toString());
String userSurname1 = pii.getProperty("userSurname1").toString();
@ -208,7 +208,7 @@ public class Notifications extends Module {
String summary = pii.getProperty("summary").toString();
Integer status = new Integer(pii.getProperty("status").toString());
String content = pii.getProperty("content").toString();
Notification n = new Notification(lastId+i, eventType, eventTime, userSurname1, userSurname2, userFirstName, location, summary, status, content);
Notification n = new Notification(notificationCode, eventType, eventTime, userSurname1, userSurname2, userFirstName, location, summary, status, content);
dbHelper.insertNotification(n);
if(isDebuggable)

View File

@ -471,7 +471,7 @@ public class TestsMake extends Module {
bar.setProgress(1);
bar.setText(1 + "/" + size);
bar.setTextColor(Color.BLUE);
bar.setTextSize(18);
bar.setTextSize(20);
eval.setVisibility(View.VISIBLE);
title_separator.setVisibility(View.VISIBLE);

View File

@ -28,13 +28,13 @@ import org.ksoap2.SoapFault;
import org.ksoap2.serialization.SoapObject;
import org.xmlpull.v1.XmlPullParserException;
import android.database.SQLException;
import android.os.Bundle;
import android.util.Log;
import android.widget.Toast;
import es.ugr.swad.swadroid.Global;
import es.ugr.swad.swadroid.R;
import es.ugr.swad.swadroid.model.Model;
import es.ugr.swad.swadroid.model.PairTable;
import es.ugr.swad.swadroid.model.Test;
import es.ugr.swad.swadroid.model.TestAnswer;
import es.ugr.swad.swadroid.model.TestQuestion;
@ -107,7 +107,6 @@ public class TestsQuestionsDownload extends Module {
List<Model> tagsListDB = dbHelper.getAllRows(Global.DB_TABLE_TEST_TAGS);
List<Model> questionsListDB = dbHelper.getAllRows(Global.DB_TABLE_TEST_QUESTIONS);
List<Model> answersListDB = dbHelper.getAllRows(Global.DB_TABLE_TEST_ANSWERS);
List<Model> questionTagsListDB = dbHelper.getAllRows(Global.DB_TABLE_TEST_QUESTION_TAGS);
//Read tags info from webservice response
int listSize = tagsListObject.getPropertyCount();
@ -135,18 +134,20 @@ public class TestsQuestionsDownload extends Module {
TestQuestion q = new TestQuestion(qstCod, stem, anstype, Global.parseIntBool(shuffle));
//If it's a new question, insert in database
if(!questionsListDB.contains(q)) {
try {
dbHelper.insertTestQuestion(q, selectedCourseCode);
questionsListDB.add(q);
if(isDebuggable)
Log.d(TAG, "INSERTED: " + q.toString());
//If it's an updated question, update it's row in database
} else {
} catch (SQLException e) {
TestQuestion old = (TestQuestion) questionsListDB.get(questionsListDB.indexOf(q));
dbHelper.updateTestQuestion(old, q, selectedCourseCode);
if(isDebuggable)
Log.d(TAG, "UPDATED: " + q.toString());
}
if(isDebuggable)
Log.d(TAG, q.toString());
}
Log.i(TAG, "Retrieved " + listSize + " questions");
@ -162,18 +163,20 @@ public class TestsQuestionsDownload extends Module {
TestAnswer a = new TestAnswer(0, ansIndex, qstCod, Global.parseIntBool(correct), answer);
//If it's a new answer, insert in database
if(!answersListDB.contains(a)) {
try {
dbHelper.insertTestAnswer(a, qstCod);
answersListDB.add(a);
if(isDebuggable)
Log.d(TAG, "INSERTED: " + a.toString());
//If it's an updated answer, update it's row in database
} else {
} catch (SQLException e) {
TestAnswer old = (TestAnswer) answersListDB.get(answersListDB.indexOf(a));
dbHelper.updateTestAnswer(old, a, qstCod);
}
if(isDebuggable)
Log.d(TAG, a.toString());
if(isDebuggable)
Log.d(TAG, "UPDATED: " + a.toString());
}
}
Log.i(TAG, "Retrieved " + listSize + " answers");
@ -190,18 +193,20 @@ public class TestsQuestionsDownload extends Module {
tag.setTagInd(tagIndex);
//If it's a new tag, insert in database
if(!tagsListDB.contains(tag)) {
try {
dbHelper.insertTestTag(tag);
tagsListDB.add(tag);
questionTagsListDB.add(new PairTable<Integer, Long>(Global.DB_TABLE_TEST_QUESTION_TAGS,
tag.getQstCod(), tag.getId()));
if(isDebuggable)
Log.d(TAG, "INSERTED: " + tag.toString());
//If it's an updated tag, update it's rows in database
} else if(!questionTagsListDB.contains(tag)) {
} catch (SQLException e) {
TestTag old = (TestTag) tagsListDB.get(tagsListDB.indexOf(tag));
dbHelper.updateTestTag(old, tag);
questionTagsListDB.add(new PairTable<Integer, Long>(Global.DB_TABLE_TEST_QUESTION_TAGS,
tag.getQstCod(), tag.getId()));
if(isDebuggable)
Log.d(TAG, "UPDATED: " + tag.toString());
}
}