Skip to content

Commit

Permalink
Hide the text from the canvas while it's being edited
Browse files Browse the repository at this point in the history
  • Loading branch information
aforcier committed Aug 21, 2020
1 parent 6f226dd commit 235b5f0
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,8 @@ interface OnPhotoEditorListener {
* @param rootView view on which the long press occurs
* @param text current text set on the view
* @param textStyler the [TextStyler] containing style rules for the view
* @param isJustAdded true if this view has just been added to the parentView
*/
fun onEditTextChangeListener(
rootView: View,
text: String,
textStyler: TextStyler?,
isJustAdded: Boolean = false
)
fun onEditTextChangeListener(rootView: View, text: String, textStyler: TextStyler?)

/**
* This is a callback when user adds any view on the [PhotoEditorView] it can be
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -261,8 +261,7 @@ class PhotoEditor private constructor(builder: Builder) :
// now open TextEditor right away if this is new text being added
if (mOnPhotoEditorListener != null && !isViewBeingReadded) {
val textInput = textInputTv.text.toString()
mOnPhotoEditorListener?.onEditTextChangeListener(
this, textInput, textStyler, true)
mOnPhotoEditorListener?.onEditTextChangeListener(this, textInput, textStyler)
}
}
return view
Expand Down Expand Up @@ -442,9 +441,7 @@ class PhotoEditor private constructor(builder: Builder) :
override fun onClick() {
val textInput = textInputTv.text.toString()
val textStyler = TextStyler.from(textInputTv)
mOnPhotoEditorListener?.onEditTextChangeListener(
rootView, textInput, textStyler, false
)
mOnPhotoEditorListener?.onEditTextChangeListener(rootView, textInput, textStyler)
}

override fun onLongClick() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -333,19 +333,17 @@ abstract class ComposeLoopFrameActivity : AppCompatActivity(), OnStoryFrameSelec
override fun onEditTextChangeListener(
rootView: View,
text: String,
textStyler: TextStyler?,
isJustAdded: Boolean
textStyler: TextStyler?
) {
if (isEditingText) {
return
}

isEditingText = true
editModeHideAllUIControls(true)
if (isJustAdded) {
// hide new text views
rootView.visibility = View.GONE
}
// Hide the text in the background while it's being edited
rootView.visibility = View.INVISIBLE

val textEditorDialogFragment = TextEditorDialogFragment.show(
this@ComposeLoopFrameActivity,
text,
Expand Down

0 comments on commit 235b5f0

Please sign in to comment.