添加进度

This commit is contained in:
sifacaii 2022-08-24 21:25:16 +08:00
parent ba452b2962
commit 3cb9752483
5 changed files with 80 additions and 3 deletions

1
.idea/misc.xml generated
View File

@ -12,6 +12,7 @@
<entry key="..\:/code/VlcJellyfin/app/src/main/res/layout/popmenu.xml" value="0.14479166666666668" />
<entry key="..\:/code/VlcJellyfin/app/src/main/res/layout/popmenu_item.xml" value="0.14479166666666668" />
<entry key="..\:/work/VlcJellyfin/app/src/main/res/drawable/img_loading_placeholder.xml" value="0.1625" />
<entry key="..\:/work/VlcJellyfin/app/src/main/res/drawable/played_percentage.xml" value="0.1615" />
<entry key="..\:/work/VlcJellyfin/app/src/main/res/drawable/popmenu_focus.xml" value="0.1625" />
<entry key="..\:/work/VlcJellyfin/app/src/main/res/drawable/shape_user_focus.xml" value="0.1625" />
<entry key="..\:/work/VlcJellyfin/app/src/main/res/drawable/shape_user_focus_VH.xml" value="0.1625" />

View File

@ -6,6 +6,7 @@ import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.SeekBar;
import android.widget.TextView;
import androidx.annotation.NonNull;
@ -26,6 +27,7 @@ public class JAdapter extends RecyclerView.Adapter {
public String type;
public TextView tvName;
public ImageView tvCover;
public SeekBar tvPlayedPercentage;
public VH(View v) {
super(v);
@ -33,6 +35,7 @@ public class JAdapter extends RecyclerView.Adapter {
type = "";
tvName = v.findViewById(R.id.tvName);
tvCover = v.findViewById(R.id.ivThumb);
tvPlayedPercentage = v.findViewById(R.id.tvPlayedPercentage);
}
}
@ -62,9 +65,24 @@ public class JAdapter extends RecyclerView.Adapter {
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
VH v = (VH)holder;
JsonObject jo = items.get(position).getAsJsonObject();
String SeriesName = Utils.getJsonString(jo,"SeriesName").getAsString();
String SeasonName = Utils.getJsonString(jo,"SeasonName").getAsString();
String Name = Utils.getJsonString(jo,"Name").getAsString();
String itemid = jo.get("Id").getAsString();
v.id = itemid;
v.tvName.setText(" " + jo.get("Name").getAsString());
v.tvName.setText(" " + SeriesName + " " + SeasonName + " " + Name);
if(jo.has("UserData")){
JsonObject ujo = jo.get("UserData").getAsJsonObject();
if(ujo.has("PlayedPercentage")){
int pp = ujo.get("PlayedPercentage").getAsInt();
v.tvPlayedPercentage.setVisibility(View.VISIBLE);
v.tvPlayedPercentage.setMax(100);
v.tvPlayedPercentage.setProgress(pp);
}
}
if(jo.has("CollectionType")){
v.type = jo.get("CollectionType").getAsString();
}

View File

@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@android:id/background"
android:gravity="center_vertical|fill_horizontal">
<shape android:shape="rectangle">
<size android:height="2dp" />
<solid android:color="#00ffffff" />
<corners android:radius="2dp" />
</shape>
</item>
<item
android:id="@android:id/progress"
android:gravity="center_vertical|fill_horizontal">
<scale android:scaleWidth="100%">
<shape android:shape="rectangle">
<size android:height="2dp" />
<!--<solid android:color="#707d93" />-->
<gradient
android:angle="0"
android:endColor="#1890ff"
android:startColor="#1890ff" />
<corners android:radius="2dp" />
</shape>
</scale>
</item>
</layer-list>

View File

@ -34,6 +34,21 @@
android:padding="0dp"
android:gravity="center"
android:singleLine="true" />
</LinearLayout>
</FrameLayout>
<SeekBar
android:id="@+id/tvPlayedPercentage"
android:layout_width="match_parent"
android:layout_height="2dp"
android:max="100"
android:progress="0"
android:layout_gravity="bottom"
android:paddingEnd="0dp"
android:paddingStart="0dp"
android:thumb="@null"
android:progressDrawable="@drawable/played_percentage"
android:visibility="gone"/>
</FrameLayout>

View File

@ -17,13 +17,13 @@
android:padding="0dp"
android:scaleType="fitXY" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:background="@color/color_99000000"
android:padding="1dp">
android:padding="1dp"
android:orientation="vertical">
<TextView
android:id="@+id/tvName"
@ -34,6 +34,22 @@
android:padding="0dp"
android:gravity="center"
android:singleLine="true" />
</LinearLayout>
</FrameLayout>
<SeekBar
android:id="@+id/tvPlayedPercentage"
android:layout_width="match_parent"
android:layout_height="2dp"
android:max="100"
android:progress="0"
android:layout_gravity="bottom"
android:paddingEnd="0dp"
android:paddingStart="0dp"
android:thumb="@null"
android:progressDrawable="@drawable/played_percentage"
android:visibility="gone"/>
</FrameLayout>