mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-13 22:00:30 +05:30
commit
3dc8edf954
@ -13,7 +13,8 @@ import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
|||||||
|
|
||||||
class ShareDialog(
|
class ShareDialog(
|
||||||
private val id: String,
|
private val id: String,
|
||||||
private val isPlaylist: Boolean
|
private val isPlaylist: Boolean,
|
||||||
|
private val position: Long = 0L
|
||||||
) : DialogFragment() {
|
) : DialogFragment() {
|
||||||
|
|
||||||
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
|
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
|
||||||
@ -39,7 +40,14 @@ class ShareDialog(
|
|||||||
else -> instanceUrl
|
else -> instanceUrl
|
||||||
}
|
}
|
||||||
val path = if (!isPlaylist) "/watch?v=$id" else "/playlist?list=$id"
|
val path = if (!isPlaylist) "/watch?v=$id" else "/playlist?list=$id"
|
||||||
val url = "$host$path"
|
var url = "$host$path"
|
||||||
|
if (PreferenceHelper.getBoolean(
|
||||||
|
PreferenceKeys.SHARE_WITH_TIME_CODE,
|
||||||
|
true
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
url += "?t=$position"
|
||||||
|
}
|
||||||
|
|
||||||
val intent = Intent()
|
val intent = Intent()
|
||||||
intent.apply {
|
intent.apply {
|
||||||
|
@ -540,7 +540,7 @@ class PlayerFragment : Fragment() {
|
|||||||
|
|
||||||
// share button
|
// share button
|
||||||
binding.relPlayerShare.setOnClickListener {
|
binding.relPlayerShare.setOnClickListener {
|
||||||
val shareDialog = ShareDialog(videoId!!, false)
|
val shareDialog = ShareDialog(videoId!!, false, exoPlayer.currentPosition)
|
||||||
shareDialog.show(childFragmentManager, "ShareDialog")
|
shareDialog.show(childFragmentManager, "ShareDialog")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,6 +80,7 @@ object PreferenceKeys {
|
|||||||
const val CLEAR_SEARCH_HISTORY = "clear_search_history"
|
const val CLEAR_SEARCH_HISTORY = "clear_search_history"
|
||||||
const val CLEAR_WATCH_HISTORY = "clear_watch_history"
|
const val CLEAR_WATCH_HISTORY = "clear_watch_history"
|
||||||
const val CLEAR_WATCH_POSITIONS = "clear_watch_positions"
|
const val CLEAR_WATCH_POSITIONS = "clear_watch_positions"
|
||||||
|
const val SHARE_WITH_TIME_CODE = "share_with_time_code"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Error logs
|
* Error logs
|
||||||
|
@ -290,4 +290,5 @@
|
|||||||
<string name="error_occurred">Error occurred</string>
|
<string name="error_occurred">Error occurred</string>
|
||||||
<string name="copied">Copied</string>
|
<string name="copied">Copied</string>
|
||||||
<string name="downloadsucceeded">Download succeeded</string>
|
<string name="downloadsucceeded">Download succeeded</string>
|
||||||
|
<string name="share_with_time">Share with time code</string>
|
||||||
</resources>
|
</resources>
|
@ -22,6 +22,16 @@
|
|||||||
|
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
|
|
||||||
|
<PreferenceCategory app:title="@string/share">
|
||||||
|
|
||||||
|
<SwitchPreferenceCompat
|
||||||
|
app:defaultValue="true"
|
||||||
|
app:icon="@drawable/ic_time"
|
||||||
|
app:key="share_with_time_code"
|
||||||
|
app:title="@string/share_with_time" />
|
||||||
|
|
||||||
|
</PreferenceCategory>
|
||||||
|
|
||||||
<PreferenceCategory app:title="@string/advanced">
|
<PreferenceCategory app:title="@string/advanced">
|
||||||
|
|
||||||
<SwitchPreferenceCompat
|
<SwitchPreferenceCompat
|
||||||
|
Loading…
Reference in New Issue
Block a user