Open lenhuy2106 opened 7 years ago
I see there are lots of nested references.
Anyways, here's a hacky way to do it with gson-serialization:
FreeDrawSerializableState copy(FreeDrawSerializableState state) {
Gson gson = new Gson();
return gson.fromJson(gson.toJson(state), FreeDrawSerializableState.class);
}
Hello RiccardoMoro!
FreeDrawSerializableState#getCurrentViewStateAsSerializable()
returns
with mCanceledPaths, mPaths as pointers to respective arraylists, such that changes are represented both on the original and the copy. If thats not intended behaviour, i would suggest returning hard copies.
Thanks for the hard work! Much love. Huy