mirror of
https://github.com/libre-tube/LibreTube.git
synced 2025-01-06 17:40:30 +05:30
fix subscriptions
This commit is contained in:
parent
61f1bf6fee
commit
a975ba212f
@ -15,8 +15,6 @@ class SubscriptionChannelAdapter(private val subscriptions: MutableList<Subscrip
|
||||
RecyclerView.Adapter<SubscriptionChannelViewHolder>() {
|
||||
val TAG = "SubChannelAdapter"
|
||||
|
||||
private var subscribed = true
|
||||
|
||||
override fun getItemCount(): Int {
|
||||
return subscriptions.size
|
||||
}
|
||||
@ -30,6 +28,8 @@ class SubscriptionChannelAdapter(private val subscriptions: MutableList<Subscrip
|
||||
|
||||
override fun onBindViewHolder(holder: SubscriptionChannelViewHolder, position: Int) {
|
||||
val subscription = subscriptions[position]
|
||||
var subscribed = true
|
||||
|
||||
holder.binding.apply {
|
||||
subscriptionChannelName.text = subscription.name
|
||||
ConnectionHelper.loadImage(subscription.avatar, subscriptionChannelImage)
|
||||
|
@ -22,7 +22,7 @@ class ImportHelper(
|
||||
private val TAG = "ImportHelper"
|
||||
|
||||
fun importSubscriptions(uri: Uri?) {
|
||||
if (uri != null) {
|
||||
if (uri == null) return
|
||||
try {
|
||||
val type = activity.contentResolver.getType(uri)
|
||||
|
||||
@ -45,9 +45,6 @@ class ImportHelper(
|
||||
break
|
||||
}
|
||||
entry = zis.nextEntry
|
||||
}
|
||||
}
|
||||
|
||||
inputStream?.bufferedReader()?.readLines()?.forEach {
|
||||
if (it.isNotBlank()) {
|
||||
val channelId = it.substringBefore(",")
|
||||
@ -57,10 +54,16 @@ class ImportHelper(
|
||||
}
|
||||
}
|
||||
inputStream?.close()
|
||||
}
|
||||
} else {
|
||||
throw IllegalArgumentException("unsupported type")
|
||||
}
|
||||
|
||||
CoroutineScope(Dispatchers.IO).launch {
|
||||
SubscriptionHelper.importSubscriptions(channels)
|
||||
}
|
||||
|
||||
Toast.makeText(activity, R.string.importsuccess, Toast.LENGTH_SHORT).show()
|
||||
} catch (e: Exception) {
|
||||
Log.e(TAG, e.toString())
|
||||
Toast.makeText(
|
||||
@ -70,7 +73,6 @@ class ImportHelper(
|
||||
).show()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun readTextFromUri(uri: Uri): String {
|
||||
val stringBuilder = StringBuilder()
|
||||
|
Loading…
Reference in New Issue
Block a user