mirror of
https://github.com/sifacaii/VlcJellyfin
synced 2025-06-03 00:58:06 -04:00
优化详情页
This commit is contained in:
parent
691d1132dd
commit
3730f712ab
@ -107,7 +107,7 @@ public class DetailActivity extends BaseActivity implements JAdapter.OnItemClick
|
|||||||
String Genres = String.join(",", details.getGenres());
|
String Genres = String.join(",", details.getGenres());
|
||||||
|
|
||||||
tvTitle.setText(Name);
|
tvTitle.setText(Name);
|
||||||
tvDetails.append(details.getProductionYear().equals("") ? "" : "年份:" + details.getProductionYear() + " ");
|
tvDetails.append(details.getProductionYear() == null ? "" : "年份:" + details.getProductionYear() + " ");
|
||||||
tvDetails.append(Genres.equals("") ? "" : "风格:" + Genres + "\n");
|
tvDetails.append(Genres.equals("") ? "" : "风格:" + Genres + "\n");
|
||||||
tvDetails.append(details.getCommunityRating() == null ? "" : "评分:" + details.getCommunityRating() + " ");
|
tvDetails.append(details.getCommunityRating() == null ? "" : "评分:" + details.getCommunityRating() + " ");
|
||||||
tvDetails.append(details.getOfficialRating() == null ? "" : "评级:" + details.getOfficialRating() + "\n");
|
tvDetails.append(details.getOfficialRating() == null ? "" : "评级:" + details.getOfficialRating() + "\n");
|
||||||
@ -133,8 +133,8 @@ public class DetailActivity extends BaseActivity implements JAdapter.OnItemClick
|
|||||||
tvDetails.append(audio.equals("") ? "" : "音频:" + audio + "\n");
|
tvDetails.append(audio.equals("") ? "" : "音频:" + audio + "\n");
|
||||||
tvDetails.append(subtitle.equals("") ? "" : "字幕:" + subtitle + "\n");
|
tvDetails.append(subtitle.equals("") ? "" : "字幕:" + subtitle + "\n");
|
||||||
}
|
}
|
||||||
|
String overview = details.getOverview() == null ? "" : details.getOverview();
|
||||||
tvDetails.append("简介: " + Html.fromHtml(details.getOverview()));
|
tvDetails.append("简介: " + Html.fromHtml(overview));
|
||||||
|
|
||||||
//填充列表
|
//填充列表
|
||||||
String type = details.getType();
|
String type = details.getType();
|
||||||
@ -150,10 +150,8 @@ public class DetailActivity extends BaseActivity implements JAdapter.OnItemClick
|
|||||||
} else if (type.equals("Movie")) {
|
} else if (type.equals("Movie")) {
|
||||||
fillMovie(details);
|
fillMovie(details);
|
||||||
} else if (type.equals("Person")) {
|
} else if (type.equals("Person")) {
|
||||||
String ProductionLocations = details.getProductionLocations().toString();
|
tvDetails.append("\n出生日期:" + Utils.UtcToLocal(details.getPremiereDate()) + "\n");
|
||||||
String PremiereDate = String.join(",", details.getPremiereDate());
|
tvDetails.append("出生地:" + String.join(",",details.getProductionLocations()));
|
||||||
tvDetails.append("\n出生日期:" + Utils.UtcToLocal(PremiereDate) + "\n");
|
|
||||||
tvDetails.append("出生地:" + (ProductionLocations == null ? "" : ProductionLocations));
|
|
||||||
fillItemsByPerson(Id);
|
fillItemsByPerson(Id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,43 +39,38 @@ public class HomeActivity extends BaseActivity{
|
|||||||
|
|
||||||
JfClient.init(getApplication());
|
JfClient.init(getApplication());
|
||||||
|
|
||||||
Log.d(TAG, "onCreate: " + JfClient.config.getJellyfinUrl());
|
|
||||||
if (JfClient.AccessToken.equals("") || JfClient.UserId.equals("")) {
|
if (JfClient.AccessToken.equals("") || JfClient.UserId.equals("")) {
|
||||||
showLoadingDialog("正在验证服务器地址!");
|
showLoadingDialog("正在验证服务器地址!");
|
||||||
JfClient.VerityServerUrl(JfClient.config.getJellyfinUrl(), new JfClient.JJCallBack() {
|
JfClient.VerityServerUrl(JfClient.config.getJellyfinUrl(), new JfClient.JJCallBack() {
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(Boolean bool) {
|
public void onSuccess(Boolean bool) {
|
||||||
dismissLoadingDialog();
|
setLoadingText("正在验证用户名和密码!");
|
||||||
if(bool){
|
|
||||||
showLoadingDialog("正在验证用户名和密码!");
|
|
||||||
JfClient.AuthenticateByName(JfClient.config.getUserName(), JfClient.config.getPassWord(), new JfClient.JJCallBack() {
|
JfClient.AuthenticateByName(JfClient.config.getUserName(), JfClient.config.getPassWord(), new JfClient.JJCallBack() {
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(Boolean bool) {
|
public void onSuccess(Boolean bool) {
|
||||||
dismissLoadingDialog();
|
dismissLoadingDialog();
|
||||||
if(bool){
|
initView();
|
||||||
initView(); //加载首页
|
}
|
||||||
}else{
|
}, connErr, false);
|
||||||
showLoginDialog();
|
}
|
||||||
|
}, connErr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},null,false);
|
|
||||||
}else{
|
private JfClient.JJCallBack connErr = new JfClient.JJCallBack() {
|
||||||
ShowToask("服务器地址不正确!");
|
|
||||||
showLoginDialog();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},new JfClient.JJCallBack(){
|
|
||||||
@Override
|
@Override
|
||||||
public void onError(String str) {
|
public void onError(String str) {
|
||||||
dismissLoadingDialog();
|
dismissLoadingDialog();
|
||||||
ShowToask("服务器连接失败!");
|
ShowToask(str);
|
||||||
showLoginDialog();
|
showLoginDialog();
|
||||||
}
|
}
|
||||||
});
|
};
|
||||||
}else{
|
|
||||||
|
@Override
|
||||||
|
protected void onResume() {
|
||||||
|
super.onResume();
|
||||||
initView();
|
initView();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private void showLoginDialog() {
|
private void showLoginDialog() {
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||||
@ -106,24 +101,22 @@ public class HomeActivity extends BaseActivity{
|
|||||||
JfClient.VerityServerUrl(urlbox.getText().toString(), new JfClient.JJCallBack() {
|
JfClient.VerityServerUrl(urlbox.getText().toString(), new JfClient.JJCallBack() {
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(Boolean bool) {
|
public void onSuccess(Boolean bool) {
|
||||||
dismissLoadingDialog();
|
setLoadingText("正在验证用户名和密码!");
|
||||||
if(bool){
|
|
||||||
showLoadingDialog("正在验证用户名和密码!");
|
|
||||||
JfClient.AuthenticateByName(unbox.getText().toString(), pwbox.getText().toString(), new JfClient.JJCallBack() {
|
JfClient.AuthenticateByName(unbox.getText().toString(), pwbox.getText().toString(), new JfClient.JJCallBack() {
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(Boolean bool) {
|
public void onSuccess(Boolean bool) {
|
||||||
dismissLoadingDialog();
|
dismissLoadingDialog();
|
||||||
if(bool){
|
|
||||||
alert.dismiss();
|
alert.dismiss();
|
||||||
initView(); //加载首页
|
initView(); //加载首页
|
||||||
}else{
|
|
||||||
ShowToask("用户名密码不正确!");
|
|
||||||
}
|
}
|
||||||
|
}, new JfClient.JJCallBack(){
|
||||||
|
@Override
|
||||||
|
public void onError(String str) {
|
||||||
|
dismissLoadingDialog();
|
||||||
|
ShowToask("用户名密码验证失败!");
|
||||||
}
|
}
|
||||||
},null,saveBox.isChecked());
|
}, saveBox.isChecked());
|
||||||
}else{
|
|
||||||
ShowToask("服务器地址不正确!");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}, new JfClient.JJCallBack() {
|
}, new JfClient.JJCallBack() {
|
||||||
@Override
|
@Override
|
||||||
@ -207,6 +200,7 @@ public class HomeActivity extends BaseActivity{
|
|||||||
}
|
}
|
||||||
|
|
||||||
private long exitTime = 0;
|
private long exitTime = 0;
|
||||||
|
|
||||||
public void exit() {
|
public void exit() {
|
||||||
if ((System.currentTimeMillis() - exitTime) > 2000) {
|
if ((System.currentTimeMillis() - exitTime) > 2000) {
|
||||||
Toast.makeText(getApplicationContext(), "再按一次退出程序",
|
Toast.makeText(getApplicationContext(), "再按一次退出程序",
|
||||||
|
@ -411,8 +411,8 @@ public class JfClient {
|
|||||||
SendPost(url, reqjson, new JJCallBack() {
|
SendPost(url, reqjson, new JJCallBack() {
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(String str) {
|
public void onSuccess(String str) {
|
||||||
|
try {
|
||||||
JsonObject userObj = new Gson().fromJson(str, JsonObject.class);
|
JsonObject userObj = new Gson().fromJson(str, JsonObject.class);
|
||||||
if (userObj != null) {
|
|
||||||
if (userObj.has("User") && userObj.has("AccessToken")) {
|
if (userObj.has("User") && userObj.has("AccessToken")) {
|
||||||
String userId = userObj.get("User").getAsJsonObject().get("Id").getAsString();
|
String userId = userObj.get("User").getAsJsonObject().get("Id").getAsString();
|
||||||
String Token = userObj.get("AccessToken").getAsString();
|
String Token = userObj.get("AccessToken").getAsString();
|
||||||
@ -426,13 +426,13 @@ public class JfClient {
|
|||||||
SetHeaders();
|
SetHeaders();
|
||||||
cb.onSuccess(true);
|
cb.onSuccess(true);
|
||||||
} else {
|
} else {
|
||||||
cb.onSuccess(false);
|
err.onError("验证失败:" + str);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
err.onError("验证失败:" + str);
|
err.onError("验证失败:" + str);
|
||||||
}
|
}
|
||||||
} else {
|
} catch (Exception e) {
|
||||||
cb.onSuccess(false);
|
err.onError("验证失败:" + e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, err);
|
}, err);
|
||||||
@ -466,25 +466,24 @@ public class JfClient {
|
|||||||
SendGet(url + "/system/info/public", new JJCallBack() {
|
SendGet(url + "/system/info/public", new JJCallBack() {
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(String str) {
|
public void onSuccess(String str) {
|
||||||
|
try {
|
||||||
JsonObject serverInfo = new Gson().fromJson(str, JsonObject.class);
|
JsonObject serverInfo = new Gson().fromJson(str, JsonObject.class);
|
||||||
Log.d(TAG, "onSuccess: " + str);
|
|
||||||
String ServerId = "";
|
String ServerId = "";
|
||||||
if (serverInfo.has("Id")) {
|
|
||||||
ServerId = serverInfo.get("Id").getAsString();
|
ServerId = serverInfo.get("Id").getAsString();
|
||||||
if (ServerId == null || ServerId.length() == 0) {
|
if (ServerId == null || ServerId.length() == 0) {
|
||||||
cb.onSuccess(false);
|
err.onError("服务器连接失败!");
|
||||||
} else {
|
} else {
|
||||||
config.setJellyfinUrl(url);
|
config.setJellyfinUrl(url);
|
||||||
cb.onSuccess(true);
|
cb.onSuccess(true);
|
||||||
}
|
}
|
||||||
} else {
|
} catch (Exception e) {
|
||||||
err.onError("联系服务器失败!");
|
err.onError(e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, err);
|
}, err);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
cb.onSuccess(false);
|
err.onError("服务器地址不能为空!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,6 +45,7 @@ public class Utils {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static String UtcToLocal(String utcTime) {
|
public static String UtcToLocal(String utcTime) {
|
||||||
|
if(utcTime == null || utcTime.length() == 0) return "";
|
||||||
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSSSSS'Z'");
|
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSSSSS'Z'");
|
||||||
df.setTimeZone(TimeZone.getTimeZone("UTC"));
|
df.setTimeZone(TimeZone.getTimeZone("UTC"));
|
||||||
String dt = "";
|
String dt = "";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user