|
@@ -8,10 +8,13 @@ import androidx.recyclerview.widget.RecyclerView;
|
|
import android.annotation.SuppressLint;
|
|
import android.annotation.SuppressLint;
|
|
import android.content.BroadcastReceiver;
|
|
import android.content.BroadcastReceiver;
|
|
import android.content.Context;
|
|
import android.content.Context;
|
|
|
|
+import android.content.ComponentName;
|
|
import android.content.Intent;
|
|
import android.content.Intent;
|
|
import android.content.IntentFilter;
|
|
import android.content.IntentFilter;
|
|
|
|
+import android.media.MediaPlayer;
|
|
import android.os.Bundle;
|
|
import android.os.Bundle;
|
|
import android.util.Log;
|
|
import android.util.Log;
|
|
|
|
+import android.widget.Toast;
|
|
|
|
|
|
import com.ch.jedge.llm.filter.glm.asserts.QAssetsCopyer;
|
|
import com.ch.jedge.llm.filter.glm.asserts.QAssetsCopyer;
|
|
import com.ch.jedge.llm.filter.glm.service.BaseJedgeService;
|
|
import com.ch.jedge.llm.filter.glm.service.BaseJedgeService;
|
|
@@ -23,9 +26,17 @@ import com.ch.jedge.llm.filter.glm.service.TVAgentService;
|
|
import com.ch.jedge.llm.filter.glm.service.TVMufisService;
|
|
import com.ch.jedge.llm.filter.glm.service.TVMufisService;
|
|
import com.ch.jedge.tvmufis.JeageTVBridge;
|
|
import com.ch.jedge.tvmufis.JeageTVBridge;
|
|
import com.changhong.qlib.util.file.FileUtils;
|
|
import com.changhong.qlib.util.file.FileUtils;
|
|
|
|
+import com.changhong.tvos.common.IResourceManager;
|
|
|
|
+import com.changhong.tvos.common.ISourceManager;
|
|
|
|
+import com.changhong.tvos.common.TVManager;
|
|
|
|
+import com.changhong.tvos.common.exception.TVManagerNotInitException;
|
|
|
|
+import com.changhong.tvos.model.EnumResource;
|
|
|
|
|
|
|
|
+import java.io.IOException;
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
|
|
+import java.util.HashMap;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
+import java.util.Map;
|
|
|
|
|
|
public class MainActivity extends AppCompatActivity {
|
|
public class MainActivity extends AppCompatActivity {
|
|
|
|
|
|
@@ -38,6 +49,8 @@ public class MainActivity extends AppCompatActivity {
|
|
private IntentFilter filter = new IntentFilter("intent.jedge.glm.msg");
|
|
private IntentFilter filter = new IntentFilter("intent.jedge.glm.msg");
|
|
private IntentFilter asr_filter = new IntentFilter("com.ch.jedge.llm.filter.glm.asr");
|
|
private IntentFilter asr_filter = new IntentFilter("com.ch.jedge.llm.filter.glm.asr");
|
|
|
|
|
|
|
|
+ private String dir, jedgeBasePath;
|
|
|
|
+
|
|
@SuppressLint("UnspecifiedRegisterReceiverFlag")
|
|
@SuppressLint("UnspecifiedRegisterReceiverFlag")
|
|
@Override
|
|
@Override
|
|
protected void onCreate(Bundle savedInstanceState) {
|
|
protected void onCreate(Bundle savedInstanceState) {
|
|
@@ -62,14 +75,22 @@ public class MainActivity extends AppCompatActivity {
|
|
}
|
|
}
|
|
String dir = FileUtils.contactPath(jedgeBasePath, "mgs");
|
|
String dir = FileUtils.contactPath(jedgeBasePath, "mgs");
|
|
String jik_dir = FileUtils.contactPath(dir, "jik");
|
|
String jik_dir = FileUtils.contactPath(dir, "jik");
|
|
- QAssetsCopyer.copyAssetFolder(getAssets(), "jik", jik_dir);
|
|
|
|
|
|
+// QAssetsCopyer.copyAssetFolder(getAssets(), "jik", jik_dir);
|
|
|
|
+
|
|
|
|
+ this.dir = dir;
|
|
|
|
+ this.jedgeBasePath = jedgeBasePath;
|
|
|
|
|
|
- BaseJedgeService.startJedgeService(this , dir, jedgeBasePath, "mgs", MgsService.class);
|
|
|
|
- BaseJedgeService.startJedgeService(this , dir, jedgeBasePath, "jbot", JBotService.class);
|
|
|
|
- BaseJedgeService.startJedgeService(this , dir, jedgeBasePath, "llm", JGlmService.class);
|
|
|
|
- BaseJedgeService.startJedgeService(this , dir, jedgeBasePath, "tvass", TVAgentService.class);
|
|
|
|
- BaseJedgeService.startJedgeService(this , dir, jedgeBasePath, "tvmufis", TVMufisService.class);
|
|
|
|
- BaseJedgeService.startJedgeService(this , dir, jedgeBasePath, "jsmart", PanleAgentService.class);
|
|
|
|
|
|
+ BaseJedgeService.startJedgeService(MainActivity.this , dir, jedgeBasePath, "mgs", MgsService.class);
|
|
|
|
+ BaseJedgeService.startJedgeService(MainActivity.this , dir, jedgeBasePath, "jbot", JBotService.class);
|
|
|
|
+ BaseJedgeService.startJedgeService(MainActivity.this , dir, jedgeBasePath, "llm", JGlmService.class);
|
|
|
|
+ BaseJedgeService.startJedgeService(MainActivity.this , dir, jedgeBasePath, "tvmufis", TVMufisService.class);
|
|
|
|
+
|
|
|
|
+// BaseJedgeService.startJedgeService(MainActivity.this , dir, jedgeBasePath, "mgs", MgsService.class);
|
|
|
|
+// BaseJedgeService.startJedgeService(MainActivity.this , dir, jedgeBasePath, "jbot", JBotService.class);
|
|
|
|
+// BaseJedgeService.startJedgeService(MainActivity.this , dir, jedgeBasePath, "llm", JGlmService.class);
|
|
|
|
+ BaseJedgeService.startJedgeService(MainActivity.this , dir, jedgeBasePath, "tvass", TVAgentService.class);
|
|
|
|
+// BaseJedgeService.startJedgeService(MainActivity.this , dir, jedgeBasePath, "tvmufis", TVMufisService.class);
|
|
|
|
+ BaseJedgeService.startJedgeService(MainActivity.this , dir, jedgeBasePath, "jsmart", PanleAgentService.class);
|
|
|
|
|
|
//注册广播
|
|
//注册广播
|
|
registerReceiver(new AsrMsgReceiver(), asr_filter);
|
|
registerReceiver(new AsrMsgReceiver(), asr_filter);
|
|
@@ -86,6 +107,22 @@ public class MainActivity extends AppCompatActivity {
|
|
protected void onResume() {
|
|
protected void onResume() {
|
|
super.onResume();
|
|
super.onResume();
|
|
LocalBroadcastManager.getInstance(this).registerReceiver(msgReceiver, filter);
|
|
LocalBroadcastManager.getInstance(this).registerReceiver(msgReceiver, filter);
|
|
|
|
+
|
|
|
|
+// Thread thread = new Thread(new Runnable() {
|
|
|
|
+// @Override
|
|
|
|
+// public void run() {
|
|
|
|
+// try {
|
|
|
|
+// Thread.sleep(20000);
|
|
|
|
+// BaseJedgeService.startJedgeService(MainActivity.this , dir, jedgeBasePath, "tvass", TVAgentService.class);
|
|
|
|
+// BaseJedgeService.startJedgeService(MainActivity.this , dir, jedgeBasePath, "jsmart", PanleAgentService.class);
|
|
|
|
+//
|
|
|
|
+// } catch (InterruptedException e) {
|
|
|
|
+// throw new RuntimeException(e);
|
|
|
|
+// }
|
|
|
|
+// }
|
|
|
|
+// });
|
|
|
|
+// thread.start();
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
private void initMsg() {
|
|
private void initMsg() {
|
|
@@ -104,6 +141,8 @@ public class MainActivity extends AppCompatActivity {
|
|
|
|
|
|
//将RecyclerView定位到最后一行
|
|
//将RecyclerView定位到最后一行
|
|
mRecyclerView.scrollToPosition(mMsgList.size() - 1);
|
|
mRecyclerView.scrollToPosition(mMsgList.size() - 1);
|
|
|
|
+ String s = content.getContent();
|
|
|
|
+ Toast.makeText(this, s, Toast.LENGTH_SHORT).show();
|
|
}
|
|
}
|
|
|
|
|
|
class MsgReceiver extends BroadcastReceiver {
|
|
class MsgReceiver extends BroadcastReceiver {
|
|
@@ -136,4 +175,30 @@ public class MainActivity extends AppCompatActivity {
|
|
bridge.senduserMsg(content);
|
|
bridge.senduserMsg(content);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+// public void startVideoPlayer(String file) {
|
|
|
|
+// if (!file.isEmpty()) {
|
|
|
|
+// Intent intent = new Intent();
|
|
|
|
+// ComponentName comp = new ComponentName("com.changhong.mmp.fileexplorer", "com.changhong.mmp.videoplayer.ChangHongVideoPlayerActivity");
|
|
|
|
+// intent.setComponent(comp);
|
|
|
|
+// ArrayList<Map<String, Object>> videoPlayNodeList = new ArrayList<Map<String, Object>>();
|
|
|
|
+//
|
|
|
|
+// HashMap<String, Object> movieNode = new HashMap<String, Object>();
|
|
|
|
+// movieNode.put("title", "文件名称");
|
|
|
|
+// movieNode.put("cn", 1);
|
|
|
|
+// String[] str = new String[]{file};
|
|
|
|
+// movieNode.put("playUrls", str);
|
|
|
|
+// videoPlayNodeList.add(movieNode);
|
|
|
|
+//
|
|
|
|
+// Bundle mData = new Bundle();
|
|
|
|
+// mData.putInt("playSourceType", 0);
|
|
|
|
+// mData.putInt("curPos", 0);
|
|
|
|
+// intent.putExtra("movieNode", videoPlayNodeList);
|
|
|
|
+// intent.putExtras(mData);
|
|
|
|
+// intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK
|
|
|
|
+// | Intent.FLAG_ACTIVITY_SINGLE_TOP);
|
|
|
|
+// startActivity(intent);
|
|
|
|
+// }
|
|
|
|
+// }
|
|
|
|
+
|
|
}
|
|
}
|