mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-14 06:10:31 +05:30
commit
b39e56f59b
@ -10,7 +10,7 @@ android {
|
||||
applicationId 'com.github.libretube'
|
||||
minSdk 21
|
||||
targetSdk 31
|
||||
versionCode 14
|
||||
versionCode 15
|
||||
versionName '0.4.1'
|
||||
multiDexEnabled true
|
||||
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
|
||||
|
3
app/proguard-rules.pro
vendored
3
app/proguard-rules.pro
vendored
@ -22,3 +22,6 @@
|
||||
#uncomment for debug
|
||||
#-keepnames class **
|
||||
-keep class com.github.libretube.obj.** { *; }
|
||||
|
||||
# prevents android from removing it
|
||||
-keep class com.github.libretube.update.** { <fields>; }
|
||||
|
@ -16,7 +16,7 @@
|
||||
}
|
||||
],
|
||||
"attributes": [],
|
||||
"versionCode": 14,
|
||||
"versionCode": 15,
|
||||
"versionName": "0.4.1",
|
||||
"outputFile": "app-x86_64-release.apk"
|
||||
},
|
||||
@ -29,23 +29,10 @@
|
||||
}
|
||||
],
|
||||
"attributes": [],
|
||||
"versionCode": 14,
|
||||
"versionCode": 15,
|
||||
"versionName": "0.4.1",
|
||||
"outputFile": "app-x86-release.apk"
|
||||
},
|
||||
{
|
||||
"type": "ONE_OF_MANY",
|
||||
"filters": [
|
||||
{
|
||||
"filterType": "ABI",
|
||||
"value": "armeabi-v7a"
|
||||
}
|
||||
],
|
||||
"attributes": [],
|
||||
"versionCode": 14,
|
||||
"versionName": "0.4.1",
|
||||
"outputFile": "app-armeabi-v7a-release.apk"
|
||||
},
|
||||
{
|
||||
"type": "ONE_OF_MANY",
|
||||
"filters": [
|
||||
@ -55,9 +42,22 @@
|
||||
}
|
||||
],
|
||||
"attributes": [],
|
||||
"versionCode": 14,
|
||||
"versionCode": 15,
|
||||
"versionName": "0.4.1",
|
||||
"outputFile": "app-arm64-v8a-release.apk"
|
||||
},
|
||||
{
|
||||
"type": "ONE_OF_MANY",
|
||||
"filters": [
|
||||
{
|
||||
"filterType": "ABI",
|
||||
"value": "armeabi-v7a"
|
||||
}
|
||||
],
|
||||
"attributes": [],
|
||||
"versionCode": 15,
|
||||
"versionName": "0.4.1",
|
||||
"outputFile": "app-armeabi-v7a-release.apk"
|
||||
}
|
||||
],
|
||||
"elementType": "File"
|
||||
|
@ -1,6 +1,5 @@
|
||||
package com.github.libretube.adapters
|
||||
|
||||
import android.content.Context
|
||||
import android.util.Log
|
||||
import android.view.LayoutInflater
|
||||
import android.view.ViewGroup
|
||||
@ -22,7 +21,6 @@ class SubscriptionChannelAdapter(private val subscriptions: MutableList<Subscrip
|
||||
val TAG = "SubChannelAdapter"
|
||||
|
||||
private var subscribed = true
|
||||
private var isLoading = false
|
||||
|
||||
override fun getItemCount(): Int {
|
||||
return subscriptions.size
|
||||
@ -44,23 +42,22 @@ class SubscriptionChannelAdapter(private val subscriptions: MutableList<Subscrip
|
||||
NavigationHelper.navigateChannel(root.context, subscription.url)
|
||||
}
|
||||
subscriptionSubscribe.setOnClickListener {
|
||||
if (!isLoading) {
|
||||
isLoading = true
|
||||
val channelId = subscription.url?.replace("/channel/", "")!!
|
||||
if (subscribed) {
|
||||
unsubscribe(root.context, channelId)
|
||||
subscriptionSubscribe.text = root.context.getString(R.string.subscribe)
|
||||
} else {
|
||||
subscribe(root.context, channelId)
|
||||
subscriptionSubscribe.text =
|
||||
root.context.getString(R.string.unsubscribe)
|
||||
}
|
||||
val channelId = subscription.url?.replace("/channel/", "")!!
|
||||
if (subscribed) {
|
||||
subscriptionSubscribe.text = root.context.getString(R.string.subscribe)
|
||||
unsubscribe(channelId)
|
||||
subscribed = false
|
||||
} else {
|
||||
subscriptionSubscribe.text =
|
||||
root.context.getString(R.string.unsubscribe)
|
||||
subscribe(channelId)
|
||||
subscribed = true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun subscribe(context: Context, channelId: String) {
|
||||
private fun subscribe(channelId: String) {
|
||||
fun run() {
|
||||
CoroutineScope(Dispatchers.IO).launch {
|
||||
try {
|
||||
@ -72,14 +69,12 @@ class SubscriptionChannelAdapter(private val subscriptions: MutableList<Subscrip
|
||||
} catch (e: Exception) {
|
||||
Log.e(TAG, e.toString())
|
||||
}
|
||||
subscribed = true
|
||||
isLoading = false
|
||||
}
|
||||
}
|
||||
run()
|
||||
}
|
||||
|
||||
private fun unsubscribe(context: Context, channelId: String) {
|
||||
private fun unsubscribe(channelId: String) {
|
||||
fun run() {
|
||||
CoroutineScope(Dispatchers.IO).launch {
|
||||
try {
|
||||
@ -91,8 +86,6 @@ class SubscriptionChannelAdapter(private val subscriptions: MutableList<Subscrip
|
||||
} catch (e: Exception) {
|
||||
Log.e(TAG, e.toString())
|
||||
}
|
||||
subscribed = false
|
||||
isLoading = false
|
||||
}
|
||||
}
|
||||
run()
|
||||
|
@ -72,17 +72,17 @@ class SubscriptionsFragment : Fragment() {
|
||||
var loadedSubbedChannels = false
|
||||
|
||||
binding.toggleSubs.setOnClickListener {
|
||||
if (!binding.subChannels.isVisible) {
|
||||
if (!binding.subChannelsContainer.isVisible) {
|
||||
if (!loadedSubbedChannels) {
|
||||
binding.subChannels.layoutManager = LinearLayoutManager(context)
|
||||
fetchChannels(binding.subChannels)
|
||||
loadedSubbedChannels = true
|
||||
}
|
||||
binding.subChannels.visibility = View.VISIBLE
|
||||
binding.subFeed.visibility = View.GONE
|
||||
binding.subChannelsContainer.visibility = View.VISIBLE
|
||||
binding.subFeedContainer.visibility = View.GONE
|
||||
} else {
|
||||
binding.subChannels.visibility = View.GONE
|
||||
binding.subFeed.visibility = View.VISIBLE
|
||||
binding.subChannelsContainer.visibility = View.GONE
|
||||
binding.subFeedContainer.visibility = View.VISIBLE
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
package com.github.libretube.preferences
|
||||
|
||||
import android.os.Bundle
|
||||
import android.util.Log
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.preference.Preference
|
||||
import androidx.preference.PreferenceFragmentCompat
|
||||
@ -82,8 +81,17 @@ class MainSettings : PreferenceFragmentCompat() {
|
||||
CoroutineScope(Dispatchers.IO).launch {
|
||||
// check for update
|
||||
val updateInfo = UpdateChecker.getLatestReleaseInfo()
|
||||
Log.e(TAG, updateInfo?.name.toString())
|
||||
if (updateInfo?.name != null && BuildConfig.VERSION_NAME != updateInfo?.name) {
|
||||
if (updateInfo?.name == null) {
|
||||
// request failed
|
||||
val settingsActivity = activity as SettingsActivity
|
||||
val snackBar = Snackbar
|
||||
.make(
|
||||
settingsActivity.binding.root,
|
||||
R.string.unknown_error,
|
||||
Snackbar.LENGTH_SHORT
|
||||
)
|
||||
snackBar.show()
|
||||
} else if (BuildConfig.VERSION_NAME != updateInfo.name) {
|
||||
// show the UpdateAvailableDialog if there's an update available
|
||||
val updateAvailableDialog = UpdateDialog(updateInfo)
|
||||
updateAvailableDialog.show(childFragmentManager, "UpdateAvailableDialog")
|
||||
|
@ -35,7 +35,7 @@
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:stateListAnimator="@null"
|
||||
android:text="@string/subscribe"
|
||||
android:text="@string/unsubscribe"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:textSize="12sp"
|
||||
app:cornerRadius="20dp"
|
||||
|
@ -95,13 +95,13 @@
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/sub_channels_container"
|
||||
android:visibility="gone"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:descendantFocusability="blocksDescendants">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
|
||||
android:visibility="gone"
|
||||
android:id="@+id/sub_channels"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
@ -110,6 +110,7 @@
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/sub_feed_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:descendantFocusability="blocksDescendants">
|
||||
|
Loading…
Reference in New Issue
Block a user