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