Commit 1b98a75e authored by liuyang's avatar liuyang

APK图片抓取识别及轮播流地址抓取,状态显示

#BYLSERVER-1438
parent 8b713673
...@@ -6,6 +6,7 @@ import org.json.JSONArray ...@@ -6,6 +6,7 @@ import org.json.JSONArray
import org.json.JSONObject import org.json.JSONObject
class ApkInfo: IModel { class ApkInfo: IModel {
lateinit var name: String
//包名 //包名
lateinit var packageName: String lateinit var packageName: String
//启动apk配置信息 //启动apk配置信息
...@@ -28,6 +29,7 @@ class ApkInfo: IModel { ...@@ -28,6 +29,7 @@ class ApkInfo: IModel {
lateinit var menuKeyEvent: String lateinit var menuKeyEvent: String
override fun from(json: JSONObject): Boolean { override fun from(json: JSONObject): Boolean {
this.name = json.optString(NAME)
this.packageName = json.optString(PACKAGE_NAME) this.packageName = json.optString(PACKAGE_NAME)
this.launcher = json.optString(LAUNCHER) this.launcher = json.optString(LAUNCHER)
this.launchDelay = json.optInt(LAUNCH_DELAY, 15) this.launchDelay = json.optInt(LAUNCH_DELAY, 15)
...@@ -53,6 +55,7 @@ class ApkInfo: IModel { ...@@ -53,6 +55,7 @@ class ApkInfo: IModel {
const val VIDEO_EXTS = "m3u8|.ts|.mp4|.rmvb|.mkv|.wmv" const val VIDEO_EXTS = "m3u8|.ts|.mp4|.rmvb|.mkv|.wmv"
//data key //data key
const val NAME = "name"
const val PACKAGE_NAME = "packageName" const val PACKAGE_NAME = "packageName"
const val LAUNCHER = "launcher" const val LAUNCHER = "launcher"
const val LAUNCH_DELAY = "launchDelay" const val LAUNCH_DELAY = "launchDelay"
......
...@@ -64,9 +64,13 @@ class Task : IAppBaseCallback { ...@@ -64,9 +64,13 @@ class Task : IAppBaseCallback {
fun start() { fun start() {
this.reportJson = JSONObject() this.reportJson = JSONObject()
// 启动应用
this.launchApp() this.launchApp()
// 频道轮询处理
this.processChannels() this.processChannels()
// 上传图片
this.uploadImage() this.uploadImage()
// 上报服务器
this.report() this.report()
} }
...@@ -278,7 +282,7 @@ class Task : IAppBaseCallback { ...@@ -278,7 +282,7 @@ class Task : IAppBaseCallback {
} }
private fun report() { private fun report() {
reportProtocol.execute(dataHandler) reportProtocol.withBody(reportJson.toString()).execute(dataHandler)
} }
override fun onProtocolFailed(p0: IProtocol?) { override fun onProtocolFailed(p0: IProtocol?) {
......
...@@ -6,15 +6,26 @@ import com.duolebo.appbase.prj.bmtv.protocol.IProtocolConfig ...@@ -6,15 +6,26 @@ import com.duolebo.appbase.prj.bmtv.protocol.IProtocolConfig
import com.duolebo.appbase.prj.bmtv.protocol.ProtocolBase import com.duolebo.appbase.prj.bmtv.protocol.ProtocolBase
import com.duolebo.blyrobot.data.ApkReportData import com.duolebo.blyrobot.data.ApkReportData
import com.duolebo.blyrobot.util.Config import com.duolebo.blyrobot.util.Config
import java.lang.StringBuilder
class ApkReportProtocol(context: Context?, config: IProtocolConfig?) : ProtocolBase(context, config) { class ApkReportProtocol(context: Context?, config: IProtocolConfig?) : ProtocolBase(context, config) {
val model = ApkReportData() val model = ApkReportData()
var body = ""
fun withBody(body: String): ApkReportProtocol {
this.body = body
return this
}
override fun prepareProtocolBody(p0: MutableMap<String, String>?) { override fun prepareProtocolBody(p0: MutableMap<String, String>?) {
} }
override fun prepareHttpBody(): ByteArray {
return body.toByteArray()
}
override fun getData(): IModel { override fun getData(): IModel {
return model return model
} }
......
package com.duolebo.blyrobot.ui
import android.content.Context
import android.view.LayoutInflater
import android.widget.RelativeLayout
import com.duolebo.blyrobot.R
import com.duolebo.blyrobot.data.ApkInfo
import kotlinx.android.synthetic.main.app_config_item.view.*
class AppConfigListItem(context: Context?) : RelativeLayout(context) {
init {
LayoutInflater.from(context).inflate(R.layout.app_config_item, this)
}
fun setData(apkInfo: ApkInfo) {
this.appName.text = apkInfo.name
this.packageName.text = apkInfo.packageName
}
}
\ No newline at end of file
...@@ -6,10 +6,12 @@ ...@@ -6,10 +6,12 @@
android:layout_width="match_parent"> android:layout_width="match_parent">
<LinearLayout <LinearLayout
android:id="@+id/btnGroup"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical" android:layout_alignParentTop="true"
android:layout_centerInParent="true"> android:layout_centerHorizontal="true"
android:orientation="horizontal">
<Button <Button
android:id="@+id/startBtn" android:id="@+id/startBtn"
android:layout_width="wrap_content" android:layout_width="wrap_content"
...@@ -20,7 +22,7 @@ ...@@ -20,7 +22,7 @@
android:id="@+id/stopBtn" android:id="@+id/stopBtn"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="10dp" android:layout_marginLeft="10dp"
android:text="停止"/> android:text="停止"/>
<TextView <TextView
...@@ -31,4 +33,10 @@ ...@@ -31,4 +33,10 @@
android:layout_marginTop="20dp"/> android:layout_marginTop="20dp"/>
</LinearLayout> </LinearLayout>
<ListView
android:id="@+id/listView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@id/btnGroup"/>
</RelativeLayout> </RelativeLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/appName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:minHeight="40dp"
android:layout_marginLeft="10dp"
android:textSize="22sp"
android:gravity="center_vertical"
tools:text="电视家" />
<TextView
android:id="@+id/packageName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:minHeight="30dp"
android:layout_marginLeft="10dp"
android:layout_below="@+id/appName"
android:gravity="center_vertical"
android:textSize="18sp"
tools:text="com.elinkway.tvlive2" />
<TextView
android:id="@+id/status"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="30dp"
android:layout_marginRight="10dp"
android:layout_centerVertical="true"
android:layout_alignParentRight="true"
android:layout_below="@+id/appName"
android:gravity="right|center_vertical"
android:textSize="18sp"
tools:text="执行中" />
</RelativeLayout>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment