Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
circles-android
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Circles
circles-android
Commits
8b266128
Commit
8b266128
authored
1 year ago
by
Taras
Browse files
Options
Downloads
Patches
Plain Diff
Propagate click on text to parent
parent
9f723f11
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
app/src/main/java/org/futo/circles/view/PostLayout.kt
+18
-5
18 additions, 5 deletions
app/src/main/java/org/futo/circles/view/PostLayout.kt
app/src/main/java/org/futo/circles/view/ReadMoreTextView.kt
+15
-1
15 additions, 1 deletion
app/src/main/java/org/futo/circles/view/ReadMoreTextView.kt
with
33 additions
and
6 deletions
app/src/main/java/org/futo/circles/view/PostLayout.kt
+
18
−
5
View file @
8b266128
...
@@ -62,8 +62,7 @@ class PostLayout(
...
@@ -62,8 +62,7 @@ class PostLayout(
}
}
override
fun
onSingleTapConfirmed
(
e
:
MotionEvent
):
Boolean
{
override
fun
onSingleTapConfirmed
(
e
:
MotionEvent
):
Boolean
{
if
(
binding
.
postFooter
.
areUserAbleToReply
())
openReplies
()
post
?.
let
{
optionsListener
?.
onReply
(
it
.
postInfo
.
roomId
,
it
.
id
)
}
return
true
return
true
}
}
...
@@ -75,9 +74,18 @@ class PostLayout(
...
@@ -75,9 +74,18 @@ class PostLayout(
}
}
init
{
init
{
binding
.
lvContent
.
setOnClickListener
{
binding
.
lvContent
.
apply
{
post
?.
let
{
setOnClickListener
{
if
(
it
.
content
.
isMedia
())
optionsListener
?.
onShowPreview
(
it
.
postInfo
.
roomId
,
it
.
id
)
post
?.
let
{
if
(
it
.
content
.
isMedia
())
optionsListener
?.
onShowPreview
(
it
.
postInfo
.
roomId
,
it
.
id
)
else
openReplies
()
}
}
setOnLongClickListener
{
binding
.
postHeader
.
showMenu
()
true
}
}
}
}
binding
.
lCard
.
setOnTouchListener
{
_
,
event
->
binding
.
lCard
.
setOnTouchListener
{
_
,
event
->
...
@@ -115,6 +123,11 @@ class PostLayout(
...
@@ -115,6 +123,11 @@ class PostLayout(
binding
.
tvEditedLabel
.
setIsVisible
(
isEdited
)
binding
.
tvEditedLabel
.
setIsVisible
(
isEdited
)
}
}
private
fun
openReplies
()
{
if
(
binding
.
postFooter
.
areUserAbleToReply
())
post
?.
let
{
optionsListener
?.
onReply
(
it
.
postInfo
.
roomId
,
it
.
id
)
}
}
private
fun
setMentionBorder
(
content
:
PostContent
)
{
private
fun
setMentionBorder
(
content
:
PostContent
)
{
val
hasMention
=
when
(
content
)
{
val
hasMention
=
when
(
content
)
{
is
MediaContent
->
content
.
caption
?.
let
{
is
MediaContent
->
content
.
caption
?.
let
{
...
...
This diff is collapsed.
Click to expand it.
app/src/main/java/org/futo/circles/view/ReadMoreTextView.kt
+
15
−
1
View file @
8b266128
...
@@ -9,10 +9,14 @@ import android.text.TextPaint
...
@@ -9,10 +9,14 @@ import android.text.TextPaint
import
android.text.TextUtils
import
android.text.TextUtils
import
android.text.style.TextAppearanceSpan
import
android.text.style.TextAppearanceSpan
import
android.util.AttributeSet
import
android.util.AttributeSet
import
android.view.ViewGroup
import
androidx.appcompat.widget.AppCompatTextView
import
androidx.appcompat.widget.AppCompatTextView
import
androidx.core.content.res.use
import
androidx.core.content.res.use
import
androidx.core.text.buildSpannedString
import
androidx.core.text.buildSpannedString
import
androidx.core.text.getSpans
import
androidx.core.text.inSpans
import
androidx.core.text.inSpans
import
androidx.core.text.toSpannable
import
io.noties.markwon.core.spans.LinkSpan
import
org.futo.circles.R
import
org.futo.circles.R
import
kotlin.text.Typography.ellipsis
import
kotlin.text.Typography.ellipsis
import
kotlin.text.Typography.nbsp
import
kotlin.text.Typography.nbsp
...
@@ -47,7 +51,17 @@ class ReadMoreTextView @JvmOverloads constructor(
...
@@ -47,7 +51,17 @@ class ReadMoreTextView @JvmOverloads constructor(
}
}
if
(
hasOnClickListeners
())
throw
IllegalStateException
(
"Custom onClickListener not supported"
)
if
(
hasOnClickListeners
())
throw
IllegalStateException
(
"Custom onClickListener not supported"
)
super
.
setOnClickListener
{
toggle
()
}
super
.
setOnClickListener
{
toggle
()
if
(
collapseText
==
originalText
&&
originalText
?.
toSpannable
()
?.
getSpans
<
LinkSpan
>(
0
,
originalText
?.
length
?:
0
)
?.
size
==
0
)
(
parent
?.
parent
as
?
ViewGroup
)
?.
performClick
()
}
super
.
setOnLongClickListener
{
(
parent
?.
parent
as
?
ViewGroup
)
?.
performLongClick
()
==
true
}
if
(
originalText
!=
null
)
invalidateText
()
if
(
originalText
!=
null
)
invalidateText
()
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment