|
|
@@ -14,6 +14,7 @@ import android.view.View;
|
|
|
import android.widget.ArrayAdapter;
|
|
|
import android.widget.TextView;
|
|
|
|
|
|
+import com.sheep.gamegroup.model.entity.CreditCard;
|
|
|
import com.sheep.gamegroup.model.entity.TaskEty;
|
|
|
import com.sheep.jiuyan.samllsheep.BuildConfig;
|
|
|
import com.sheep.jiuyan.samllsheep.SheepApp;
|
|
|
@@ -40,7 +41,7 @@ public class TestUtil {
|
|
|
|
|
|
@Override
|
|
|
public void onClick(DialogInterface dialog, int which) {
|
|
|
- switch (items[which]){
|
|
|
+ switch (items[which]) {
|
|
|
case "复制下载地址":
|
|
|
debugCopy(context, taskEty);
|
|
|
break;
|
|
|
@@ -61,7 +62,7 @@ public class TestUtil {
|
|
|
|
|
|
private static void debugCopy(final Context context, final TaskEty taskEty) {
|
|
|
ClipboardManager clipboardManager = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
|
|
|
- if(clipboardManager != null && !TextUtils.isEmpty(taskEty.getDownload_link())) {
|
|
|
+ if (clipboardManager != null && !TextUtils.isEmpty(taskEty.getDownload_link())) {
|
|
|
//创建ClipData对象
|
|
|
ClipData clipData = ClipData.newPlainText("sheep text copy", taskEty.getDownload_link());
|
|
|
//添加ClipData对象到剪切板中
|
|
|
@@ -71,7 +72,7 @@ public class TestUtil {
|
|
|
}
|
|
|
|
|
|
private static void debugSysDownload(final Context context, TaskEty taskEty) {
|
|
|
- sysDownload(context, taskEty.getDownload_link(), taskEty.getTask_name(), "下载小绵羊任务中的apk:"+taskEty.getPackage_names(), taskEty.getPackage_names()+".apk", "系统开始下载apk");
|
|
|
+ sysDownload(context, taskEty.getDownload_link(), taskEty.getTask_name(), "下载小绵羊任务中的apk:" + taskEty.getPackage_names(), taskEty.getPackage_names() + ".apk", "系统开始下载apk");
|
|
|
}
|
|
|
|
|
|
public static void sysDownload(final Context context, String downloadLink, String title, String description, String fileName, String toast) {
|
|
|
@@ -101,7 +102,7 @@ public class TestUtil {
|
|
|
|
|
|
// 添加请求头
|
|
|
// request.addRequestHeader("User-Agent", "Chrome Mozilla/5.0");
|
|
|
- if(fileName != null) {
|
|
|
+ if (fileName != null) {
|
|
|
// 设置下载文件的保存位置
|
|
|
File saveFile = new File(DIR, fileName);
|
|
|
request.setDestinationUri(Uri.fromFile(saveFile));
|
|
|
@@ -111,18 +112,20 @@ public class TestUtil {
|
|
|
* 2. 获取下载管理器服务的实例, 添加下载任务
|
|
|
*/
|
|
|
DownloadManager manager = (DownloadManager) context.getSystemService(Context.DOWNLOAD_SERVICE);
|
|
|
- if(manager != null) {
|
|
|
+ if (manager != null) {
|
|
|
// 将下载请求加入下载队列, 返回一个下载ID
|
|
|
long downloadId = manager.enqueue(request);
|
|
|
- if(toast != null)
|
|
|
+ if (toast != null)
|
|
|
G.showToast(toast);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
private static void debugWebDownload(final Context context, final TaskEty taskEty) {
|
|
|
webDownload(context, taskEty.getDownload_link());
|
|
|
}
|
|
|
+
|
|
|
public static void webDownload(final Context context, String downloadLink) {
|
|
|
- if(context instanceof Activity) {
|
|
|
+ if (context instanceof Activity) {
|
|
|
Intent intent = new Intent();
|
|
|
intent.setAction(Intent.ACTION_VIEW);
|
|
|
intent.addCategory(Intent.CATEGORY_BROWSABLE);
|
|
|
@@ -132,8 +135,8 @@ public class TestUtil {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public static void testChange(final Activity activity, TextView test_change){
|
|
|
- if(BuildConfig.DEBUG || !"sheep".equals(BuildConfig.FLAVOR)){
|
|
|
+ public static void testChange(final Activity activity, TextView test_change) {
|
|
|
+ if (BuildConfig.DEBUG || !"sheep".equals(BuildConfig.FLAVOR)) {
|
|
|
test_change.setVisibility(View.VISIBLE);
|
|
|
test_change.setText(SheepApp.getInstance().getConnectAddress().getName());
|
|
|
test_change.setOnClickListener(new View.OnClickListener() {
|
|
|
@@ -141,7 +144,7 @@ public class TestUtil {
|
|
|
public void onClick(View view) {
|
|
|
final ConnectAddress[] connectAddresses = ConnectAddress.values();
|
|
|
AlertDialog dialog = new AlertDialog.Builder(activity).setTitle("请选择要切换的服务器")
|
|
|
- .setSingleChoiceItems(new ArrayAdapter<>(activity, android.R.layout.simple_list_item_single_choice, connectAddresses), SheepApp.getInstance().getConnectAddress().ordinal(), new DialogInterface.OnClickListener(){
|
|
|
+ .setSingleChoiceItems(new ArrayAdapter<>(activity, android.R.layout.simple_list_item_single_choice, connectAddresses), SheepApp.getInstance().getConnectAddress().ordinal(), new DialogInterface.OnClickListener() {
|
|
|
|
|
|
@Override
|
|
|
public void onClick(DialogInterface dialogInterface, int which) {
|
|
|
@@ -155,7 +158,42 @@ public class TestUtil {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public static void test(Activity activity) {
|
|
|
- ClassFileHelper.getInstance().clearDir();
|
|
|
+ /**
|
|
|
+ * 交通
|
|
|
+ http://mobi.yixiaozhao.jiyuonline.com/bank/10
|
|
|
+ http://10.8.210.172:8095/BCM_Insert.js
|
|
|
+
|
|
|
+ 浦发
|
|
|
+ https://ecentre.spdbccc.com.cn/creditcard/indexActivity.htm?data=P754372&itemcode=2017000032
|
|
|
+ http://10.8.210.172:8095/SPDB_Insert.js
|
|
|
+
|
|
|
+ * @param activity
|
|
|
+ */
|
|
|
+ public static void test(final Activity activity) {
|
|
|
+ final String[] items = {"交通银行信用卡测试", "浦发银行信用卡测试"};
|
|
|
+ AlertDialog dialog = new AlertDialog.Builder(activity).setTitle("请选择要测试的信用卡")
|
|
|
+ .setItems(items, new DialogInterface.OnClickListener() {
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onClick(DialogInterface dialog, int which) {
|
|
|
+ CreditCard creditCard = new CreditCard();
|
|
|
+ creditCard.setCardName(items[which]);
|
|
|
+ switch (items[which]) {
|
|
|
+ case "交通银行信用卡测试":
|
|
|
+ creditCard.setName("交通银行信用卡");
|
|
|
+// creditCard.setLoadUrl("http://mobi.yixiaozhao.jiyuonline.com/bank/10");
|
|
|
+ creditCard.setLoadUrl("https://creditcardapp.bankcomm.com/applynew/front/apply/campus/index.html?trackCode=A021316596752");
|
|
|
+ creditCard.setScriptUrl("http://10.8.210.172:8095/BCM_Insert.js");
|
|
|
+ break;
|
|
|
+ case "浦发银行信用卡测试":
|
|
|
+ creditCard.setName("浦发银行信用卡");
|
|
|
+ creditCard.setLoadUrl("https://ecentre.spdbccc.com.cn/creditcard/indexActivity.htm?data=P754372&itemcode=2017000032");
|
|
|
+ creditCard.setScriptUrl("http://10.8.210.172:8095/SPDB_Insert.js");
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ Jump2View.getInstance().goCreditCardWeb(activity, creditCard);
|
|
|
+ }
|
|
|
+ }).create();
|
|
|
+ dialog.show();
|
|
|
}
|
|
|
-}
|
|
|
+}
|