public void doSearch(RemoteScheduleVO vo, String deviceId) { if (vo == null) { return; } ECommandType commandType = null; // String type = vo.getIdentity().getIdentity().split("-")[0]; String type = vo.getParams().get(RemoteTaskDefine.SCHEDULE_COMMAND_TYPE_KEY).toString(); commandType = ECommandType.valueOf(type); AbstractTask task = null; switch (commandType) { case Movie: // 电影 case Teleplay: // 电视剧 case Variety: // 综艺 case Cartoon: // 动漫 MovieCommand command = new MovieCommand(); command.setCommandType(commandType); command.setRemoteScheduleVO(vo); command.setDeviceId(deviceId); task = new MovieTask(command); break; case ProgramView: // 视频详情 VideoDetailCommand vdCommand = new VideoDetailCommand(); vdCommand.setRemoteScheduleVO(vo); vdCommand.setCommandType(commandType); vdCommand.setDeviceId(deviceId); task = new VideoDetailTask(vdCommand); break; case ProgramRelatedVideos: // 视频相关推荐 RelatedVideosCommand rvCommand = new RelatedVideosCommand(); rvCommand.setRemoteScheduleVO(vo); rvCommand.setCommandType(commandType); rvCommand.setDeviceId(deviceId); task = new RelatedVideosTask(rvCommand); break; case ProgramReviews: // 视频影评 ProgramReviewsCommand prCommand = new ProgramReviewsCommand(); prCommand.setRemoteScheduleVO(vo); prCommand.setCommandType(commandType); prCommand.setDeviceId(deviceId); task = new ProgramReviewsTask(prCommand); break; case ProgramHotKeyword: // 最热搜索关键字 TopKeywordCommand tkCommand = new TopKeywordCommand(); tkCommand.setRemoteScheduleVO(vo); tkCommand.setCommandType(commandType); tkCommand.setDeviceId(deviceId); task = new TopKeywordTask(tkCommand); break; case SubType: // 子类型查询 SubTypeCommand sbCommand = new SubTypeCommand(); sbCommand.setCommandType(commandType); sbCommand.setRemoteScheduleVO(vo); sbCommand.setDeviceId(deviceId); task = new SubTypeTask(sbCommand); break; default: break; } if (task != null) { taskPoolManager.addTask(task); } }
@Override public void onCreate() { super.onCreate(); taskPoolManager = new TaskPoolManager(); taskPoolManager.start(); }