Hide MXPlayer if not install.

pull/1/head
Cuke 4 years ago
parent e0596997da
commit a833a046b2
  1. 4
      app/src/main/java/com/github/tvbox/osc/base/BaseActivity.java
  2. 21
      app/src/main/java/com/github/tvbox/osc/player/controller/VodController.java
  3. 2
      app/src/main/java/com/github/tvbox/osc/player/thirdparty/MXPlayer.java

@ -163,12 +163,12 @@ public abstract class BaseActivity extends AppCompatActivity implements CustomAd
@Override
public float getSizeInDp() {
return 0;
return isBaseOnWidth() ? 1280 : 720;
}
@Override
public boolean isBaseOnWidth() {
return !(screenRatio >= 2.0f);
return !(screenRatio >= 4.0f);
}
}

@ -17,6 +17,7 @@ import com.github.tvbox.osc.R;
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;
@ -231,11 +232,18 @@ public class VodController extends BaseController {
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();
@ -331,9 +339,12 @@ public class VodController extends BaseController {
private JSONObject mPlayerConfig = null;
private boolean mxPlayerExist = false;
public void setPlayerConfig(JSONObject playerCfg) {
this.mPlayerConfig = playerCfg;
updatePlayerCfgView();
mxPlayerExist = MXPlayer.getMXPackageInfo() != null;
}
void updatePlayerCfgView() {

@ -141,7 +141,7 @@ public class MXPlayer {
/**
* @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);

Loading…
Cancel
Save