Fix spider has md5 problem

pull/21/head
FongMi 4 years ago
parent 14a60d4c5f
commit 3d4140d6d9
  1. 6
      app/src/main/AndroidManifest.xml
  2. 1
      app/src/main/java/com/fongmi/bear/ApiConfig.java
  3. 12
      app/src/main/java/com/fongmi/bear/impl/KeyDownImpl.java
  4. 3
      app/src/main/java/com/fongmi/bear/ui/activity/DetailActivity.java
  5. 31
      app/src/main/java/com/fongmi/bear/utils/KeyDown.java

@ -4,10 +4,14 @@
package="com.fongmi.bear">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" tools:ignore="ScopedStorage" />
<uses-permission
android:name="android.permission.MANAGE_EXTERNAL_STORAGE"
tools:ignore="ScopedStorage" />
<uses-feature
android:name="android.hardware.touchscreen"

@ -131,6 +131,7 @@ public class ApiConfig {
}
private void parseJar(String spider) throws Exception {
if (spider.contains(";md5")) spider = spider.split(";md5")[0];
if (spider.startsWith("file://")) {
loader.load(FileUtil.getLocal(spider));
} else if (Patterns.WEB_URL.matcher(spider).matches()) {

@ -1,12 +0,0 @@
package com.fongmi.bear.impl;
public interface KeyDownImpl {
void onSeeking(int time);
void onSeekTo(int time);
void onKeyDown();
void onKeyCenter();
}

@ -25,7 +25,6 @@ import com.fongmi.bear.bean.Vod;
import com.fongmi.bear.databinding.ActivityDetailBinding;
import com.fongmi.bear.databinding.ViewControllerBottomBinding;
import com.fongmi.bear.event.PlayerEvent;
import com.fongmi.bear.impl.KeyDownImpl;
import com.fongmi.bear.model.SiteViewModel;
import com.fongmi.bear.player.Players;
import com.fongmi.bear.ui.presenter.EpisodePresenter;
@ -44,7 +43,7 @@ import org.greenrobot.eventbus.ThreadMode;
import java.util.ArrayList;
import java.util.List;
public class DetailActivity extends BaseActivity implements KeyDownImpl {
public class DetailActivity extends BaseActivity implements KeyDown.Listener {
private ViewControllerBottomBinding mControl;
private ViewGroup.LayoutParams mFrameParams;

@ -2,32 +2,30 @@ package com.fongmi.bear.utils;
import android.view.KeyEvent;
import com.fongmi.bear.impl.KeyDownImpl;
public class KeyDown {
private final KeyDownImpl mKeyDown;
private final Listener mListener;
private int mHoldTime;
public static KeyDown create(KeyDownImpl keyDown) {
return new KeyDown(keyDown);
public static KeyDown create(Listener listener) {
return new KeyDown(listener);
}
private KeyDown(KeyDownImpl keyDown) {
this.mKeyDown = keyDown;
private KeyDown(Listener listener) {
this.mListener = listener;
}
public boolean onKeyDown(KeyEvent event) {
boolean isLeft = isLeftKey(event);
boolean isRight = isRightKey(event);
if (event.getAction() == KeyEvent.ACTION_DOWN && (isLeft || isRight)) {
mKeyDown.onSeeking(isRight ? addTime() : subTime());
mListener.onSeeking(isRight ? addTime() : subTime());
} else if (event.getAction() == KeyEvent.ACTION_UP && (isLeft || isRight)) {
mKeyDown.onSeekTo(mHoldTime);
mListener.onSeekTo(mHoldTime);
} else if (event.getAction() == KeyEvent.ACTION_UP && isDownKey(event)) {
mKeyDown.onKeyDown();
mListener.onKeyDown();
} else if (event.getAction() == KeyEvent.ACTION_UP && isEnterKey(event)) {
mKeyDown.onKeyCenter();
mListener.onKeyCenter();
}
return true;
}
@ -67,4 +65,15 @@ public class KeyDown {
private boolean isRightKey(KeyEvent event) {
return event.getKeyCode() == KeyEvent.KEYCODE_DPAD_RIGHT;
}
public interface Listener {
void onSeeking(int time);
void onSeekTo(int time);
void onKeyDown();
void onKeyCenter();
}
}

Loading…
Cancel
Save