Skip to content

Commit

Permalink
Merge pull request CatVodTVOfficial#138 from CatVodTVOfficial/dev
Browse files Browse the repository at this point in the history
Hide MXPlayer if not install.
  • Loading branch information
lite-cucumber authored Jul 5, 2022
2 parents ba435d1 + a833a04 commit eb14864
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 8 deletions.
4 changes: 2 additions & 2 deletions app/src/main/java/com/github/tvbox/osc/base/BaseActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -163,12 +163,12 @@ protected String getAssetText(String fileName) {

@Override
public float getSizeInDp() {
return 0;
return isBaseOnWidth() ? 1280 : 720;
}

@Override
public boolean isBaseOnWidth() {
return !(screenRatio >= 2.0f);
return !(screenRatio >= 4.0f);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import com.github.tvbox.osc.api.ApiConfig;
import com.github.tvbox.osc.bean.IJKCode;
import com.github.tvbox.osc.bean.ParseBean;
import com.github.tvbox.osc.player.thirdparty.MXPlayer;
import com.github.tvbox.osc.ui.adapter.ParseAdapter;
import com.github.tvbox.osc.util.HawkConfig;
import com.github.tvbox.osc.util.PlayerHelper;
Expand Down Expand Up @@ -231,11 +232,18 @@ public void onClick(View view) {
public void onClick(View view) {
try {
int playerType = mPlayerConfig.getInt("pl");
playerType++;
if (playerType > 10)
playerType = 0;
if (playerType > 2)
playerType = 10;
boolean playerVail = false;
do {
playerType++;
if (playerType <= 2) {
playerVail = true;
} else if (playerType == 10) {
playerVail = mxPlayerExist;
} else if (playerType > 10) {
playerType = 0;
playerVail = true;
}
} while (!playerVail);
mPlayerConfig.put("pl", playerType);
updatePlayerCfgView();
listener.updatePlayerCfg();
Expand Down Expand Up @@ -331,9 +339,12 @@ public void showParse(boolean userJxList) {

private JSONObject mPlayerConfig = null;

private boolean mxPlayerExist = false;

public void setPlayerConfig(JSONObject playerCfg) {
this.mPlayerConfig = playerCfg;
updatePlayerCfgView();
mxPlayerExist = MXPlayer.getMXPackageInfo() != null;
}

void updatePlayerCfgView() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ private static class MXPackageInfo {
/**
* @return null if any MX Player packages not exist.
*/
private static MXPackageInfo getMXPackageInfo() {
public static MXPackageInfo getMXPackageInfo() {
for (MXPackageInfo pkg : PACKAGES) {
try {
ApplicationInfo info = App.getInstance().getPackageManager().getApplicationInfo(pkg.packageName, 0);
Expand Down

0 comments on commit eb14864

Please sign in to comment.