Merge branch 'master' into push

This commit is contained in:
Bnyro 2022-07-29 08:49:31 +02:00 committed by GitHub
commit f3c10f94d8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
40 changed files with 340 additions and 470 deletions

View File

@ -16,6 +16,7 @@ import com.github.libretube.preferences.PreferenceHelper
import com.github.libretube.util.ConnectionHelper import com.github.libretube.util.ConnectionHelper
import com.github.libretube.util.NavigationHelper import com.github.libretube.util.NavigationHelper
import com.github.libretube.util.RetrofitInstance import com.github.libretube.util.RetrofitInstance
import com.github.libretube.util.setWatchProgressLength
import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
@ -51,13 +52,13 @@ class PlaylistAdapter(
holder.binding.apply { holder.binding.apply {
playlistTitle.text = streamItem.title playlistTitle.text = streamItem.title
playlistDescription.text = streamItem.uploaderName playlistDescription.text = streamItem.uploaderName
playlistDuration.text = DateUtils.formatElapsedTime(streamItem.duration!!) thumbnailDuration.text = DateUtils.formatElapsedTime(streamItem.duration!!)
ConnectionHelper.loadImage(streamItem.thumbnail, playlistThumbnail) ConnectionHelper.loadImage(streamItem.thumbnail, playlistThumbnail)
root.setOnClickListener { root.setOnClickListener {
NavigationHelper.navigateVideo(root.context, streamItem.url, playlistId) NavigationHelper.navigateVideo(root.context, streamItem.url, playlistId)
} }
root.setOnLongClickListener {
val videoId = streamItem.url!!.replace("/watch?v=", "") val videoId = streamItem.url!!.replace("/watch?v=", "")
root.setOnLongClickListener {
VideoOptionsDialog(videoId, root.context) VideoOptionsDialog(videoId, root.context)
.show(childFragmentManager, "VideoOptionsDialog") .show(childFragmentManager, "VideoOptionsDialog")
true true
@ -70,6 +71,7 @@ class PlaylistAdapter(
removeFromPlaylist(token, position) removeFromPlaylist(token, position)
} }
} }
watchProgress.setWatchProgressLength(videoId, streamItem.duration!!)
} }
} }

View File

@ -16,12 +16,24 @@ import com.github.libretube.util.setWatchProgressLength
class TrendingAdapter( class TrendingAdapter(
private val streamItems: List<StreamItem>, private val streamItems: List<StreamItem>,
private val childFragmentManager: FragmentManager private val childFragmentManager: FragmentManager,
private val showAllAtOne: Boolean = true
) : RecyclerView.Adapter<SubscriptionViewHolder>() { ) : RecyclerView.Adapter<SubscriptionViewHolder>() {
private val TAG = "SubscriptionAdapter" private val TAG = "TrendingAdapter"
var index = 10
override fun getItemCount(): Int { override fun getItemCount(): Int {
return streamItems.size return if (showAllAtOne) streamItems.size
else index
}
fun updateItems() {
index += 10
if (index > streamItems.size) {
index = streamItems.size
}
notifyDataSetChanged()
} }
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): SubscriptionViewHolder { override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): SubscriptionViewHolder {

View File

@ -5,9 +5,10 @@ import android.view.LayoutInflater
import android.view.ViewGroup import android.view.ViewGroup
import androidx.fragment.app.FragmentManager import androidx.fragment.app.FragmentManager
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import com.github.libretube.databinding.VideoRowBinding import com.github.libretube.databinding.WatchHistoryRowBinding
import com.github.libretube.dialogs.VideoOptionsDialog import com.github.libretube.dialogs.VideoOptionsDialog
import com.github.libretube.obj.WatchHistoryItem import com.github.libretube.obj.WatchHistoryItem
import com.github.libretube.preferences.PreferenceHelper
import com.github.libretube.util.ConnectionHelper import com.github.libretube.util.ConnectionHelper
import com.github.libretube.util.NavigationHelper import com.github.libretube.util.NavigationHelper
import com.github.libretube.util.setWatchProgressLength import com.github.libretube.util.setWatchProgressLength
@ -19,15 +20,9 @@ class WatchHistoryAdapter(
RecyclerView.Adapter<WatchHistoryViewHolder>() { RecyclerView.Adapter<WatchHistoryViewHolder>() {
private val TAG = "WatchHistoryAdapter" private val TAG = "WatchHistoryAdapter"
fun clear() {
val size = watchHistory.size
watchHistory.clear()
notifyItemRangeRemoved(0, size)
}
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): WatchHistoryViewHolder { override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): WatchHistoryViewHolder {
val layoutInflater = LayoutInflater.from(parent.context) val layoutInflater = LayoutInflater.from(parent.context)
val binding = VideoRowBinding.inflate(layoutInflater, parent, false) val binding = WatchHistoryRowBinding.inflate(layoutInflater, parent, false)
return WatchHistoryViewHolder(binding) return WatchHistoryViewHolder(binding)
} }
@ -45,6 +40,12 @@ class WatchHistoryAdapter(
NavigationHelper.navigateChannel(root.context, video.uploaderUrl) NavigationHelper.navigateChannel(root.context, video.uploaderUrl)
} }
deleteBTN.setOnClickListener {
PreferenceHelper.removeFromWatchHistory(video.videoId!!)
watchHistory.removeAt(position)
notifyItemRemoved(position)
}
root.setOnClickListener { root.setOnClickListener {
NavigationHelper.navigateVideo(root.context, video.videoId) NavigationHelper.navigateVideo(root.context, video.videoId)
} }
@ -63,5 +64,5 @@ class WatchHistoryAdapter(
} }
} }
class WatchHistoryViewHolder(val binding: VideoRowBinding) : class WatchHistoryViewHolder(val binding: WatchHistoryRowBinding) :
RecyclerView.ViewHolder(binding.root) RecyclerView.ViewHolder(binding.root)

View File

@ -600,7 +600,6 @@ class PlayerFragment : Fragment() {
} }
mainActivity.requestedOrientation = orientation mainActivity.requestedOrientation = orientation
} }
binding.player.setDoubleTapOverlayLayoutParams(90)
Globals.IS_FULL_SCREEN = true Globals.IS_FULL_SCREEN = true
} }

View File

@ -66,6 +66,7 @@ class SearchFragment : Fragment() {
binding.clearSearchImageView.setOnClickListener { binding.clearSearchImageView.setOnClickListener {
binding.autoCompleteTextView.text.clear() binding.autoCompleteTextView.text.clear()
binding.historyRecycler.adapter = null
showHistory() showHistory()
} }
@ -128,7 +129,7 @@ class SearchFragment : Fragment() {
} }
override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) { override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) {
if (s!! != "") { if (s.toString() != "") {
binding.searchRecycler.adapter = null binding.searchRecycler.adapter = null
binding.searchRecycler.viewTreeObserver binding.searchRecycler.viewTreeObserver
@ -143,14 +144,15 @@ class SearchFragment : Fragment() {
override fun afterTextChanged(s: Editable?) { override fun afterTextChanged(s: Editable?) {
if (s!!.isEmpty()) { if (s!!.isEmpty()) {
binding.historyRecycler.adapter = null
showHistory() showHistory()
} }
} }
}) })
binding.autoCompleteTextView.setOnEditorActionListener( binding.autoCompleteTextView.setOnEditorActionListener(
OnEditorActionListener { _, actionId, _ -> OnEditorActionListener { textView, actionId, _ ->
if (actionId == EditorInfo.IME_ACTION_SEARCH) { if (actionId == EditorInfo.IME_ACTION_SEARCH && textView.text.toString() != "") {
view?.let { context?.hideKeyboard(it) } view.let { context?.hideKeyboard(it) }
binding.searchRecycler.visibility = VISIBLE binding.searchRecycler.visibility = VISIBLE
binding.historyRecycler.visibility = GONE binding.historyRecycler.visibility = GONE
fetchSearch(binding.autoCompleteTextView.text.toString()) fetchSearch(binding.autoCompleteTextView.text.toString())

View File

@ -85,6 +85,20 @@ class SubscriptionsFragment : Fragment() {
binding.subFeedContainer.visibility = View.VISIBLE binding.subFeedContainer.visibility = View.VISIBLE
} }
} }
binding.scrollviewSub.viewTreeObserver
.addOnScrollChangedListener {
if (binding.scrollviewSub.getChildAt(0).bottom
== (binding.scrollviewSub.height + binding.scrollviewSub.scrollY)
) {
// scroll view is at bottom
if (isLoaded) {
binding.subRefresh.isRefreshing = true
subscriptionAdapter?.updateItems()
binding.subRefresh.isRefreshing = false
}
}
}
} else { } else {
binding.subRefresh.isEnabled = false binding.subRefresh.isEnabled = false
} }
@ -106,7 +120,7 @@ class SubscriptionsFragment : Fragment() {
binding.subRefresh.isRefreshing = false binding.subRefresh.isRefreshing = false
} }
if (response.isNotEmpty()) { if (response.isNotEmpty()) {
subscriptionAdapter = TrendingAdapter(response, childFragmentManager) subscriptionAdapter = TrendingAdapter(response, childFragmentManager, false)
feedRecView.adapter = subscriptionAdapter feedRecView.adapter = subscriptionAdapter
} else { } else {
runOnUiThread { runOnUiThread {

View File

@ -27,12 +27,12 @@ class WatchHistoryFragment : Fragment() {
super.onViewCreated(view, savedInstanceState) super.onViewCreated(view, savedInstanceState)
val watchHistory = PreferenceHelper.getWatchHistory() val watchHistory = PreferenceHelper.getWatchHistory()
if (watchHistory.isNotEmpty()) {
val watchHistoryAdapter = WatchHistoryAdapter(watchHistory, childFragmentManager) val watchHistoryAdapter = WatchHistoryAdapter(watchHistory, childFragmentManager)
binding.watchHistoryRecView.adapter = watchHistoryAdapter binding.watchHistoryRecView.adapter = watchHistoryAdapter
binding.historyEmpty.visibility = View.GONE
binding.clearHistory.setOnClickListener { binding.watchHistoryRecView.visibility = View.VISIBLE
PreferenceHelper.removePreference("watch_history")
watchHistoryAdapter.clear()
} }
// reverse order // reverse order

View File

@ -3,10 +3,8 @@ package com.github.libretube.preferences
import android.os.Bundle import android.os.Bundle
import androidx.preference.Preference import androidx.preference.Preference
import androidx.preference.PreferenceFragmentCompat import androidx.preference.PreferenceFragmentCompat
import androidx.preference.SwitchPreferenceCompat
import com.github.libretube.R import com.github.libretube.R
import com.github.libretube.activities.SettingsActivity import com.github.libretube.activities.SettingsActivity
import com.github.libretube.dialogs.RequireRestartDialog
import com.google.android.material.dialog.MaterialAlertDialogBuilder import com.google.android.material.dialog.MaterialAlertDialogBuilder
class AdvancedSettings : PreferenceFragmentCompat() { class AdvancedSettings : PreferenceFragmentCompat() {
@ -18,13 +16,6 @@ class AdvancedSettings : PreferenceFragmentCompat() {
val settingsActivity = activity as SettingsActivity val settingsActivity = activity as SettingsActivity
settingsActivity.changeTopBarText(getString(R.string.advanced)) settingsActivity.changeTopBarText(getString(R.string.advanced))
val dataSaverMode = findPreference<SwitchPreferenceCompat>(PreferenceKeys.DATA_SAVER_MODE)
dataSaverMode?.setOnPreferenceChangeListener { _, _ ->
val restartDialog = RequireRestartDialog()
restartDialog.show(childFragmentManager, "RequireRestartDialog")
true
}
val resetSettings = findPreference<Preference>(PreferenceKeys.RESET_SETTINGS) val resetSettings = findPreference<Preference>(PreferenceKeys.RESET_SETTINGS)
resetSettings?.setOnPreferenceClickListener { resetSettings?.setOnPreferenceClickListener {
showResetDialog() showResetDialog()
@ -34,6 +25,9 @@ class AdvancedSettings : PreferenceFragmentCompat() {
private fun showResetDialog() { private fun showResetDialog() {
MaterialAlertDialogBuilder(requireContext()) MaterialAlertDialogBuilder(requireContext())
.setTitle(R.string.reset)
.setMessage(R.string.reset_message)
.setNegativeButton(getString(R.string.cancel)) { _, _ -> }
.setPositiveButton(R.string.reset) { _, _ -> .setPositiveButton(R.string.reset) { _, _ ->
// clear default preferences // clear default preferences
PreferenceHelper.clearPreferences() PreferenceHelper.clearPreferences()
@ -41,12 +35,8 @@ class AdvancedSettings : PreferenceFragmentCompat() {
// clear login token // clear login token
PreferenceHelper.setToken("") PreferenceHelper.setToken("")
val restartDialog = RequireRestartDialog() activity?.recreate()
restartDialog.show(childFragmentManager, "RequireRestartDialog")
} }
.setNegativeButton(getString(R.string.cancel)) { _, _ -> }
.setTitle(R.string.reset)
.setMessage(R.string.reset_message)
.show() .show()
} }
} }

View File

@ -51,13 +51,6 @@ class AppearanceSettings : PreferenceFragmentCompat() {
true true
} }
val gridColumns = findPreference<ListPreference>(PreferenceKeys.GRID_COLUMNS)
gridColumns?.setOnPreferenceChangeListener { _, _ ->
val restartDialog = RequireRestartDialog()
restartDialog.show(childFragmentManager, "RequireRestartDialog")
true
}
val labelVisibilityMode = findPreference<ListPreference>(PreferenceKeys.LABEL_VISIBILITY) val labelVisibilityMode = findPreference<ListPreference>(PreferenceKeys.LABEL_VISIBILITY)
labelVisibilityMode?.setOnPreferenceChangeListener { _, _ -> labelVisibilityMode?.setOnPreferenceChangeListener { _, _ ->
val restartDialog = RequireRestartDialog() val restartDialog = RequireRestartDialog()

View File

@ -2,7 +2,6 @@ package com.github.libretube.preferences
import android.os.Bundle import android.os.Bundle
import androidx.preference.ListPreference import androidx.preference.ListPreference
import androidx.preference.Preference
import androidx.preference.PreferenceFragmentCompat import androidx.preference.PreferenceFragmentCompat
import androidx.preference.SwitchPreferenceCompat import androidx.preference.SwitchPreferenceCompat
import com.github.libretube.R import com.github.libretube.R
@ -18,13 +17,6 @@ class GeneralSettings : PreferenceFragmentCompat() {
val settingsActivity = activity as SettingsActivity val settingsActivity = activity as SettingsActivity
settingsActivity.changeTopBarText(getString(R.string.general)) settingsActivity.changeTopBarText(getString(R.string.general))
val region = findPreference<Preference>("region")
region?.setOnPreferenceChangeListener { _, _ ->
val restartDialog = RequireRestartDialog()
restartDialog.show(childFragmentManager, "RequireRestartDialog")
true
}
val language = findPreference<ListPreference>("language") val language = findPreference<ListPreference>("language")
language?.setOnPreferenceChangeListener { _, _ -> language?.setOnPreferenceChangeListener { _, _ ->
val restartDialog = RequireRestartDialog() val restartDialog = RequireRestartDialog()

View File

@ -5,6 +5,7 @@ import androidx.preference.Preference
import androidx.preference.PreferenceFragmentCompat import androidx.preference.PreferenceFragmentCompat
import com.github.libretube.R import com.github.libretube.R
import com.github.libretube.activities.SettingsActivity import com.github.libretube.activities.SettingsActivity
import com.google.android.material.dialog.MaterialAlertDialogBuilder
class HistorySettings : PreferenceFragmentCompat() { class HistorySettings : PreferenceFragmentCompat() {
@ -17,22 +18,34 @@ class HistorySettings : PreferenceFragmentCompat() {
// clear search history // clear search history
val clearHistory = findPreference<Preference>(PreferenceKeys.CLEAR_SEARCH_HISTORY) val clearHistory = findPreference<Preference>(PreferenceKeys.CLEAR_SEARCH_HISTORY)
clearHistory?.setOnPreferenceClickListener { clearHistory?.setOnPreferenceClickListener {
PreferenceHelper.removePreference("search_history") showClearDialog(R.string.clear_history, "search_history")
true true
} }
// clear watch history and positions // clear watch history and positions
val clearWatchHistory = findPreference<Preference>(PreferenceKeys.CLEAR_WATCH_HISTORY) val clearWatchHistory = findPreference<Preference>(PreferenceKeys.CLEAR_WATCH_HISTORY)
clearWatchHistory?.setOnPreferenceClickListener { clearWatchHistory?.setOnPreferenceClickListener {
PreferenceHelper.removePreference("watch_history") showClearDialog(R.string.clear_history, "watch_history")
true true
} }
// clear watch positions // clear watch positions
val clearWatchPositions = findPreference<Preference>(PreferenceKeys.CLEAR_WATCH_POSITIONS) val clearWatchPositions = findPreference<Preference>(PreferenceKeys.CLEAR_WATCH_POSITIONS)
clearWatchPositions?.setOnPreferenceClickListener { clearWatchPositions?.setOnPreferenceClickListener {
PreferenceHelper.removePreference("watch_positions") showClearDialog(R.string.reset_watch_positions, "watch_positions")
true true
} }
} }
private fun showClearDialog(title: Int, preferenceKey: String) {
MaterialAlertDialogBuilder(requireContext())
.setTitle(title)
.setMessage(R.string.irreversible)
.setNegativeButton(getString(R.string.cancel)) { _, _ -> }
.setPositiveButton(R.string.okay) { _, _ ->
// clear the selected preference preferences
PreferenceHelper.removePreference(preferenceKey)
}
.show()
}
} }

View File

@ -21,7 +21,6 @@ import com.github.libretube.dialogs.CustomInstanceDialog
import com.github.libretube.dialogs.DeleteAccountDialog import com.github.libretube.dialogs.DeleteAccountDialog
import com.github.libretube.dialogs.LoginDialog import com.github.libretube.dialogs.LoginDialog
import com.github.libretube.dialogs.LogoutDialog import com.github.libretube.dialogs.LogoutDialog
import com.github.libretube.dialogs.RequireRestartDialog
import com.github.libretube.util.PermissionHelper import com.github.libretube.util.PermissionHelper
import com.github.libretube.util.RetrofitInstance import com.github.libretube.util.RetrofitInstance
import org.json.JSONObject import org.json.JSONObject
@ -120,14 +119,13 @@ class InstanceSettings : PreferenceFragmentCompat() {
// fetchInstance() // fetchInstance()
initCustomInstances(instance!!) initCustomInstances(instance!!)
instance.setOnPreferenceChangeListener { _, newValue -> instance.setOnPreferenceChangeListener { _, newValue ->
val restartDialog = RequireRestartDialog()
restartDialog.show(childFragmentManager, "RequireRestartDialog")
RetrofitInstance.url = newValue.toString() RetrofitInstance.url = newValue.toString()
if (!PreferenceHelper.getBoolean(PreferenceKeys.AUTH_INSTANCE_TOGGLE, false)) { if (!PreferenceHelper.getBoolean(PreferenceKeys.AUTH_INSTANCE_TOGGLE, false)) {
RetrofitInstance.authUrl = newValue.toString() RetrofitInstance.authUrl = newValue.toString()
logout() logout()
} }
RetrofitInstance.lazyMgr.reset() RetrofitInstance.lazyMgr.reset()
activity?.recreate()
true true
} }
@ -142,8 +140,7 @@ class InstanceSettings : PreferenceFragmentCompat() {
RetrofitInstance.authUrl = newValue.toString() RetrofitInstance.authUrl = newValue.toString()
RetrofitInstance.lazyMgr.reset() RetrofitInstance.lazyMgr.reset()
logout() logout()
val restartDialog = RequireRestartDialog() activity?.recreate()
restartDialog.show(childFragmentManager, "RequireRestartDialog")
true true
} }
@ -155,8 +152,8 @@ class InstanceSettings : PreferenceFragmentCompat() {
// either use new auth url or the normal api url if auth instance disabled // either use new auth url or the normal api url if auth instance disabled
RetrofitInstance.authUrl = if (newValue == false) RetrofitInstance.url RetrofitInstance.authUrl = if (newValue == false) RetrofitInstance.url
else authInstance.value else authInstance.value
val restartDialog = RequireRestartDialog() RetrofitInstance.lazyMgr.reset()
restartDialog.show(childFragmentManager, "RequireRestartDialog") activity?.recreate()
true true
} }

View File

@ -26,38 +26,10 @@ object PreferenceHelper {
editor = settings.edit() editor = settings.edit()
} }
fun setString(key: String?, value: String?) {
editor.putString(key, value)
editor.apply()
}
fun setInt(key: String?, value: Int) {
editor.putInt(key, value)
editor.apply()
}
fun setLong(key: String?, value: Long) {
editor.putLong(key, value)
editor.apply()
}
fun setBoolean(key: String?, value: Boolean) {
editor.putBoolean(key, value)
editor.apply()
}
fun getString(key: String?, defValue: String?): String { fun getString(key: String?, defValue: String?): String {
return settings.getString(key, defValue)!! return settings.getString(key, defValue)!!
} }
fun getInt(key: String?, defValue: Int): Int {
return settings.getInt(key, defValue)
}
fun getLong(key: String?, defValue: Long): Long {
return settings.getLong(key, defValue)
}
fun getBoolean(key: String?, defValue: Boolean): Boolean { fun getBoolean(key: String?, defValue: Boolean): Boolean {
return settings.getBoolean(key, defValue) return settings.getBoolean(key, defValue)
} }
@ -150,6 +122,8 @@ object PreferenceHelper {
} }
fun addToWatchHistory(videoId: String, streams: Streams) { fun addToWatchHistory(videoId: String, streams: Streams) {
removeFromWatchHistory(videoId)
val watchHistoryItem = WatchHistoryItem( val watchHistoryItem = WatchHistoryItem(
videoId, videoId,
streams.title, streams.title,
@ -161,21 +135,30 @@ object PreferenceHelper {
streams.duration streams.duration
) )
val mapper = ObjectMapper()
val watchHistory = getWatchHistory() val watchHistory = getWatchHistory()
// delete entries that have the same videoId
var indexToRemove: Int? = null
watchHistory.forEachIndexed { index, item ->
if (item.videoId == videoId) indexToRemove = index
}
if (indexToRemove != null) watchHistory.removeAt(indexToRemove!!)
watchHistory += watchHistoryItem watchHistory += watchHistoryItem
val json = mapper.writeValueAsString(watchHistory) val json = mapper.writeValueAsString(watchHistory)
editor.putString("watch_history", json).apply() editor.putString("watch_history", json).apply()
} }
fun removeFromWatchHistory(videoId: String) {
val mapper = ObjectMapper()
val watchHistory = getWatchHistory()
var indexToRemove: Int? = null
watchHistory.forEachIndexed { index, item ->
if (item.videoId == videoId) indexToRemove = index
}
if (indexToRemove != null) {
watchHistory.removeAt(indexToRemove!!)
val json = mapper.writeValueAsString(watchHistory)
editor.putString("watch_history", json).commit()
}
}
fun getWatchHistory(): ArrayList<WatchHistoryItem> { fun getWatchHistory(): ArrayList<WatchHistoryItem> {
val json: String = settings.getString("watch_history", "")!! val json: String = settings.getString("watch_history", "")!!
val type = mapper.typeFactory.constructCollectionType( val type = mapper.typeFactory.constructCollectionType(

View File

@ -5,7 +5,6 @@ import android.content.Context
import android.util.AttributeSet import android.util.AttributeSet
import android.view.MotionEvent import android.view.MotionEvent
import android.view.View import android.view.View
import com.github.libretube.R
import com.github.libretube.databinding.ExoStyledPlayerControlViewBinding import com.github.libretube.databinding.ExoStyledPlayerControlViewBinding
import com.github.libretube.util.DoubleTapListener import com.github.libretube.util.DoubleTapListener
import com.github.libretube.util.OnDoubleTapEventListener import com.github.libretube.util.OnDoubleTapEventListener
@ -54,26 +53,6 @@ internal class CustomExoPlayerView(
setOnClickListener(doubleTouchListener) setOnClickListener(doubleTouchListener)
} }
override fun hideController() {
super.hideController()
setDoubleTapOverlayLayoutParams(0)
}
override fun showController() {
setDoubleTapOverlayLayoutParams(90)
super.showController()
}
// set the top and bottom margin of the double tap overlay
fun setDoubleTapOverlayLayoutParams(margin: Int) {
val dpMargin = resources?.displayMetrics?.density!!.toInt() * margin
val doubleTapOverlay = binding.root.findViewById<DoubleTapOverlay>(R.id.doubleTapOverlay)
val params = doubleTapOverlay.layoutParams as MarginLayoutParams
params.topMargin = dpMargin
params.bottomMargin = dpMargin
doubleTapOverlay.layoutParams = params
}
override fun onTouchEvent(event: MotionEvent): Boolean { override fun onTouchEvent(event: MotionEvent): Boolean {
// save the x position of the touch event // save the x position of the touch event
xPos = event.x xPos = event.x

View File

@ -1,11 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" <vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp" android:width="24dp"
android:height="24dp" android:height="24dp"
android:tint="?attr/colorControlNormal" android:tint="?android:attr/colorControlNormal"
android:viewportWidth="24" android:viewportWidth="48"
android:viewportHeight="24"> android:viewportHeight="48">
<path <path
android:fillColor="#FF000000" android:fillColor="#FF000000"
android:pathData="M7,21Q6.175,21 5.588,20.413Q5,19.825 5,19V6Q4.575,6 4.287,5.713Q4,5.425 4,5Q4,4.575 4.287,4.287Q4.575,4 5,4H9Q9,3.575 9.288,3.287Q9.575,3 10,3H14Q14.425,3 14.713,3.287Q15,3.575 15,4H19Q19.425,4 19.712,4.287Q20,4.575 20,5Q20,5.425 19.712,5.713Q19.425,6 19,6V19Q19,19.825 18.413,20.413Q17.825,21 17,21ZM7,6V19Q7,19 7,19Q7,19 7,19H17Q17,19 17,19Q17,19 17,19V6ZM7,6V19Q7,19 7,19Q7,19 7,19Q7,19 7,19Q7,19 7,19V6ZM12,13.9 L13.9,15.8Q14.2,16.075 14.613,16.075Q15.025,16.075 15.3,15.8Q15.6,15.5 15.6,15.087Q15.6,14.675 15.3,14.4L13.4,12.5L15.3,10.6Q15.6,10.3 15.6,9.887Q15.6,9.475 15.3,9.2Q15.025,8.9 14.613,8.9Q14.2,8.9 13.9,9.2L12,11.1L10.1,9.2Q9.825,8.9 9.413,8.9Q9,8.9 8.7,9.2Q8.425,9.475 8.425,9.887Q8.425,10.3 8.7,10.6L10.6,12.5L8.7,14.4Q8.425,14.675 8.425,15.087Q8.425,15.5 8.7,15.8Q9,16.075 9.413,16.075Q9.825,16.075 10.1,15.8Z" /> android:pathData="M13.05,42q-1.2,0 -2.1,-0.9 -0.9,-0.9 -0.9,-2.1L10.05,10.5L8,10.5v-3h9.4L17.4,6h13.2v1.5L40,7.5v3h-2.05L37.95,39q0,1.2 -0.9,2.1 -0.9,0.9 -2.1,0.9ZM18.35,34.7h3L21.35,14.75h-3ZM26.65,34.7h3L29.65,14.75h-3Z" />
</vector> </vector>

View File

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="8dp" android:layout_marginLeft="8dp"
@ -24,8 +25,8 @@
android:layout_toEndOf="@id/subscription_channel_image" android:layout_toEndOf="@id/subscription_channel_image"
android:ellipsize="end" android:ellipsize="end"
android:maxLines="1" android:maxLines="1"
android:text="Channel Name" android:textSize="16sp"
android:textSize="16sp" /> tools:text="Channel Name" />
<com.google.android.material.button.MaterialButton <com.google.android.material.button.MaterialButton
android:id="@+id/subscription_subscribe" android:id="@+id/subscription_subscribe"
@ -35,9 +36,9 @@
android:layout_alignParentEnd="true" android:layout_alignParentEnd="true"
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:stateListAnimator="@null" android:stateListAnimator="@null"
android:text="@string/unsubscribe"
android:textColor="?android:attr/textColorPrimary" android:textColor="?android:attr/textColorPrimary"
android:textSize="12sp" android:textSize="12sp"
app:cornerRadius="20dp" app:cornerRadius="20dp"
app:elevation="20dp" /> app:elevation="20dp"
tools:text="@string/unsubscribe" />
</RelativeLayout> </RelativeLayout>

View File

@ -3,6 +3,7 @@
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="match_parent" android:layout_height="match_parent"
xmlns:tools="http://schemas.android.com/tools"
android:background="?attr/selectableItemBackground" android:background="?attr/selectableItemBackground"
android:backgroundTint="@android:color/transparent" android:backgroundTint="@android:color/transparent"
app:strokeWidth="0dp"> app:strokeWidth="0dp">
@ -23,12 +24,12 @@
<TextView <TextView
android:id="@+id/chapter_title" android:id="@+id/chapter_title"
tools:text="Title"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="3dp" android:layout_marginTop="3dp"
android:ellipsize="end" android:ellipsize="end"
android:maxLines="3" android:maxLines="3"
android:text="Title"
android:textSize="13sp" /> android:textSize="13sp" />
</LinearLayout> </LinearLayout>

View File

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="?android:attr/selectableItemBackground"> android:background="?android:attr/selectableItemBackground">
@ -45,9 +46,9 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:ellipsize="end" android:ellipsize="end"
android:maxLines="2" android:maxLines="2"
android:text="Author and Time"
android:textSize="15sp" android:textSize="15sp"
android:textStyle="bold" /> android:textStyle="bold"
tools:text="Author and Time" />
<ImageView <ImageView
android:id="@+id/verified_imageView" android:id="@+id/verified_imageView"
@ -74,7 +75,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginBottom="4dp" android:layout_marginBottom="4dp"
android:autoLink="web" android:autoLink="web"
android:text="Comment Text" /> tools:text="Comment Text" />
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
@ -93,7 +94,7 @@
android:id="@+id/likes_textView" android:id="@+id/likes_textView"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="LikeCount" /> tools:text="LikeCount" />
<ImageView <ImageView
android:id="@+id/hearted_imageView" android:id="@+id/hearted_imageView"

View File

@ -39,8 +39,8 @@
<LinearLayout <LinearLayout
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_marginLeft="10dp" android:layout_marginStart="10dp"
android:layout_marginRight="5dp" android:layout_marginEnd="5dp"
android:layout_weight="1" android:layout_weight="1"
android:orientation="vertical"> android:orientation="vertical">
@ -57,9 +57,9 @@
android:drawablePadding="3dip" android:drawablePadding="3dip"
android:ellipsize="end" android:ellipsize="end"
android:maxLines="1" android:maxLines="1"
android:text="Channel Name"
android:textSize="16sp" android:textSize="16sp"
android:textStyle="bold" /> android:textStyle="bold"
tools:text="Channel Name" />
</LinearLayout> </LinearLayout>
@ -78,14 +78,15 @@
style="@style/Widget.Material3.Button.ElevatedButton" style="@style/Widget.Material3.Button.ElevatedButton"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:drawableLeft="@drawable/ic_bell_small" android:drawableStart="@drawable/ic_bell_small"
android:drawableTint="?android:attr/textColorPrimary" android:drawableTint="?android:attr/textColorPrimary"
android:stateListAnimator="@null" android:stateListAnimator="@null"
android:text="@string/subscribe" android:text="@string/subscribe"
android:textColor="?android:attr/textColorPrimary" android:textColor="?android:attr/textColorPrimary"
android:textSize="12sp" android:textSize="12sp"
app:cornerRadius="20dp" app:cornerRadius="20dp"
app:elevation="20dp" /> app:elevation="20dp"
tools:targetApi="m" />
</LinearLayout> </LinearLayout>
@ -96,8 +97,7 @@
android:layout_marginStart="10dp" android:layout_marginStart="10dp"
android:layout_marginEnd="10dp" android:layout_marginEnd="10dp"
android:layout_marginBottom="15dp" android:layout_marginBottom="15dp"
android:autoLink="web" android:autoLink="web" />
android:text="" />
<RelativeLayout <RelativeLayout
android:layout_width="match_parent" android:layout_width="match_parent"

View File

@ -6,7 +6,7 @@
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="wrap_content"
android:orientation="vertical"> android:orientation="vertical">
<com.google.android.material.imageview.ShapeableImageView <com.google.android.material.imageview.ShapeableImageView

View File

@ -41,8 +41,8 @@
android:layout_marginStart="10dp" android:layout_marginStart="10dp"
android:layout_marginTop="10dp" android:layout_marginTop="10dp"
android:layout_marginEnd="30dp" android:layout_marginEnd="30dp"
android:text="Video Title" android:textSize="18sp"
android:textSize="18sp" /> tools:text="Video Title" />
<ImageView <ImageView
@ -68,7 +68,7 @@
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_weight="1"
android:text="10M views 2 days ago " /> tools:text="10M views 2 days ago " />
<LinearLayout <LinearLayout
android:layout_width="wrap_content" android:layout_width="wrap_content"
@ -87,7 +87,7 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginHorizontal="5dp" android:layout_marginHorizontal="5dp"
android:text="4.2K" /> tools:text="4.2K" />
<ImageView <ImageView
android:layout_width="12dp" android:layout_width="12dp"
@ -102,7 +102,7 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginHorizontal="5dp" android:layout_marginHorizontal="5dp"
android:text="1.3K" /> tools:text="1.3K" />
</LinearLayout> </LinearLayout>
@ -264,7 +264,6 @@
android:layout_toEndOf="@+id/player_channelImage" android:layout_toEndOf="@+id/player_channelImage"
android:ellipsize="end" android:ellipsize="end"
android:maxLines="1" android:maxLines="1"
android:text=""
android:textSize="15sp" /> android:textSize="15sp" />
@ -275,7 +274,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentEnd="true" android:layout_alignParentEnd="true"
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:drawableLeft="@drawable/ic_bell" android:drawableStart="@drawable/ic_bell"
android:drawableTint="?android:attr/textColorPrimary" android:drawableTint="?android:attr/textColorPrimary"
android:text="@string/subscribe" android:text="@string/subscribe"
android:textColor="?android:attr/textColorPrimary" android:textColor="?android:attr/textColorPrimary"
@ -377,7 +376,9 @@
<com.github.libretube.views.DoubleTapOverlay <com.github.libretube.views.DoubleTapOverlay
android:id="@+id/doubleTapOverlay" android:id="@+id/doubleTapOverlay"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" /> android:layout_gravity="center"
android:gravity="center"
android:layout_height="wrap_content" />
</com.github.libretube.views.CustomExoPlayerView> </com.github.libretube.views.CustomExoPlayerView>

View File

@ -34,7 +34,6 @@
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_weight="1"
android:text=""
android:textSize="24sp" android:textSize="24sp"
android:textStyle="bold" /> android:textStyle="bold" />
@ -43,7 +42,7 @@
android:layout_width="20dp" android:layout_width="20dp"
android:layout_height="20dp" android:layout_height="20dp"
android:layout_gravity="center" android:layout_gravity="center"
android:layout_marginRight="10dp" android:layout_marginEnd="10dp"
android:src="@drawable/ic_three_dots" /> android:src="@drawable/ic_three_dots" />
</LinearLayout> </LinearLayout>

View File

@ -37,8 +37,8 @@
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox" style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="20dp" android:layout_marginStart="20dp"
android:layout_marginRight="30dp" android:layout_marginEnd="30dp"
android:background="@android:color/transparent" android:background="@android:color/transparent"
app:hintEnabled="false"> app:hintEnabled="false">
@ -59,9 +59,9 @@
android:id="@+id/clearSearch_imageView" android:id="@+id/clearSearch_imageView"
android:layout_width="20dp" android:layout_width="20dp"
android:layout_height="20dp" android:layout_height="20dp"
android:layout_alignParentRight="true" android:layout_alignParentEnd="true"
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:layout_marginRight="16dp" android:layout_marginEnd="16dp"
android:src="@drawable/ic_close" /> android:src="@drawable/ic_close" />
</RelativeLayout> </RelativeLayout>
@ -71,260 +71,12 @@
android:id="@+id/filterMenu_imageView" android:id="@+id/filterMenu_imageView"
android:layout_width="30dp" android:layout_width="30dp"
android:layout_height="30dp" android:layout_height="30dp"
android:layout_alignParentRight="true"
android:layout_marginTop="25dp" android:layout_marginTop="25dp"
android:layout_marginRight="20dp" android:layout_marginEnd="20dp"
android:layout_weight="0" android:layout_weight="0"
android:src="@drawable/ic_filter" /> android:src="@drawable/ic_filter" />
</LinearLayout> </LinearLayout>
<!-- <TextView-->
<!-- android:id="@+id/tv_genres"-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_margin="25dp"-->
<!-- android:text="Explore different genres"-->
<!-- android:textSize="16sp"-->
<!-- app:layout_constraintStart_toStartOf="parent"-->
<!-- app:layout_constraintTop_toBottomOf="@+id/outlinedTextField" />-->
<!-- <LinearLayout-->
<!-- android:id="@+id/genres"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_marginLeft="10dp"-->
<!-- android:layout_marginTop="30dp"-->
<!-- android:layout_marginRight="10dp"-->
<!-- android:orientation="horizontal"-->
<!-- app:layout_constraintEnd_toEndOf="parent"-->
<!-- app:layout_constraintStart_toStartOf="parent"-->
<!-- app:layout_constraintTop_toBottomOf="@id/tv_genres">-->
<!-- <com.google.android.material.card.MaterialCardView-->
<!-- android:id="@+id/btn_trending"-->
<!-- android:layout_width="0dp"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_marginLeft="20dp"-->
<!-- android:layout_marginRight="20dp"-->
<!-- android:layout_weight=".5"-->
<!-- android:background="@android:color/transparent"-->
<!-- app:cardBackgroundColor="@android:color/transparent"-->
<!-- app:strokeWidth="0dp">-->
<!-- <RelativeLayout-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="match_parent"-->
<!-- android:orientation="horizontal">-->
<!-- <ImageView-->
<!-- android:id="@+id/iv_ic"-->
<!-- android:layout_width="25dp"-->
<!-- android:layout_height="25dp"-->
<!-- android:layout_alignParentLeft="true"-->
<!-- android:layout_centerVertical="true"-->
<!-- android:layout_marginStart="5dp"-->
<!-- android:layout_marginTop="5dp"-->
<!-- android:layout_marginEnd="5dp"-->
<!-- android:layout_marginBottom="5dp"-->
<!-- android:src="@drawable/ic_hot" />-->
<!-- <TextView-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_centerVertical="true"-->
<!-- android:layout_marginLeft="7dp"-->
<!-- android:layout_toRightOf="@id/iv_ic"-->
<!-- android:text="@string/trending"-->
<!-- android:textSize="16sp" />-->
<!-- <ImageView-->
<!-- android:layout_width="10dp"-->
<!-- android:layout_height="10dp"-->
<!-- android:layout_alignParentRight="true"-->
<!-- android:layout_centerVertical="true"-->
<!-- android:src="@drawable/ic_arrow" />-->
<!-- </RelativeLayout>-->
<!-- </com.google.android.material.card.MaterialCardView>-->
<!-- <com.google.android.material.card.MaterialCardView-->
<!-- android:id="@+id/btn_live"-->
<!-- android:layout_width="0dp"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_marginLeft="30dp"-->
<!-- android:layout_marginRight="20dp"-->
<!-- android:layout_weight=".5"-->
<!-- android:background="@android:color/transparent"-->
<!-- app:cardBackgroundColor="@android:color/transparent"-->
<!-- app:strokeWidth="0dp">-->
<!-- <RelativeLayout-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="match_parent"-->
<!-- android:orientation="horizontal">-->
<!-- <ImageView-->
<!-- android:id="@+id/iv_ic2"-->
<!-- android:layout_width="25dp"-->
<!-- android:layout_height="25dp"-->
<!-- android:layout_alignParentLeft="true"-->
<!-- android:layout_centerVertical="true"-->
<!-- android:layout_marginStart="5dp"-->
<!-- android:layout_marginTop="5dp"-->
<!-- android:layout_marginEnd="5dp"-->
<!-- android:layout_marginBottom="5dp"-->
<!-- android:src="@drawable/ic_live" />-->
<!-- <TextView-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_centerVertical="true"-->
<!-- android:layout_marginLeft="7dp"-->
<!-- android:layout_toRightOf="@id/iv_ic2"-->
<!-- android:text="@string/live"-->
<!-- android:textSize="16sp" />-->
<!-- <ImageView-->
<!-- android:layout_width="10dp"-->
<!-- android:layout_height="10dp"-->
<!-- android:layout_alignParentRight="true"-->
<!-- android:layout_centerVertical="true"-->
<!-- android:src="@drawable/ic_arrow" />-->
<!-- </RelativeLayout>-->
<!-- </com.google.android.material.card.MaterialCardView>-->
<!-- </LinearLayout>-->
<!-- <LinearLayout-->
<!-- android:id="@+id/genres2"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_marginLeft="10dp"-->
<!-- android:layout_marginTop="20dp"-->
<!-- android:layout_marginRight="10dp"-->
<!-- android:orientation="horizontal"-->
<!-- app:layout_constraintEnd_toEndOf="parent"-->
<!-- app:layout_constraintStart_toStartOf="parent"-->
<!-- app:layout_constraintTop_toBottomOf="@id/genres">-->
<!-- <com.google.android.material.card.MaterialCardView-->
<!-- android:id="@+id/btn_music"-->
<!-- android:layout_width="0dp"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_marginLeft="20dp"-->
<!-- android:layout_marginRight="20dp"-->
<!-- android:layout_weight=".5"-->
<!-- android:background="@android:color/transparent"-->
<!-- app:cardBackgroundColor="@android:color/transparent"-->
<!-- app:strokeWidth="0dp">-->
<!-- <RelativeLayout-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="match_parent"-->
<!-- android:orientation="horizontal">-->
<!-- <ImageView-->
<!-- android:id="@+id/iv_ic3"-->
<!-- android:layout_width="25dp"-->
<!-- android:layout_height="25dp"-->
<!-- android:layout_alignParentLeft="true"-->
<!-- android:layout_centerVertical="true"-->
<!-- android:layout_marginStart="5dp"-->
<!-- android:layout_marginTop="5dp"-->
<!-- android:layout_marginEnd="5dp"-->
<!-- android:layout_marginBottom="5dp"-->
<!-- android:src="@drawable/ic_music" />-->
<!-- <TextView-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_centerVertical="true"-->
<!-- android:layout_marginLeft="7dp"-->
<!-- android:layout_toRightOf="@id/iv_ic3"-->
<!-- android:text="@string/music"-->
<!-- android:textSize="16sp" />-->
<!-- <ImageView-->
<!-- android:layout_width="10dp"-->
<!-- android:layout_height="10dp"-->
<!-- android:layout_alignParentRight="true"-->
<!-- android:layout_centerVertical="true"-->
<!-- android:src="@drawable/ic_arrow" />-->
<!-- </RelativeLayout>-->
<!-- </com.google.android.material.card.MaterialCardView>-->
<!-- <com.google.android.material.card.MaterialCardView-->
<!-- android:id="@+id/btn_films"-->
<!-- android:layout_width="0dp"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_marginLeft="30dp"-->
<!-- android:layout_marginRight="20dp"-->
<!-- android:layout_weight=".5"-->
<!-- android:background="@android:color/transparent"-->
<!-- app:cardBackgroundColor="@android:color/transparent"-->
<!-- app:strokeWidth="0dp">-->
<!-- <RelativeLayout-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="match_parent"-->
<!-- android:orientation="horizontal">-->
<!-- <ImageView-->
<!-- android:id="@+id/iv_ic4"-->
<!-- android:layout_width="25dp"-->
<!-- android:layout_height="25dp"-->
<!-- android:layout_alignParentLeft="true"-->
<!-- android:layout_centerVertical="true"-->
<!-- android:layout_marginStart="5dp"-->
<!-- android:layout_marginTop="5dp"-->
<!-- android:layout_marginEnd="5dp"-->
<!-- android:layout_marginBottom="5dp"-->
<!-- android:src="@drawable/ic_film" />-->
<!-- <TextView-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_centerVertical="true"-->
<!-- android:layout_marginLeft="7dp"-->
<!-- android:layout_toRightOf="@id/iv_ic4"-->
<!-- android:text="@string/film"-->
<!-- android:textSize="16sp" />-->
<!-- <ImageView-->
<!-- android:layout_width="10dp"-->
<!-- android:layout_height="10dp"-->
<!-- android:layout_alignParentRight="true"-->
<!-- android:layout_centerVertical="true"-->
<!-- android:src="@drawable/ic_arrow" />-->
<!-- </RelativeLayout>-->
<!-- </com.google.android.material.card.MaterialCardView>-->
<!-- </LinearLayout>-->
<!-- <TextView-->
<!-- android:id="@+id/tv_history"-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_margin="25dp"-->
<!-- android:text="@string/history"-->
<!-- android:textSize="14sp"-->
<!-- app:layout_constraintStart_toStartOf="parent"-->
<!-- app:layout_constraintTop_toBottomOf="@+id/outlinedTextField"-->
<!-- android:visibility="gone"/>-->
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
android:id="@+id/history_recycler" android:id="@+id/history_recycler"
android:layout_width="0dp" android:layout_width="0dp"

View File

@ -1,34 +1,29 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
<LinearLayout <LinearLayout
android:id="@+id/history_empty"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical"> android:orientation="vertical">
<LinearLayout <ImageView
android:layout_width="match_parent" android:layout_width="100dp"
android:layout_height="wrap_content" android:layout_height="100dp"
android:layout_marginBottom="8dp" android:layout_marginBottom="16dp"
android:paddingHorizontal="8dp"> android:src="@drawable/ic_history" />
<TextView <TextView
android:layout_width="0dp" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_marginHorizontal="10dp"
android:text="@string/watch_history" android:gravity="center"
android:textSize="16sp" /> android:text="@string/history_empty"
android:textSize="20sp"
<ImageView android:textStyle="bold" />
android:id="@+id/clearHistory"
android:layout_width="16dp"
android:layout_height="16dp"
android:layout_gravity="center"
android:layout_marginRight="5dp"
android:src="@drawable/ic_reset" />
</LinearLayout> </LinearLayout>
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
@ -36,8 +31,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_margin="8dp" android:layout_margin="8dp"
android:nestedScrollingEnabled="false" /> android:nestedScrollingEnabled="false"
android:visibility="gone" />
</LinearLayout> </FrameLayout>
</ScrollView>

View File

@ -36,27 +36,43 @@
android:layout_height="match_parent" android:layout_height="match_parent"
tools:srcCompat="@tools:sample/backgrounds/scenic" /> tools:srcCompat="@tools:sample/backgrounds/scenic" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:orientation="vertical">
<androidx.cardview.widget.CardView <androidx.cardview.widget.CardView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="bottom|end" android:layout_gravity="end"
android:layout_margin="5dp" android:layout_marginEnd="5dp"
android:layout_marginBottom="5dp"
app:cardBackgroundColor="@color/duration_background_color" app:cardBackgroundColor="@color/duration_background_color"
app:cardCornerRadius="8dp" app:cardCornerRadius="8dp"
app:cardElevation="0dp"> app:cardElevation="0dp">
<TextView <TextView
android:id="@+id/playlist_duration" android:id="@+id/thumbnail_duration"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingStart="6dp" android:paddingHorizontal="6dp"
android:paddingTop="2dp" android:paddingVertical="2dp"
android:paddingEnd="6dp"
android:paddingBottom="2dp"
android:textColor="@color/duration_text_color" android:textColor="@color/duration_text_color"
android:textSize="11sp"
tools:text="05:36" /> tools:text="05:36" />
</androidx.cardview.widget.CardView> </androidx.cardview.widget.CardView>
<View
android:id="@+id/watch_progress"
android:layout_width="match_parent"
android:layout_height="4dp"
android:layout_gravity="bottom"
android:background="@android:color/holo_red_dark" />
</LinearLayout>
</com.google.android.material.card.MaterialCardView> </com.google.android.material.card.MaterialCardView>
<TextView <TextView
@ -64,20 +80,20 @@
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="8dp" android:layout_marginStart="8dp"
android:text="TextView"
app:layout_constraintEnd_toStartOf="@+id/delete_playlist" app:layout_constraintEnd_toStartOf="@+id/delete_playlist"
app:layout_constraintStart_toEndOf="@+id/card_search_thumbnail" app:layout_constraintStart_toEndOf="@+id/card_search_thumbnail"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent"
tools:text="Playlist Name" />
<TextView <TextView
android:id="@+id/playlist_description" android:id="@+id/playlist_description"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="8dp" android:layout_marginStart="8dp"
android:text="TextView"
app:layout_constraintEnd_toStartOf="@+id/delete_playlist" app:layout_constraintEnd_toStartOf="@+id/delete_playlist"
app:layout_constraintStart_toEndOf="@+id/card_search_thumbnail" app:layout_constraintStart_toEndOf="@+id/card_search_thumbnail"
app:layout_constraintTop_toBottomOf="@+id/playlist_title" /> app:layout_constraintTop_toBottomOf="@+id/playlist_title"
tools:text="Description" />
<com.google.android.material.imageview.ShapeableImageView <com.google.android.material.imageview.ShapeableImageView
android:id="@+id/delete_playlist" android:id="@+id/delete_playlist"

View File

@ -42,7 +42,6 @@
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="8dp" android:layout_marginStart="8dp"
android:text=""
app:layout_constraintEnd_toStartOf="@+id/delete_playlist" app:layout_constraintEnd_toStartOf="@+id/delete_playlist"
app:layout_constraintStart_toEndOf="@+id/card_playlist_thumbnail" app:layout_constraintStart_toEndOf="@+id/card_playlist_thumbnail"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent" />
@ -52,8 +51,7 @@
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="8dp" android:layout_marginStart="8dp"
android:text="" app:layout_constraintEnd_toStartOf="@id/delete_playlist"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/card_playlist_thumbnail" app:layout_constraintStart_toEndOf="@+id/card_playlist_thumbnail"
app:layout_constraintTop_toBottomOf="@+id/playlist_title" /> app:layout_constraintTop_toBottomOf="@+id/playlist_title" />

View File

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"> android:layout_height="wrap_content">
@ -34,9 +35,9 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:ellipsize="end" android:ellipsize="end"
android:maxLines="2" android:maxLines="2"
android:text="Author and Time"
android:textSize="15sp" android:textSize="15sp"
android:textStyle="bold" /> android:textStyle="bold"
tools:text="Author and Time" />
<ImageView <ImageView
android:id="@+id/verified_imageView" android:id="@+id/verified_imageView"
@ -63,7 +64,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginBottom="4dp" android:layout_marginBottom="4dp"
android:autoLink="web" android:autoLink="web"
android:text="Comment Text" /> tools:text="Comment Text" />
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
@ -82,7 +83,7 @@
android:id="@+id/likes_textView" android:id="@+id/likes_textView"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="LikeCount" /> tools:text="LikeCount" />
<ImageView <ImageView
android:id="@+id/hearted_imageView" android:id="@+id/hearted_imageView"

View File

@ -48,7 +48,6 @@
android:paddingHorizontal="6dp" android:paddingHorizontal="6dp"
android:paddingVertical="2dp" android:paddingVertical="2dp"
android:textColor="@color/duration_text_color" android:textColor="@color/duration_text_color"
android:textSize="11sp"
tools:text="05:36" /> tools:text="05:36" />
</androidx.cardview.widget.CardView> </androidx.cardview.widget.CardView>
@ -74,22 +73,22 @@
android:layout_marginEnd="8dp" android:layout_marginEnd="8dp"
android:ellipsize="end" android:ellipsize="end"
android:maxLines="2" android:maxLines="2"
android:text="Title"
android:textSize="15sp" android:textSize="15sp"
android:textStyle="bold" android:textStyle="bold"
app:layout_constraintEnd_toEndOf="@+id/thumbnailcard" app:layout_constraintEnd_toEndOf="@+id/thumbnailcard"
app:layout_constraintStart_toEndOf="@+id/channel_image" app:layout_constraintStart_toEndOf="@+id/channel_image"
app:layout_constraintTop_toBottomOf="@+id/thumbnailcard" /> app:layout_constraintTop_toBottomOf="@+id/thumbnailcard"
tools:text="Title" />
<TextView <TextView
android:id="@+id/textView_channel" android:id="@+id/textView_channel"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingBottom="16dp" android:paddingBottom="16dp"
android:text="Channel Name"
app:layout_constraintEnd_toEndOf="@+id/textView_title" app:layout_constraintEnd_toEndOf="@+id/textView_title"
app:layout_constraintStart_toStartOf="@+id/textView_title" app:layout_constraintStart_toStartOf="@+id/textView_title"
app:layout_constraintTop_toBottomOf="@+id/textView_title" /> app:layout_constraintTop_toBottomOf="@+id/textView_title"
tools:text="Channel Name" />
<de.hdodenhof.circleimageview.CircleImageView <de.hdodenhof.circleimageview.CircleImageView
android:id="@+id/channel_image" android:id="@+id/channel_image"

View File

@ -0,0 +1,129 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/video_search"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:background="?android:attr/selectableItemBackground">
<androidx.constraintlayout.widget.Guideline
android:id="@+id/guideline"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintGuide_percent=".45" />
<com.google.android.material.card.MaterialCardView
android:id="@+id/thumbnail_card"
android:layout_width="0dp"
android:layout_height="0dp"
app:cardCornerRadius="8dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintDimensionRatio="16:9"
app:layout_constraintEnd_toStartOf="@+id/guideline"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0"
app:strokeWidth="0dp">
<ImageView
android:id="@+id/thumbnail"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:srcCompat="@tools:sample/backgrounds/scenic" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:orientation="vertical">
<androidx.cardview.widget.CardView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end"
android:layout_marginEnd="5dp"
android:layout_marginBottom="5dp"
app:cardBackgroundColor="@color/duration_background_color"
app:cardCornerRadius="8dp"
app:cardElevation="0dp">
<TextView
android:id="@+id/thumbnail_duration"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingHorizontal="6dp"
android:paddingVertical="2dp"
android:textColor="@color/duration_text_color"
android:textSize="11sp"
tools:text="05:36" />
</androidx.cardview.widget.CardView>
<View
android:id="@+id/watch_progress"
android:layout_width="match_parent"
android:layout_height="4dp"
android:layout_gravity="bottom"
android:background="@android:color/holo_red_dark" />
</LinearLayout>
</com.google.android.material.card.MaterialCardView>
<TextView
android:id="@+id/video_title"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:ellipsize="end"
android:maxLines="2"
app:layout_constraintEnd_toStartOf="@id/deleteBTN"
app:layout_constraintStart_toEndOf="@id/thumbnail_card"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/video_info"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
app:layout_constraintEnd_toStartOf="@id/deleteBTN"
app:layout_constraintStart_toEndOf="@id/thumbnail_card"
app:layout_constraintTop_toBottomOf="@id/video_title" />
<de.hdodenhof.circleimageview.CircleImageView
android:id="@+id/channel_image"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
app:layout_constraintStart_toStartOf="@+id/guideline"
app:layout_constraintTop_toBottomOf="@id/video_info" />
<TextView
android:id="@+id/channel_name"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="12dp"
android:ellipsize="end"
android:maxLines="1"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/channel_image"
app:layout_constraintTop_toBottomOf="@id/video_info" />
<com.google.android.material.imageview.ShapeableImageView
android:id="@+id/deleteBTN"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:background="?android:attr/selectableItemBackground"
android:padding="8dp"
android:src="@drawable/ic_delete"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:shapeAppearanceOverlay="@style/roundedImageViewRounded" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -271,4 +271,6 @@
<string name="checking_frequency">Checking frequency</string> <string name="checking_frequency">Checking frequency</string>
<string name="new_streams_count">%1$s new streams are available</string> <string name="new_streams_count">%1$s new streams are available</string>
<string name="new_streams_by">New streams by %1$s …</string> <string name="new_streams_by">New streams by %1$s …</string>
<string name="irreversible">Are you sure? This can\'t be undone!</string>
<string name="history_empty">History is empty.</string>
</resources> </resources>

View File

@ -45,7 +45,7 @@
<Preference <Preference
android:icon="@drawable/ic_reset" android:icon="@drawable/ic_reset"
app:key="reset_watch_positions" app:key="clear_watch_positions"
app:title="@string/reset_watch_positions" /> app:title="@string/reset_watch_positions" />
</PreferenceCategory> </PreferenceCategory>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 575 KiB

After

Width:  |  Height:  |  Size: 1.4 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 489 KiB

After

Width:  |  Height:  |  Size: 1.4 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 259 KiB

After

Width:  |  Height:  |  Size: 270 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 436 KiB

After

Width:  |  Height:  |  Size: 895 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 114 KiB

After

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 455 KiB

After

Width:  |  Height:  |  Size: 703 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 118 KiB

After

Width:  |  Height:  |  Size: 1005 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 146 KiB

After

Width:  |  Height:  |  Size: 1.2 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 252 KiB

After

Width:  |  Height:  |  Size: 103 KiB