Refactored code

This commit is contained in:
Juan Miguel Boyero Corral 2011-05-07 09:28:40 +02:00
parent 9ddd2ab96d
commit 4d41372159
4 changed files with 11 additions and 64 deletions

View File

@ -38,7 +38,6 @@ import android.view.View;
import android.widget.ExpandableListView;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import es.ugr.swad.swadroid.model.DataBaseHelper;
import es.ugr.swad.swadroid.modules.notifications.Notifications;
import es.ugr.swad.swadroid.modules.tests.Tests;
@ -175,10 +174,10 @@ public class SWADMain extends ExpandableListActivity {
startActivityForResult(activity, Global.NOTIFICATIONS_REQUEST_CODE);
} else if(keyword.equals(getString(R.string.testsModuleLabel))) {
/*activity = new Intent(getBaseContext(), Tests.class);
startActivityForResult(activity, Global.TESTS_REQUEST_CODE);*/
Toast.makeText(this, keyword + " aún no implementado", Toast.LENGTH_LONG)
.show();
activity = new Intent(getBaseContext(), Tests.class);
startActivityForResult(activity, Global.TESTS_REQUEST_CODE);
/*Toast.makeText(this, keyword + " aún no implementado", Toast.LENGTH_LONG)
.show();*/
}
return true;
@ -198,7 +197,7 @@ public class SWADMain extends ExpandableListActivity {
*/
private void createMainMenu()
{
// Construct Expandable List
//Construct Expandable List
final ArrayList<HashMap<String, Object>> headerData = new ArrayList<HashMap<String, Object>>();
final HashMap<String, Object> messages = new HashMap<String, Object>();
@ -278,13 +277,15 @@ public class SWADMain extends ExpandableListActivity {
SecureConnection.initSecureConnection();
//Check if this is the first run after an install or upgrade
//If this is the first run, show configuration dialog
//If this is an upgrade, show upgrade dialog
lastVersion = prefs.getLastVersion();
currentVersion = getPackageManager().getPackageInfo(getPackageName(), 0).versionCode;
//If this is the first run, show configuration dialog
if(lastVersion == 0) {
showConfigurationDialog();
prefs.setLastVersion(currentVersion);
//If this is an upgrade, show upgrade dialog
} else if(lastVersion < 12) {
dbHelper.emptyTable(Global.DB_TABLE_NOTIFICATIONS);
prefs.setLastVersion(currentVersion);

View File

@ -282,60 +282,6 @@ public class Notification extends Model {
return result;
}
/* (non-Javadoc)
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (!super.equals(obj))
return false;
if (getClass() != obj.getClass())
return false;
Notification other = (Notification) obj;
if (content == null) {
if (other.content != null)
return false;
} else if (!content.equals(other.content))
return false;
if (eventTime != other.eventTime)
return false;
if (eventType == null) {
if (other.eventType != null)
return false;
} else if (!eventType.equals(other.eventType))
return false;
if (location == null) {
if (other.location != null)
return false;
} else if (!location.equals(other.location))
return false;
if (status != other.status)
return false;
if (summary == null) {
if (other.summary != null)
return false;
} else if (!summary.equals(other.summary))
return false;
if (userFirstName == null) {
if (other.userFirstName != null)
return false;
} else if (!userFirstName.equals(other.userFirstName))
return false;
if (userSurname1 == null) {
if (other.userSurname1 != null)
return false;
} else if (!userSurname1.equals(other.userSurname1))
return false;
if (userSurname2 == null) {
if (other.userSurname2 != null)
return false;
} else if (!userSurname2.equals(other.userSurname2))
return false;
return true;
}
/* (non-Javadoc)
* @see java.lang.Object#toString()
*/

View File

@ -186,8 +186,7 @@ public class Notifications extends Module {
}
//Request finalized without errors
if(isDebuggable)
Log.i(Global.NOTIFICATIONS_TAG, "Retrieved " + csSize + " notifications");
Log.i(Global.NOTIFICATIONS_TAG, "Retrieved " + csSize + " notifications");
//Clear old notifications to control database size
dbHelper.clearOldNotifications(SIZE_LIMIT);

View File

@ -54,6 +54,7 @@ public class NotificationsCursorAdapter extends CursorAdapter {
String[] dateContent;
Date d;
view.setScrollContainer(false);
TextView eventType = (TextView) view.findViewById(R.id.eventType);
TextView eventDate = (TextView) view.findViewById(R.id.eventDate);
TextView eventTime = (TextView) view.findViewById(R.id.eventTime);