fongmi
FongMi 6 days ago
parent a65f28ae7e
commit 97ace97208
  1. 2
      app/src/leanback/java/com/fongmi/android/tv/ui/activity/VideoActivity.java
  2. 4
      app/src/main/java/com/fongmi/android/tv/bean/Episode.java
  3. 2
      app/src/mobile/java/com/fongmi/android/tv/ui/activity/VideoActivity.java
  4. 8
      chaquo/src/main/java/com/fongmi/chaquo/Platform.java
  5. 8
      quickjs/src/main/java/com/fongmi/quickjs/method/Global.java
  6. 22
      quickjs/src/main/java/com/fongmi/quickjs/utils/Async.java

@ -1159,7 +1159,7 @@ public class VideoActivity extends BaseActivity implements CustomKeyDownVod.List
private void setMetadata() {
String title = mHistory.getVodName();
String episode = getEpisode().getName();
boolean empty = title.equals(episode) || episode == null;
boolean empty = episode.isEmpty() || title.equals(episode);
String artist = empty ? "" : getString(R.string.play_now, episode);
mPlayers.setMetadata(title, artist, mHistory.getVodPic());
}

@ -97,8 +97,8 @@ public class Episode implements Parcelable, Diffable<Episode> {
public int getScore(String name, int number) {
if (getName().equalsIgnoreCase(name)) return 100;
if (number != -1 && getNumber() == number) return 80;
if (number == -1 && getName().toLowerCase().contains(name.toLowerCase())) return 70;
if (number == -1 && name.toLowerCase().contains(getName().toLowerCase())) return 60;
if (number == -1 && !name.isEmpty() && getName().toLowerCase().contains(name.toLowerCase())) return 70;
if (number == -1 && !getName().isEmpty() && name.toLowerCase().contains(getName().toLowerCase())) return 60;
return 0;
}

@ -1302,7 +1302,7 @@ public class VideoActivity extends BaseActivity implements Clock.Callback, Custo
private void setMetadata() {
String title = mHistory.getVodName();
String episode = getEpisode().getName();
boolean empty = title.equals(episode) || episode == null;
boolean empty = episode.isEmpty() || title.equals(episode);
String artist = empty ? "" : getString(R.string.play_now, episode);
mPlayers.setMetadata(title, artist, mHistory.getVodPic());
}

@ -40,10 +40,6 @@ public class Platform extends Python.Platform {
private final Context context;
private String ABI;
public static Platform create() {
return new Platform();
}
public Platform() {
this.context = Init.context();
this.sp = context.getSharedPreferences(Common.ASSET_DIR, Context.MODE_PRIVATE);
@ -69,6 +65,10 @@ public class Platform extends Python.Platform {
if (ABI == null) throw new RuntimeException("No supported ABI found in: " + supportedAbis);
}
public static Platform create() {
return new Platform();
}
@Override
public @NotNull String getPath() {
String assetDir = new File(context.getFilesDir(), Common.ASSET_DIR).getAbsolutePath();

@ -32,10 +32,6 @@ public class Global {
private final QuickJSContext ctx;
private final Timer timer;
public static Global create(QuickJSContext ctx, ExecutorService executor) {
return new Global(ctx, executor);
}
private Global(QuickJSContext ctx, ExecutorService executor) {
this.executor = executor;
this.timer = new Timer();
@ -43,6 +39,10 @@ public class Global {
setProperty();
}
public static Global create(QuickJSContext ctx, ExecutorService executor) {
return new Global(ctx, executor);
}
private void setProperty() {
for (Method method : getClass().getMethods()) {
if (!method.isAnnotationPresent(JSMethod.class)) continue;

@ -10,6 +10,17 @@ public class Async {
private CompletableFuture<Object> future;
private final JSCallFunction success = args -> {
future.complete(args != null && args.length > 0 ? args[0] : null);
return null;
};
private final JSCallFunction error = args -> {
String msg = args != null && args.length > 0 && args[0] != null ? args[0].toString() : "";
future.completeExceptionally(new Exception(msg));
return null;
};
private Async() {
this.future = new CompletableFuture<>();
}
@ -61,15 +72,4 @@ public class Async {
}
}
private final JSCallFunction success = args -> {
future.complete(args != null && args.length > 0 ? args[0] : null);
return null;
};
private final JSCallFunction error = args -> {
String msg = args != null && args.length > 0 && args[0] != null ? args[0].toString() : "";
future.completeExceptionally(new Exception(msg));
return null;
};
}

Loading…
Cancel
Save