-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don't use the serializable type for parcelable arrays, see #53
- Loading branch information
Showing
8 changed files
with
175 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
library/src/test/java/com/evernote/android/state/test/TestParcelableArray.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package com.evernote.android.state.test; | ||
|
||
import com.evernote.android.state.State; | ||
import com.evernote.android.state.StateReflection; | ||
|
||
/** | ||
* @author rwondratschek | ||
*/ | ||
public class TestParcelableArray { | ||
@State | ||
public TestTypes.ParcelableImpl[] mParcelableArrayImpl1 = new TestTypes.ParcelableImpl[]{new TestTypes.ParcelableImpl(0)}; | ||
|
||
@State | ||
private TestTypes.ParcelableImpl[] mParcelableArrayImpl2 = new TestTypes.ParcelableImpl[]{new TestTypes.ParcelableImpl(0)}; | ||
|
||
@StateReflection | ||
private TestTypes.ParcelableImpl[] mParcelableArrayImpl3 = new TestTypes.ParcelableImpl[]{new TestTypes.ParcelableImpl(0)}; | ||
|
||
public TestTypes.ParcelableImpl[] getParcelableArrayImpl2() { | ||
return mParcelableArrayImpl2; | ||
} | ||
|
||
public void setParcelableArrayImpl2(TestTypes.ParcelableImpl[] parcelableArrayImpl2) { | ||
mParcelableArrayImpl2 = parcelableArrayImpl2; | ||
} | ||
|
||
public void setToValue(int value) { | ||
mParcelableArrayImpl1 = new TestTypes.ParcelableImpl[]{new TestTypes.ParcelableImpl(value)}; | ||
mParcelableArrayImpl2 = new TestTypes.ParcelableImpl[]{new TestTypes.ParcelableImpl(value)}; | ||
mParcelableArrayImpl3 = new TestTypes.ParcelableImpl[]{new TestTypes.ParcelableImpl(value)}; | ||
} | ||
|
||
public boolean isValue(int value) { | ||
return mParcelableArrayImpl1[0].isValue(value) && mParcelableArrayImpl2[0].isValue(value) && mParcelableArrayImpl3[0].isValue(value); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
library/src/test/kotlin/com/evernote/android/state/test/TestKotlinParcelableArray.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package com.evernote.android.state.test | ||
|
||
import com.evernote.android.state.State | ||
import com.evernote.android.state.StateReflection | ||
|
||
/** | ||
* @author rwondratschek | ||
*/ | ||
class TestKotlinParcelableArray { | ||
@State | ||
var parcelableArrayImpl1: Array<TestTypes.ParcelableImpl> = arrayOf(TestTypes.ParcelableImpl(0)) | ||
|
||
@StateReflection | ||
private var mParcelableArrayImpl2: Array<TestTypes.ParcelableImpl> = arrayOf(TestTypes.ParcelableImpl(0)) | ||
|
||
fun setToValue(value: Int) { | ||
parcelableArrayImpl1 = arrayOf(TestTypes.ParcelableImpl(value)) | ||
mParcelableArrayImpl2 = arrayOf(TestTypes.ParcelableImpl(value)) | ||
} | ||
|
||
fun isValue(value: Int): Boolean { | ||
return parcelableArrayImpl1[0].isValue(value) && mParcelableArrayImpl2[0].isValue(value) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters