added quick download mode
This commit is contained in:
parent
7073a358eb
commit
ed0a01f5fc
21 changed files with 265 additions and 145 deletions
|
|
@ -26,7 +26,6 @@ class App : Application() {
|
||||||
|
|
||||||
override fun onCreate() {
|
override fun onCreate() {
|
||||||
super.onCreate()
|
super.onCreate()
|
||||||
DynamicColors.applyToActivitiesIfAvailable(this)
|
|
||||||
createNotificationChannels()
|
createNotificationChannels()
|
||||||
PreferenceManager.setDefaultValues(
|
PreferenceManager.setDefaultValues(
|
||||||
this,
|
this,
|
||||||
|
|
|
||||||
|
|
@ -77,7 +77,7 @@ class ActiveDownloadAdapter(onItemClickListener: OnItemClickListener, activity:
|
||||||
if (title.length > 100) {
|
if (title.length > 100) {
|
||||||
title = title.substring(0, 40) + "..."
|
title = title.substring(0, 40) + "..."
|
||||||
}
|
}
|
||||||
itemTitle.text = title
|
itemTitle.text = title.ifEmpty { "`${activity.getString(R.string.defaultValue)}`" }
|
||||||
|
|
||||||
// Author ----------------------------------
|
// Author ----------------------------------
|
||||||
val author = card.findViewById<TextView>(R.id.author)
|
val author = card.findViewById<TextView>(R.id.author)
|
||||||
|
|
@ -86,7 +86,7 @@ class ActiveDownloadAdapter(onItemClickListener: OnItemClickListener, activity:
|
||||||
if (item.author.isNotEmpty()) info += " • "
|
if (item.author.isNotEmpty()) info += " • "
|
||||||
info += item.duration
|
info += item.duration
|
||||||
}
|
}
|
||||||
author.text = info
|
author.text = info.ifEmpty { "`${activity.getString(R.string.defaultValue)}`" }
|
||||||
|
|
||||||
val type = card.findViewById<MaterialButton>(R.id.download_type)
|
val type = card.findViewById<MaterialButton>(R.id.download_type)
|
||||||
when(item.type){
|
when(item.type){
|
||||||
|
|
|
||||||
|
|
@ -50,6 +50,9 @@ class CookieAdapter(onItemClickListener: OnItemClickListener, activity: Activity
|
||||||
onItemClickListener.onItemClick(item!!)
|
onItemClickListener.onItemClick(item!!)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
card.setOnLongClickListener {
|
||||||
|
onItemClickListener.onDelete(item!!); true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
interface OnItemClickListener {
|
interface OnItemClickListener {
|
||||||
|
|
|
||||||
|
|
@ -67,7 +67,7 @@ class GenericDownloadAdapter(onItemClickListener: OnItemClickListener, activity:
|
||||||
if (title.length > 100) {
|
if (title.length > 100) {
|
||||||
title = title.substring(0, 40) + "..."
|
title = title.substring(0, 40) + "..."
|
||||||
}
|
}
|
||||||
itemTitle.text = title
|
itemTitle.text = title.ifEmpty { "`${activity.getString(R.string.defaultValue)}`" }
|
||||||
|
|
||||||
val formatNote = card.findViewById<TextView>(R.id.format_note)
|
val formatNote = card.findViewById<TextView>(R.id.format_note)
|
||||||
if (item.format.format_note == "?" || item.format.format_note == "") formatNote!!.visibility =
|
if (item.format.format_note == "?" || item.format.format_note == "") formatNote!!.visibility =
|
||||||
|
|
|
||||||
|
|
@ -55,6 +55,10 @@ class TemplatesAdapter(onItemClickListener: OnItemClickListener, activity: Activ
|
||||||
card.setOnClickListener {
|
card.setOnClickListener {
|
||||||
onItemClickListener.onItemClick(item!!, position)
|
onItemClickListener.onItemClick(item!!, position)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
card.setOnLongClickListener {
|
||||||
|
onItemClickListener.onDelete(item!!); true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
interface OnItemClickListener {
|
interface OnItemClickListener {
|
||||||
|
|
|
||||||
|
|
@ -171,6 +171,22 @@ class DownloadViewModel(private val application: Application) : AndroidViewModel
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun createEmptyResultItem(url: String) : ResultItem {
|
||||||
|
return ResultItem(
|
||||||
|
0,
|
||||||
|
url,
|
||||||
|
"",
|
||||||
|
"",
|
||||||
|
"",
|
||||||
|
"",
|
||||||
|
"",
|
||||||
|
"",
|
||||||
|
arrayListOf(),
|
||||||
|
System.currentTimeMillis()
|
||||||
|
)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
fun switchDownloadType(list: List<DownloadItem>, type: Type) : List<DownloadItem>{
|
fun switchDownloadType(list: List<DownloadItem>, type: Type) : List<DownloadItem>{
|
||||||
list.forEach {
|
list.forEach {
|
||||||
val format = getFormat(it.allFormats, type)
|
val format = getFormat(it.allFormats, type)
|
||||||
|
|
|
||||||
|
|
@ -42,6 +42,7 @@ import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import kotlinx.coroutines.withContext
|
import kotlinx.coroutines.withContext
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
import kotlin.properties.Delegates
|
||||||
import kotlin.system.exitProcess
|
import kotlin.system.exitProcess
|
||||||
|
|
||||||
class ShareActivity : BaseActivity() {
|
class ShareActivity : BaseActivity() {
|
||||||
|
|
@ -51,6 +52,7 @@ class ShareActivity : BaseActivity() {
|
||||||
private lateinit var downloadViewModel: DownloadViewModel
|
private lateinit var downloadViewModel: DownloadViewModel
|
||||||
private lateinit var cookieViewModel: CookieViewModel
|
private lateinit var cookieViewModel: CookieViewModel
|
||||||
private lateinit var sharedPreferences: SharedPreferences
|
private lateinit var sharedPreferences: SharedPreferences
|
||||||
|
private var quickDownload by Delegates.notNull<Boolean>()
|
||||||
|
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
|
|
@ -61,7 +63,6 @@ class ShareActivity : BaseActivity() {
|
||||||
v.setPadding(0, 0, 0, 0)
|
v.setPadding(0, 0, 0, 0)
|
||||||
insets
|
insets
|
||||||
}
|
}
|
||||||
|
|
||||||
window.run {
|
window.run {
|
||||||
setBackgroundDrawable(ColorDrawable(0))
|
setBackgroundDrawable(ColorDrawable(0))
|
||||||
setLayout(
|
setLayout(
|
||||||
|
|
@ -106,6 +107,8 @@ class ShareActivity : BaseActivity() {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
quickDownload = intent.getBooleanExtra("quick_download", sharedPreferences.getBoolean("quick_download", false))
|
||||||
|
|
||||||
val loadingBottomSheet = BottomSheetDialog(this)
|
val loadingBottomSheet = BottomSheetDialog(this)
|
||||||
loadingBottomSheet.requestWindowFeature(Window.FEATURE_NO_TITLE)
|
loadingBottomSheet.requestWindowFeature(Window.FEATURE_NO_TITLE)
|
||||||
loadingBottomSheet.setContentView(R.layout.please_wait_bottom_sheet)
|
loadingBottomSheet.setContentView(R.layout.please_wait_bottom_sheet)
|
||||||
|
|
@ -118,24 +121,29 @@ class ShareActivity : BaseActivity() {
|
||||||
val inputQuery = intent.getStringExtra(Intent.EXTRA_TEXT)
|
val inputQuery = intent.getStringExtra(Intent.EXTRA_TEXT)
|
||||||
try {
|
try {
|
||||||
val result = resultViewModel.getItemByURL(inputQuery!!)
|
val result = resultViewModel.getItemByURL(inputQuery!!)
|
||||||
loadingBottomSheet.cancel()
|
loadingBottomSheet.dismiss()
|
||||||
showDownloadSheet(result)
|
showDownloadSheet(result)
|
||||||
}catch (e: Exception){
|
}catch (e: Exception){
|
||||||
resultViewModel.deleteAll()
|
resultViewModel.deleteAll()
|
||||||
lifecycleScope.launch {
|
if (quickDownload && inputQuery!!.matches("(https?://(?:www\\.|(?!www))[a-zA-Z\\d][a-zA-Z\\d-]+[a-zA-Z\\d]\\.\\S{2,}|www\\.[a-zA-Z\\d][a-zA-Z\\d-]+[a-zA-Z\\d]\\.\\S{2,}|https?://(?:www\\.|(?!www))[a-zA-Z\\d]+\\.\\S{2,}|www\\.[a-zA-Z\\d]+\\.\\S{2,})".toRegex())){
|
||||||
var res: ArrayList<ResultItem?>
|
val result = downloadViewModel.createEmptyResultItem(inputQuery)
|
||||||
withContext(Dispatchers.IO){
|
loadingBottomSheet.dismiss()
|
||||||
res = resultViewModel.parseQuery(inputQuery!!, true)
|
showDownloadSheet(result)
|
||||||
}
|
}else{
|
||||||
if (res.isEmpty()) {
|
lifecycleScope.launch {
|
||||||
Toast.makeText(this@ShareActivity, "No Results Found!", Toast.LENGTH_SHORT).show()
|
val res = withContext(Dispatchers.IO){
|
||||||
exit()
|
resultViewModel.parseQuery(inputQuery!!, true)
|
||||||
}else{
|
}
|
||||||
loadingBottomSheet.cancel()
|
if (res.isEmpty()) {
|
||||||
if (res.size == 1){
|
Toast.makeText(this@ShareActivity, "No Results Found!", Toast.LENGTH_SHORT).show()
|
||||||
showDownloadSheet(res[0]!!)
|
exit()
|
||||||
}else{
|
}else{
|
||||||
showSelectPlaylistItems(res.toList())
|
loadingBottomSheet.dismiss()
|
||||||
|
if (res.size == 1){
|
||||||
|
showDownloadSheet(res[0]!!)
|
||||||
|
}else{
|
||||||
|
showSelectPlaylistItems(res.toList())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -145,7 +153,7 @@ class ShareActivity : BaseActivity() {
|
||||||
|
|
||||||
private fun showDownloadSheet(it: ResultItem){
|
private fun showDownloadSheet(it: ResultItem){
|
||||||
if (sharedPreferences.getBoolean("download_card", true)){
|
if (sharedPreferences.getBoolean("download_card", true)){
|
||||||
val bottomSheet = DownloadBottomSheetDialog(it, DownloadViewModel.Type.valueOf(sharedPreferences.getString("preferred_download_type", "video")!!), null)
|
val bottomSheet = DownloadBottomSheetDialog(it, DownloadViewModel.Type.valueOf(sharedPreferences.getString("preferred_download_type", "video")!!), null, quickDownload)
|
||||||
bottomSheet.show(supportFragmentManager, "downloadSingleSheet")
|
bottomSheet.show(supportFragmentManager, "downloadSingleSheet")
|
||||||
}else{
|
}else{
|
||||||
lifecycleScope.launch(Dispatchers.IO){
|
lifecycleScope.launch(Dispatchers.IO){
|
||||||
|
|
|
||||||
|
|
@ -157,7 +157,7 @@ class HomeFragment : Fragment(), HomeAdapter.OnItemClickListener, View.OnClickLi
|
||||||
}else if (resultViewModel.itemCount.value!! == 1){
|
}else if (resultViewModel.itemCount.value!! == 1){
|
||||||
if (sharedPreferences!!.getBoolean("download_card", true)){
|
if (sharedPreferences!!.getBoolean("download_card", true)){
|
||||||
if(it.size == 1 && quickLaunchSheet && parentFragmentManager.findFragmentByTag("downloadSingleSheet") == null){
|
if(it.size == 1 && quickLaunchSheet && parentFragmentManager.findFragmentByTag("downloadSingleSheet") == null){
|
||||||
showSingleDownloadSheet(it[0], DownloadViewModel.Type.valueOf(sharedPreferences!!.getString("preferred_download_type", "video")!!))
|
showSingleDownloadSheet(it[0], DownloadViewModel.Type.valueOf(sharedPreferences!!.getString("preferred_download_type", "video")!!), false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
|
|
@ -450,7 +450,28 @@ class HomeFragment : Fragment(), HomeAdapter.OnItemClickListener, View.OnClickLi
|
||||||
}
|
}
|
||||||
resultViewModel.deleteAll()
|
resultViewModel.deleteAll()
|
||||||
lifecycleScope.launch(Dispatchers.IO){
|
lifecycleScope.launch(Dispatchers.IO){
|
||||||
resultViewModel.parseQueries(queryList)
|
Thread.sleep(300)
|
||||||
|
if(sharedPreferences!!.getBoolean("quick_download", false)){
|
||||||
|
if (queryList.size == 1 && queryList.first().matches("(https?://(?:www\\.|(?!www))[a-zA-Z\\d][a-zA-Z\\d-]+[a-zA-Z\\d]\\.\\S{2,}|www\\.[a-zA-Z\\d][a-zA-Z\\d-]+[a-zA-Z\\d]\\.\\S{2,}|https?://(?:www\\.|(?!www))[a-zA-Z\\d]+\\.\\S{2,}|www\\.[a-zA-Z\\d]+\\.\\S{2,})".toRegex())){
|
||||||
|
val resultItem = downloadViewModel.createEmptyResultItem(queryList.first())
|
||||||
|
if (sharedPreferences!!.getBoolean("download_card", true)) {
|
||||||
|
showSingleDownloadSheet(resultItem, DownloadViewModel.Type.valueOf(sharedPreferences!!.getString("preferred_download_type", "video")!!), true)
|
||||||
|
} else {
|
||||||
|
lifecycleScope.launch{
|
||||||
|
val downloadItem = withContext(Dispatchers.IO){
|
||||||
|
downloadViewModel.createDownloadItemFromResult(resultItem, DownloadViewModel.Type.valueOf(sharedPreferences!!.getString("preferred_download_type", "video")!!))
|
||||||
|
}
|
||||||
|
downloadViewModel.queueDownloads(listOf(downloadItem))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}else{
|
||||||
|
resultViewModel.parseQueries(queryList)
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
resultViewModel.parseQueries(queryList)
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -470,7 +491,7 @@ class HomeFragment : Fragment(), HomeAdapter.OnItemClickListener, View.OnClickLi
|
||||||
Log.e(TAG, resultsList!![0].toString() + " " + videoURL)
|
Log.e(TAG, resultsList!![0].toString() + " " + videoURL)
|
||||||
val btn = recyclerView!!.findViewWithTag<MaterialButton>("""${item?.url}##$type""")
|
val btn = recyclerView!!.findViewWithTag<MaterialButton>("""${item?.url}##$type""")
|
||||||
if (sharedPreferences!!.getBoolean("download_card", true)) {
|
if (sharedPreferences!!.getBoolean("download_card", true)) {
|
||||||
showSingleDownloadSheet(item!!, type!!)
|
showSingleDownloadSheet(item!!, type!!, false)
|
||||||
} else {
|
} else {
|
||||||
lifecycleScope.launch{
|
lifecycleScope.launch{
|
||||||
val downloadItem = withContext(Dispatchers.IO){
|
val downloadItem = withContext(Dispatchers.IO){
|
||||||
|
|
@ -484,11 +505,11 @@ class HomeFragment : Fragment(), HomeAdapter.OnItemClickListener, View.OnClickLi
|
||||||
override fun onLongButtonClick(videoURL: String, type: DownloadViewModel.Type?) {
|
override fun onLongButtonClick(videoURL: String, type: DownloadViewModel.Type?) {
|
||||||
Log.e(TAG, type.toString() + " " + videoURL)
|
Log.e(TAG, type.toString() + " " + videoURL)
|
||||||
val item = resultsList!!.find { it?.url == videoURL }
|
val item = resultsList!!.find { it?.url == videoURL }
|
||||||
showSingleDownloadSheet(item!!, type!!)
|
showSingleDownloadSheet(item!!, type!!, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun showSingleDownloadSheet(resultItem : ResultItem, type: DownloadViewModel.Type){
|
private fun showSingleDownloadSheet(resultItem : ResultItem, type: DownloadViewModel.Type, quickDownload: Boolean){
|
||||||
val bottomSheet = DownloadBottomSheetDialog(resultItem, type, null)
|
val bottomSheet = DownloadBottomSheetDialog(resultItem, type, null, quickDownload)
|
||||||
bottomSheet.show(parentFragmentManager, "downloadSingleSheet")
|
bottomSheet.show(parentFragmentManager, "downloadSingleSheet")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,20 +3,19 @@ package com.deniscerri.ytdlnis.ui.downloadcard
|
||||||
import android.annotation.SuppressLint
|
import android.annotation.SuppressLint
|
||||||
import android.app.Dialog
|
import android.app.Dialog
|
||||||
import android.content.DialogInterface
|
import android.content.DialogInterface
|
||||||
|
import android.content.Intent
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.text.format.DateFormat
|
import android.text.format.DateFormat
|
||||||
import android.util.DisplayMetrics
|
import android.util.DisplayMetrics
|
||||||
import android.util.Log
|
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import android.widget.Button
|
import android.widget.Button
|
||||||
|
import android.widget.LinearLayout
|
||||||
import android.widget.Toast
|
import android.widget.Toast
|
||||||
import androidx.fragment.app.Fragment
|
|
||||||
import androidx.lifecycle.ViewModelProvider
|
import androidx.lifecycle.ViewModelProvider
|
||||||
import androidx.lifecycle.lifecycleScope
|
import androidx.lifecycle.lifecycleScope
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
import androidx.viewpager.widget.ViewPager
|
|
||||||
import androidx.viewpager2.widget.ViewPager2
|
import androidx.viewpager2.widget.ViewPager2
|
||||||
import com.deniscerri.ytdlnis.R
|
import com.deniscerri.ytdlnis.R
|
||||||
import com.deniscerri.ytdlnis.database.DBManager
|
import com.deniscerri.ytdlnis.database.DBManager
|
||||||
|
|
@ -25,28 +24,26 @@ import com.deniscerri.ytdlnis.database.models.DownloadItem
|
||||||
import com.deniscerri.ytdlnis.database.models.ResultItem
|
import com.deniscerri.ytdlnis.database.models.ResultItem
|
||||||
import com.deniscerri.ytdlnis.database.viewmodel.DownloadViewModel
|
import com.deniscerri.ytdlnis.database.viewmodel.DownloadViewModel
|
||||||
import com.deniscerri.ytdlnis.database.viewmodel.DownloadViewModel.Type
|
import com.deniscerri.ytdlnis.database.viewmodel.DownloadViewModel.Type
|
||||||
|
import com.deniscerri.ytdlnis.database.viewmodel.ResultViewModel
|
||||||
import com.deniscerri.ytdlnis.receiver.ShareActivity
|
import com.deniscerri.ytdlnis.receiver.ShareActivity
|
||||||
|
import com.deniscerri.ytdlnis.ui.downloads.DownloadQueueActivity
|
||||||
import com.deniscerri.ytdlnis.util.FileUtil
|
import com.deniscerri.ytdlnis.util.FileUtil
|
||||||
import com.deniscerri.ytdlnis.util.UiUtil
|
import com.deniscerri.ytdlnis.util.UiUtil
|
||||||
import com.google.android.material.bottomsheet.BottomSheetBehavior
|
import com.google.android.material.bottomsheet.BottomSheetBehavior
|
||||||
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
|
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
|
||||||
import com.google.android.material.button.MaterialButton
|
import com.google.android.material.button.MaterialButton
|
||||||
import com.google.android.material.tabs.TabLayout
|
import com.google.android.material.tabs.TabLayout
|
||||||
import com.google.android.material.tabs.TabLayout.TabLayoutOnPageChangeListener
|
import kotlinx.coroutines.*
|
||||||
import com.google.android.material.tabs.TabLayoutMediator
|
|
||||||
import kotlinx.coroutines.Dispatchers
|
|
||||||
import kotlinx.coroutines.launch
|
|
||||||
import kotlinx.coroutines.runBlocking
|
|
||||||
import kotlinx.coroutines.withContext
|
|
||||||
import java.text.SimpleDateFormat
|
import java.text.SimpleDateFormat
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
|
|
||||||
class DownloadBottomSheetDialog(private val resultItem: ResultItem, private val type: Type, private val downloadItem: DownloadItem?) : BottomSheetDialogFragment() {
|
class DownloadBottomSheetDialog(private val resultItem: ResultItem, private val type: Type, private val downloadItem: DownloadItem?,private val quickDownload: Boolean) : BottomSheetDialogFragment() {
|
||||||
private lateinit var tabLayout: TabLayout
|
private lateinit var tabLayout: TabLayout
|
||||||
private lateinit var viewPager2: ViewPager2
|
private lateinit var viewPager2: ViewPager2
|
||||||
private lateinit var fragmentAdapter : DownloadFragmentAdapter
|
private lateinit var fragmentAdapter : DownloadFragmentAdapter
|
||||||
private lateinit var downloadViewModel: DownloadViewModel
|
private lateinit var downloadViewModel: DownloadViewModel
|
||||||
|
private lateinit var resultViewModel: ResultViewModel
|
||||||
private lateinit var behavior: BottomSheetBehavior<View>
|
private lateinit var behavior: BottomSheetBehavior<View>
|
||||||
private lateinit var commandTemplateDao : CommandTemplateDao
|
private lateinit var commandTemplateDao : CommandTemplateDao
|
||||||
private lateinit var uiUtil: UiUtil
|
private lateinit var uiUtil: UiUtil
|
||||||
|
|
@ -58,6 +55,7 @@ class DownloadBottomSheetDialog(private val resultItem: ResultItem, private val
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
downloadViewModel = ViewModelProvider(this)[DownloadViewModel::class.java]
|
downloadViewModel = ViewModelProvider(this)[DownloadViewModel::class.java]
|
||||||
|
resultViewModel = ViewModelProvider(this)[ResultViewModel::class.java]
|
||||||
commandTemplateDao = DBManager.getInstance(requireContext()).commandTemplateDao
|
commandTemplateDao = DBManager.getInstance(requireContext()).commandTemplateDao
|
||||||
uiUtil = UiUtil(FileUtil())
|
uiUtil = UiUtil(FileUtil())
|
||||||
}
|
}
|
||||||
|
|
@ -186,6 +184,29 @@ class DownloadBottomSheetDialog(private val resultItem: ResultItem, private val
|
||||||
uiUtil.copyLinkToClipBoard(requireContext(), resultItem.url, null)
|
uiUtil.copyLinkToClipBoard(requireContext(), resultItem.url, null)
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val updateItem = view.findViewById<Button>(R.id.update_item)
|
||||||
|
if (quickDownload) {
|
||||||
|
(updateItem.parent as LinearLayout).visibility = View.VISIBLE
|
||||||
|
updateItem.setOnClickListener {
|
||||||
|
lifecycleScope.launch(Dispatchers.IO){
|
||||||
|
if (activity is ShareActivity) {
|
||||||
|
val intent = Intent(context, ShareActivity::class.java)
|
||||||
|
intent.action = Intent.ACTION_SEND
|
||||||
|
intent.type = "text/plain"
|
||||||
|
intent.putExtra(Intent.EXTRA_TEXT, resultItem.url)
|
||||||
|
intent.putExtra("quick_download", false)
|
||||||
|
startActivity(intent)
|
||||||
|
dismiss()
|
||||||
|
}else{
|
||||||
|
resultViewModel.parseQueries(listOf(resultItem.url))
|
||||||
|
dismiss()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
(updateItem.parent as LinearLayout).visibility = View.GONE
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getDownloadItem() : DownloadItem{
|
private fun getDownloadItem() : DownloadItem{
|
||||||
|
|
|
||||||
|
|
@ -145,7 +145,7 @@ class SelectPlaylistItemsBottomSheetDialog(private val items: List<ResultItem?>,
|
||||||
val checkedResultItems = items.filter { item -> checkedItems.contains(item!!.url) }
|
val checkedResultItems = items.filter { item -> checkedItems.contains(item!!.url) }
|
||||||
if (checkedResultItems.size == 1){
|
if (checkedResultItems.size == 1){
|
||||||
val resultItem = resultViewModel.getItemByURL(checkedResultItems[0]!!.url)
|
val resultItem = resultViewModel.getItemByURL(checkedResultItems[0]!!.url)
|
||||||
val bottomSheet = DownloadBottomSheetDialog(resultItem, type, null)
|
val bottomSheet = DownloadBottomSheetDialog(resultItem, type, null, false)
|
||||||
bottomSheet.show(parentFragmentManager, "downloadSingleSheet")
|
bottomSheet.show(parentFragmentManager, "downloadSingleSheet")
|
||||||
}else{
|
}else{
|
||||||
val downloadItems = mutableListOf<DownloadItem>()
|
val downloadItems = mutableListOf<DownloadItem>()
|
||||||
|
|
|
||||||
|
|
@ -113,9 +113,9 @@ class CancelledDownloadsFragment : Fragment(), GenericDownloadAdapter.OnItemClic
|
||||||
bottomSheet.requestWindowFeature(Window.FEATURE_NO_TITLE)
|
bottomSheet.requestWindowFeature(Window.FEATURE_NO_TITLE)
|
||||||
bottomSheet.setContentView(R.layout.history_item_details_bottom_sheet)
|
bottomSheet.setContentView(R.layout.history_item_details_bottom_sheet)
|
||||||
val title = bottomSheet.findViewById<TextView>(R.id.bottom_sheet_title)
|
val title = bottomSheet.findViewById<TextView>(R.id.bottom_sheet_title)
|
||||||
title!!.text = item.title
|
title!!.text = item.title.ifEmpty { "`${requireContext().getString(R.string.defaultValue)}`" }
|
||||||
val author = bottomSheet.findViewById<TextView>(R.id.bottom_sheet_author)
|
val author = bottomSheet.findViewById<TextView>(R.id.bottom_sheet_author)
|
||||||
author!!.text = item.author
|
author!!.text = item.author.ifEmpty { "`${requireContext().getString(R.string.defaultValue)}`" }
|
||||||
|
|
||||||
// BUTTON ----------------------------------
|
// BUTTON ----------------------------------
|
||||||
val btn = bottomSheet.findViewById<MaterialButton>(R.id.downloads_download_button_type)
|
val btn = bottomSheet.findViewById<MaterialButton>(R.id.downloads_download_button_type)
|
||||||
|
|
@ -196,7 +196,7 @@ class CancelledDownloadsFragment : Fragment(), GenericDownloadAdapter.OnItemClic
|
||||||
|
|
||||||
redownload.setOnLongClickListener {
|
redownload.setOnLongClickListener {
|
||||||
bottomSheet.cancel()
|
bottomSheet.cancel()
|
||||||
val sheet = DownloadBottomSheetDialog(downloadViewModel.createResultItemFromDownload(item), item.type, item)
|
val sheet = DownloadBottomSheetDialog(downloadViewModel.createResultItemFromDownload(item), item.type, item, false)
|
||||||
sheet.show(parentFragmentManager, "downloadSingleSheet")
|
sheet.show(parentFragmentManager, "downloadSingleSheet")
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -113,9 +113,9 @@ class ErroredDownloadsFragment : Fragment(), GenericDownloadAdapter.OnItemClickL
|
||||||
bottomSheet.requestWindowFeature(Window.FEATURE_NO_TITLE)
|
bottomSheet.requestWindowFeature(Window.FEATURE_NO_TITLE)
|
||||||
bottomSheet.setContentView(R.layout.history_item_details_bottom_sheet)
|
bottomSheet.setContentView(R.layout.history_item_details_bottom_sheet)
|
||||||
val title = bottomSheet.findViewById<TextView>(R.id.bottom_sheet_title)
|
val title = bottomSheet.findViewById<TextView>(R.id.bottom_sheet_title)
|
||||||
title!!.text = item.title
|
title!!.text = item.title.ifEmpty { "`${requireContext().getString(R.string.defaultValue)}`" }
|
||||||
val author = bottomSheet.findViewById<TextView>(R.id.bottom_sheet_author)
|
val author = bottomSheet.findViewById<TextView>(R.id.bottom_sheet_author)
|
||||||
author!!.text = item.author
|
author!!.text = item.author.ifEmpty { "`${requireContext().getString(R.string.defaultValue)}`" }
|
||||||
|
|
||||||
// BUTTON ----------------------------------
|
// BUTTON ----------------------------------
|
||||||
val btn = bottomSheet.findViewById<MaterialButton>(R.id.downloads_download_button_type)
|
val btn = bottomSheet.findViewById<MaterialButton>(R.id.downloads_download_button_type)
|
||||||
|
|
@ -196,7 +196,7 @@ class ErroredDownloadsFragment : Fragment(), GenericDownloadAdapter.OnItemClickL
|
||||||
|
|
||||||
redownload.setOnLongClickListener {
|
redownload.setOnLongClickListener {
|
||||||
bottomSheet.cancel()
|
bottomSheet.cancel()
|
||||||
val sheet = DownloadBottomSheetDialog(downloadViewModel.createResultItemFromDownload(item), item.type, item)
|
val sheet = DownloadBottomSheetDialog(downloadViewModel.createResultItemFromDownload(item), item.type, item, false)
|
||||||
sheet.show(parentFragmentManager, "downloadSingleSheet")
|
sheet.show(parentFragmentManager, "downloadSingleSheet")
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -499,7 +499,7 @@ class HistoryFragment : Fragment(), HistoryAdapter.OnItemClickListener{
|
||||||
|
|
||||||
redownload.setOnLongClickListener {
|
redownload.setOnLongClickListener {
|
||||||
bottomSheet!!.cancel()
|
bottomSheet!!.cancel()
|
||||||
val sheet = DownloadBottomSheetDialog(downloadViewModel.createResultItemFromHistory(item), item.type, downloadViewModel.createDownloadItemFromHistory(item))
|
val sheet = DownloadBottomSheetDialog(downloadViewModel.createResultItemFromHistory(item), item.type, downloadViewModel.createDownloadItemFromHistory(item), false)
|
||||||
sheet.show(parentFragmentManager, "downloadSingleSheet")
|
sheet.show(parentFragmentManager, "downloadSingleSheet")
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
|
@ -640,7 +640,7 @@ class HistoryFragment : Fragment(), HistoryAdapter.OnItemClickListener{
|
||||||
ItemTouchHelper.RIGHT -> {
|
ItemTouchHelper.RIGHT -> {
|
||||||
val item = historyList!![position]!!
|
val item = historyList!![position]!!
|
||||||
historyAdapter!!.notifyItemChanged(position)
|
historyAdapter!!.notifyItemChanged(position)
|
||||||
val sheet = DownloadBottomSheetDialog(downloadViewModel.createResultItemFromHistory(item), item.type, downloadViewModel.createDownloadItemFromHistory(item))
|
val sheet = DownloadBottomSheetDialog(downloadViewModel.createResultItemFromHistory(item), item.type, downloadViewModel.createDownloadItemFromHistory(item), false)
|
||||||
sheet.show(parentFragmentManager, "downloadSingleSheet")
|
sheet.show(parentFragmentManager, "downloadSingleSheet")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -121,9 +121,9 @@ class QueuedDownloadsFragment : Fragment(), GenericDownloadAdapter.OnItemClickLi
|
||||||
bottomSheet.requestWindowFeature(Window.FEATURE_NO_TITLE)
|
bottomSheet.requestWindowFeature(Window.FEATURE_NO_TITLE)
|
||||||
bottomSheet.setContentView(R.layout.history_item_details_bottom_sheet)
|
bottomSheet.setContentView(R.layout.history_item_details_bottom_sheet)
|
||||||
val title = bottomSheet.findViewById<TextView>(R.id.bottom_sheet_title)
|
val title = bottomSheet.findViewById<TextView>(R.id.bottom_sheet_title)
|
||||||
title!!.text = item.title
|
title!!.text = item.title.ifEmpty { "`${requireContext().getString(R.string.defaultValue)}`" }
|
||||||
val author = bottomSheet.findViewById<TextView>(R.id.bottom_sheet_author)
|
val author = bottomSheet.findViewById<TextView>(R.id.bottom_sheet_author)
|
||||||
author!!.text = item.author
|
author!!.text = item.author.ifEmpty { "`${requireContext().getString(R.string.defaultValue)}`" }
|
||||||
|
|
||||||
// BUTTON ----------------------------------
|
// BUTTON ----------------------------------
|
||||||
val btn = bottomSheet.findViewById<MaterialButton>(R.id.downloads_download_button_type)
|
val btn = bottomSheet.findViewById<MaterialButton>(R.id.downloads_download_button_type)
|
||||||
|
|
|
||||||
|
|
@ -49,6 +49,7 @@ class SettingsFragment : PreferenceFragmentCompat() {
|
||||||
private var searchEngine : ListPreference? = null
|
private var searchEngine : ListPreference? = null
|
||||||
private var startDestination : ListPreference? = null
|
private var startDestination : ListPreference? = null
|
||||||
private var downloadCard: SwitchPreferenceCompat? = null
|
private var downloadCard: SwitchPreferenceCompat? = null
|
||||||
|
private var quickDownload: SwitchPreferenceCompat? = null
|
||||||
private var meteredNetwork: SwitchPreferenceCompat? = null
|
private var meteredNetwork: SwitchPreferenceCompat? = null
|
||||||
private var apiKey: EditTextPreference? = null
|
private var apiKey: EditTextPreference? = null
|
||||||
private var homeRecommendations: SwitchPreferenceCompat? = null
|
private var homeRecommendations: SwitchPreferenceCompat? = null
|
||||||
|
|
@ -121,6 +122,7 @@ class SettingsFragment : PreferenceFragmentCompat() {
|
||||||
searchEngine = findPreference("search_engine")
|
searchEngine = findPreference("search_engine")
|
||||||
startDestination = findPreference("start_destination")
|
startDestination = findPreference("start_destination")
|
||||||
downloadCard = findPreference("download_card")
|
downloadCard = findPreference("download_card")
|
||||||
|
quickDownload = findPreference("quick_download")
|
||||||
meteredNetwork = findPreference("metered_networks")
|
meteredNetwork = findPreference("metered_networks")
|
||||||
apiKey = findPreference("api_key")
|
apiKey = findPreference("api_key")
|
||||||
homeRecommendations = findPreference("home_recommendations")
|
homeRecommendations = findPreference("home_recommendations")
|
||||||
|
|
@ -193,6 +195,7 @@ class SettingsFragment : PreferenceFragmentCompat() {
|
||||||
editor.putString("search_engine", searchEngine!!.value)
|
editor.putString("search_engine", searchEngine!!.value)
|
||||||
editor.putString("start_destination", startDestination!!.value)
|
editor.putString("start_destination", startDestination!!.value)
|
||||||
editor.putBoolean("download_card", downloadCard!!.isChecked)
|
editor.putBoolean("download_card", downloadCard!!.isChecked)
|
||||||
|
editor.putBoolean("quick_download", quickDownload!!.isChecked)
|
||||||
editor.putBoolean("metered_networks", meteredNetwork!!.isChecked)
|
editor.putBoolean("metered_networks", meteredNetwork!!.isChecked)
|
||||||
editor.putString("api_key", apiKey!!.text)
|
editor.putString("api_key", apiKey!!.text)
|
||||||
editor.putBoolean("home_recommendations", homeRecommendations!!.isChecked)
|
editor.putBoolean("home_recommendations", homeRecommendations!!.isChecked)
|
||||||
|
|
@ -382,6 +385,13 @@ class SettingsFragment : PreferenceFragmentCompat() {
|
||||||
editor.apply()
|
editor.apply()
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
quickDownload!!.onPreferenceChangeListener =
|
||||||
|
Preference.OnPreferenceChangeListener { _: Preference?, newValue: Any ->
|
||||||
|
val enable = newValue as Boolean
|
||||||
|
editor.putBoolean("quick_download", enable)
|
||||||
|
editor.apply()
|
||||||
|
true
|
||||||
|
}
|
||||||
meteredNetwork!!.onPreferenceChangeListener =
|
meteredNetwork!!.onPreferenceChangeListener =
|
||||||
Preference.OnPreferenceChangeListener { _: Preference?, newValue: Any ->
|
Preference.OnPreferenceChangeListener { _: Preference?, newValue: Any ->
|
||||||
val enable = newValue as Boolean
|
val enable = newValue as Boolean
|
||||||
|
|
|
||||||
|
|
@ -5,120 +5,150 @@
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<LinearLayout
|
<androidx.core.widget.NestedScrollView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:scrollbars="none"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent">
|
app:layout_constraintTop_toTopOf="parent">
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginHorizontal="20dp"
|
android:orientation="vertical">
|
||||||
android:orientation="horizontal"
|
|
||||||
android:paddingTop="20dp">
|
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
<TextView
|
android:layout_width="match_parent"
|
||||||
android:id="@+id/bottom_sheet_title"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="4dp"
|
android:layout_marginHorizontal="20dp"
|
||||||
android:maxLines="2"
|
android:orientation="horizontal"
|
||||||
android:singleLine="false"
|
android:paddingTop="20dp">
|
||||||
android:text="@string/download"
|
|
||||||
android:textSize="25sp"
|
|
||||||
app:layout_constraintEnd_toStartOf="@+id/bottomsheet_schedule_button"
|
|
||||||
app:layout_constraintHorizontal_bias="0.0"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/bottom_sheet_subtitle"
|
<TextView
|
||||||
android:layout_width="0dp"
|
android:id="@+id/bottom_sheet_title"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="4dp"
|
||||||
|
android:maxLines="2"
|
||||||
|
android:singleLine="false"
|
||||||
|
android:text="@string/download"
|
||||||
|
android:textSize="25sp"
|
||||||
|
app:layout_constraintEnd_toStartOf="@+id/bottomsheet_schedule_button"
|
||||||
|
app:layout_constraintHorizontal_bias="0.0"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/bottom_sheet_subtitle"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:maxLines="2"
|
||||||
|
android:singleLine="false"
|
||||||
|
android:text="@string/configure_download"
|
||||||
|
android:textSize="12sp"
|
||||||
|
app:layout_constraintEnd_toStartOf="@+id/bottomsheet_schedule_button"
|
||||||
|
app:layout_constraintHorizontal_bias="0.0"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/bottom_sheet_title" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/bottomsheet_schedule_button"
|
||||||
|
style="?attr/materialIconButtonFilledTonalStyle"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginEnd="10dp"
|
||||||
|
app:icon="@drawable/ic_clock"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toStartOf="@+id/bottomsheet_download_button"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/bottomsheet_download_button"
|
||||||
|
style="@style/Widget.Material3.Button.ElevatedButton.Icon"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:autoLink="all"
|
||||||
|
android:text="@string/download"
|
||||||
|
app:icon="@drawable/ic_down"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
|
<com.google.android.material.tabs.TabLayout
|
||||||
|
android:id="@+id/download_tablayout"
|
||||||
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:maxLines="2"
|
android:layout_margin="10dp"
|
||||||
android:singleLine="false"
|
android:backgroundTint="@android:color/transparent"
|
||||||
android:text="@string/configure_download"
|
app:tabGravity="fill"
|
||||||
android:textSize="12sp"
|
app:tabMode="scrollable">
|
||||||
app:layout_constraintEnd_toStartOf="@+id/bottomsheet_schedule_button"
|
|
||||||
app:layout_constraintHorizontal_bias="0.0"
|
<com.google.android.material.tabs.TabItem
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
android:layout_width="wrap_content"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/bottom_sheet_title" />
|
android:layout_height="match_parent"
|
||||||
|
android:text="@string/audio" />
|
||||||
|
|
||||||
|
<com.google.android.material.tabs.TabItem
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:text="@string/video" />
|
||||||
|
|
||||||
|
<com.google.android.material.tabs.TabItem
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:text="@string/command" />
|
||||||
|
|
||||||
|
|
||||||
|
</com.google.android.material.tabs.TabLayout>
|
||||||
|
|
||||||
|
<androidx.viewpager2.widget.ViewPager2
|
||||||
|
android:id="@+id/download_viewpager"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content" />
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/bottomsheet_schedule_button"
|
android:id="@+id/bottom_sheet_link"
|
||||||
style="?attr/materialIconButtonFilledTonalStyle"
|
style="@style/Widget.Material3.Button.TextButton.Icon"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginEnd="10dp"
|
android:layout_margin="10dp"
|
||||||
app:icon="@drawable/ic_clock"
|
android:textAlignment="textStart"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
android:singleLine="true"
|
||||||
app:layout_constraintEnd_toStartOf="@+id/bottomsheet_download_button"
|
android:text="@string/app_name"
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
android:textSize="15sp"
|
||||||
|
app:icon="@drawable/ic_link" />
|
||||||
|
|
||||||
<Button
|
<LinearLayout
|
||||||
android:id="@+id/bottomsheet_download_button"
|
android:layout_width="match_parent"
|
||||||
style="@style/Widget.Material3.Button.ElevatedButton.Icon"
|
android:gravity="end"
|
||||||
android:layout_width="wrap_content"
|
android:visibility="gone"
|
||||||
android:layout_height="wrap_content"
|
android:paddingBottom="10dp"
|
||||||
android:autoLink="all"
|
android:paddingHorizontal="20dp"
|
||||||
android:text="@string/download"
|
android:layout_height="wrap_content">
|
||||||
app:icon="@drawable/ic_down"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/update_item"
|
||||||
|
style="@style/Widget.Material3.Button.ElevatedButton.Icon"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:autoLink="all"
|
||||||
|
android:text="@string/update"
|
||||||
|
app:icon="@drawable/ic_update"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<com.google.android.material.tabs.TabLayout
|
</LinearLayout>
|
||||||
android:id="@+id/download_tablayout"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_margin="10dp"
|
|
||||||
android:backgroundTint="@android:color/transparent"
|
|
||||||
app:tabGravity="fill"
|
|
||||||
app:tabMode="scrollable">
|
|
||||||
|
|
||||||
<com.google.android.material.tabs.TabItem
|
</androidx.core.widget.NestedScrollView>
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:text="@string/audio" />
|
|
||||||
|
|
||||||
<com.google.android.material.tabs.TabItem
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:text="@string/video" />
|
|
||||||
|
|
||||||
<com.google.android.material.tabs.TabItem
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:text="@string/command" />
|
|
||||||
|
|
||||||
|
|
||||||
</com.google.android.material.tabs.TabLayout>
|
|
||||||
|
|
||||||
<androidx.viewpager2.widget.ViewPager2
|
|
||||||
android:id="@+id/download_viewpager"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content" />
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/bottom_sheet_link"
|
|
||||||
style="@style/Widget.Material3.Button.TextButton.Icon"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_margin="10dp"
|
|
||||||
android:textAlignment="textStart"
|
|
||||||
android:singleLine="true"
|
|
||||||
android:text="@string/app_name"
|
|
||||||
android:textSize="15sp"
|
|
||||||
app:icon="@drawable/ic_link" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources>
|
<resources>
|
||||||
<color name="icon_bg">#1c1d23</color>
|
<color name="icon_bg">#000</color>
|
||||||
<color name="black">#000000</color>
|
<color name="black">#000000</color>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
||||||
|
|
@ -4,8 +4,6 @@
|
||||||
<item name="android:windowLightStatusBar">@android:color/transparent</item>
|
<item name="android:windowLightStatusBar">@android:color/transparent</item>
|
||||||
<item name="android:statusBarColor">@android:color/transparent</item>
|
<item name="android:statusBarColor">@android:color/transparent</item>
|
||||||
<item name="android:color">@android:color/transparent</item>
|
<item name="android:color">@android:color/transparent</item>
|
||||||
<item name="android:navigationBarColor">@android:color/transparent</item>
|
|
||||||
<item name="windowActionModeOverlay">true</item>
|
|
||||||
<item name="alertDialogTheme">@style/ThemeOverlay.Material3.MaterialAlertDialog</item>
|
<item name="alertDialogTheme">@style/ThemeOverlay.Material3.MaterialAlertDialog</item>
|
||||||
<item name="dialogCornerRadius">28dp</item>
|
<item name="dialogCornerRadius">28dp</item>
|
||||||
<item name="switchPreferenceCompatStyle">@style/Preference.SwitchPreferenceCompat.Material3</item>
|
<item name="switchPreferenceCompatStyle">@style/Preference.SwitchPreferenceCompat.Material3</item>
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
<color name="black">#000000</color>
|
<color name="black">#000000</color>
|
||||||
<color name="grey">#323232</color>
|
<color name="grey">#323232</color>
|
||||||
<color name="light_grey">#A6A6A6</color>
|
<color name="light_grey">#A6A6A6</color>
|
||||||
<color name="icon_bg">#1c1d23</color>
|
<color name="icon_bg">#FFFFFF</color>
|
||||||
<color name="icon_fg">#d43c3c</color>
|
<color name="icon_fg">#d43c3c</color>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -241,4 +241,6 @@
|
||||||
<string name="downloaded">"Downloaded: "</string>
|
<string name="downloaded">"Downloaded: "</string>
|
||||||
<string name="finished_download_notification_channel_name">Finished Downloads</string>
|
<string name="finished_download_notification_channel_name">Finished Downloads</string>
|
||||||
<string name="finished_download_notification_channel_description">Notification for finished or faulty downloads</string>
|
<string name="finished_download_notification_channel_description">Notification for finished or faulty downloads</string>
|
||||||
|
<string name="quick_download">Quick Download</string>
|
||||||
|
<string name="quick_download_summary">Don\'t fetch data beforehand</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
@ -91,6 +91,14 @@
|
||||||
app:summary="@string/download_card_summary"
|
app:summary="@string/download_card_summary"
|
||||||
app:title="@string/show_download_card" />
|
app:title="@string/show_download_card" />
|
||||||
|
|
||||||
|
<SwitchPreferenceCompat
|
||||||
|
android:widgetLayout="@layout/preferece_material_switch"
|
||||||
|
app:defaultValue="false"
|
||||||
|
android:icon="@drawable/ic_speed"
|
||||||
|
android:key="quick_download"
|
||||||
|
app:summary="@string/quick_download_summary"
|
||||||
|
app:title="@string/quick_download" />
|
||||||
|
|
||||||
<SwitchPreferenceCompat
|
<SwitchPreferenceCompat
|
||||||
android:widgetLayout="@layout/preferece_material_switch"
|
android:widgetLayout="@layout/preferece_material_switch"
|
||||||
app:defaultValue="true"
|
app:defaultValue="true"
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue