Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Serialization part 1: implement kotlinx-serializable, use serialized AddedViews #414

Merged
merged 24 commits into from
Jul 19, 2020
Merged
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
2500285
setup kotlinx serialization plugin
mzorz Jul 2, 2020
c25f9cd
added @Serializable annotations, changed AddedViewList constructor to…
mzorz Jul 2, 2020
b855ea6
implemented serializer/deserializer and added AddedViewInfo structure…
mzorz Jul 3, 2020
9687731
Merge branch 'feature/wp-stories/alpha1-cut' into issue/393-keep-state
mzorz Jul 4, 2020
ce53d6a
added update() method to update AddedViewInfo when it's saved
mzorz Jul 4, 2020
9af1b21
removed custom serializer, fixed bad import preventing View from bein…
mzorz Jul 5, 2020
5531659
using ArrayListSerializer for AddedViewList
mzorz Jul 6, 2020
9d4867c
made changes so added views can be either referenced (rememberd) or r…
mzorz Jul 6, 2020
8065985
added AddedViewTextInfo class to hold information inherent to TextVie…
mzorz Jul 6, 2020
f76a380
fixed lint warnings
mzorz Jul 6, 2020
97cf627
removed commented code line
mzorz Jul 6, 2020
5c8a3d8
clarified comment
mzorz Jul 6, 2020
a12891c
only trigger the texteditor if view is a new addition (not a re-add f…
mzorz Jul 6, 2020
e557194
using the actual calculated value in px for fontSize
mzorz Jul 6, 2020
f98e5bd
modified test log comment
mzorz Jul 6, 2020
402b9ba
renamed method
mzorz Jul 6, 2020
ef642bb
updated proguard rules to keep serializer classes
mzorz Jul 7, 2020
6ee2f54
removed test code
mzorz Jul 7, 2020
53c04cf
removed unused imports
mzorz Jul 7, 2020
3713a9b
renamed param
mzorz Jul 8, 2020
aed3634
renamed variable
mzorz Jul 17, 2020
8e84597
simplified fun expression with assignment
mzorz Jul 17, 2020
4492f53
renamed iterator temporal variable name for clarity
mzorz Jul 17, 2020
7a65da2
returning assignment in when statement itself
mzorz Jul 17, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
using the actual calculated value in px for fontSize
mzorz committed Jul 6, 2020
commit e55719421310dd9d42d5d25071453ca928489c8b
Original file line number Diff line number Diff line change
@@ -53,8 +53,8 @@ import kotlinx.android.synthetic.main.view_photo_editor_emoji.view.*
import kotlinx.android.synthetic.main.view_photo_editor_text.view.*
import java.io.File
import java.io.FileInputStream
import java.util.ArrayList
import java.lang.ref.WeakReference
import java.util.ArrayList

/**
*
@@ -410,7 +410,8 @@ class PhotoEditor private constructor(builder: Builder) :
view = addEmoji(addedViewInfo.addedViewTextInfo.text)
// apply specific TextView parameters for emoji (fontsize)
val emojiTextView = view?.findViewById<TextView>(R.id.tvPhotoEditorEmoji)
emojiTextView?.textSize = addedViewInfo.addedViewTextInfo.fontSizeSp
// the actual calculated text size as obtained from the view is expressed in px.
emojiTextView?.setTextSize(TypedValue.COMPLEX_UNIT_PX, addedViewInfo.addedViewTextInfo.fontSizePx)
}
TEXT -> {
// create TEXT view layout
@@ -421,7 +422,8 @@ class PhotoEditor private constructor(builder: Builder) :
)
// apply specific TextView parameters for text (fontsize, text color)
val normalTextView = view?.findViewById<TextView>(R.id.tvPhotoEditorText)
normalTextView?.textSize = addedViewInfo.addedViewTextInfo.fontSizeSp
// the actual calculated text size as obtained from the view is expressed in px.
normalTextView?.setTextSize(TypedValue.COMPLEX_UNIT_PX, addedViewInfo.addedViewTextInfo.fontSizePx)
normalTextView?.setTextColor(addedViewInfo.addedViewTextInfo.textColor)
}
}
Original file line number Diff line number Diff line change
@@ -12,4 +12,4 @@ data class AddedViewInfo(
)

@Serializable
data class AddedViewTextInfo(val text: String, val fontSizeSp: Float, val textColor: Int)
data class AddedViewTextInfo(val text: String, val fontSizePx: Float, val textColor: Int)