fix some bundling/serialization problems

Now that params[] are being bundled all objects passed that way must be
serializeable. And as long as I'm asserting bundle success using
equals() the objects being serialized must implement it.
This commit is contained in:
Eric House 2017-07-29 20:59:00 -07:00
parent 80cc12fc79
commit d55d9573e4
3 changed files with 24 additions and 4 deletions

View file

@ -49,6 +49,7 @@ import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.Serializable;
import java.nio.channels.FileChannel;
import java.sql.Timestamp;
import java.util.ArrayList;
@ -446,13 +447,29 @@ public class DBUtils {
return result;
}
public static class SentInvitesInfo {
public static class SentInvitesInfo implements Serializable {
public long m_rowid;
private ArrayList<InviteMeans> m_means;
private ArrayList<String> m_targets;
private ArrayList<Timestamp> m_timestamps;
private int m_cachedCount = 0;
@Override
public boolean equals( Object other )
{
boolean result = null != other && other instanceof SentInvitesInfo;
if ( result ) {
SentInvitesInfo it = (SentInvitesInfo)other;
result = it.m_rowid == m_rowid
&& it.m_means.equals(m_means)
&& it.m_targets.equals(m_targets)
&& it.m_timestamps.equals(m_timestamps)
&& it.m_cachedCount == m_cachedCount;
}
// Log.d( TAG, "equals() => %b", result );
return result;
}
private SentInvitesInfo( long rowID ) {
m_rowid = rowID;
m_means = new ArrayList<InviteMeans>();

View file

@ -100,7 +100,7 @@ public class DlgState implements Parcelable {
DlgState other = (DlgState)it;
result = other != null
&& m_id.equals(other.m_id)
&& m_msg.equals(other.m_msg)
&& ((null == m_msg) ? (null == other.m_msg) : m_msg.equals(other.m_msg))
&& m_posButton == other.m_posButton
&& m_negButton == other.m_negButton
&& m_action == other.m_action
@ -157,7 +157,10 @@ public class DlgState implements Parcelable {
DlgState newState = DlgState.CREATOR.createFromParcel(parcel);
Assert.assertFalse(newState == this);
Assert.assertTrue(this.equals(newState));
if ( !this.equals(newState) ) {
Log.d( TAG, "restore failed!!: %s => %s", this, newState );
Assert.fail();
}
}
}

View file

@ -439,7 +439,7 @@ public class GameSummary implements Serializable {
Log.ex( TAG, ex );
}
}
Log.i( TAG, "getStringExtra(%s) => %s", key, result );
// Log.i( TAG, "getStringExtra(%s) => %s", key, result );
return result;
}