mirror of
https://github.com/libre-tube/LibreTube.git
synced 2025-04-29 16:30:31 +05:30
Merge pull request #151 from Bnyro/master
This commit is contained in:
commit
e077e1ea9f
@ -3,6 +3,7 @@ package com.github.libretube
|
|||||||
import android.Manifest
|
import android.Manifest
|
||||||
import android.content.ContentResolver
|
import android.content.ContentResolver
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
|
import android.content.Intent
|
||||||
import android.content.pm.PackageManager
|
import android.content.pm.PackageManager
|
||||||
import android.net.Uri
|
import android.net.Uri
|
||||||
import android.os.Build
|
import android.os.Build
|
||||||
@ -21,7 +22,8 @@ import androidx.preference.ListPreference
|
|||||||
import androidx.preference.Preference
|
import androidx.preference.Preference
|
||||||
import androidx.preference.PreferenceFragmentCompat
|
import androidx.preference.PreferenceFragmentCompat
|
||||||
import retrofit2.HttpException
|
import retrofit2.HttpException
|
||||||
import java.io.*
|
import java.io.IOException
|
||||||
|
import java.io.InputStream
|
||||||
import java.util.zip.ZipEntry
|
import java.util.zip.ZipEntry
|
||||||
import java.util.zip.ZipInputStream
|
import java.util.zip.ZipInputStream
|
||||||
|
|
||||||
@ -174,7 +176,13 @@ class Settings : PreferenceFragmentCompat() {
|
|||||||
}
|
}
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
val about = findPreference<Preference>("about")
|
||||||
|
about?.setOnPreferenceClickListener {
|
||||||
|
val uri = Uri.parse("https://libre-tube.github.io/")
|
||||||
|
val intent = Intent(Intent.ACTION_VIEW).setData(uri)
|
||||||
|
startActivity(intent)
|
||||||
|
true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun fetchInstance() {
|
private fun fetchInstance() {
|
||||||
|
@ -56,7 +56,11 @@ class CustomViewHolder1(private val v: View): RecyclerView.ViewHolder(v){
|
|||||||
val channelImage = v.findViewById<ImageView>(R.id.search_channel_image)
|
val channelImage = v.findViewById<ImageView>(R.id.search_channel_image)
|
||||||
Picasso.get().load(item.uploaderAvatar).into(channelImage)
|
Picasso.get().load(item.uploaderAvatar).into(channelImage)
|
||||||
val title = v.findViewById<TextView>(R.id.search_description)
|
val title = v.findViewById<TextView>(R.id.search_description)
|
||||||
title.text = item.title
|
if (item.title!!.length > 60) {
|
||||||
|
title.text = item.title?.substring(0, 60) + "..."
|
||||||
|
} else {
|
||||||
|
title.text = item.title
|
||||||
|
}
|
||||||
val views = v.findViewById<TextView>(R.id.search_views)
|
val views = v.findViewById<TextView>(R.id.search_views)
|
||||||
views.text = item.views.formatShort() +" • "+item.uploadedDate
|
views.text = item.views.formatShort() +" • "+item.uploadedDate
|
||||||
val channelName = v.findViewById<TextView>(R.id.search_channel_name)
|
val channelName = v.findViewById<TextView>(R.id.search_channel_name)
|
||||||
|
10
app/src/main/res/drawable/ic_info.xml
Normal file
10
app/src/main/res/drawable/ic_info.xml
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="24"
|
||||||
|
android:viewportHeight="24"
|
||||||
|
android:tint="?attr/colorControlNormal">
|
||||||
|
<path
|
||||||
|
android:fillColor="@android:color/white"
|
||||||
|
android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM13,17h-2v-6h2v6zM13,9h-2L11,7h2v2z"/>
|
||||||
|
</vector>
|
@ -6,5 +6,5 @@
|
|||||||
android:tint="?attr/colorControlNormal">
|
android:tint="?attr/colorControlNormal">
|
||||||
<path
|
<path
|
||||||
android:fillColor="@android:color/white"
|
android:fillColor="@android:color/white"
|
||||||
android:pathData="M19,12v7L5,19v-7L3,12v7c0,1.1 0.9,2 2,2h14c1.1,0 2,-0.9 2,-2v-7h-2zM13,12.67l2.59,-2.58L17,11.5l-5,5 -5,-5 1.41,-1.41L11,12.67L11,3h2z"/>
|
android:pathData="M14,10L2,10v2h12v-2zM14,6L2,6v2h12L14,6zM18,14v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zM2,16h8v-2L2,14v2z"/>
|
||||||
</vector>
|
</vector>
|
||||||
|
@ -1,43 +1,47 @@
|
|||||||
<?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:layout_margin="8dp"
|
|
||||||
android:layout_marginBottom="16dp"
|
android:layout_marginBottom="16dp"
|
||||||
android:background="?android:attr/selectableItemBackground"
|
android:background="?android:attr/selectableItemBackground"
|
||||||
>
|
>
|
||||||
|
|
||||||
<de.hdodenhof.circleimageview.CircleImageView
|
<de.hdodenhof.circleimageview.CircleImageView
|
||||||
android:id="@+id/search_channel_image"
|
android:id="@+id/search_channel_image"
|
||||||
android:layout_width="130dp"
|
android:layout_width="110dp"
|
||||||
android:layout_height="130dp"
|
android:layout_height="110dp"
|
||||||
android:layout_marginStart="32dp"
|
app:layout_constraintEnd_toStartOf="@+id/constraintLayout"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
<TextView
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
android:id="@+id/search_channel_name"
|
android:id="@+id/constraintLayout"
|
||||||
android:layout_width="0dp"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginStart="24dp"
|
android:layout_marginEnd="40dp"
|
||||||
android:layout_marginTop="24dp"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
android:text="TextView"
|
|
||||||
android:textSize="16sp"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toEndOf="@+id/search_channel_image"
|
app:layout_constraintTop_toTopOf="parent">
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/search_views"
|
android:id="@+id/search_channel_name"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginStart="24dp"
|
android:text="TextView"
|
||||||
android:layout_marginTop="8dp"
|
android:textSize="16sp"
|
||||||
android:text="TextView"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
app:layout_constraintStart_toEndOf="@+id/search_channel_image"
|
|
||||||
app:layout_constraintTop_toBottomOf="@+id/search_channel_name" />
|
<TextView
|
||||||
|
android:id="@+id/search_views"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="TextView"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/search_channel_name" />
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/search_sub_button"
|
android:id="@+id/search_sub_button"
|
||||||
@ -47,8 +51,7 @@
|
|||||||
android:background="@android:color/transparent"
|
android:background="@android:color/transparent"
|
||||||
android:text="@string/subscribe"
|
android:text="@string/subscribe"
|
||||||
android:textColor="@color/colorPrimary"
|
android:textColor="@color/colorPrimary"
|
||||||
app:layout_constraintStart_toEndOf="@+id/search_channel_image"
|
android:visibility="gone"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/search_views"
|
app:layout_constraintStart_toEndOf="@+id/search_channel_image" />
|
||||||
android:visibility="gone"/>
|
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
@ -76,6 +76,7 @@
|
|||||||
android:hint="@string/playlistName"/>
|
android:hint="@string/playlistName"/>
|
||||||
</com.google.android.material.textfield.TextInputLayout>
|
</com.google.android.material.textfield.TextInputLayout>
|
||||||
</com.google.android.material.card.MaterialCardView>
|
</com.google.android.material.card.MaterialCardView>
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/create_playlist"
|
android:id="@+id/create_playlist"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
|
@ -15,12 +15,13 @@
|
|||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
app:layout_constraintGuide_percent=".5"/>
|
app:layout_constraintGuide_percent=".45"/>
|
||||||
<com.google.android.material.card.MaterialCardView
|
<com.google.android.material.card.MaterialCardView
|
||||||
android:id="@+id/card_search_thumbnail"
|
android:id="@+id/card_search_thumbnail"
|
||||||
app:cardCornerRadius="8dp"
|
app:cardCornerRadius="8dp"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="0dp"
|
android:layout_height="0dp"
|
||||||
|
app:strokeWidth="0dp"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintDimensionRatio="16:9"
|
app:layout_constraintDimensionRatio="16:9"
|
||||||
app:layout_constraintHorizontal_bias="0.0"
|
app:layout_constraintHorizontal_bias="0.0"
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
xmlns:tools="http://schemas.android.com/tools"
|
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_margin="8dp"
|
|
||||||
android:layout_marginBottom="16dp"
|
android:layout_marginBottom="16dp"
|
||||||
android:background="?android:attr/selectableItemBackground"
|
android:background="?android:attr/selectableItemBackground"
|
||||||
>
|
>
|
||||||
@ -14,12 +13,13 @@
|
|||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
app:layout_constraintGuide_percent=".5"/>
|
app:layout_constraintGuide_percent=".45"/>
|
||||||
<com.google.android.material.card.MaterialCardView
|
<com.google.android.material.card.MaterialCardView
|
||||||
android:id="@+id/card_playlist"
|
android:id="@+id/card_playlist"
|
||||||
app:cardCornerRadius="8dp"
|
app:cardCornerRadius="8dp"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="0dp"
|
android:layout_height="0dp"
|
||||||
|
app:strokeWidth="0dp"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintDimensionRatio="16:9"
|
app:layout_constraintDimensionRatio="16:9"
|
||||||
app:layout_constraintHorizontal_bias="0.0"
|
app:layout_constraintHorizontal_bias="0.0"
|
||||||
@ -67,9 +67,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:layout_marginBottom="2dp"
|
|
||||||
android:text="TextView"
|
android:text="TextView"
|
||||||
android:textColor="#000000"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toEndOf="@+id/card_playlist"
|
app:layout_constraintStart_toEndOf="@+id/card_playlist"
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
app:layout_constraintGuide_percent=".5"/>
|
app:layout_constraintGuide_percent=".45"/>
|
||||||
<com.google.android.material.card.MaterialCardView
|
<com.google.android.material.card.MaterialCardView
|
||||||
android:id="@+id/card_playlist_thumbnail"
|
android:id="@+id/card_playlist_thumbnail"
|
||||||
app:cardCornerRadius="8dp"
|
app:cardCornerRadius="8dp"
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
xmlns:tools="http://schemas.android.com/tools"
|
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_margin="8dp"
|
|
||||||
android:layout_marginBottom="16dp"
|
android:layout_marginBottom="16dp"
|
||||||
android:background="?android:attr/selectableItemBackground"
|
android:background="?android:attr/selectableItemBackground"
|
||||||
android:id="@+id/video_search"
|
android:id="@+id/video_search"
|
||||||
@ -15,12 +14,13 @@
|
|||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
app:layout_constraintGuide_percent=".5"/>
|
app:layout_constraintGuide_percent=".45"/>
|
||||||
<com.google.android.material.card.MaterialCardView
|
<com.google.android.material.card.MaterialCardView
|
||||||
android:id="@+id/card_search_thumbnail"
|
android:id="@+id/card_search_thumbnail"
|
||||||
app:cardCornerRadius="8dp"
|
app:cardCornerRadius="8dp"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="0dp"
|
android:layout_height="0dp"
|
||||||
|
app:strokeWidth="0dp"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintDimensionRatio="16:9"
|
app:layout_constraintDimensionRatio="16:9"
|
||||||
app:layout_constraintHorizontal_bias="0.0"
|
app:layout_constraintHorizontal_bias="0.0"
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
xmlns:tools="http://schemas.android.com/tools"
|
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_margin="8dp"
|
|
||||||
android:layout_marginBottom="16dp"
|
android:layout_marginBottom="16dp"
|
||||||
android:background="?android:attr/selectableItemBackground"
|
android:background="?android:attr/selectableItemBackground"
|
||||||
android:id="@+id/video_search"
|
android:id="@+id/video_search"
|
||||||
@ -15,12 +14,13 @@
|
|||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
app:layout_constraintGuide_percent=".5"/>
|
app:layout_constraintGuide_percent=".45"/>
|
||||||
<com.google.android.material.card.MaterialCardView
|
<com.google.android.material.card.MaterialCardView
|
||||||
android:id="@+id/card_search_thumbnail"
|
android:id="@+id/card_search_thumbnail"
|
||||||
app:cardCornerRadius="8dp"
|
app:cardCornerRadius="8dp"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="0dp"
|
android:layout_height="0dp"
|
||||||
|
app:strokeWidth="0dp"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintDimensionRatio="16:9"
|
app:layout_constraintDimensionRatio="16:9"
|
||||||
app:layout_constraintHorizontal_bias="0.0"
|
app:layout_constraintHorizontal_bias="0.0"
|
||||||
@ -29,11 +29,11 @@
|
|||||||
app:layout_constraintVertical_bias="0.0"
|
app:layout_constraintVertical_bias="0.0"
|
||||||
app:layout_constraintEnd_toStartOf="@+id/guideline">
|
app:layout_constraintEnd_toStartOf="@+id/guideline">
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/search_thumbnail"
|
android:id="@+id/search_thumbnail"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
tools:srcCompat="@tools:sample/backgrounds/scenic" />
|
tools:srcCompat="@tools:sample/backgrounds/scenic" />
|
||||||
</com.google.android.material.card.MaterialCardView>
|
</com.google.android.material.card.MaterialCardView>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
@ -58,8 +58,8 @@
|
|||||||
|
|
||||||
<de.hdodenhof.circleimageview.CircleImageView
|
<de.hdodenhof.circleimageview.CircleImageView
|
||||||
android:id="@+id/search_channel_image"
|
android:id="@+id/search_channel_image"
|
||||||
android:layout_width="40dp"
|
android:layout_width="30dp"
|
||||||
android:layout_height="40dp"
|
android:layout_height="30dp"
|
||||||
android:layout_marginStart="8dp"
|
android:layout_marginStart="8dp"
|
||||||
android:layout_marginTop="8dp"
|
android:layout_marginTop="8dp"
|
||||||
app:layout_constraintStart_toStartOf="@+id/guideline"
|
app:layout_constraintStart_toStartOf="@+id/guideline"
|
||||||
@ -70,7 +70,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:layout_marginTop="16dp"
|
android:layout_marginTop="12dp"
|
||||||
android:text="TextView"
|
android:text="TextView"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toEndOf="@+id/search_channel_image"
|
app:layout_constraintStart_toEndOf="@+id/search_channel_image"
|
||||||
|
@ -49,4 +49,5 @@
|
|||||||
<string name="addToPlaylist">Add to Playlist</string>
|
<string name="addToPlaylist">Add to Playlist</string>
|
||||||
<string name="success">Success!</string>
|
<string name="success">Success!</string>
|
||||||
<string name="fail">Failed :(</string>
|
<string name="fail">Failed :(</string>
|
||||||
|
<string name="about">About</string>
|
||||||
</resources>
|
</resources>
|
@ -63,5 +63,10 @@
|
|||||||
android:icon="@drawable/ic_column"
|
android:icon="@drawable/ic_column"
|
||||||
app:useSimpleSummaryProvider="true"
|
app:useSimpleSummaryProvider="true"
|
||||||
/>
|
/>
|
||||||
|
<Preference
|
||||||
|
app:title="@string/about"
|
||||||
|
app:key="about"
|
||||||
|
android:icon="@drawable/ic_info"
|
||||||
|
/>
|
||||||
|
|
||||||
</androidx.preference.PreferenceScreen>
|
</androidx.preference.PreferenceScreen>
|
Loading…
x
Reference in New Issue
Block a user