* download files with friendly name (not video ID) * Update Picasso library FIX : add extension in downloaded filename. download files with friendly name (not video ID) * Update Gradle Add 0.75x and 1.25x to play speed Co-authored-by: jmgfr <13685004+jmgfr@users.noreply.github.com>
This commit is contained in:
parent
7af3b4d6b2
commit
c843e268d0
@ -35,10 +35,10 @@ android {
|
||||
implementation 'com.squareup.retrofit2:retrofit:2.5.0'
|
||||
|
||||
// image downloading and caching library
|
||||
implementation 'com.squareup.picasso:picasso:2.5.2'
|
||||
implementation 'com.squareup.picasso:picasso:2.71828'
|
||||
|
||||
// json decoder/encoder
|
||||
implementation 'com.google.code.gson:gson:2.8.5'
|
||||
implementation 'com.google.code.gson:gson:2.8.6'
|
||||
implementation 'com.squareup.retrofit2:converter-gson:2.5.0'
|
||||
|
||||
// Torrents and WebRTC
|
||||
@ -79,5 +79,4 @@ android {
|
||||
dependencies {
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-beta6'
|
||||
implementation 'androidx.appcompat:appcompat:1.1.0'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
|
||||
}
|
||||
|
@ -200,7 +200,7 @@ public class AccountActivity extends CommonActivity {
|
||||
Avatar avatar = account.getAvatar();
|
||||
if (avatar != null) {
|
||||
String avatarPath = avatar.getPath();
|
||||
Picasso.with(AccountActivity.this)
|
||||
Picasso.get()
|
||||
.load(APIUrlHelper.getUrl(AccountActivity.this) + avatarPath)
|
||||
.into(accountAvatar);
|
||||
}
|
||||
|
@ -70,7 +70,7 @@ public class ChannelAdapter extends RecyclerView.Adapter<ChannelAdapter.AccountV
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull AccountViewHolder holder, int position) {
|
||||
|
||||
Picasso.with(this.context)
|
||||
Picasso.get()
|
||||
.load(baseUrl + videoList.get(position).getPreviewPath())
|
||||
.into(holder.thumb);
|
||||
|
||||
@ -78,7 +78,7 @@ public class ChannelAdapter extends RecyclerView.Adapter<ChannelAdapter.AccountV
|
||||
Avatar avatar = videoList.get(position).getAccount().getAvatar();
|
||||
if (avatar != null) {
|
||||
String avatarPath = avatar.getPath();
|
||||
Picasso.with(this.context)
|
||||
Picasso.get()
|
||||
.load(baseUrl + avatarPath)
|
||||
.into(holder.avatar);
|
||||
}
|
||||
|
@ -73,7 +73,7 @@ public class VideoAdapter extends RecyclerView.Adapter<VideoAdapter.VideoViewHol
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull VideoViewHolder holder, int position) {
|
||||
|
||||
Picasso.with(this.context)
|
||||
Picasso.get()
|
||||
.load(baseUrl + videoList.get(position).getPreviewPath())
|
||||
.into(holder.thumb);
|
||||
|
||||
@ -81,7 +81,7 @@ public class VideoAdapter extends RecyclerView.Adapter<VideoAdapter.VideoViewHol
|
||||
Avatar avatar = videoList.get(position).getAccount().getAvatar();
|
||||
if (avatar != null) {
|
||||
String avatarPath = avatar.getPath();
|
||||
Picasso.with(this.context)
|
||||
Picasso.get()
|
||||
.load(baseUrl + avatarPath)
|
||||
.into(holder.avatar);
|
||||
}
|
||||
|
@ -37,7 +37,9 @@ public class VideoMenuSpeedFragment extends BottomSheetDialogFragment {
|
||||
public static final String TAG = "VideoMenuSpeed";
|
||||
|
||||
private TextView speed05Icon;
|
||||
private TextView speed075Icon;
|
||||
private TextView speed10Icon;
|
||||
private TextView speed125Icon;
|
||||
private TextView speed15Icon;
|
||||
private TextView speed20Icon;
|
||||
|
||||
@ -57,13 +59,17 @@ public class VideoMenuSpeedFragment extends BottomSheetDialogFragment {
|
||||
|
||||
// Icons
|
||||
speed05Icon = view.findViewById(R.id.video_speed05_icon);
|
||||
speed075Icon = view.findViewById(R.id.video_speed075_icon);
|
||||
speed10Icon = view.findViewById(R.id.video_speed10_icon);
|
||||
speed125Icon = view.findViewById(R.id.video_speed125_icon);
|
||||
speed15Icon = view.findViewById(R.id.video_speed15_icon);
|
||||
speed20Icon = view.findViewById(R.id.video_speed20_icon);
|
||||
|
||||
// Buttons
|
||||
TextView speed05 = view.findViewById(R.id.video_speed05);
|
||||
TextView speed075 = view.findViewById(R.id.video_speed075);
|
||||
TextView speed10 = view.findViewById(R.id.video_speed10);
|
||||
TextView speed125 = view.findViewById(R.id.video_speed125);
|
||||
TextView speed15 = view.findViewById(R.id.video_speed15);
|
||||
TextView speed20 = view.findViewById(R.id.video_speed20);
|
||||
|
||||
@ -72,7 +78,9 @@ public class VideoMenuSpeedFragment extends BottomSheetDialogFragment {
|
||||
|
||||
// Attach the listener
|
||||
speed05.setOnClickListener(v -> setVideoSpeed(0.5f, speed05Icon));
|
||||
speed075.setOnClickListener(v -> setVideoSpeed(0.75f, speed075Icon));
|
||||
speed10.setOnClickListener(v -> setVideoSpeed(1.0f, speed10Icon));
|
||||
speed125.setOnClickListener(v -> setVideoSpeed(1.25f, speed125Icon));
|
||||
speed15.setOnClickListener(v -> setVideoSpeed(1.5f, speed15Icon));
|
||||
speed20.setOnClickListener(v -> setVideoSpeed(2.0f, speed20Icon));
|
||||
|
||||
@ -84,7 +92,9 @@ public class VideoMenuSpeedFragment extends BottomSheetDialogFragment {
|
||||
private void setVideoSpeed(Float speed, TextView icon) {
|
||||
|
||||
speed05Icon.setText("");
|
||||
speed075Icon.setText("");
|
||||
speed10Icon.setText("");
|
||||
speed125Icon.setText("");
|
||||
speed15Icon.setText("");
|
||||
speed20Icon.setText("");
|
||||
|
||||
|
@ -165,7 +165,7 @@ public class VideoMetaDataFragment extends Fragment {
|
||||
ImageView avatarView = activity.findViewById(R.id.avatar);
|
||||
String baseUrl = APIUrlHelper.getUrl(context);
|
||||
String avatarPath = avatar.getPath();
|
||||
Picasso.with(context)
|
||||
Picasso.get()
|
||||
.load(baseUrl + avatarPath)
|
||||
.into(avatarView);
|
||||
}
|
||||
|
@ -25,10 +25,13 @@ import android.content.pm.PackageManager;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Environment;
|
||||
import android.webkit.MimeTypeMap;
|
||||
import android.webkit.URLUtil;
|
||||
|
||||
|
||||
import com.github.se_bastiaan.torrentstream.TorrentOptions;
|
||||
|
||||
import net.schueller.peertube.R;
|
||||
import net.schueller.peertube.helper.APIUrlHelper;
|
||||
import net.schueller.peertube.model.Video;
|
||||
|
||||
@ -66,12 +69,14 @@ public class Intents {
|
||||
public static void Download(Context context, Video video) {
|
||||
|
||||
String url = video.getFiles().get(0).getFileDownloadUrl();
|
||||
String destFilename = video.getName() + "." + MimeTypeMap.getFileExtensionFromUrl(URLUtil.guessFileName(url,null,null));
|
||||
//Toast.makeText(context, destFilename, Toast.LENGTH_LONG).show();
|
||||
DownloadManager.Request request = new DownloadManager.Request(Uri.parse(url));
|
||||
request.setDescription(video.getDescription());
|
||||
request.setTitle(video.getName());
|
||||
request.allowScanningByMediaScanner();
|
||||
request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
|
||||
request.setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS, URLUtil.guessFileName(url, null, null));
|
||||
request.setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS, destFilename);
|
||||
|
||||
// get download service and enqueue file
|
||||
DownloadManager manager = (DownloadManager) context.getSystemService(Context.DOWNLOAD_SERVICE);
|
||||
|
@ -35,6 +35,35 @@
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/video_speed075_icon"
|
||||
android:layout_width="32dp"
|
||||
android:layout_height="56dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:gravity="center|start"
|
||||
android:textAllCaps="false"
|
||||
android:textColor="#ffffff"
|
||||
android:textSize="12sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/video_speed075"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="56dp"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:gravity="center|start"
|
||||
android:text="@string/video_speed_075"
|
||||
android:textAllCaps="false"
|
||||
android:textColor="#ffffff"
|
||||
android:textSize="16sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
@ -65,6 +94,34 @@
|
||||
android:textSize="16sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/video_speed125_icon"
|
||||
android:layout_width="32dp"
|
||||
android:layout_height="56dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:gravity="center|start"
|
||||
android:textAllCaps="false"
|
||||
android:textColor="#ffffff"
|
||||
android:textSize="12sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/video_speed125"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="56dp"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:gravity="center|start"
|
||||
android:text="@string/video_speed_125"
|
||||
android:textAllCaps="false"
|
||||
android:textColor="#ffffff"
|
||||
android:textSize="16sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
|
@ -310,4 +310,6 @@
|
||||
<string name="server_selection_peertube_server_url">عنوان خادوم PeerTube</string>
|
||||
<string name="action_bar_title_server_selection">حدد الخادوم</string>
|
||||
<string name="login_current_server_hint">الخادوم الحالي</string>
|
||||
<string name="video_speed_075">0.75x</string>
|
||||
<string name="video_speed_125">1.25x</string>
|
||||
</resources>
|
@ -322,4 +322,6 @@
|
||||
<string name="server_selection_signup_allowed_no">না</string>
|
||||
<string name="server_selection_peertube_server_url">পিয়ারটিউব সার্ভার URL</string>
|
||||
<string name="action_bar_title_server_selection">সার্ভার নির্বাচন করুন</string>
|
||||
<string name="video_speed_075">0.75x</string>
|
||||
<string name="video_speed_125">1.25x</string>
|
||||
</resources>
|
@ -298,4 +298,6 @@
|
||||
<string name="na">nauru</string>
|
||||
<string name="ky">kirgiisi</string>
|
||||
<string name="tk">turkmeeni</string>
|
||||
<string name="video_speed_125">1.25x</string>
|
||||
<string name="video_speed_075">0.75x</string>
|
||||
</resources>
|
@ -310,4 +310,6 @@
|
||||
<string name="za">zhuang</string>
|
||||
<string name="zu">zoulou</string>
|
||||
<string name="login_current_server_hint">Serveur actuel</string>
|
||||
<string name="video_speed_075">0.75x</string>
|
||||
<string name="video_speed_125">1.25x</string>
|
||||
</resources>
|
@ -300,4 +300,6 @@
|
||||
<string name="server_selection_peertube_server_url">PeerTube-server-url</string>
|
||||
<string name="action_bar_title_server_selection">Server kiezen</string>
|
||||
<string name="login_current_server_hint">Huidige server</string>
|
||||
<string name="video_speed_075">0.75x</string>
|
||||
<string name="video_speed_125">1.25x</string>
|
||||
</resources>
|
@ -99,4 +99,6 @@
|
||||
<string name="video_meta_button_language">语言</string>
|
||||
<string name="server_selection_signup_allowed_yes">是</string>
|
||||
<string name="server_selection_signup_allowed_no">不</string>
|
||||
<string name="video_speed_075">0.75倍速</string>
|
||||
<string name="video_speed_125">1.25倍速</string>
|
||||
</resources>
|
@ -299,4 +299,6 @@
|
||||
<string name="server_selection_peertube_server_url">PeerTube 伺服器 URL</string>
|
||||
<string name="action_bar_title_server_selection">選取伺服器</string>
|
||||
<string name="login_current_server_hint">目前的伺服器</string>
|
||||
<string name="video_speed_125">1.25x</string>
|
||||
<string name="video_speed_075">0.75x</string>
|
||||
</resources>
|
@ -332,5 +332,7 @@
|
||||
<string name="video_rating_dislike" translatable="false">dislike</string>
|
||||
<string name="peertube_required_server_version" translatable="false">1.0.0-alpha.7</string>
|
||||
<string name="login_current_server_hint">Current Server</string>
|
||||
<string name="video_speed_075">0.75x</string>
|
||||
<string name="video_speed_125">1.25x</string>
|
||||
|
||||
</resources>
|
@ -7,7 +7,7 @@ buildscript {
|
||||
jcenter()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:3.6.3'
|
||||
classpath 'com.android.tools.build:gradle:4.0.0'
|
||||
|
||||
|
||||
// NOTE: Do not place your application dependencies here; they belong
|
||||
|
4
gradle/wrapper/gradle-wrapper.properties
vendored
4
gradle/wrapper/gradle-wrapper.properties
vendored
@ -1,6 +1,6 @@
|
||||
#Sat May 16 15:51:28 CEST 2020
|
||||
#Mon Jun 01 12:58:36 CEST 2020
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
|
||||
|
Loading…
Reference in New Issue
Block a user