Market support copy
This commit is contained in:
parent
0ea8f7ca75
commit
26ea3d91e1
|
|
@ -13,9 +13,15 @@ public class Item {
|
|||
private String url;
|
||||
@SerializedName("icon")
|
||||
private String icon;
|
||||
@SerializedName("copy")
|
||||
private String copy;
|
||||
@SerializedName("version")
|
||||
private String version;
|
||||
|
||||
public Item(String url) {
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return TextUtils.isEmpty(name) ? "" : name;
|
||||
}
|
||||
|
|
@ -28,6 +34,10 @@ public class Item {
|
|||
return TextUtils.isEmpty(icon) ? "" : icon;
|
||||
}
|
||||
|
||||
public String getCopy() {
|
||||
return TextUtils.isEmpty(copy) ? "" : copy;
|
||||
}
|
||||
|
||||
public String getVersion() {
|
||||
return TextUtils.isEmpty(version) ? "" : version;
|
||||
}
|
||||
|
|
@ -35,4 +45,12 @@ public class Item {
|
|||
public Vod vod() {
|
||||
return new Vod(getUrl(), getName(), getIcon(), getVersion(), Vod.Style.rect(1.0f));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) return true;
|
||||
if (!(obj instanceof Item)) return false;
|
||||
Item it = (Item) obj;
|
||||
return getUrl().equals(it.getUrl());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ import com.github.catvod.bean.Class;
|
|||
import com.github.catvod.bean.Result;
|
||||
import com.github.catvod.bean.Vod;
|
||||
import com.github.catvod.bean.market.Data;
|
||||
import com.github.catvod.bean.market.Item;
|
||||
import com.github.catvod.crawler.Spider;
|
||||
import com.github.catvod.net.OkHttp;
|
||||
import com.github.catvod.utils.FileUtil;
|
||||
|
|
@ -100,6 +101,7 @@ public class Market extends Spider {
|
|||
if (file.getName().endsWith(".zip")) FileUtil.unzip(file, Path.download());
|
||||
if (file.getName().endsWith(".apk")) FileUtil.openFile(Path.chmod(file));
|
||||
else Utils.notify("下載完成");
|
||||
checkCopy(url);
|
||||
dismiss();
|
||||
} catch (Exception e) {
|
||||
Utils.notify(e.getMessage());
|
||||
|
|
@ -121,6 +123,16 @@ public class Market extends Spider {
|
|||
}
|
||||
}
|
||||
|
||||
private void checkCopy(String url) {
|
||||
for (Data data : datas) {
|
||||
int index = data.getList().indexOf(new Item(url));
|
||||
if (index != -1) {
|
||||
String text = data.getList().get(index).getCopy();
|
||||
if (!text.isEmpty()) Utils.copy(text);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void setDialog() {
|
||||
Init.run(() -> {
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,8 @@
|
|||
package com.github.catvod.utils;
|
||||
|
||||
import android.content.ClipData;
|
||||
import android.content.ClipboardManager;
|
||||
import android.content.Context;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.util.DisplayMetrics;
|
||||
|
|
@ -152,6 +155,12 @@ public class Utils {
|
|||
return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dp, getDisplayMetrics());
|
||||
}
|
||||
|
||||
public static void copy(String text) {
|
||||
ClipboardManager clipboard = (ClipboardManager) Init.context().getSystemService(Context.CLIPBOARD_SERVICE);
|
||||
ClipData clip = ClipData.newPlainText("fongmi", text);
|
||||
clipboard.setPrimaryClip(clip);
|
||||
}
|
||||
|
||||
public static void loadUrl(WebView webView, String script) {
|
||||
loadUrl(webView, script, null);
|
||||
}
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -1 +1 @@
|
|||
9cc15b83a755468e6b725667ef362a04
|
||||
a8d5d275bb8703210af343b98eda5f6d
|
||||
|
|
|
|||
Loading…
Reference in New Issue