优化详情页

This commit is contained in:
sifacaii 2022-09-01 12:58:52 +08:00
parent 6a9152c773
commit 5871727d7f
3 changed files with 11 additions and 9 deletions

View File

@ -97,10 +97,7 @@ public class DetailActivity extends BaseActivity implements JAdapter.OnItemClick
.error(R.drawable.img_loading_placeholder)
.into(tvCover);
Log.d(TAG, "fillDetails: " + detailObj.toString());
JsonElement genres = JfClient.jeFromGson(detailObj, "Genres");
List<String> fg = new Gson().fromJson(genres,List.class);
String Genres = (genres == null ? "" : String.join(",",fg));
String Genres = JfClient.strFromGson(detailObj, "Genres");
String OfficialRating = JfClient.strFromGson(detailObj, "OfficialRating");
String CommunityRating = JfClient.strFromGson(detailObj, "CommunityRating");
String ProductionYear = JfClient.strFromGson(detailObj, "ProductionYear");
@ -153,10 +150,10 @@ public class DetailActivity extends BaseActivity implements JAdapter.OnItemClick
} else if (type.equals("Movie")) {
fillMovie(detailObj);
} else if (type.equals("Person")){
JsonElement ProductionLocations = JfClient.jeFromGson(detailObj,"ProductionLocations");
String ProductionLocations = JfClient.strFromGson(detailObj,"ProductionLocations");
String PremiereDate = JfClient.strFromGson(detailObj,"PremiereDate");
tvDetails.append("\n出生日期" + Utils.UtcToLocal(PremiereDate)+"\n");
tvDetails.append("出生地:" + (ProductionLocations == null ? "" : ProductionLocations.getAsString()));
tvDetails.append("出生地:" + (ProductionLocations == null ? "" : ProductionLocations));
fillItemsByPerson(Id);
}
@ -306,6 +303,7 @@ public class DetailActivity extends BaseActivity implements JAdapter.OnItemClick
@Override
public void onClick(JsonObject jo) {
Log.d(TAG, "onClick: " + jo);
String itemId = jo.get("Id").getAsString();
String type = jo.get("Type").getAsString();
Intent intent = null;

View File

@ -19,6 +19,7 @@ import com.lzy.okgo.model.Response;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Timer;
import java.util.concurrent.TimeUnit;
@ -571,6 +572,10 @@ public class JfClient {
if (jo == null) {
return "";
} else {
if(jo.getClass() == JsonArray.class){
List<String> list = new Gson().fromJson(jo,List.class);
return String.join(",",list);
}
return jo.getAsString();
}
}

View File

@ -51,7 +51,7 @@
android:id="@+id/tvDetails"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="260dp"
android:minHeight="200dp"
android:layout_marginTop="20dp"
android:textSize="20dp" />
@ -78,7 +78,6 @@
android:id="@+id/mGridView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:clipChildren="false"
android:clipToPadding="false"
android:focusable="false"
@ -97,6 +96,7 @@
android:id="@+id/tvPersonLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:visibility="gone" >
<TextView
@ -109,7 +109,6 @@
android:id="@+id/mPersonGridView"
android:layout_width="match_parent"
android:layout_height="312dp"
android:layout_marginTop="30dp"
android:clipChildren="false"
android:clipToPadding="false"
android:focusable="false"