Skip to content

Commit ba8c34f

Browse files
author
Yevhen Babiichuk (DustDFG)
committed
Convert newpipe/util/text/UrlLongPressClickableSpan to kotlin
1 parent 589977c commit ba8c34f

2 files changed

Lines changed: 25 additions & 34 deletions

File tree

app/src/main/java/org/schabi/newpipe/util/text/UrlLongPressClickableSpan.java

Lines changed: 0 additions & 34 deletions
This file was deleted.
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/*
2+
* SPDX-FileCopyrightText: 2023-2026 NewPipe contributors <https://newpipe.net>
3+
* SPDX-License-Identifier: GPL-3.0-or-later
4+
*/
5+
6+
package org.schabi.newpipe.util.text
7+
8+
import android.content.Context
9+
import android.view.View
10+
import org.schabi.newpipe.util.external_communication.ShareUtils
11+
12+
internal class UrlLongPressClickableSpan(
13+
private val context: Context,
14+
private val url: String
15+
) : LongPressClickableSpan() {
16+
override fun onClick(view: View) {
17+
if (!InternalUrlsHandler.handleUrlDescriptionTimestamp(context, url)) {
18+
ShareUtils.openUrlInApp(context, url)
19+
}
20+
}
21+
22+
override fun onLongClick(view: View) {
23+
ShareUtils.copyToClipboard(context, url)
24+
}
25+
}

0 commit comments

Comments
 (0)