diff --git "a/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/.idea/.gitignore" "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/.idea/.gitignore" new file mode 100644 index 0000000000000000000000000000000000000000..26d33521af10bcc7fd8cea344038eaaeb78d0ef5 --- /dev/null +++ "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/.idea/.gitignore" @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git "a/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/.idea/gradle.xml" "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/.idea/gradle.xml" new file mode 100644 index 0000000000000000000000000000000000000000..4dada841fd8b88cfbf1b4b5398c63bb3e6c24ead --- /dev/null +++ "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/.idea/gradle.xml" @@ -0,0 +1,16 @@ + + + + + + \ No newline at end of file diff --git "a/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/.idea/modules.xml" "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/.idea/modules.xml" new file mode 100644 index 0000000000000000000000000000000000000000..fb68b24d0f5a986038051db7f9890b1838a325f6 --- /dev/null +++ "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/.idea/modules.xml" @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git "a/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/.idea/rentutu\347\232\204\346\226\207\344\273\266.iml" "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/.idea/rentutu\347\232\204\346\226\207\344\273\266.iml" new file mode 100644 index 0000000000000000000000000000000000000000..d6ebd4805981b8400db3e3291c74a743fef9a824 --- /dev/null +++ "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/.idea/rentutu\347\232\204\346\226\207\344\273\266.iml" @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git "a/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/.idea/vcs.xml" "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/.idea/vcs.xml" new file mode 100644 index 0000000000000000000000000000000000000000..8fc0cc3c32146d949de493f8b20f537a75105731 --- /dev/null +++ "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/.idea/vcs.xml" @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git "a/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/.keep" "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/.keep" new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git "a/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/.gitignore" "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/.gitignore" new file mode 100644 index 0000000000000000000000000000000000000000..fdc0c4a65db238be4186f16e1e0911b1d61fbf31 --- /dev/null +++ "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/.gitignore" @@ -0,0 +1,16 @@ +*.iml +.gradle +/local.properties +/.idea/caches +/.idea/libraries +/.idea/modules.xml +/.idea/workspace.xml +/.idea/navEditor.xml +/.idea/assetWizardSettings.xml +.DS_Store +/build +/captures +.externalNativeBuild +/entry/.preview +.cxx +/node_modules diff --git "a/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/.idea/.gitignore" "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/.idea/.gitignore" new file mode 100644 index 0000000000000000000000000000000000000000..26d33521af10bcc7fd8cea344038eaaeb78d0ef5 --- /dev/null +++ "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/.idea/.gitignore" @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git "a/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/.idea/compiler.xml" "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/.idea/compiler.xml" new file mode 100644 index 0000000000000000000000000000000000000000..fb7f4a8a465d42b4a0390d464b83b99e8465bba7 --- /dev/null +++ "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/.idea/compiler.xml" @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git "a/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/.idea/gradle.xml" "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/.idea/gradle.xml" new file mode 100644 index 0000000000000000000000000000000000000000..a9efccf08dc0d083b3968ec7554ee2cf11369390 --- /dev/null +++ "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/.idea/gradle.xml" @@ -0,0 +1,25 @@ + + + + + + + \ No newline at end of file diff --git "a/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/.idea/jarRepositories.xml" "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/.idea/jarRepositories.xml" new file mode 100644 index 0000000000000000000000000000000000000000..19e238eaa31f512cfc1e8641964227098d1eb8bb --- /dev/null +++ "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/.idea/jarRepositories.xml" @@ -0,0 +1,25 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git "a/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/.idea/misc.xml" "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/.idea/misc.xml" new file mode 100644 index 0000000000000000000000000000000000000000..794aa67e635837ac492499857a20ce72f4938e28 --- /dev/null +++ "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/.idea/misc.xml" @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git "a/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/.idea/vcs.xml" "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/.idea/vcs.xml" new file mode 100644 index 0000000000000000000000000000000000000000..b2bdec2d71b6a5ce4ae49efc37516809c50e4d5e --- /dev/null +++ "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/.idea/vcs.xml" @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git "a/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/README.md" "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/README.md" new file mode 100644 index 0000000000000000000000000000000000000000..37d5bc3a8b1e4c3fed232f1f58c1bda52149b23d --- /dev/null +++ "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/README.md" @@ -0,0 +1,229 @@ +# 新闻流转模板的主旨: + +- 通过新闻应用场景展现鸿蒙系统的分布式调用能力,开发者使用本模板时可以重点关注流转流程的具体实现 + + +# 新闻流转模板的调试和使用 + +- 本模板是双entry + 一个har包的结构,两个entry分别对应于手机和大屏两端,而har包作为公有库提供新闻读取、多端信息发送与接受的能力 + +- 模板中新闻流转功能的路径:调用系统分布式能力拉起已经组网的其他设备上的新闻流转应用 + +- 模板设计有两种新闻页面: + + -JS开发新闻页面,具体页面entry/src/main/js/default/pages/detail/detail.js。 + + -Java端通过webview显示新闻网页,具体页面entry/src/main/java/../WebviewAbility + 注:若使用webview功能,需在配置文件config.json中添加权限请求ohos.permission.INTERNET。 + +- 在具体使用时,考虑到开发者不一定拥有智慧屏作为开发设备。在手机端对应entry中的MainAbility提供了智慧屏debug模式 + + - 可以通过将手机和智慧屏两端的entry分别安装在两台手机上,并且在手机端entry中使能debug模式(设置enableDebugMode方法的返回值为true) + 来体验整个模板的完整功能;若体验手机间流转新闻,关闭debug模式(debugMode设置为false)。 + + - 注:手机端与大屏端因为系统的差异导致UI效果有些许差别,具体体现在智慧屏会自动为当前焦点绘制方框而手机端没有此特性。 + 最终显示效果请以大屏端为参照。 + + - 当前实现远程启动FA需要至少两个设备处于同一个分布式网络中,可以通过操作如下配置实现: + + - 所有设备接入同一网络 + + - 所有设备登陆相同华为账号 + + - 所有设备上开启设置”设置-更多连接-多设备协同“ + + +- 流转能力的规格限制: + + - 调用系统分布式能力实现流转的规格: + + - 双端设备系统需要同时具备分布式能力 + + - 手机可以向其他组网设备包括手机、智慧屏发起流转 + + - 智慧屏只能作为流转的接收方 + +# 流转过程具体实现 + +- 开发者在阅读代码时应该对以下方面有前置了解: + + - JS UI框架实现的FA与继承自AceInternalAbility的PA的通信 + + - PA与JS UI框架实现的FA通过订阅(subscribe)机制进行通信 + +- 基于系统能力实现新闻详情页中手机流转到大屏的流程(具体代码参考对应JS UI页面和对应调用的继承自AceInternalAbility的PA) + + - 首先用户在新闻详情页面点击流转后页面跳转至设备选择界面,此处会显示出当前在线的其他已组网设备 + + - 获取组网设备代码段如下: + + entry\src\main\java\..\DeviceSelectInternalAbility.ACTION_REQUEST_DEVICE_LIST + + ``` + + List devices = DeviceManager.getDeviceList(DeviceInfo.FLAG_GET_ONLINE_DEVICE); + + ``` + + - 用户选择流转设备,页面根据获取到的对端设备信息判断如果对端设备为智慧屏则跳转至遥控界面否则返回详情界面,并调用分布式拉起方法拉起对端应用 + + - 拉起对端FA的代码段如下: + + - entry/src/main/js/default/pages/detail/detail.js + + ``` + async transfer() { + var forwardCompatible = false; + ---前向兼容检查 --- + ....... + ---获取用户选择的流转设备 + var result = await FeatureAbility.startAbilityForResult(target); + if (!!forwardCompatible == true) { + result = JSON.parse(result); + } + ...... + ---调用系统分布式拉起能力,拉起对端新闻应用 + var res1 = await FeatureAbility.startAbility(target); + if (!!forwardCompatible == true) { + res1 = JSON.parse(res1); + } + ...... + ---判断对端设备类型决定是否进行跳转 + if (res1.code == 0 && (targetDeviceType == 'SMART_TV' || deviceDebugMode == true)) { + + ``` + + - 若对端为大屏设备,页面跳转至遥控器界面后设备会尝试与对端建立持续连接以此来传送后续的遥控信号 + (通过remoteDataSenderAbility.java/connectRemote()方法中下调用系统方法connectAbility()) + + - 连接对端PA的代码段如下: + + - DistributeInternalAbility(手机端)#CONNECT_ABILITY + + ``` + case CONNECT_ABILITY: { + ZSONObject dataParsed = ZSONObject.stringToZSON(data.readString()); + selectDeviceId = dataParsed.getString("deviceId"); + RemoteDataSender.connectRemote(selectDeviceId, context); + assembleReplyResult(replyResult, new Object(), reply); + break; + } + ``` + + - commonlib\src\main\java\..\remotedatabus\RemoteDataSender#connectRemote + + ``` + public static boolean connectRemote(String deviceId, Context context) { + RemoteConnection remote = REMOTE_CONNECTION_MAP.get(deviceId); + if (remote != null) { + context.disconnectAbility(remote); + REMOTE_CONNECTION_MAP.remove(deviceId); + } + + RemoteConnection newRemote = new RemoteConnection(); + Intent intent = new Intent(); + Operation operation = new Intent.OperationBuilder() + .withDeviceId(deviceId) + .withBundleName(context.getBundleName()) + .withAbilityName(RemoteDataReceiverAbility.class.getName()) + .withFlags(Intent.FLAG_ABILITYSLICE_MULTI_DEVICE) + .build(); + + intent.setOperation(operation); + ---调用系统分布式能力与远端建立持续连接 + boolean isSuccess = context.connectAbility(intent, newRemote); + HiLog.error(TAG, "connectRemote " + isSuccess); + if (isSuccess) { + REMOTE_CONNECTION_MAP.put(deviceId, newRemote); + } + return isSuccess; + } + ``` + + - 大屏端作为接收端接收到应用拉起请求后,处理接收到的参数并渲染新闻页面。同时主动订阅对应PA(通过subscribe机制) + + - 大屏端接收手机端消息的代码段如下: + + - default/pages/index/index.js(大屏端首页) 进入页面时主动订阅对应PA(DistributeInternalAbility) + + ``` + async subscribe() { + const subAction = {}; + subAction.bundleName = 'com.example.middleplatform.newsshare.tv'; + subAction.abilityName = 'DistributeInternalAbility'; + subAction.messageCode = ACTION_MESSAGE_CODE_SUBSCRIBE; + subAction.abilityType = ABILITY_TYPE_INTERNAL; + subAction.syncOption = ACTION_SYNC; + await FeatureAbility.subscribeAbilityEvent(subAction, (callbackData) => { + const callbackJson = JSON.parse(callbackData); + const { message } = callbackJson.data; + if (message < MESSAGE_CODE_DISCRIMINATOR) { + this.handleCommand(message); + } else { + this.handleTVOperation(message); + } + }); + }, + ``` + - DistributeInternalAbility.ACTION_MESSAGE_CODE_SUBSCRIBE PA接收订阅请求,初始化消息队列声明消息处理逻辑 + + ``` + case ACTION_MESSAGE_CODE_SUBSCRIBE : { + remoteObjectHandler = data.readRemoteObject(); + if (remoteMessageHandler == null) { + if (newRunner == null) { + newRunner = EventRunner.create(true); // 创建消息队列 + } + remoteMessageHandler = makeEventHandler(); // 创建消息处理逻辑 + RemoteDataReceiverAbility.registerMessageHandler(Command.COMMAND_TV, + (remoteData, remoteReply) -> { + remoteMessageHandler.sendEvent(remoteData.readInt()); + remoteReply.writeInt(0); // 远端遥控指令处理 + }); + } + Map replyResult = new HashMap<>(); + replyResult.put("code", 0); + reply.writeString(ZSONObject.toZSONString(replyResult)); + break; + } + ``` + + - 大屏的PA在FA订阅成功后,在接收到远端发来的遥控信号时会将其处理并把结果加入消息队列发送给FA进行页面刷新 + + DistributeInternalAbility.makeEventHandler FA订阅PA后PA消息队列中的消息处理逻辑 + + - 手机端FA接收用户输入后向PA请求发送遥控指令至智慧屏端需要调用RemoteDataSender的消息发送能力 + + - entry\src\main\js\default\pages\remote_controller\controller.js FA请求PA向远端发送遥控指令 + + ``` + async sendMsg(mesg) { + ...... + const callAction = this.makeAction(ACTION_MESSAGE_CODE_SEND_MSG, actionData); + const result = await FeatureAbility.callAbility(callAction); + const ret = JSON.parse(result); + ...... + }, + ``` + + - DistributeInternalAbility(手机端)中向远端发送遥控指令,通过调用commonlib中的 RemoteDataSender的sendMessage方法 + + ``` + case SEND_MSG: { + try { + ZSONObject dataParsed = ZSONObject.stringToZSON(data.readString()); + int message = dataParsed.getIntValue("message"); + int success = RemoteDataSender.sendMessage(selectDeviceId, Command.COMMAND_TV, message); + if (success == -1) { + boolean connectRes = RemoteDataSender.connectRemote(selectDeviceId, context); + if (!connectRes) { + throw new RemoteException(); + } + } + assembleReplyResult(replyResult, new Object(), reply); + } catch (RemoteException e) { + HiLog.error(TAG, "DistributeInternalAbility Exception " + e); + } + break; + } + ``` \ No newline at end of file diff --git "a/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/build.gradle" "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/build.gradle" new file mode 100644 index 0000000000000000000000000000000000000000..7b262c269082b0d379749be22b21102d60415736 --- /dev/null +++ "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/build.gradle" @@ -0,0 +1,33 @@ +// Top-level build file where you can add configuration options common to all sub-projects/modules. +apply plugin: 'com.huawei.ohos.app' + +//For instructions on signature configuration, see https://developer.harmonyos.com/cn/docs/documentation/doc-guides/ide_debug_device-0000001053822404#section1112183053510 +ohos { + compileSdkVersion 6 +} + +buildscript { + repositories { + maven { + url 'https://repo.huaweicloud.com/repository/maven/' + } + maven { + url 'https://developer.huawei.com/repo/' + } + } + dependencies { + classpath 'com.huawei.ohos:hap:3.0.3.2' + classpath 'com.huawei.ohos:decctest:1.2.6.0' + } +} + +allprojects { + repositories { + maven { + url 'https://repo.huaweicloud.com/repository/maven/' + } + maven { + url 'https://developer.huawei.com/repo/' + } + } +} diff --git "a/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/commonlib/.gitignore" "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/commonlib/.gitignore" new file mode 100644 index 0000000000000000000000000000000000000000..7d5b7a94f4dcf381f03ff21f28f8a2494b58023f --- /dev/null +++ "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/commonlib/.gitignore" @@ -0,0 +1,2 @@ +/build +/node_modules diff --git "a/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/commonlib/build.gradle" "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/commonlib/build.gradle" new file mode 100644 index 0000000000000000000000000000000000000000..5dbf413466ea1bd3ac1aa7629bd1748b2f8c9409 --- /dev/null +++ "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/commonlib/build.gradle" @@ -0,0 +1,20 @@ +apply plugin: 'com.huawei.ohos.library' + +ohos { + compileSdkVersion 6 + defaultConfig { + compatibleSdkVersion 6 + } + buildTypes { + release { + proguardOpt { + proguardEnabled false + rulesFiles 'proguard-rules.pro' + } + } + } +} + +dependencies { + implementation fileTree(dir: 'libs', include: ['*.jar','*.har']) +} \ No newline at end of file diff --git "a/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/commonlib/consumer-rules.pro" "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/commonlib/consumer-rules.pro" new file mode 100644 index 0000000000000000000000000000000000000000..9dccc613bc71b04b83531f550bdab2fb667ecfc9 --- /dev/null +++ "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/commonlib/consumer-rules.pro" @@ -0,0 +1 @@ +# Add har specific ProGuard rules for consumer here. \ No newline at end of file diff --git "a/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/commonlib/proguard-rules.pro" "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/commonlib/proguard-rules.pro" new file mode 100644 index 0000000000000000000000000000000000000000..f7666e47561d514b2a76d5a7dfbb43ede86da92a --- /dev/null +++ "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/commonlib/proguard-rules.pro" @@ -0,0 +1 @@ +# config module specific ProGuard rules here. \ No newline at end of file diff --git "a/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/commonlib/src/main/config.json" "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/commonlib/src/main/config.json" new file mode 100644 index 0000000000000000000000000000000000000000..d79356d849f1b897e8c77887ea26d41749770acf --- /dev/null +++ "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/commonlib/src/main/config.json" @@ -0,0 +1,24 @@ +{ + "app": { + "bundleName": "com.example.myapplication", + "vendor": "example", + "version": { + "code": 1000000, + "name": "1.0.0" + } + }, + "deviceConfig": { + }, + "module": { + "package": "com.example.myapplication", + "deviceType": [ + "phone", + "tv" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "commonlib", + "moduleType": "har" + } + } +} \ No newline at end of file diff --git "a/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/commonlib/src/main/java/com/example/myapplication/constant/Command.java" "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/commonlib/src/main/java/com/example/myapplication/constant/Command.java" new file mode 100644 index 0000000000000000000000000000000000000000..5850b64a6f4c9bb5bab1e342597d6ed01422a3ac --- /dev/null +++ "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/commonlib/src/main/java/com/example/myapplication/constant/Command.java" @@ -0,0 +1,11 @@ +package com.example.myapplication.constant; + +/** + * message_code which send to TV. + */ +public class Command { + /** + * the message code of tv command + */ + public static final int COMMAND_TV = 1; +} \ No newline at end of file diff --git "a/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/commonlib/src/main/java/com/example/myapplication/newsdata/NewsInfo.java" "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/commonlib/src/main/java/com/example/myapplication/newsdata/NewsInfo.java" new file mode 100644 index 0000000000000000000000000000000000000000..9f83780eca64f14a4909c95532b2d27390fdc512 --- /dev/null +++ "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/commonlib/src/main/java/com/example/myapplication/newsdata/NewsInfo.java" @@ -0,0 +1,197 @@ +package com.example.myapplication.newsdata; + +import java.io.IOException; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.HashMap; + +import ohos.app.Context; +import ohos.global.resource.Resource; +import ohos.hiviewdfx.HiLog; +import ohos.hiviewdfx.HiLogLabel; +import ohos.utils.zson.ZSONObject; + +/** + * newsInfo class, defined the newsInfo structure, and provide related method to read newsInfo from json. + * You can override this part to extend business logic, such as read from different data source + */ +public class NewsInfo { + private static final HiLogLabel TAG = new HiLogLabel(0, 0, "NewsInfo"); + private static final String NEWS_FILE_PREFIX = "resources/rawfile/news"; + private static final int NEWS_LIMIT = 10; + private static final int NEWS_CONTENT_SIZE = 1024; + private static final int EOF = -1; + private volatile static NewsInfo newsInfo; + private final Context context; + private final HashMap newsInfoMap = new HashMap<>(); + private final ArrayList newsTitleList = new ArrayList<>(); + private final ArrayList newsUrlList = new ArrayList<>(); + private final ArrayList newsImageList = new ArrayList<>(); + private final ArrayList newsContainsVideos = new ArrayList<>(); + private final ArrayList newsVideoUrl = new ArrayList<>(); + private final ArrayList newsContainsWeb = new ArrayList<>(); + private final ArrayList newsWebList = new ArrayList<>(); + + /** + * default constructor + * + * @param context context + */ + private NewsInfo(Context context) { + this.context = context; + int index = 0; + while (index < NEWS_LIMIT) { + String resourcePath = NEWS_FILE_PREFIX + index + ".json"; + String newsString = getNewsFile(resourcePath); + if ("".equals(newsString)) { + break; + } + ZSONObject newsJson = ZSONObject.stringToZSON(newsString); + String url = newsJson.getString("url"); + String title = newsJson.getString("title"); + String image = newsJson.getString("title_image"); + boolean containsVideo = newsJson.getBooleanValue("contains_video"); + String video = newsJson.getString("title_video"); + boolean containsWeb = newsJson.getBooleanValue("contains_webpage"); + String webPage = newsJson.getString("web_page"); + + newsUrlList.add(url); + newsTitleList.add(title); + newsImageList.add(image); + newsInfoMap.put(url, resourcePath); + newsContainsVideos.add(containsVideo); + newsVideoUrl.add(video != null ? video : ""); + newsContainsWeb.add(containsWeb); + newsWebList.add(webPage); + index++; + } + } + + /** + * singleton newsInfo + * + * @param context context. + * @return newsInfo. + */ + public static NewsInfo getInstance(Context context) { + if (newsInfo == null) { + synchronized (NewsInfo.class) { + if (newsInfo == null) { + newsInfo = new NewsInfo(context); + } + } + } + return newsInfo; + } + + /** + * to check whether news contains video. + * + * @param index the news index. + * @return whether news contains video. + */ + boolean getNewsContainsVideos(int index) { + return newsContainsVideos.get(index); + } + + /** + * get news video url + * + * @param index the news index. + * @return empty String or video url. + */ + String getNewsVideoUrl(int index) { + return newsVideoUrl.get(index); + } + + /** + * getNewsCount + * + * @return newsList size + */ + int getNewsCount() { + return newsUrlList.size(); + } + + /** + * getNewsTitle + * + * @param index news index + * @return news title + */ + public String getNewsTitle(int index) { + return newsTitleList.get(index); + } + + + /** + * get specific news url. + * + * @param index the news index. + * @return specific news url. + */ + public String getNewsUrl(int index) { + return newsUrlList.get(index); + } + + /** + * getNewsImage + * + * @param index news index + * @return new image url + */ + public String getNewsImage(int index) { + return newsImageList.get(index); + } + + /** + * getNewsJson + * + * @param url new url + * @return invoke getNewsFile() + */ + String getNewsJson(String url) { + String path = newsInfoMap.get(url); + return getNewsFile(path); + } + + /** + * readNewsFile from json, you can extend this part to read newsInfo from different data source. + * + * @param resourcePath news file location + * @return newsJson + */ + private String getNewsFile(String resourcePath) { + try { + Resource resource = context.getResourceManager().getRawFileEntry(resourcePath).openRawFile(); + byte[] tmp = new byte[NEWS_CONTENT_SIZE * NEWS_CONTENT_SIZE]; + int reads = resource.read(tmp); + if (reads != EOF) { + return new String(tmp, 0, reads, StandardCharsets.UTF_8); + } + } catch (IOException ex) { + HiLog.error(TAG, "GetHttpNews get IO error"); + } + return ""; + } + + /** + * to check whether news contains video. + * + * @param index the news index. + * @return whether news contains video. + */ + boolean getNewsContainsWeb(int index) { + return newsContainsWeb.get(index); + } + + /** + * get Web News url for Web View. + * + * @param index the news index. + * @return News Http url. + */ + public String getWebNewsUrl(int index) { + return newsWebList.get(index); + } +} diff --git "a/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/commonlib/src/main/java/com/example/myapplication/newsdata/NewsInfoInternalAbility.java" "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/commonlib/src/main/java/com/example/myapplication/newsdata/NewsInfoInternalAbility.java" new file mode 100644 index 0000000000000000000000000000000000000000..d47a04b2950b89e21783ab8592a87ad6636501dd --- /dev/null +++ "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/commonlib/src/main/java/com/example/myapplication/newsdata/NewsInfoInternalAbility.java" @@ -0,0 +1,105 @@ +package com.example.myapplication.newsdata; + +import java.util.HashMap; +import java.util.Map; + +import ohos.ace.ability.AceInternalAbility; +import ohos.app.AbilityContext; +import ohos.hiviewdfx.HiLog; +import ohos.hiviewdfx.HiLogLabel; +import ohos.rpc.MessageOption; +import ohos.rpc.MessageParcel; +import ohos.utils.zson.ZSONArray; +import ohos.utils.zson.ZSONObject; + +/** + * NewsInfoInternalAbility mainly duty is to react for FA's news requests. + * both phone and TV will get news list and news content from list PA. + */ +public class NewsInfoInternalAbility extends AceInternalAbility { + private static final HiLogLabel TAG = new HiLogLabel(0, 0, "NewsInfoInternalAbility"); + private static final int ACTION_REQUEST_NEWS_LIST = 1001; + private static final int ACTION_REQUEST_NEWS = 1002; + private static NewsInfoInternalAbility INSTANCE; + private final AbilityContext context; + + private NewsInfo newsInfo; + + /** + * default constructor + * + * @param context ability context + */ + public NewsInfoInternalAbility(AbilityContext context) { + super("com.example.myapplication.newsdata", "NewsInfoInternalAbility"); + this.context = context; + } + + /** + * set InternalAbilityHandler for NewsInfoInternalAbility instance + * + * @param context ability context + */ + public static void register(AbilityContext context) { + INSTANCE = new NewsInfoInternalAbility(context); + INSTANCE.setInternalAbilityHandler((code, data, reply, option) -> + INSTANCE.onRemoteRequest(code, data, reply, option)); + } + + /** + * FA requests news list and news details from this PA with ACTION_CODE, it'll answer for both TV FA and phone FA. + * phone/index.js,detail.js tv/index.js will get news content through this method. + * + * @param code ACTION_CODE + * @param data data sent from FA + * @param reply reply to send back to FA + * @param option currently excessive + * @return whether request is correctly responded + */ + private boolean onRemoteRequest(int code, MessageParcel data, MessageParcel reply, MessageOption option) { + newsInfo = NewsInfo.getInstance(context); + if (code == ACTION_REQUEST_NEWS_LIST) { + ZSONArray zsonArray = new ZSONArray(); + int cnt = newsInfo.getNewsCount(); + for (int index = 0; index < cnt; index++) { + String title = newsInfo.getNewsTitle(index); + String url = newsInfo.getNewsUrl(index); + String image = newsInfo.getNewsImage(index); + boolean containsVideo = newsInfo.getNewsContainsVideos(index); + String videoUrl = newsInfo.getNewsVideoUrl(index); + boolean containsWeb = newsInfo.getNewsContainsWeb(index); + String webPage = newsInfo.getWebNewsUrl(index); + + ZSONObject obj = new ZSONObject(); + obj.put("url", url); + obj.put("title", title); + obj.put("title_image", image); + obj.put("contains_video", containsVideo); + obj.put("video_url", videoUrl); + obj.put("contains_webpage", containsWeb); + obj.put("web_page", webPage); + zsonArray.add(obj); + } + Map zsonResult = new HashMap<>(); + zsonResult.put("code", 0); + zsonResult.put("list", zsonArray); + reply.writeString(ZSONObject.toZSONString(zsonResult)); + } else if (code == ACTION_REQUEST_NEWS) { + String zsonStr = data.readString(); + ZSONObject zsonObject = ZSONObject.stringToZSON(zsonStr); + String content = newsInfo.getNewsJson(zsonObject.getString("url")); + String index = zsonObject.getString("index"); + boolean containsVideo = newsInfo.getNewsContainsVideos(Integer.parseInt(index)); + String videoUrl = newsInfo.getNewsVideoUrl(Integer.parseInt(index)); + Map zsonResult = new HashMap<>(); + zsonResult.put("code", 0); + zsonResult.put("contains_video", containsVideo); + zsonResult.put("video_url", videoUrl); + zsonResult.put("data", content); + reply.writeString(ZSONObject.toZSONString(zsonResult)); + } else { + HiLog.info(TAG, "Unsupported code from js"); + } + return true; + } +} diff --git "a/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/commonlib/src/main/java/com/example/myapplication/remotedatabus/RemoteDataReceiverAbility.java" "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/commonlib/src/main/java/com/example/myapplication/remotedatabus/RemoteDataReceiverAbility.java" new file mode 100644 index 0000000000000000000000000000000000000000..9c48f22c6fa2d28bdf03e6b9acecd7fa035e8656 --- /dev/null +++ "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/commonlib/src/main/java/com/example/myapplication/remotedatabus/RemoteDataReceiverAbility.java" @@ -0,0 +1,111 @@ +package com.example.myapplication.remotedatabus; + +import ohos.aafwk.ability.Ability; +import ohos.aafwk.content.Intent; +import ohos.event.notification.NotificationRequest; +import ohos.hiviewdfx.HiLog; +import ohos.hiviewdfx.HiLogLabel; +import ohos.rpc.IRemoteBroker; +import ohos.rpc.IRemoteObject; +import ohos.rpc.MessageOption; +import ohos.rpc.MessageParcel; +import ohos.rpc.RemoteObject; + +import java.util.HashMap; +import java.util.Map; + +/** + * when remote device connect TV, it will connect with NewsServiceAbility instance. + * if connection is done, we will return a RemoteMessage object to remote caller as + * a proxy to communicate with native PA. + * In this template, when a phone transfer news to A TV, the phone will try to start + * this ability by calling connectAbility() at phone's DistributeInternalAbility.java. + */ +public class RemoteDataReceiverAbility extends Ability { + private static final HiLogLabel TAG = new HiLogLabel(0, 0, "RemoteDataReceiverAbility"); + private static final int NOTIFICATION_ID = 1005; + private static final Map HANDLER_MAP = new HashMap<>(); + private final RemoteHandler remote = new RemoteHandler(); + + /** + * when devices' FA need to subscribe from PA, it will invoke this method to register message handler. + * + * @param code device message code. + * @param handler message handler. + */ + public static void registerMessageHandler(int code, RemoteMessageHandler handler) { + HiLog.info(TAG, "registerMessageHandler code " + code); + HANDLER_MAP.put(code, handler); + } + + @Override + protected void onStart(Intent intent) { + super.onStart(intent); + // when transfer done create notification,notificationId is 1005. + NotificationRequest request = new NotificationRequest(NOTIFICATION_ID); + NotificationRequest.NotificationNormalContent content = new NotificationRequest.NotificationNormalContent(); + content.setTitle("News share").setText("News is connected with remote device"); + NotificationRequest.NotificationContent notificationContent = + new NotificationRequest.NotificationContent(content); + request.setContent(notificationContent); + keepBackgroundRunning(NOTIFICATION_ID, request); + } + + @Override + protected IRemoteObject onConnect(Intent intent) { + super.onConnect(intent); + return remote.asObject(); + } + + @Override + protected void onDisconnect(Intent intent) { + super.onDisconnect(intent); + } + + @Override + protected void onStop() { + super.onStop(); + cancelBackgroundRunning(); + } + + /** + * the handler interface for FA subscribe PA mechanism's messageQueue. + */ + public interface RemoteMessageHandler { + void handlerRemote(MessageParcel data, MessageParcel reply); + } + + /** + * inner class RemoteMessage stands for proxy of remote device, we can communication + * with remote device through this proxy + */ + public static class RemoteHandler extends RemoteObject implements IRemoteBroker { + private static final int ERROR = -1; + + /** + * default constructor + */ + RemoteHandler() { + super("MyService_MessageRemote"); + } + + @Override + public IRemoteObject asObject() { + return this; + } + + @Override + public boolean onRemoteRequest(int code, MessageParcel data, MessageParcel reply, MessageOption option) { + HiLog.info(TAG, "onRemoteRequest code " + code); + if (HANDLER_MAP.get(code) == null) { + reply.writeInt(ERROR); + return false; + } + + RemoteMessageHandler handler = HANDLER_MAP.get(code); + handler.handlerRemote(data, reply); + return true; + } + } + +} \ No newline at end of file diff --git "a/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/commonlib/src/main/java/com/example/myapplication/remotedatabus/RemoteDataSender.java" "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/commonlib/src/main/java/com/example/myapplication/remotedatabus/RemoteDataSender.java" new file mode 100644 index 0000000000000000000000000000000000000000..4f18cb2a62b084e9f69b14e872990f4809e0000c --- /dev/null +++ "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/commonlib/src/main/java/com/example/myapplication/remotedatabus/RemoteDataSender.java" @@ -0,0 +1,136 @@ +package com.example.myapplication.remotedatabus; + +import ohos.aafwk.ability.IAbilityConnection; +import ohos.aafwk.content.Intent; +import ohos.aafwk.content.Operation; +import ohos.app.Context; +import ohos.bundle.ElementName; +import ohos.hiviewdfx.HiLog; +import ohos.hiviewdfx.HiLogLabel; +import ohos.rpc.IRemoteObject; +import ohos.rpc.MessageOption; +import ohos.rpc.MessageParcel; +import ohos.rpc.RemoteException; + +import java.util.HashMap; +import java.util.Map; + +/** + * CommRemoteProxy class for remote Object, all remote communication will go through this proxy instance. + */ +public class RemoteDataSender { + private static final HiLogLabel TAG = new HiLogLabel(0, 0, "RemoteDataSender"); + private static final int ERROR = -1; + private static final Map REMOTE_CONNECTION_MAP = new HashMap<>(); + + /** + * This method will be invoke by devices' DistributeInternalAbility when + * it want to connect with remote device. + * + * @param deviceId the deviceID of which device we want to transfer to. + * @param context native ability context + * @return isSuccess whether connect remote is successful. + */ + public static boolean connectRemote(String deviceId, Context context) { + RemoteConnection remote = REMOTE_CONNECTION_MAP.get(deviceId); + if (remote != null) { + context.disconnectAbility(remote); + REMOTE_CONNECTION_MAP.remove(deviceId); + } + + RemoteConnection newRemote = new RemoteConnection(); + Intent intent = new Intent(); + Operation operation = new Intent.OperationBuilder() + .withDeviceId(deviceId) + .withBundleName(context.getBundleName()) + .withAbilityName(RemoteDataReceiverAbility.class.getName()) + .withFlags(Intent.FLAG_ABILITYSLICE_MULTI_DEVICE) + .build(); + + intent.setOperation(operation); + boolean isSuccess = context.connectAbility(intent, newRemote); + HiLog.error(TAG, "connectRemote " + isSuccess); + if (isSuccess) { + REMOTE_CONNECTION_MAP.put(deviceId, newRemote); + } + return isSuccess; + } + + /** + * This method will be invoke by devices' DistributeInternalAbility when + * it want to disconnect with remote device. + * + * @param deviceId the deviceID of which device we want to stop connection. + * @param context native ability context + */ + public static void disConnectRemote(String deviceId, Context context) { + RemoteConnection remote = REMOTE_CONNECTION_MAP.get(deviceId); + if (remote != null) { + context.disconnectAbility(remote); + REMOTE_CONNECTION_MAP.remove(deviceId); + } + } + + /** + * this method will be invoke by phone DistributeInternalAbility when it wants to + * send message to other remote device. + * + * @param deviceId the deviceID of remote device which we send message to. + * @param code device message code. + * @param message the action code. + * @return result of sending message. + */ + public static int sendMessage(String deviceId, int code, int message) { + MessageParcel data = MessageParcel.obtain(); + MessageParcel reply = MessageParcel.obtain(); + MessageOption option = new MessageOption(MessageOption.TF_SYNC); + data.writeInt(message); + RemoteConnection remote = REMOTE_CONNECTION_MAP.get(deviceId); + int result = ERROR; + if (remote != null) { + boolean success = remote.sendMessage(code, data, reply, option); + HiLog.info(TAG, "RemoteDataSender: sendMessage " + success); + if (success) { + result = reply.readInt(); + } + data.reclaim(); + reply.reclaim(); + } + return result; + } + + private static class RemoteConnection implements IAbilityConnection { + IRemoteObject myRemoteProxy; + boolean isConnected = false; + + RemoteConnection() { + } + + @Override + public void onAbilityConnectDone(ElementName element, IRemoteObject remote, int resultCode) { + // when remote device connect done, it return a serializable object represent remote object + // we can control remote object through this proxy + myRemoteProxy = remote; + isConnected = true; + HiLog.info(TAG, "RemoteDataSender: onAbilityConnectDone"); + } + + @Override + public void onAbilityDisconnectDone(ElementName element, int resultCode) { + // when remote device PA is closed this callback will be called + // developer can handle PA lifecycle according to different returned error message + isConnected = false; + myRemoteProxy = null; + } + + boolean sendMessage(int code, MessageParcel data, MessageParcel reply, MessageOption option) { + try { + myRemoteProxy.sendRequest(code, data, reply, option); + } catch (RemoteException e) { + HiLog.error(TAG, "SendCommand error"); + return false; + } + return true; + } + } +} diff --git "a/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/commonlib/src/main/resources/base/element/string.json" "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/commonlib/src/main/resources/base/element/string.json" new file mode 100644 index 0000000000000000000000000000000000000000..56966b365930b37b47dbbb7b67865d1411ac8ebe --- /dev/null +++ "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/commonlib/src/main/resources/base/element/string.json" @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "commonlib_library", + "value": "commonlib_library" + } + ] +} diff --git "a/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/commonlib/src/main/resources/base/media/icon.png" "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/commonlib/src/main/resources/base/media/icon.png" new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/commonlib/src/main/resources/base/media/icon.png" differ diff --git "a/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/commonlib/src/main/resources/rawfile/news0.json" "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/commonlib/src/main/resources/rawfile/news0.json" new file mode 100644 index 0000000000000000000000000000000000000000..fac48e7d315cac1f578424bf030f3249345a06a6 --- /dev/null +++ "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/commonlib/src/main/resources/rawfile/news0.json" @@ -0,0 +1,88 @@ +{ + "url": "example://consumer.huawei.com/news0", + "title": "Huawei Announces Apps Up 2020 Global Winners", + "title_image": "/common/newsimages/huawei-hms-app-innovation-contest.jpg", + "date": "Dec 02. 2020", + "content": [ + { + "type": 2, + "image": "/common/newsimages/huawei-hms-app-innovation-contest.jpg" + }, + { + "type": 0, + "text": "Huawei announces the winners of its global HUAWEI HMS App Innovation Contest. More than 3,000 teams worldwide compete for total prizes of 1 million USD in cash." + }, + { + "type": 1, + "text": "• More than 100 winners across five contest regions won the highest prizes with each of $15,000 in cash, angel investment and major promotional opportunities\n• Thousands of exciting new apps released on AppGallery during competition process\n• Full list of winners published on the Apps Up 2020 website" + }, + { + "type": 0, + "text": "More than 3,000 developer teams from five regions across the world participated in Apps Up 2020, HUAWEI HMS App Innovation Contest. The final winners are announced today" + }, + { + "type": 0, + "text": "The HUAWEI HMS App Innovation Contest for HMS developers was launched in June in Europe, China, Asia Pacific, Latin America and the Middle East & Africa, attracting contestants from over 170 countries. The contest spanned more than 100 days, as contestants found innovative ways to use services of HMS Core." + }, + { + "type": 0, + "text": "After an extensive public voting phase combined with assessments by our panel of experts, more than 100 entries have been selected for the following categories:" + }, + { + "type": 1, + "text": "- Best App\n- Best Game\n- Best Social Impact App\n- ost Popular App\n- Honorable Mention" + }, + { + "type": 0, + "text": "Apps Up 2020 winners enjoy a share of a USD 1 million prize pot, plus potential angel investment and promotional opportunities. Winners will also enjoy promotion of their apps on HUAWEI AppGallery, as well as free access to HUAWEI Mobile Cloud resources and Huawei Developers events, courses and certifications. Apps Up winners also have the opportunity to exchange ideas with the competition judging panel." + }, + { + "type": 0, + "text": "All contestants already have their apps published on HUAWEI AppGallery, giving them access to a market of millions of HUAWEI device users worldwide." + }, + { + "type": 0, + "text": "Huawei welcomes submissions from a wide range of fields, including physical and mental health, education, science, agricultural development, environmental protection, transportation, and public safety. Huawei’s aim is to promote apps that create a new smart-living experience for everyone, worldwide." + }, + { + "type": 0, + "text": "Here are a few examples of the type of creative and inspiring inventions emerged in the Apps Up 2020 Contest:" + }, + { + "type": 0, + "text": "• Europe: PlantSnap provides a platform for users to share their passion for plants, nature and the environment with like-minded people around the world. Powered by HUAWEI Account Kit and other HMS Core capabilities, it is able to identify plants in seconds\n• China: Earthquake Map & Alert App provides real-time and historical earthquake data sourced from official meteorological websites, helping people around the globe.It integrates HUAWEI Push Kit.\n• Asia Pacific: Spick & Span is an arcade game that encourages players to push for a cleaner world. It integrates In-App Purchases, Account Kit,Push Kit and HUAWEI Ads.\n• Latin America: SOSMex is a panic button app that enables women in Mexico to alert their friends and family of their whereabouts, so they know when they are in danger. The app is built with HUAWEI Awareness Kit, among other HMS Core open capabilities.\n• The Middle East and Africa: The Deaf Sign Language App (ASL) helps users learn sign language by simply saying a word or phrase so they can communicate easily with people that suffer from hearing impairment. It integrates HUAWEI Analytics Kit and HUAWEI Account Kit." + }, + { + "type": 0, + "text": "Zhang Ping'an, President of Huawei Consumer Cloud Service says: “We remain committed to providing developers with more capabilities, IDE and tools, aspiring to help them make their innovative ideas into reality and bring their creations to the world. Huawei welcomes all developers to join us in the HMS ecosystem and looks forward to joining hands with them to shape the future of technology.”" + }, + { + "type": 0, + "text": "#HMSInnovateforAll" + }, + { + "type": 1, + "text": "About Huawei Developers" + }, + { + "type": 0, + "text": "Huawei Developers, a platform as part of Huawei Mobile Services, provides a one-stop operation support to developers throughout the entire cycle of app and service development; helping developers to turn ideas into reality with the full suite of development capabilities available through HMS Core." + }, + { + "type": 0, + "text": "With more than 2 million developers worldwide already, the ambition of Huawei Developers is to connect with global developers to build an open and innovative ecosystem with shared success." + }, + { + "type": 0, + "text": "Apps created on Huawei Developers can be published and distributed on HUAWEI AppGallery, Huawei’s app distribution platform and one of the world's first app stores implementing a developer identity verification system. It also features a four-layer detection system to ensure app security and leverages proprietary algorithms to enable useful content recommendations." + }, + { + "type": 1, + "text": "About HMS Core" + }, + { + "type": 0, + "text": "HMS Core is a collection of tools made for Huawei’s partners and app developers to create unique, new experiences that tap into the full hardware and software capabilities of Huawei devices have on offer. By integrating HMS Core 5.0, developers can quickly leverage Huawei’s on-device capabilities. HMS Core are currently supporting more than 2 million developers, and 55,000 apps worldwide." + } + ] +} \ No newline at end of file diff --git "a/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/commonlib/src/main/resources/rawfile/news1.json" "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/commonlib/src/main/resources/rawfile/news1.json" new file mode 100644 index 0000000000000000000000000000000000000000..28d2835ac2c7a5574881da0f3970cdc0de527103 --- /dev/null +++ "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/commonlib/src/main/resources/rawfile/news1.json" @@ -0,0 +1,8 @@ +{ + "url": "example://consumer.huawei.com/news1", + "title": "HUAWEI Mate40 Series", + "title_image": "/common/newsimages/mate40-series-web.jpg", + "date": "Oct 22. 2020", + "contains_video": true, + "title_video": "/common/newsvideo/mate40-pv.mp4" +} \ No newline at end of file diff --git "a/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/commonlib/src/main/resources/rawfile/news2.json" "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/commonlib/src/main/resources/rawfile/news2.json" new file mode 100644 index 0000000000000000000000000000000000000000..23656c52f2348210734b66bcd063ed16b78bac52 --- /dev/null +++ "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/commonlib/src/main/resources/rawfile/news2.json" @@ -0,0 +1,100 @@ +{ + "url": "example://consumer.huawei.com/news2", + "title": "Leap Further Ahead with HUAWEI Mate 40 Series: Huawei Unveils the Most Powerful Mate Line-up Ever", + "title_image": "/common/newsimages/leap-further-ahead-with-huawei-mate-40.jpg", + "date": "Oct 22. 2020", + "content": [ + { + "type": 0, + "text": "Huawei Consumer Business Group (BG) today bolstered its product line-up with the advanced HUAWEI Mate 40 Series, the latest revolutionary flagship smartphones that empower users to leap further ahead. Showcasing the pinnacle of Huawei technology, the new Series reinforces Huawei’s dedication to innovation and its unrelenting determination to create the best Mate ever." + }, + { + "type": 2, + "image": "/common/newsimages/leap-further-ahead-with-huawei-mate-40.jpg" + }, + { + "type": 0, + "text": "The HUAWEI Mate 40 Series has the Mate Series DNA at its core. Over the last eight years, there have been 10 outstanding generations of Mate Series devices and now the latest flagship smartphones take Mate to new heights with the best technology in the industry. From powerful performance to unique user interactions, everything about the HUAWEI Mate 40 Series has been fine-tuned to provide the most exciting smartphone experience possible. HUAWEI Mate 40 Pro and HUAWEI Mate 40 Pro+ incorporate the world’s first 5 nanometer 5G SoC, Ultra Vision Cine Camera system and the iconic Space Ring Design, as well as a smarter, more attentive digital experience." + }, + { + "type": 0, + "text": "Richard Yu, Executive Director and CEO of Huawei Consumer BG said: “Each year the HUAWEI Mate Series brings the most exciting technology together into one stunning package. This is what defines the Mate Series DNA and is all made possible by our dedication to innovation. In these unprecedented times, we remain committed to creating a better future, with innovative technology that delivers a positive and meaningful impact on the lives of consumers. In the future, we will continue working closely with our partners to bring the Seamless AI Life experience to consumers all around the world." + }, + { + "type": 1, + "text": "Leap further ahead with the iconic Space Ring Design" + }, + { + "type": 0, + "text": "Marrying iconic design with innovative technology, HUAWEI Mate 40 Pro and HUAWEI Mate 40 Pro+ are informed by the design principle that form manifests function. The uncompromised design of the HUAWEI 88° Horizon Display creates an immersive viewing experience in a compact package, while the silky curve also means the devices are comfortable to hold. The handsets also offer IP 68 dust and water resistance, a choice of both virtual and physical volume controls and enhanced mistouch prevention algorithms." + }, + { + "type": 0, + "text": "Objects of sheer beauty, the HUAWEI Mate 40 Pro and HUAWEI Mate 40 Pro+ devices carry a small front camera cut-out, which is packed full of technology, with 3D Face Unlock, an Ultra Vision Selfie Camera and Smart Gesture Control." + }, + { + "type": 0, + "text": "Turn the devices over and you will see that the HUAWEI Mate 40 Series adopts the Space Ring Design, an evolution of the HUAWEI Mate Series’ iconic circular and symmetrical design. HUAWEI Mate 40 and HUAWEI Mate 40 Pro are available in Black and White, as well as an enchanting Mystic Silver, a finish with a colour-shifting effect that evokes the mysteries of the unseen. There are also two vegan leather variants, Yellow and Green. Meanwhile, HUAWEI Mate 40 Pro+ features an exquisite nano-tech ceramic back panel available in two iconic colours: Ceramic White and Ceramic Black." + }, + { + "type": 1, + "text": "Leap further ahead with Kirin 9000 setting a new standard for performance" + }, + { + "type": 0, + "text": "Powering the best Mate ever, the Kirin 9000 Series is fully equipped for 5G, capable of handling intensive computations and multi-tasking operations with ease. Embedded in HUAWEI Mate 40 Pro and HUAWEI Mate 40 Pro+, the Kirin 9000 is the most sophisticated 5nm 5G SoC available, delivering vastly improved performance and power efficiency over its predecessor. For the first time ever, the flagship 5G SoC has more than 15.3 billion transistors, making it the densest and most full-featured 5G SoC to date. The powerful CPU features a three-level power efficiency architecture with cores running at clock frequencies of up to 3.13GHz. Also integrated into the SoC is a 24-core Mali-G78 GPU, as well as an innovative NPU featuring two big cores and one tiny core, taking on-device AI to a new level." + }, + { + "type": 0, + "text": "The 24-core Mali-G78 GPU in HUAWEI Mate 40 Pro and HUAWEI Mate 40 Pro+ is the most powerful GPU ever seen on a Huawei device. This delivers advanced graphics performance and is complemented by an amazing audio visual experience for immersive gaming. The 90Hz display works together with 240Hz touch sampling rate for greater responsiveness and now provides haptic feedback to correspond with the visual experience. This entertainment set-up is completed with dual stereo speakers to create experiences with super bass stereo." + }, + { + "type": 0, + "text": "The HUAWEI Mate 40 Series is also equipped with the battery technology that is needed to keep up with the demands of 5G, supporting the fastest iteration of HUAWEI SuperCharge." + }, + { + "type": 1, + "text": "Leap further ahead with an all-round imaging system engineered to make photography simple" + }, + { + "type": 0, + "text": "The camera system on the HUAWEI Mate 40 Series has been co-engineered with Leica to provide the best camera solution possible and sees breakthrough upgrades to the ultra-wide angle lens, powerful high-definition main camera, impressive telephoto camera and more. With the Dual Cine Cameras and Dual Ultra Wide Cameras on HUAWEI Mate 40 Pro and HUAWEI Mate 40 Pro+, users can capture amazing wide angle videos and images from both the front-and rear-facing cameras." + }, + { + "type": 0, + "text": "When it comes to cinematic videography, the HUAWEI Mate 40 Pro and HUAWEI Mate 40 Pro+ are unparalleled. The Dual Cine Cameras feature a 3:2 cinema-style shooting ratio sensor. Capturing high quality footage is easier than ever with Steady Shot, while the XD Fusion HDR Video ensures balanced exposure, even when users are capturing with extreme lighting contrast. Other evolutions include Tracking Shot, while Story Creator allows for true cinematic effects. Background music, filters and effects can also be added with ease. Not neglecting audio, HUAWEI Mate 40 Series features Audio Focus, Audio Zoom, and dual stereo speakers." + }, + { + "type": 0, + "text": "The Ultra Wide Cine Camera now offers an even wider field of view, as well as richer detail, improved low light performance and distortion correction algorithms, allowing users to capture beautiful expansive landscapes, while the Super Sensing Wide Camera provides true high definition shots. Image quality has been further enhanced with Full Pixel Octa PD AutoFocus. Improved distortion correction targets the face, body and limbs, making the ultra-wide angle lens useful in more scenarios than ever. HUAWEI Mate 40 Pro features a Periscope Telephoto Camera to support 10x hybrid zoom and 50x digital zoom, and HUAWEI Mate 40 Pro+ takes it further with a dual-telephoto camera system that enables 20x hybrid zoom and 100x digital zoom." + }, + { + "type": 0, + "text": "The Ultra Vision Selfie Camera on the HUAWEI Mate 40 Series take selfies and videos to new heights with support for 4K capture and the option to shoot in one of three available fields of view, ranging from up close and personal to ultra-wide. Slow-Motion Selfie adds even more versatility to the front camera by letting users add dramatic flair when documenting their fast-paced actions." + }, + { + "type": 1, + "text": "Leap further ahead with an all new user experience" + }, + { + "type": 0, + "text": "HUAWEI Mate 40 Pro and HUAWEI Mate 40 Pro+ are set to revolutionise how consumers integrate smartphones into their lives with new user-centric features including Smart Gesture Control, which allows total hands-free control of your device. Simply hover your hand over the device to wake it up or navigate your phone by swiping left, right, up and down. There is also an air press gesture for call answering." + }, + { + "type": 0, + "text": "A device that is always there for you, the all new dynamic Eyes on Display on HUAWEI Mate 40 Pro and HUAWEI Mate 40 Pro+ can be activated at a glance, with fully customisable interactive displays hosting all the information you need from your phone. The ring of incoming calls can be reduced by making eye contact with your phone." + }, + { + "type": 0, + "text": "Improved MeeTime functionality is a gateway to a better connected, more intelligent life.When combined with the power of Huawei’s 1+8+N ecosystem, Multi-screen Collaboration offers an intuitive way for users to operate multiple devices at once, running several apps simultaneously, combining smartphone and PC to deliver unique experiences." + }, + { + "type": 0, + "text": "When it comes to privacy and security, the EMUI 11 operating system has always featured comprehensive security solutions to protect Huawei device users. The Trusted Execution Environment operating system is CC EAL5+ certified, which is the highest certification level for commercialised security microkernel. EMUI 11 also comes with new privacy features. When transferring images, users can easily purge sensitive personal data such as location, time and device details from the file before it is sent." + }, + { + "type": 0, + "text": "HUAWEI Mate 40 Series comes equipped with the innovative Huawei Mobile Services (HMS), bringing users a smarter, richer, more convenient and secure smartphone experience. During the launch, Huawei also unveiled new apps available for global Huawei users, including Petal Search, a search engine with support for multiple types of searches; Petal Maps, a map app that utilises the HUAWEI Mate 40 Series’ gesture control feature; and HUAWEI Docs, a unified word document service. These apps come together to lead the way towards a better digital life for the 700 million Huawei device users worldwide." + } + ] +} \ No newline at end of file diff --git "a/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/commonlib/src/main/resources/rawfile/news3.json" "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/commonlib/src/main/resources/rawfile/news3.json" new file mode 100644 index 0000000000000000000000000000000000000000..b817581aadcf394bc87011950c2346357a58124e --- /dev/null +++ "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/commonlib/src/main/resources/rawfile/news3.json" @@ -0,0 +1,68 @@ +{ + "url": "example://consumer.huawei.com/news3", + "title": "Huawei Launches Petal Search, Petal Maps, HUAWEI Docs and More", + "title_image": "/common/newsimages/huawei-launches-petal-search-petal-map-1.jpg", + "date": "Oct 22. 2020", + "content": [ + { + "type": 0, + "text": "Huawei today announced new developments to Huawei Mobile Services ecosystem at the HUAWEI Mate 40 Series launch event, launching Petal Search, Petal Maps, HUAWEI Docs, levelling up global Huawei users' digital experience with other new updates." + }, + { + "type": 1, + "text": "Hardware and software integration enhances digital lifestyle experience" + }, + { + "type": 0, + "text": "Huawei’s official search engine app, Petal Search now is available in over 170 countries and regions and supports over 50 languages, letting users conveniently and instantly find out the information and services they need." + }, + { + "type": 2, + "image": "/common/newsimages/huawei-launches-petal-search-petal-map-1.jpg" + }, + { + "type": 0, + "text": "Petal Search offers search capabilities across more than 20 categories, including apps, news, videos, images, shopping, flights, and local business. It also develops and integrates various tools, such as weather, calculator, rate exchange and even paper query to help user easily obtain daily-used information. With the new update, the search experience is now visually richer. Search results are presented in information cards, as opposed to simple weblinks, to help users get this wealth of useful information instantly with just a few clicks." + }, + { + "type": 0, + "text": "Leveraging Huawei devices’ AI capabilities, Petal Search allows users to search by taking photos or images through its visual search function. It recognises a wide range of objects such as people, animals, and landmarks, and will introduce new capabilities such as plants identification. For instance, user can simply take a photo of a dish and Petal Search will provide the recipe. A voice search feature is also integrated in the app, supporting English, Spanish, French, Arabic and more. These features help Petal Search meet the needs of users accustomed to an efficient and mobile-centric lifestyle." + }, + { + "type": 0, + "text": "In addition, with the cooperation with global and local partners, Petal Search is vigorously developing local life search services, to provide users a rich location-based and scenario-based search experience. When user look up for local life content, Petal Search provides users with high-quality and popular localized information, such as personalized recommendations or nearby foods, worth visiting local attractions, and shopping discounts." + }, + { + "type": 0, + "text": "Petal Maps, meanwhile, is Huawei’s quality and convenient mapping and navigational tool, offering positioning services, immersive map displays, place searches, driving navigation and favorite place lists  to users in over 140 countries and regions. Petal Maps supports map displays in multiple languages, with voice notifications in English, French, Spanish, German, Italian, and Mandarin." + }, + { + "type": 0, + "text": "Petal Maps is also equipped with cutting-edge functions to give a real-time publish transit updates in some major cities, helping commuters better plan their routes and take the worry off travelling. Utilizing pioneering technologies such as Super GNSS and image recognition algorithms, Petal Maps further heighten the accuracy and present users the most efficient and least congested routes." + }, + { + "type": 0, + "text": "Thanks to HUAWEI Mate 40 Series devices’ Gesture Control, drivers are able to switch between the navigation view and map overview by simply using “air press” towards the screen with their palms. These smart interactions significantly enhance the ease of travel, as well as facilitate a safe driving experience." + }, + { + "type": 0, + "text": "HUAWEI Docs, available in more than 100 countries and regions, supports document viewing and editing across over 50 formats including PDF, PPT, and DOC. With real-time syncing enabled by cloud capabilities, HUAWEI Docs lets users seamlessly work on the same document on different devices logged into the same HUAWEI ID, enhancing the smart office experience." + }, + { + "type": 1, + "text": "Full suite of Huawei Mobile Services apps to complement digital living" + }, + { + "type": 0, + "text": "Upgrade on Find Device enables users to locate their Huawei devices such as smartphones, watches, earphones, and glasses. Users can either play a ringtone remotely to help locate the devices, or choose to lock and wipe devices information, protecting user privacy." + }, + { + "type": 0, + "text": "HUAWEI Themes introduced exclusive theme packs to enable deeper device personalisation. The first batch of packs includes themes of famous artists, classic literature, and the Ingenuity series Huawei selected. " + }, + { + "type": 0, + "text": "Supported by 2 million global developers, Huawei Mobile Services ecosystem maintains rapid growth. As one of the top 3 app marketplace globally, AppGallery continues to bring together popular global and local apps to over 500 million monthly active users. HUAWEI Quick App also reach a 260% year-on-year increase of monthly active users for its tap-to-use and installation-free experience." + } + ] +} diff --git "a/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/commonlib/src/main/resources/rawfile/news4.json" "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/commonlib/src/main/resources/rawfile/news4.json" new file mode 100644 index 0000000000000000000000000000000000000000..266ef89dc1df3e69e7b2b9e4fe9a20a911ac55f1 --- /dev/null +++ "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/commonlib/src/main/resources/rawfile/news4.json" @@ -0,0 +1,8 @@ +{ + "url": "example://consumer.huawei.com/news4", + "title": "HUAWEI WATCH GT 2 Pro", + "title_image": "/common/newsimages/watch-gt2-pro.jpg", + "date": "Oct 22. 2020", + "contains_video": true, + "title_video": "/common/newsvideo/huawei-watch-gt2-pro-video.mp4" +} \ No newline at end of file diff --git "a/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/commonlib/src/main/resources/rawfile/news5.json" "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/commonlib/src/main/resources/rawfile/news5.json" new file mode 100644 index 0000000000000000000000000000000000000000..671f2825f37c066dc652c7070ddf68b8cd407589 --- /dev/null +++ "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/commonlib/src/main/resources/rawfile/news5.json" @@ -0,0 +1,56 @@ +{ + "url": "example://consumer.huawei.com/news5", + "title": "Porsche Design and Huawei Unveil PORSCHE DESIGN HUAWEI WATCH GT 2", + "title_image": "/common/newsimages/huawei-unveil-porsche-design-huawei-watch-gt-2.jpg", + "date": "Oct 22. 2020", + "content": [ + { + "type": 0, + "text": "Design and Huawei today released the new PORSCHE DESIGN HUAWEI WATCH GT 2 at the HUAWEI Mate 40 Series launch event. Huawei’s lat-est smartwatch is a classic yet luxurious addition to the HUAWEI WATCH GT 2 family and marks the brand’s latest collaboration with Porsche Design in the smartwatch industry. As the most high-end addition to the lineup, the PORSCHE DESIGN HUAWEI WATCH GT 2 is a stunning combination of Huawei’s innovative technology and Porsche Design’s pure and functional design philosophy, result-ing in a brand new look that ushers in the next era of smartwatch design." + }, + { + "type": 2, + "image": "/common/newsimages/huawei-unveil-porsche-design-huawei-watch-gt-2.jpg" + }, + { + "type": 1, + "text": "Classic sports car-inspired design and materials" + }, + { + "type": 0, + "text": "The PORSCHE DESIGN HUAWEI WATCH GT 2 features a streamlined titanium body that pays homage to high-speed supercar design. The bezel, with the iconic Porsche Design logo integrated at the top, is seamlessly incorporated into the watch face giving it a premium touch. The smartwatch comes with the innovative quick fit titanium link strap, which users can easily disassemble or adjust, and is made from titanium and polished with a rigorous sandblasting process for a perfect matte finish. Huawei’s new titanium buckle is accented with the Porsche Design Icon, and makes the process of putting on and taking off the watch quick and easy. The end result is a flawlessly designed smartwatch that is premium, mature and scratch-resistant, ideal for everyday wear and outdoor activities." + }, + { + "type": 0, + "text": "Two digital crowns feature Porsche Design’s iconic red circle and are a testament to the innovative and high-end manufacturing of the watch. With a gentle press, users can easily explore the various settings and configurations." + }, + { + "type": 0, + "text": "The customised Porsche Design watch faces are beautifully crafted and provide a sharp yet smart aesthetic. The classic and always-on watch face allows time to pass by elegantly on the wrist. Both the watch hands and numbers are easy to read at a glance. Less is more with the E-PURE watch face which takes the iconic analogue dial to the digital era. Motorsport-inspired racing lines displayed on the back of the PORSCHE DESIGN HUAWEI Mate 40 RS are transferred from the Smartphone to the racing watch face, paying homage to the brand’s sports car DNA and racing history. The smartwatch also offers an innovative stopwatch face that allows users to start timing with a tap of the screen." + }, + { + "type": 1, + "text": "Smart workout modes and health monitoring" + }, + { + "type": 0, + "text": "The PORSCHE DESIGN HUAWEI WATCH GT 2 is built with excellence from the outside in. The new smartwatch provides an impressive two-week long battery life, offering a reliable digital health and fitness manager for users. " + }, + { + "type": 0, + "text": "The smartwatch supports data tracking for more than 100 workout modes, including indoor and outdoor sports such as golf driving range, skiing and mountain climbing amongst others. Combining exclusive and pure design, great durability and 50 metre water-resistance1 , the PORSCHE DESIGN HUAWEI WATCH GT 2 is an ideal companion for all occasions. " + }, + { + "type": 0, + "text": "Advanced heart rate tracking is available via upgraded HUAWEI TruSeen™ 4.0+ heart rate monitoring technology and a 6-in-1 LED lens, which is installed on the delicate ceramic back of the watch. The lens is made of sapphire for better light penetration and accurate heart rate tracking, while the ceramic rear case feels comfortable on the skin. The PORSCHE DESIGN HUAWEI WATCH GT 2 offers comprehensive health monitoring around the clock and measures everything from heart rate, stress level, sleep quality and SpO2 level. In addition, the smartwatch supports all day continuous monitoring of SpO2 level2 , caring for users’ health day and night." + }, + { + "type": 1, + "text": "About Porsche Design:" + }, + { + "type": 0, + "text": "In 1963, Professor Ferdinand Alexander Porsche created one of the most iconic design objects in contemporary history: the Porsche 911. Following his vision to take the principles and myth of Porsche beyond the automotive world, he created the exclusive lifestyle brand Porsche Design in 1972.  His philosophy and design language can still be seen in all Porsche Design products today. Every Porsche Design product stands for extraordinary precision and perfection, boasts a high level of technological innovation and seamlessly combines intelligent functionality and puristic de-sign.  Created by Studio F. A. Porsche in Austria, our products are sold worldwide in over 130 Porsche Design stores, high-end department stores, exclusive specialist retailers and the official online store(www.porsche-design.com)." + } + ] +} \ No newline at end of file diff --git "a/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/commonlib/src/main/resources/rawfile/news6.json" "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/commonlib/src/main/resources/rawfile/news6.json" new file mode 100644 index 0000000000000000000000000000000000000000..7bfc6e638224c7dd2206462b2a0995a3f7954129 --- /dev/null +++ "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/commonlib/src/main/resources/rawfile/news6.json" @@ -0,0 +1,72 @@ +{ + "url": "example://consumer.huawei.com/news6", + "title": "Huawei Introduces FreeBuds Studio Featuring Dynamic ANC and Hi-Fi Sound", + "title_image": "/common/newsimages/huawei-launches-freebuds-studio.jpg", + "date": "Oct 22. 2020", + "content": [ + { + "type": 0, + "text": "Huawei Consumer Business Group (BG) today announced the company’s first over-ear wireless headphones, HUAWEI FreeBuds Studio. The new headphones offer a Hi-Fi-level listening experience and up to 48 kHz wide frequency high-resolution sound quality to truly restore the rich details of high-resolution music. The industry-leading intelligent dynamic active noise cancellation (ANC) provides three noise cancellation modes that can be switched according to varying environmental noise. With the dual connection, users can say goodbye to the complicated pairing process and enjoy the seamless connection provided by HUAWEI FreeBuds Studio." + }, + { + "type": 0, + "text": "Inspired by geometrics and simplicity, HUAWEI FreeBuds Studio offers a stylish look and comfortable fit. It is not only a headphone, but also a smart assistant that allows consumers to experience a better digital audio world." + }, + { + "type": 1, + "text": "Rethink aesthetics with geometric shapes" + }, + { + "type": 0, + "text": "HUAWEI FreeBuds Studio combines art with technology to deliver a beautifully designed and comfortable pair of headphones suitable for many different styles. Instead of using complicated shapes, the ear cups are designed with simple lines and circles, finished with a metallic matte texture for a premium look. A stainless steel cylindrical arm connects the headband and ear cups to provide a unique design." + }, + { + "type": 0, + "text": "Further improving the wearing experience, HUAWEI FreeBuds Studio provides larger ear cups that measure 65 mm x 42 mm to create a spacious fit for more ear sizes. The protein leather ear pad not only feels soft and comfortable, but also enables great sound insulation effects. Its headband uses a streamlined design and can extend to 150 degrees to fit different head shapes and sizes." + }, + { + "type": 1, + "text": "Rethink the listening experience with high resolution sound quality" + }, + { + "type": 0, + "text": "Thanks to professional acoustic components, HUAWEI FreeBuds Pro supports an ultra-wide frequency response of 4Hz - 48 kHz, fine-tuned by audio experts to deliver great sounding music with rich details." + }, + { + "type": 0, + "text": "HUAWEI FreeBuds Studio features a customised diaphragm driver. A four-layer 40mm polymer diaphragm enables a wider frequency response range and higher sensitivity, while Huawei's self-developed L2HC wireless audio codec technologies achieve an audio transmission rate of up to 960 kbps This allows HUAWEI FreeBuds Studio to truly reproduce the original high-quality sounds of audio files in glorious detail." + }, + { + "type": 1, + "text": "Intelligent dynamic noise cancellation for a whole new ANC experience" + }, + { + "type": 0, + "text": "HUAWEI FreeBuds Studio features the innovative \"TAT\" double-layer sound insulation structure and intelligent dynamic ANC that achieve noise cancellation effect of up to 40 dB. With the built-in IMU environment sensor and microphone system, the headphones can accurately detect the user’s sound environment and offer three ANC modes that can adapt to the environment for better noise cancellation effects." + }, + { + "type": 0, + "text": "In addition, HUAWEI FreeBuds Studio supports awareness mode and voice mode, allowing users to stay aware of their surroundings or have a clear conversations without removing their headphones. Moreover, the all-new six-mic call noise reduction system can pick up voice more directionally, effectively focusing on voices and cutting out background noise." + }, + { + "type": 1, + "text": "Seamless all-scenario connections to revamp the audio connection experience" + }, + { + "type": 0, + "text": "Users are beginning to expect dual-device connections in the smart life era. HUAWEI FreeBuds Studio features four-channel, dual-mode and dual connection, which allows users to simultaneously connect with two devices without needing to disconnect and re-connect. It not only supports dual connection with Huawei all-scenario devices, but also with Android, iOS and Windows-based devices to enable seamless connection between devices." + }, + { + "type": 0, + "text": "HUAWEI FreeBuds Studio is the industry’s first dual antenna over-ear wireless headphone that offers 360° omnidirectional Bluetooth signal coverage for a more stable connection. Even in places with strong signal interference such as airports, the dual antenna design can intelligently identify and automatically switch to another antenna with a stronger signal, bringing better connection and stability for smooth phone calls." + }, + { + "type": 0, + "text": "When the HUAWEI FreeBuds Studio is fully charged, it can play music with ANC for up to 20 hours, or 24 hours if the ANC is turned off. With just a 10-minute quick charge, the HUAWEI FreeBuds Studio can offer five hours of music playback with ANC on, or eight hours if the ANC is turned off." + }, + { + "type": 0, + "text": "The new HUAWEI FreeBuds Studio meets users’ increasingly demanding audio needs. Its Hi-Fi level of wireless audio quality performance, ground-breaking noise cancellation experience and interactive features enhance both work and entertainment, providing all-day wearing comfort." + } + ] +} \ No newline at end of file diff --git "a/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/commonlib/src/main/resources/rawfile/news7.json" "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/commonlib/src/main/resources/rawfile/news7.json" new file mode 100644 index 0000000000000000000000000000000000000000..cd582a473a7f67ed80b0f12dc81285ddda29b09a --- /dev/null +++ "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/commonlib/src/main/resources/rawfile/news7.json" @@ -0,0 +1,52 @@ +{ + "url": "example://consumer.huawei.com/news7", + "title": "Huawei Announces HUAWEI X GENTLE MONSTER Eyewear II: Leading the Way in Smart Audio Fashion", + "title_image": "common/newsimages/huawei-launches-gentle-monster-eyewear.jpg", + "date": "Oct 22. 2020", + "content": [ + { + "type": 0, + "text": "Today, Huawei officially unveiled the next generation of smart glasses in the HUAWEI X GENTLE MONSTER Eyewear II. Based on their core design philosophy of the seamless fusion of technology with fashion, Huawei’s second-generation smart glasses continue to focus on audio and smart innovation, with a more avant-garde yet comfortable design and a greater wealth of outstanding smart functions to experience. With it, Huawei is forging a unique and iconic smart wear trend for sophisticated fashion-conscious consumers. " + }, + { + "type": 2, + "image": "common/newsimages/huawei-launches-gentle-monster-eyewear.jpg" + }, + { + "type": 0, + "text": "The Eyewear II collection is a bold and forward-thinking variation on GENTLE MONSTER’s designs. The Eyewear II draws on GENTLE MONSTER’s design philosophy which is not only visually stunning but also offers a wide range of sunglasses and eyewear options to accentuate the wearer’s personality. Eyewear II was designed using Huawei’s core technologies and acoustic privacy protection features. The semi-open, ultra-thin, large-amplitude speaker effectively cancels out sound leakage and provides the wearer with high-definition stereo sound. The newly upgraded Smart Interaction function turns the glasses into your own personal assistant, which offers not only faster access to information, but also a more intelligent form of interaction, providing consumers with a brand new experience of smart wearable technology. " + }, + { + "type": 1, + "text": "Fashion and comfort in style" + }, + { + "type": 0, + "text": "The HUAWEI X GENTLE MONSTER Eyewear II offers a more comfortable wearing experience. Integrating technologies in a precise manner, the slim temples are made of plastic titanium for lower density and lighter weight. The hinge between the temples and the frame rim is also made of titanium elastic, with increased holding strength to reduce the gripping feeling brought about on the temples. Furthermore, the curved earpiece angle has been increased from the first generation, from 12° to 20°, to achieve a better fit." + }, + { + "type": 0, + "text": "Compared to the first generation, Eyewear II features a larger, slimmer, large-amplitude loudspeaker that offers a wider soundstage range for a more immersive sound experience, perfect for listening to music, playing games or watching TV." + }, + { + "type": 0, + "text": "Eyewear II also features a unique acoustic privacy design, with one semi-open speaker on each side of the lens temple, which transmits sound directly to the wearer's ear through the directional sound chamber, effectively reducing sound leakage and providing a clearer and more layered stereo experience. Meanwhile, both temples include a leakage hole design that can offset the directional sound waves generated by sound cavities, further reducing sound leakage. Together with adaptive volume technology, Eyewear II can automatically lower the volume based on the ambient sound environment, which ensures the user can hear clearly while minimising the impact on the people around them." + }, + { + "type": 1, + "text": "Smart audio, smart interaction" + }, + { + "type": 0, + "text": "Eyewear II supports updated smart gesture control. For pairing, users only need to gently pinch on the left temple. In addition, the voice assistant can be easily activated by a double tap on the left temple. Eyewear II also supports swiping gestures. To play the next/previous song or adjust the volume, users only need to make a few swipes on the temples without taking out their phone. Equipped with multiple advanced sensors, Eyewear II can intelligently detect wear status. For instance, during music playback, Eyewear II will pause when the sensors detect that the user has taken off the glasses, and will resume if the user puts them on again within three minutes." + }, + { + "type": 0, + "text": "In addition, Eyewear II makes a step forward interms of smart experience. After the user puts aside their Eyewear II for a while and put them on again, a window will pop up on the smartphone screen, so the user can check Eyewear II’s battery level with a glance. By tapping on the pop-up window, the user can quickly go to the device’s settings for more details3. Eyewear II plays a greeting when the user puts them on for the first time each day. " + }, + { + "type": 0, + "text": "Aside from outstanding audio experience, Eyewear II comes with powerful battery to allow users to keep wearing them for hours on end. Eyewear II can play music for 5 hours continuously on a single charge. Moreover, Eyewear II features new NFC contactless and wireless fast charging technology, making the glasses ready to use anytime, anywhere." + } + ] +} diff --git "a/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/commonlib/src/main/resources/rawfile/news8.json" "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/commonlib/src/main/resources/rawfile/news8.json" new file mode 100644 index 0000000000000000000000000000000000000000..e411af73764099ae538cc6ae88fd7326441b984e --- /dev/null +++ "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/commonlib/src/main/resources/rawfile/news8.json" @@ -0,0 +1,29 @@ +{ + "url": "example://consumer.huawei.com/news8", + "title": "HUAWEI Women Developers Program Drives Technological Innovation", + "title_image": "/common/newsimages/woman-dev.jpg", + "contains_webpage": true, + "web_page": "https://consumer.huawei.com/en/press/news/2021/huawei-women-developers-program-drives-technological-innovation/", + "content": [ + { + "type": 0, + "text": "Huawei today officially launched its HUAWEI Women Developers (HWD) program, which aims to empower women developers to create applications and tools that can change the world. The program is intended to encourage more women to join in technological innovation by providing participants with more opportunities and platforms for career development and skill training. Any woman developer from around the world can register to join the program on the HUAWEI Developers official website." + }, + { + "type": 2, + "image": "common/newsimages/huawei-woman.jpg" + }, + { + "type": 0, + "text": "Huawei states in the announcement that, in the digital era, more opportunities and support must be given to women to ensure they have access to the education and training that they need to be fundamentally competitive in the digital economy. Equipping women with these skills has proven to promote social integration and inclusive and diversified societies." + }, + { + "type": 2, + "image": "common/newsimages/woman-dev.jpg" + }, + { + "type": 0, + "text": "The HUAWEI Women Developers program is the newest initiative that Huawei has taken as part of its commitment to promoting gender equality. The program will provide participants with training on technological innovation and career development paths, along with opportunities to meet with experts in cutting-edge technologies from various fields, and to participate in hands-on scenario-based experiments and drills. Huawei hopes to create a special community for women developers on the HUAWEI Developers platform, and organize a series of online and offline events." + } + ] +} \ No newline at end of file diff --git "a/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/commonlib/src/main/resources/rawfile/news9.json" "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/commonlib/src/main/resources/rawfile/news9.json" new file mode 100644 index 0000000000000000000000000000000000000000..b912c6e1964d4957f3b1bca157c85cda835c3229 --- /dev/null +++ "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/commonlib/src/main/resources/rawfile/news9.json" @@ -0,0 +1,33 @@ +{ + "url": "example://consumer.huawei.com/news9", + "title": "Huawei Debuts Smart Home Project at MWC Shanghai 2021", + "title_image": "/common/newsimages/smart-home.jpg", + "contains_webpage": true, + "web_page": "https://consumer.huawei.com/en/press/news/2021/huawei-debuts-smart-home-project-at-mwc-shanghai-2021/", + "content": [ + { + "type": 0, + "text": "Today, Huawei's first Smart Home project was unveiled at MWC Shanghai 2021. Following the core design concept of building a smart home, the installation includes a living room, kitchen, study, home gym, entertainment room, and garage, and covers an area of 550 m2 in total. Using wireless technologies, Huawei's products, including phones, PCs, tablets, watches, smart speakers, and the Vision TV range, are integrated with products from Huawei ecosystem partners to provide a comfortable, intelligent and immersive Smart Home experience." + }, + { + "type": 0, + "text": "Smart home represents a key part of Huawei's Seamless AI Life Strategy. The Smart Home project, which integrates innovative technologies such as HUAWEI HiLink, HarmonyOS, and HUAWEI HiCar, is a prototype for what a smart home can be in the Internet of Everything era." + }, + { + "type": 2, + "image": "common/newsimages/smart-home.jpg" + }, + { + "type": 0, + "text": "In the living room, it just takes a few words to wake up the smart assistant and enable the Back Home Mode. In this mode, the air purifier and warm light are turned on, and curtains are closed. These connected devices can all be controlled using the smart assistant. In the kitchen, you'll find a full complement of HarmonyOS-based household appliances. Establishing a network connection is as simple as tapping your phone against those devices. A card will be displayed, from which you can control them at any time." + }, + { + "type": 2, + "image": "common/newsimages/dining-room.jpg" + }, + { + "type": 0, + "text": "In the coming Internet of Everything era, living in a smart home is no longer merely about installing smart devices at home. The focus is now shifting to how those devices will form a virtual world and become an extension of human senses, as well as improving how we interact with those devices by developing a repertoire of intuitive voice and gesture commands. Smart devices powered by AI sensing and computing capabilities can sense users' behaviors, monitor their health indicators, and even understand their emotions, to better grease the wheels of daily life." + } + ] +} \ No newline at end of file diff --git "a/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/.gitignore" "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/.gitignore" new file mode 100644 index 0000000000000000000000000000000000000000..7d5b7a94f4dcf381f03ff21f28f8a2494b58023f --- /dev/null +++ "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/.gitignore" @@ -0,0 +1,2 @@ +/build +/node_modules diff --git "a/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/build.gradle" "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/build.gradle" new file mode 100644 index 0000000000000000000000000000000000000000..858ca0bf7603f4a7ea7884a95085182cae5b363f --- /dev/null +++ "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/build.gradle" @@ -0,0 +1,26 @@ +apply plugin: 'com.huawei.ohos.hap' +apply plugin: 'com.huawei.ohos.decctest' +//For instructions on signature configuration, see https://developer.harmonyos.com/cn/docs/documentation/doc-guides/ide_debug_device-0000001053822404#section1112183053510 +ohos { + compileSdkVersion 6 + defaultConfig { + compatibleSdkVersion 6 + } + buildTypes { + release { + proguardOpt { + proguardEnabled false + rulesFiles 'proguard-rules.pro' + } + } + } +} +dependencies { + implementation fileTree(dir: 'libs', include: ['*.jar', '*.har']) + testImplementation 'junit:junit:4.13.1' + ohosTestImplementation 'com.huawei.ohos.testkit:runner:1.0.0.200' + implementation project(path: ':commonlib') +} +decc { + supportType = ['html', 'xml'] +} diff --git "a/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/package.json" "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/package.json" new file mode 100644 index 0000000000000000000000000000000000000000..0967ef424bce6791893e9a57bb952f80fd536e93 --- /dev/null +++ "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/package.json" @@ -0,0 +1 @@ +{} diff --git "a/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/proguard-rules.pro" "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/proguard-rules.pro" new file mode 100644 index 0000000000000000000000000000000000000000..f7666e47561d514b2a76d5a7dfbb43ede86da92a --- /dev/null +++ "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/proguard-rules.pro" @@ -0,0 +1 @@ +# config module specific ProGuard rules here. \ No newline at end of file diff --git "a/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/config.json" "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/config.json" new file mode 100644 index 0000000000000000000000000000000000000000..380947242e7afd112f923beb7862cc4d4926807a --- /dev/null +++ "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/config.json" @@ -0,0 +1,108 @@ +{ + "app": { + "bundleName": "com.example.myapplication", + "vendor": "example", + "version": { + "code": 1000000, + "name": "1.0.0" + } + }, + "deviceConfig": {}, + "module": { + "package": "com.example.myapplication", + "name": ".MyApplication", + "mainAbility": "com.example.myapplication.MainAbility", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry", + "installationFree": false + }, + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "visible": true, + "name": "com.example.myapplication.MainAbility", + "icon": "$media:icon", + "description": "$string:mainability_description", + "label": "$string:entry_MainAbility", + "type": "page", + "launchType": "singleton" + }, + { + "visible": true, + "name": "com.example.myapplication.DeviceSelectAbility", + "icon": "$media:icon", + "description": "$string:deviceselectability_description", + "label": "$string:entry_MainAbility", + "type": "page", + "launchType": "singleton" + }, + { + "visible": true, + "icon": "$media:icon", + "name": "com.example.myapplication.WebViewAbility", + "description": "$string:webviewability_description", + "label": "$string:entry_MainAbility", + "type": "page", + "launchType": "standard" + } + ], + "js": [ + { + "pages": [ + "pages/index/index", + "pages/detail/detail", + "pages/remote_controller/controller" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": true + } + }, + { + "pages": [ + "pages/selectdevice/selectdevice" + ], + "name": "selectdevice", + "window": { + "designWidth": 720, + "autoDesignWidth": true + } + } + ], + "reqPermissions": [ + { + "name": "ohos.permission.INTERNET" + }, + { + "name": "ohos.permission.DISTRIBUTED_DATASYNC" + }, + { + "name": "ohos.permission.DISTRIBUTED_DEVICE_STATE_CHANGE" + }, + { + "name": "ohos.permission.GET_DISTRIBUTED_DEVICE_INFO" + }, + { + "name": "ohos.permission.GET_BUNDLE_INFO" + }, + { + "name": "ohos.permission.KEEP_BACKGROUND_RUNNING" + } + ] + } +} \ No newline at end of file diff --git "a/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/java/com/example/myapplication/DeviceSelectAbility.java" "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/java/com/example/myapplication/DeviceSelectAbility.java" new file mode 100644 index 0000000000000000000000000000000000000000..485adbd92711e2c30352a61f044529f40a08f534 --- /dev/null +++ "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/java/com/example/myapplication/DeviceSelectAbility.java" @@ -0,0 +1,22 @@ +package com.example.myapplication; + +import ohos.aafwk.content.Intent; +import ohos.ace.ability.AceAbility; + +/** + * DeviceSelectAbility to invoke DeviceSelectInternalAbility.register() method + */ +public class DeviceSelectAbility extends AceAbility { + @Override + public void onStart(Intent intent) { + DeviceSelectInternalAbility.register(this); + setInstanceName("selectdevice"); + setPageParams("pages/selectdevice/selectdevice", intent.getParams()); + super.onStart(intent); + } + + @Override + public void onStop() { + super.onStop(); + } +} \ No newline at end of file diff --git "a/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/java/com/example/myapplication/DeviceSelectInternalAbility.java" "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/java/com/example/myapplication/DeviceSelectInternalAbility.java" new file mode 100644 index 0000000000000000000000000000000000000000..0d64eace9865c256dd92772f72f8b15a95a1e7b0 --- /dev/null +++ "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/java/com/example/myapplication/DeviceSelectInternalAbility.java" @@ -0,0 +1,85 @@ +package com.example.myapplication; + +import ohos.ace.ability.AceInternalAbility; +import ohos.app.AbilityContext; +import ohos.distributedschedule.interwork.DeviceInfo; +import ohos.distributedschedule.interwork.DeviceManager; +import ohos.hiviewdfx.HiLog; +import ohos.hiviewdfx.HiLogLabel; +import ohos.rpc.MessageOption; +import ohos.rpc.MessageParcel; +import ohos.rpc.RemoteException; +import ohos.utils.zson.ZSONArray; +import ohos.utils.zson.ZSONObject; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * deviceSelectInternalAbility declare business logic to react according + * to messageCode sent from FA(written by javascript) + */ +class DeviceSelectInternalAbility extends AceInternalAbility { + private static final int ACTION_REQUEST_DEVICE_LIST = 1001; + private static final HiLogLabel TAG = new HiLogLabel(0, 0, "DeviceSelectInternalAbility"); + private static DeviceSelectInternalAbility INSTANCE; + private final AbilityContext context; + + /** + * constructor of DeviceSelectInternalAbility + * + * @param context ability context + */ + private DeviceSelectInternalAbility(AbilityContext context) { + super("com.example.myapplication.phone", "DeviceSelectInternalAbility"); + this.context = context; + } + + /** + * set InternalAbilityHandler for instance of DeviceSelectInternalAbility + * + * @param context ability context + */ + static void register(AbilityContext context) { + INSTANCE = new DeviceSelectInternalAbility(context); + INSTANCE.setInternalAbilityHandler((code, data, reply, option) + -> INSTANCE.onRemoteRequest(code, data, reply, option)); + } + + /** + * react to remote request due to different ACTION_CODE, you should make sure ACTION_CODE is same at FA and PA. + * + * @param code ACTION_CODE + * @param data currently excessive + * @param reply reply for remote request + * @param option currently excessive + * @return whether request is correctly reply + * @throws RemoteException when action for remote request went wrong + */ + private boolean onRemoteRequest(int code, MessageParcel data, MessageParcel reply, MessageOption option) throws + RemoteException { + if (code == ACTION_REQUEST_DEVICE_LIST) { + context.requestPermissionsFromUser(new String[]{"ohos.permission.DISTRIBUTED_DATASYNC"}, 0); + Map replyResult = new HashMap<>(); + replyResult.put("code", 0); + ZSONArray zsonArray = new ZSONArray(); + List devices = DeviceManager.getDeviceList(DeviceInfo.FLAG_GET_ONLINE_DEVICE); + HiLog.info(TAG, "Find online device count:" + devices.size()); + for (DeviceInfo deviceInfo : devices) { + ZSONObject obj = new ZSONObject(); + obj.put("name", deviceInfo.getDeviceName()); + obj.put("type", deviceInfo.getDeviceType()); + obj.put("id", deviceInfo.getDeviceId()); + obj.put("debugMode", MainAbility.enableDebugMode()); + zsonArray.add(obj); + } + replyResult.put("devices", zsonArray); + reply.writeString(ZSONObject.toZSONString(replyResult)); + } else { + throw new RemoteException(); + } + + return true; + } +} diff --git "a/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/java/com/example/myapplication/DistributeInternalAbility.java" "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/java/com/example/myapplication/DistributeInternalAbility.java" new file mode 100644 index 0000000000000000000000000000000000000000..2a4ab564217accef3e294b67cc82bc0195d2f109 --- /dev/null +++ "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/java/com/example/myapplication/DistributeInternalAbility.java" @@ -0,0 +1,123 @@ +package com.example.myapplication; + +import com.example.myapplication.constant.Command; +import com.example.myapplication.remotedatabus.RemoteDataSender; + +import ohos.ace.ability.AceInternalAbility; +import ohos.app.AbilityContext; +import ohos.hiviewdfx.HiLog; +import ohos.hiviewdfx.HiLogLabel; +import ohos.rpc.MessageOption; +import ohos.rpc.MessageParcel; +import ohos.rpc.RemoteException; +import ohos.utils.zson.ZSONObject; + +import java.util.HashMap; +import java.util.Map; + +/** + * DistributeInternalAbility responsible for connect with remote device, also handle FA request : declare different + * business logic to react according to messageCode sent from FA. + */ +public class DistributeInternalAbility extends AceInternalAbility { + private static final HiLogLabel TAG = new HiLogLabel(0, 0, "DistributeInternalAbility"); + private static final int CONNECT_ABILITY = 2000; + private static final int DISCONNECT_ABILITY = 2001; + private static final int SEND_MSG = 2002; + private static final int SUCCESS_CODE = 0; + private static final int FAIL_CODE = -1; + private static DistributeInternalAbility INSTANCE; + private final AbilityContext context; + private String selectDeviceId; + + /** + * default constructor + * + * @param context ability context + */ + public DistributeInternalAbility(AbilityContext context) { + super("com.example.myapplication.phone", "DistributeInternalAbility"); + this.context = context; + } + + /** + * setInternalAbilityHandler for DistributeInternalAbility instance + * + * @param context ability context + */ + static void register(AbilityContext context) { + INSTANCE = new DistributeInternalAbility(context); + INSTANCE.setInternalAbilityHandler((code, data, reply, option) -> + INSTANCE.onRemoteRequest(code, data, reply, option)); + } + + /** + * destroy DistributeInternalAbility instance + */ + private static void unregister() { + INSTANCE.destroy(); + } + + /** + * default destructor + */ + private void destroy() { + } + + /** + * hand click request from javascript + * + * @param code ACTION_CODE + * @param data data sent from javascript + * @param reply reply for javascript + * @param option currently excessive + * @return whether javascript click event is correctly responded + */ + private boolean onRemoteRequest(int code, MessageParcel data, MessageParcel reply, MessageOption option) { + Map replyResult = new HashMap<>(); + switch (code) { + // send message to remote device, message contains controller command from FA + case SEND_MSG: { + try { + ZSONObject dataParsed = ZSONObject.stringToZSON(data.readString()); + int message = dataParsed.getIntValue("message"); + int success = RemoteDataSender.sendMessage(selectDeviceId, Command.COMMAND_TV, message); + if (success == -1) { + boolean connectRes = RemoteDataSender.connectRemote(selectDeviceId, context); + if (!connectRes) { + throw new RemoteException(); + } + } + assembleReplyResult(SUCCESS_CODE, replyResult, new Object(), reply); + } catch (RemoteException e) { + HiLog.error(TAG, "DistributeInternalAbility Exception " + e); + } + break; + } + // to invoke remote device's newsShare ability and send news url we transfer + case CONNECT_ABILITY: { + ZSONObject dataParsed = ZSONObject.stringToZSON(data.readString()); + selectDeviceId = dataParsed.getString("deviceId"); + boolean result = RemoteDataSender.connectRemote(selectDeviceId, context); + assembleReplyResult(result ? SUCCESS_CODE : FAIL_CODE, replyResult, new Object(), reply); + break; + } + // when controller FA went to destroy lifeCycle, disconnect with remote newsShare ability + case DISCONNECT_ABILITY: { + RemoteDataSender.disConnectRemote(selectDeviceId, context); + assembleReplyResult(SUCCESS_CODE, replyResult, new Object(), reply); + unregister(); + break; + } + default: + HiLog.error(TAG, "messageCode not handle properly in phone distributeInternalAbility"); + } + return true; + } + + private void assembleReplyResult(int code, Map replyResult, Object content, MessageParcel reply) { + replyResult.put("code", code); + replyResult.put("content", content); + reply.writeString(ZSONObject.toZSONString(replyResult)); + } +} diff --git "a/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/java/com/example/myapplication/MainAbility.java" "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/java/com/example/myapplication/MainAbility.java" new file mode 100644 index 0000000000000000000000000000000000000000..0263b80f0bf8f86d104338be1440980b3f7e0bd8 --- /dev/null +++ "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/java/com/example/myapplication/MainAbility.java" @@ -0,0 +1,60 @@ +package com.example.myapplication; + +import com.example.myapplication.newsdata.NewsInfoInternalAbility; + +import ohos.aafwk.content.Intent; +import ohos.ace.ability.AceAbility; +import ohos.bundle.AbilityInfo; + +/** + * This template is a NewsShare demo to show the possibility of DistributeAbility of HarmonyOS. + * The general business logic of this template is: when we read news on a phone we can transfer + * specific news detail to SMART_TV or another phone, if the destination is TV, the phone will + * router to controller page where we can send command to control news reading on the TV. + *

+ * Currently our demo read news from json, you can rewrite get news method in NewsInfo.java to + * choose different data source. And news content can also contains video you can extend this + * template with more functions. + *

+ * By the way, if you don't have a smart_TV as debug device, you can enable DEBUG_MODE below + * to make your phone recognize your another phone as TV. You should install TV hap to your + * another phone to make it as an TV instance, and install a "DEBUG_MODE" enabled hap to your + * phone. + */ +public class MainAbility extends AceAbility { + + /** + * If you need to simulate TV by your phone, please follow the instructions below. + * 0.enable DEBUG_MODE and install this phone hap to your phone A. + * 1.install TV hap to your phone B to make it a TV instance. + * + * @return DEBUG_MODE + */ + static boolean enableDebugMode() { + // default: true,which mean your another phone is simulated as TV. + return true; + } + + @Override + public void onStart(Intent intent) { + NewsInfoInternalAbility.register(this); + DistributeInternalAbility.register(this); + setDisplayOrientation(AbilityInfo.DisplayOrientation.PORTRAIT); + setInstanceName("default"); + super.onStart(intent); + } + + @Override + public void onNewIntent(Intent intent) { + if (intent.hasParameter("deviceId")) { + pushPage("pages/remote_controller/controller", intent.getParams()); + } + super.onNewIntent(intent); + } + + @Override + public void onStop() { + super.onStop(); + } + +} diff --git "a/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/java/com/example/myapplication/MyApplication.java" "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/java/com/example/myapplication/MyApplication.java" new file mode 100644 index 0000000000000000000000000000000000000000..33915e2cc691b0fa169fd0a13e2262ac3925bafd --- /dev/null +++ "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/java/com/example/myapplication/MyApplication.java" @@ -0,0 +1,10 @@ +package com.example.myapplication; + +import ohos.aafwk.ability.AbilityPackage; + +public class MyApplication extends AbilityPackage { + @Override + public void onInitialize() { + super.onInitialize(); + } +} diff --git "a/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/java/com/example/myapplication/WebViewAbility.java" "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/java/com/example/myapplication/WebViewAbility.java" new file mode 100644 index 0000000000000000000000000000000000000000..05267263c5f2e8d670f2226a8f7098f6603a8934 --- /dev/null +++ "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/java/com/example/myapplication/WebViewAbility.java" @@ -0,0 +1,190 @@ +package com.example.myapplication; + +import com.example.myapplication.newsdata.NewsInfo; + +import ohos.aafwk.ability.Ability; +import ohos.aafwk.content.Intent; +import ohos.aafwk.content.IntentParams; +import ohos.aafwk.content.Operation; + +import ohos.agp.components.Button; +import ohos.agp.components.ProgressBar; +import ohos.agp.components.webengine.BrowserAgent; +import ohos.agp.components.webengine.Navigator; +import ohos.agp.components.webengine.WebAgent; +import ohos.agp.components.webengine.WebView; + +import ohos.hiviewdfx.HiLog; +import ohos.hiviewdfx.HiLogLabel; + +import ohos.utils.zson.ZSONObject; + +/** + * WebViewAbility implements Web Page browsing function in the app. + */ +public class WebViewAbility extends Ability { + private static final HiLogLabel TAG = new HiLogLabel(0, 0, "WebViewAbility"); + private static final String SHARING_EXTRA_INFO = "sharing_fa_extra_info"; + private static final String INIT_WEB_PAGE = "web_page"; + private static final String INIT_INDEX = "index"; + private WebView webView; + private ProgressBar progressBar; + private Button buttonBack; + private Button buttonTrans; + private String webPage; + private int newsIndex; + private NewsInfo newsInfo; + + @Override + public void onStart(Intent intent) { + super.onStart(intent); + super.setUIContent(ResourceTable.Layout_webview_detail); + initComponent(); + newsInfo = NewsInfo.getInstance(this); + + IntentParams intentParams = intent.getParams(); + if (intentParams.hasParam("__startParams")) { + ZSONObject newZson = ZSONObject.stringToZSON(intentParams.getParam("__startParams").toString()); + this.webPage = newZson.getString(INIT_WEB_PAGE); + this.newsIndex = Integer.parseInt(newZson.getString(INIT_INDEX)); + } + + String shareInfo = intent.getStringParam(SHARING_EXTRA_INFO); + if (shareInfo != null) { + this.newsIndex = Integer.parseInt(shareInfo); + this.webPage = newsInfo.getWebNewsUrl(this.newsIndex); + } + + configComponent(); + } + + @Override + public void onNewIntent(Intent intent) { + String shareInfo = intent.getStringParam(SHARING_EXTRA_INFO); + if (shareInfo != null) { + this.newsIndex = Integer.parseInt(shareInfo); + this.webPage = newsInfo.getWebNewsUrl(this.newsIndex); + } + webView.load(this.webPage); + super.onNewIntent(intent); + } + + private void initComponent() { + this.webView = (WebView) findComponentById(ResourceTable.Id_webview); + this.progressBar = (ProgressBar) findComponentById(ResourceTable.Id_progressbar); + this.buttonBack = (Button) findComponentById(ResourceTable.Id_button_back); + this.buttonTrans = (Button) findComponentById(ResourceTable.Id_button_transfer); + } + + private void configComponent() { + webView.load(this.webPage); + webView.setWebAgent(new WebAgent()); + webView.getWebConfig().setJavaScriptPermit(true); + webView.setBrowserAgent(new BrowserAgent(this) { + @Override + public void onProgressUpdated(WebView webView, int newProgress) { + super.onProgressUpdated(webView, newProgress); + if (newProgress == 100) { + progressBar.setVisibility(WebView.HIDE); + } else { + progressBar.setVisibility(WebView.VISIBLE); + progressBar.setProgressValue(newProgress); + } + } + }); + Navigator navigator = webView.getNavigator(); + if (navigator.canGoBack()) { + navigator.goBack(); + } + if (navigator.canGoForward()) { + navigator.goForward(); + } + + this.buttonBack.setClickedListener(component -> { + if (navigator.canGoBack()) { + navigator.goBack(); + } else { + onBackPressed(); + } + }); + + this.buttonTrans.setClickedListener(component -> { + Intent newIntent = new Intent(); + newIntent.setParam("title", this.webPage); + Operation operation = new Intent.OperationBuilder() + .withBundleName(getBundleName()) + .withAbilityName(DeviceSelectAbility.class.getName()) + .build(); + newIntent.setOperation(operation); + startAbilityForResult(newIntent, 0); + }); + } + + @Override + protected void onAbilityResult(int requestCode, int resultCode, Intent resultData) { + if (resultData == null) { + return; + } + super.onAbilityResult(requestCode, resultCode, resultData); + + ZSONObject newZson = ZSONObject.classToZSON(resultData); + String deviceName = newZson.getZSONObject("params").getZSONObject("params").getZSONObject("resultData") + .getZSONObject("result").getString("deviceName"); + String deviceType = newZson.getZSONObject("params").getZSONObject("params").getZSONObject("resultData") + .getZSONObject("result").getString("deviceType"); + String deviceId = newZson.getZSONObject("params").getZSONObject("params").getZSONObject("resultData") + .getZSONObject("result").getString("deviceId"); + if (deviceId == null || "".equals(deviceId)) { + return; + } + boolean debugMode = newZson.getZSONObject("params").getZSONObject("params").getZSONObject("resultData") + .getZSONObject("result").getBoolean("deviceDebugMode"); + + Intent newIntent = new Intent(); + Intent.OperationBuilder operationBuilder = new Intent.OperationBuilder().withDeviceId(deviceId) + .withBundleName("com.example.myapplication").withFlags(Intent.FLAG_ABILITYSLICE_MULTI_DEVICE); + Operation operation; + + // when transferring to smartphone which simulated as tv, add debugMode here + if ("SMART_TV".equals(deviceType)) { + newIntent.setParam("newsUrl", newsInfo.getNewsUrl(this.newsIndex)); + operation = operationBuilder.withAbilityName(MainAbility.class.getName()).build(); + newIntent.setOperation(operation); + startAbility(newIntent); + + Intent localIntent = new Intent(); + localIntent.setParam("newsUrl", newsInfo.getNewsUrl(this.newsIndex)); + localIntent.setParam("newsTitle", newsInfo.getNewsTitle(this.newsIndex)); + localIntent.setParam("newsImage", newsInfo.getNewsImage(this.newsIndex)); + localIntent.setParam("deviceId", deviceId); + localIntent.setParam("deviceType", deviceType); + localIntent.setParam("deviceName", deviceName); + + Operation localOpt = new Intent.OperationBuilder() + .withDeviceId("") + .withBundleName("com.example.myapplication") + .withAbilityName(MainAbility.class.getName()) + .build(); + localIntent.setOperation(localOpt); + startAbility(localIntent); + } else if ("SMART_PHONE".equals(deviceType)) { + newIntent.setParam(SHARING_EXTRA_INFO, String.valueOf(this.newsIndex)); + operation = operationBuilder.withAbilityName(WebViewAbility.class.getName()).build(); + newIntent.setOperation(operation); + startAbility(newIntent); + } else { + HiLog.error(TAG, "Device Type Error, please Try Again"); + } + } + + @Override + protected void onActive() { + super.onActive(); + } + + @Override + public void onStop() { + super.onStop(); + } + +} diff --git "a/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/default/app.js" "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/default/app.js" new file mode 100644 index 0000000000000000000000000000000000000000..aedcefe0054c6e16c40491f4d1abc20a4dc1c6ef --- /dev/null +++ "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/default/app.js" @@ -0,0 +1,8 @@ +export default { + onCreate() { + console.info('AceApplication onCreate'); + }, + onDestroy() { + console.info('AceApplication onDestroy'); + } +}; diff --git "a/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/default/common/images/ic_back.png" "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/default/common/images/ic_back.png" new file mode 100644 index 0000000000000000000000000000000000000000..22e9f34d99d41d9199ab1a979838a041c331803f Binary files /dev/null and "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/default/common/images/ic_back.png" differ diff --git "a/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/default/common/images/ic_back.svg" "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/default/common/images/ic_back.svg" new file mode 100644 index 0000000000000000000000000000000000000000..cf99b03acd1f35fd4713dea424402544c5a64fd0 --- /dev/null +++ "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/default/common/images/ic_back.svg" @@ -0,0 +1,14 @@ + + + + + diff --git "a/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/default/common/images/ic_comments.svg" "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/default/common/images/ic_comments.svg" new file mode 100644 index 0000000000000000000000000000000000000000..2c0b1718a687ba984cb042320210bec9c21bcb3a --- /dev/null +++ "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/default/common/images/ic_comments.svg" @@ -0,0 +1,31 @@ + + + ic_comments + + + + + + + + + + \ No newline at end of file diff --git "a/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/default/common/images/ic_device_matebook.png" "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/default/common/images/ic_device_matebook.png" new file mode 100644 index 0000000000000000000000000000000000000000..8be6cf916b17de6303924cdce635cf3ec76f4f44 Binary files /dev/null and "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/default/common/images/ic_device_matebook.png" differ diff --git "a/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/default/common/images/ic_device_phone.png" "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/default/common/images/ic_device_phone.png" new file mode 100644 index 0000000000000000000000000000000000000000..ba1df19f6585d203347b66c146968a8c5b2b7aab Binary files /dev/null and "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/default/common/images/ic_device_phone.png" differ diff --git "a/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/default/common/images/ic_device_tv.png" "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/default/common/images/ic_device_tv.png" new file mode 100644 index 0000000000000000000000000000000000000000..d549ddb789387467f45a4b955d91a22d9812f2ce Binary files /dev/null and "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/default/common/images/ic_device_tv.png" differ diff --git "a/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/default/common/images/ic_huawei_share.svg" "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/default/common/images/ic_huawei_share.svg" new file mode 100644 index 0000000000000000000000000000000000000000..79e331c8da5cdbaf230aa1de15a5729151bfd60b --- /dev/null +++ "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/default/common/images/ic_huawei_share.svg" @@ -0,0 +1,30 @@ + + + 4 + + + + + + + + \ No newline at end of file diff --git "a/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/default/common/images/ic_huaweishare.png" "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/default/common/images/ic_huaweishare.png" new file mode 100644 index 0000000000000000000000000000000000000000..c14a8cc70720be992670d634bd95e8295e754b6d Binary files /dev/null and "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/default/common/images/ic_huaweishare.png" differ diff --git "a/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/default/common/images/ic_menu.svg" "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/default/common/images/ic_menu.svg" new file mode 100644 index 0000000000000000000000000000000000000000..1d23bbb903cffec423ef487bec69921c27fde0b9 --- /dev/null +++ "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/default/common/images/ic_menu.svg" @@ -0,0 +1,20 @@ + + + + + + diff --git "a/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/default/common/images/ic_mic.svg" "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/default/common/images/ic_mic.svg" new file mode 100644 index 0000000000000000000000000000000000000000..765ebba96e5264734b432cf9f632d4c6604ddfbd --- /dev/null +++ "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/default/common/images/ic_mic.svg" @@ -0,0 +1,16 @@ + + + + + diff --git "a/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/default/common/images/ic_more.png" "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/default/common/images/ic_more.png" new file mode 100644 index 0000000000000000000000000000000000000000..7fa811d099d05046de4d8c4563eddb2ff8ba2d3b Binary files /dev/null and "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/default/common/images/ic_more.png" differ diff --git "a/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/default/common/images/ic_more.svg" "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/default/common/images/ic_more.svg" new file mode 100644 index 0000000000000000000000000000000000000000..ace904bfb90169100ffa26d4b66b4733beaf3e6d --- /dev/null +++ "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/default/common/images/ic_more.svg" @@ -0,0 +1,20 @@ + + + + + + diff --git "a/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/default/common/images/ic_more_edit.svg" "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/default/common/images/ic_more_edit.svg" new file mode 100644 index 0000000000000000000000000000000000000000..ca75d8201c0de302c985f9485fd72e1a23eec0f0 --- /dev/null +++ "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/default/common/images/ic_more_edit.svg" @@ -0,0 +1,79 @@ + + + ic / ic_more_edit + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git "a/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/default/common/images/ic_pause_norm.svg" "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/default/common/images/ic_pause_norm.svg" new file mode 100644 index 0000000000000000000000000000000000000000..0f44feef7622886993fb79d7d322a7e526cc2679 --- /dev/null +++ "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/default/common/images/ic_pause_norm.svg" @@ -0,0 +1,39 @@ + + + Group + + + + + + + + + + + \ No newline at end of file diff --git "a/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/default/common/images/ic_transfer.png" "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/default/common/images/ic_transfer.png" new file mode 100644 index 0000000000000000000000000000000000000000..6fa272e6f4aef8041d0da32a707a7305ea907e21 Binary files /dev/null and "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/default/common/images/ic_transfer.png" differ diff --git "a/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/default/common/images/ic_transfer.svg" "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/default/common/images/ic_transfer.svg" new file mode 100644 index 0000000000000000000000000000000000000000..99cad3a5ef0befc5997401103975f926b5391bac --- /dev/null +++ "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/default/common/images/ic_transfer.svg" @@ -0,0 +1,73 @@ + + + Group + + + + + + + + + + + + + + + \ No newline at end of file diff --git "a/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/default/common/images/ic_transfering.svg" "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/default/common/images/ic_transfering.svg" new file mode 100644 index 0000000000000000000000000000000000000000..2a20288971a65eb9f25104e18d33861ea197ccc0 --- /dev/null +++ "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/default/common/images/ic_transfering.svg" @@ -0,0 +1,20 @@ + + + + + diff --git "a/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/default/common/newsimages/huawei-hms-app-innovation-contest.jpg" "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/default/common/newsimages/huawei-hms-app-innovation-contest.jpg" new file mode 100644 index 0000000000000000000000000000000000000000..01b2754bd02154e71021c2a9847d50d091c32c67 Binary files /dev/null and "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/default/common/newsimages/huawei-hms-app-innovation-contest.jpg" differ diff --git "a/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/default/common/newsimages/huawei-launches-freebuds-studio.jpg" "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/default/common/newsimages/huawei-launches-freebuds-studio.jpg" new file mode 100644 index 0000000000000000000000000000000000000000..981de0c36766736e05362fd023ad11481be1182f Binary files /dev/null and "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/default/common/newsimages/huawei-launches-freebuds-studio.jpg" differ diff --git "a/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/default/common/newsimages/huawei-launches-gentle-monster-eyewear.jpg" "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/default/common/newsimages/huawei-launches-gentle-monster-eyewear.jpg" new file mode 100644 index 0000000000000000000000000000000000000000..2df03739feaecd7d5f49788c0c8fb94420b13bd5 Binary files /dev/null and "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/default/common/newsimages/huawei-launches-gentle-monster-eyewear.jpg" differ diff --git "a/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/default/common/newsimages/huawei-launches-petal-search-petal-map-1.jpg" "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/default/common/newsimages/huawei-launches-petal-search-petal-map-1.jpg" new file mode 100644 index 0000000000000000000000000000000000000000..bf810f02c6ac923bf6e1a0b9b2f957b0ef705954 Binary files /dev/null and "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/default/common/newsimages/huawei-launches-petal-search-petal-map-1.jpg" differ diff --git "a/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/default/common/newsimages/huawei-unveil-porsche-design-huawei-watch-gt-2.jpg" "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/default/common/newsimages/huawei-unveil-porsche-design-huawei-watch-gt-2.jpg" new file mode 100644 index 0000000000000000000000000000000000000000..2a61f89611598259a42146c31a661dd0b008169a Binary files /dev/null and "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/default/common/newsimages/huawei-unveil-porsche-design-huawei-watch-gt-2.jpg" differ diff --git "a/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/default/common/newsimages/leap-further-ahead-with-huawei-mate-40.jpg" "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/default/common/newsimages/leap-further-ahead-with-huawei-mate-40.jpg" new file mode 100644 index 0000000000000000000000000000000000000000..f2837ea925a92d57dfb06559c0ae7ebd49a177a9 Binary files /dev/null and "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/default/common/newsimages/leap-further-ahead-with-huawei-mate-40.jpg" differ diff --git "a/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/default/common/newsimages/mate40-series-web.jpg" "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/default/common/newsimages/mate40-series-web.jpg" new file mode 100644 index 0000000000000000000000000000000000000000..2e42d96c8067c7a364c7521ae613073b3abab908 Binary files /dev/null and "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/default/common/newsimages/mate40-series-web.jpg" differ diff --git "a/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/default/common/newsimages/smart-home.jpg" "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/default/common/newsimages/smart-home.jpg" new file mode 100644 index 0000000000000000000000000000000000000000..4ef3df0cee49c88338a9022289e2d1fc19a5420a Binary files /dev/null and "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/default/common/newsimages/smart-home.jpg" differ diff --git "a/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/default/common/newsimages/watch-gt2-pro.jpg" "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/default/common/newsimages/watch-gt2-pro.jpg" new file mode 100644 index 0000000000000000000000000000000000000000..4e3c407e1ccfd49addc56553f34bd6d63f24152c Binary files /dev/null and "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/default/common/newsimages/watch-gt2-pro.jpg" differ diff --git "a/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/default/common/newsimages/woman-dev.jpg" "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/default/common/newsimages/woman-dev.jpg" new file mode 100644 index 0000000000000000000000000000000000000000..57efdb78f5f58d75d039f2df23c7bf718518de66 Binary files /dev/null and "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/default/common/newsimages/woman-dev.jpg" differ diff --git "a/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/default/common/newsvideo/huawei-watch-gt2-pro-video.mp4" "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/default/common/newsvideo/huawei-watch-gt2-pro-video.mp4" new file mode 100644 index 0000000000000000000000000000000000000000..d180cc56a04931792846e5dbdde57691f03a9e7e Binary files /dev/null and "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/default/common/newsvideo/huawei-watch-gt2-pro-video.mp4" differ diff --git "a/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/default/common/newsvideo/mate40-pv.mp4" "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/default/common/newsvideo/mate40-pv.mp4" new file mode 100644 index 0000000000000000000000000000000000000000..63b82908c67f0896f7e15da2d28c5bffbfc45fa4 Binary files /dev/null and "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/default/common/newsvideo/mate40-pv.mp4" differ diff --git "a/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/default/common/video/1.mp4" "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/default/common/video/1.mp4" new file mode 100644 index 0000000000000000000000000000000000000000..592abe4f4551198d5c4c25e346f66e523b21cd18 Binary files /dev/null and "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/default/common/video/1.mp4" differ diff --git "a/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/default/common/video/2.mp4" "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/default/common/video/2.mp4" new file mode 100644 index 0000000000000000000000000000000000000000..8ad9ba799eba39018fb8a9c015e35b92d396092c Binary files /dev/null and "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/default/common/video/2.mp4" differ diff --git "a/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/default/common/video/daea3058dce77ddbb7a6faafe8b3ed4e.mp4" "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/default/common/video/daea3058dce77ddbb7a6faafe8b3ed4e.mp4" new file mode 100644 index 0000000000000000000000000000000000000000..e80c679a8c4f5bd96633ab1781937437d67469ec Binary files /dev/null and "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/default/common/video/daea3058dce77ddbb7a6faafe8b3ed4e.mp4" differ diff --git "a/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/default/i18n/en-US.json" "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/default/i18n/en-US.json" new file mode 100644 index 0000000000000000000000000000000000000000..6ce917980f4a2c39deff445619e1abe65cd6f0d1 --- /dev/null +++ "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/default/i18n/en-US.json" @@ -0,0 +1,15 @@ +{ + "strings": { + "hello": "Hello", + "world": "World", + "last_page": "Last page", + "next_page": "Next page", + "last_news": "Last news", + "next_news": "Next news", + "phone": "'s phone", + "on_showing": "on showing", + "recommend": "Recommend" + }, + "Files": { + } +} \ No newline at end of file diff --git "a/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/default/i18n/zh-CN.json" "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/default/i18n/zh-CN.json" new file mode 100644 index 0000000000000000000000000000000000000000..d68b50244c1f488e3f1181c2f47b5194c9fa5d8f --- /dev/null +++ "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/default/i18n/zh-CN.json" @@ -0,0 +1,15 @@ +{ + "strings": { + "hello": "您好", + "world": "世界", + "last_page": "上一页", + "next_page": "下一页", + "last_news": "上一篇", + "next_news": "下一篇", + "phone": "的手机", + "on_showing": "正在展示", + "recommend": "为你推荐" + }, + "Files": { + } +} \ No newline at end of file diff --git "a/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/default/pages/detail/detail.css" "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/default/pages/detail/detail.css" new file mode 100644 index 0000000000000000000000000000000000000000..1a22215d8c4b6a61b1d8e06fdcddb521d7fbaebc --- /dev/null +++ "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/default/pages/detail/detail.css" @@ -0,0 +1,125 @@ +.container { + flex-direction: column; + justify-content: center; + align-items: center; + width: 100%; + background-color: #FAFAFA; +} + +.news-page { + flex-direction: column; + justify-content: center; + align-items: center; + width: 100%; + flex: 1; +} + +.bottom-bar { + width: 100%; + height: 48px; + background-color: #000000; +} + +.news-item { + width: 100%; + flex-direction: column; + justify-content: center; + align-items: center; +} + +.title-image { + width: 100%; + object-fit: fill; +} + +.news-content { + width: 100%; + flex-direction: column; + justify-content: center; + align-items: center; + margin-right: 16px; + margin-left: 16px; +} + +.news-title { + margin-top: 24px; + width: 100%; + font-size: 24px; + line-height: 31.2px; + font-family: PingFangSC-Semibold; + color: #000000; +} + +.news-date { + margin-top: 12px; + width: 100%; + font-size: 14px; + line-height: 18px; + font-family: HWtext-55ST; + color: #000000; +} + +.article { + margin-top: 24px; + font-size: 17px; + width: 100%; + line-height: 27px; +} + +.article_em { + margin-top: 12px; + font-size: 17px; + width: 100%; + line-height: 27px; + font-weight: bold; +} + +.image { + width: 100%; + margin-top: 24px; + object-fit: fill; +} + +.bottom-icon-back { + margin-top: 12px; + position: absolute; + left: 16px; + width: 24px; + height: 24px; + icon-width: 24px; + icon-height: 24px; + background-color: #000000; +} + +.bottom-icon-share { + margin-top: 12px; + position: absolute; + right: 92px; + width: 24px; + height: 24px; + icon-width: 24px; + icon-height: 24px; + background-color: #000000; +} + +.bottom-icon-transfer { + margin-top: 12px; + position: absolute; + right: 54px; + width: 24px; + height: 24px; + icon-width: 24px; + icon-height: 24px; + background-color: #000000; +} + +.bottom-icon-more { + margin-top: 12px; + position: absolute; + right: 16px; + width: 24px; + height: 24px; + icon-width: 12px; + icon-height: 24px; + background-color: #000000; +} \ No newline at end of file diff --git "a/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/default/pages/detail/detail.hml" "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/default/pages/detail/detail.hml" new file mode 100644 index 0000000000000000000000000000000000000000..1be28d935d6b60e88c42a4a8634be067da614d70 --- /dev/null +++ "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/default/pages/detail/detail.hml" @@ -0,0 +1,39 @@ +

+
+ + + +
+ + +
+ +
+ + {{ newsTitle }} + + + {{ newsDate }} + + + + + {{ $item.text }} + + + + + {{ $item.text }} + + + + + + +
+
+
+
+ +
\ No newline at end of file diff --git "a/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/default/pages/detail/detail.js" "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/default/pages/detail/detail.js" new file mode 100644 index 0000000000000000000000000000000000000000..b26d5238521c6b4658dfdab4842ae4231b469021 --- /dev/null +++ "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/default/pages/detail/detail.js" @@ -0,0 +1,137 @@ +import router from '@system.router'; +import device from '@system.device'; + +const ACTION_REQUEST_NEWS = 1002; + +export default { + data: { + news: new Array(), + newsTitle: '', + newsDate: '', + newsImage: '', + newsUrl: '', + deviceId: '', + currentIndex: '', + }, + async onInit() { + await this.requestNews(this.newsUrl); + }, + async onNewRequest() { + await this.requestNews(this.newsUrl); + }, + makeAction(bundleName, abilityName, code, data) { + const action = {}; + action.bundleName = bundleName; + action.abilityName = abilityName; + action.messageCode = code; + action.abilityType = 1; + action.data = data; + return action; + }, + async requestNews(urlStr) { + this.news = new Array(); + const action = this.makeAction('com.example.myapplication.newsdata', + 'NewsInfoInternalAbility', ACTION_REQUEST_NEWS, + { + url: urlStr, + index: 0 + }); + try { + const result = await FeatureAbility.callAbility(action); + const resData = JSON.parse(result); + if (resData.code == 0) { + const data = JSON.parse(resData.data); + this.newsImage = data.title_image; + this.newsTitle = data.title; + this.newsDate = data.date; + for (let i = 0; i < data.content.length; i++) { + const value = data.content[i]; + this.news.push(value); + } + } else { + console.error('RequestNews fail'); + } + } catch (e) { + console.error("RequestNews caught exception" + e); + } + }, + back() { + router.back(); + }, + async transfer() { + var forwardCompatible = false; + device.getInfo({ + success: function (data) { + if (data.apiVersion >= 5) { + forwardCompatible = false; + } else { + forwardCompatible = true; + } + }, + fail: function (data, code) { + } + }); + const target = {}; + target.bundleName = 'com.example.myapplication'; + target.abilityName = 'DeviceSelectAbility'; + target.deviceType = 1; + target.data = { + title: this.newsTitle, + transferName: 'HUAWEI News', + transferIcon: this.newsImage, + }; + this.deviceId = ''; + var result = await FeatureAbility.startAbilityForResult(target); + if (!!forwardCompatible == true) { + result = JSON.parse(result); + } + if (result.code == 0) { + var dataRemote = JSON.parse(result.data); + var data; + if (!!forwardCompatible == true) { + data = dataRemote; + } else { + data = dataRemote.result; + } + const targetDeviceId = data.deviceId; + const targetDeviceName = data.deviceName; + const targetDeviceType = data.deviceType; + const deviceDebugMode = data.deviceDebugMode; + if (!!targetDeviceId && (targetDeviceId != this.deviceId)) { + this.deviceId = targetDeviceId; + const target = {}; + target.bundleName = 'com.example.myapplication'; + target.abilityName = 'MainAbility'; + target.deviceId = this.deviceId; + target.data = { + newsUrl: this.newsUrl, + }; + var res1 = await FeatureAbility.startAbility(target); + if (!!forwardCompatible == true) { + res1 = JSON.parse(res1); + } + if (res1.code == 0 && (targetDeviceType == 'SMART_TV' || deviceDebugMode == true)) { + router.push({ + uri: 'pages/remote_controller/controller', + params: { + deviceId: targetDeviceId, + deviceName: targetDeviceName, + deviceType: targetDeviceType, + newsImage: this.newsImage, + newsTitle: this.newsTitle + }, + }); + } + } + } + }, + showDetail(url) { + router.push({ + uri: 'pages/detail/detail', + params: { + newsUrl: url, + currentIndex: this.currentIndex, + }, + }); + }, +}; \ No newline at end of file diff --git "a/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/default/pages/index/index.css" "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/default/pages/index/index.css" new file mode 100644 index 0000000000000000000000000000000000000000..c13a10ebbd674e458c0779b0a00c054e515f8fa7 --- /dev/null +++ "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/default/pages/index/index.css" @@ -0,0 +1,154 @@ +.container { + flex-direction: column; + justify-content: center; + align-items: center; + width: 100%; + height: 100%; + background-color: #FAFAFA; +} + +.video-block { + margin-bottom: 4px; + width: 99%; +} + +.news-list { + flex-direction: column; + align-items: center; + justify-content: center; + height: 100%; + width: 100%; +} + +.news-list-item { + flex-direction: column; + margin-top: 12px; + margin-bottom: 12px; + padding-left: 12px; + width: 100%; + height: 275px; +} + +.news-list-item-small { + align-content: center; + margin-bottom: 12px; + margin-top: 12px; + padding-left: 12px; + flex-direction: column; + width: 100%; + height: 105.5px; +} + +.news-content { + flex-direction: column; + width: 100%; + margin: 12px; + height: 100%; +} + +.news-box-large { + flex-direction: column; + justify-content: center; + align-items: center; + width: 100%; + height: 272.5px; +} + +.news-box-small { + flex-direction: row; + justify-content: center; + align-items: center; + width: 100%; + height: 105.5px; +} + + +.news-image-large { + width: 95%; + height: 184.5px; + padding-right: 12px; + justify-content: center; + align-content: center; +} + +.news-image-small { + width: 32%; + height: 71px; + padding-right: 12px; + align-content: center; +} + +.news-content { + font-size: 16px; + font-weight: bold; + margin-top: 9px; + padding-left: 1px; + width: 100%; + height: 42px; + max-lines: 2; + text-overflow: ellipsis; +} + +.news-content-small { + font-size: 16px; + font-weight: bold; + line-height: 21px; + padding-right: 14px; + width: 62%; + height: 72px; + max-lines: 3; + text-overflow: ellipsis; +} + + +.image { + border-radius: 10px; +} + +.video { + object-fit: cover; + display: flex; +} + +.news-source { + font-size: 12px; + color: darkgrey; + line-height: 16px; + padding-left: 12px; + width: 88%; +} + +.news-sidebar { + flex-direction: row; + +} + +.transfer-icon { + height: 25px; + width: 25px; + width: 11%; + padding-right: 12px; +} + +.more-image { + object-fit: contain; + height: 16px; + width: 10px; + align-content: center; +} + +.play-button { + visibility: visible; + width: 40px; + height: 40px; + margin-top: 72px; + align-items: center; +} + +.video-stack { + width: 100%; + height: 184.5px; + align-content: center; + justify-content: center; +} + diff --git "a/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/default/pages/index/index.hml" "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/default/pages/index/index.hml" new file mode 100644 index 0000000000000000000000000000000000000000..73f2348484fe8f17c79485dea4c3d7fd6931d64f --- /dev/null +++ "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/default/pages/index/index.hml" @@ -0,0 +1,112 @@ + +
+
+
+ +
+ + +
+
+ +
+
+ +
+
+
+ +
+ + + +
+
+ 视频播放完成,是否重新播放? +
+
+ + +
+
+
+ + +
+ + + +
+ {{ $item.msg }} + +
+ +
+
+ + + + +
+ + +
+
+ + +
diff --git "a/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/default/pages/index/index.js" "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/default/pages/index/index.js" new file mode 100644 index 0000000000000000000000000000000000000000..57c26fd7377e6783647d7a3588cfe4bd6fe38bf7 --- /dev/null +++ "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/default/pages/index/index.js" @@ -0,0 +1,335 @@ +import router from '@system.router'; +import device from '@system.device'; +import prompt from '@system.prompt'; + +const ACTION_REQUEST_NEWS_LIST = 1001; + +export default { + data: { + news: new Array(), + newsList: new Array(), + videoPlayingStatus: new Array(), + newsUrl: '', + currentIndex: 0, + currentPlaying: -1, + deviceId: '', + videoPlayFlag: true, + containsVideo: false, + autoplay: false, // 是否自动播放 + videoId: 'video', // 播放器id + url: '../../common/video/daea3058dce77ddbb7a6faafe8b3ed4e.mp4', // 视频地址 + posterUrl: '/common/images/first.jpg', // 视频预览的海报路径 + controlShow: true, // 是否显示控制栏 + loop: true, // 是否循环播放 + startTime: 0, // 播放开始时间 + speed: 1.0, // 播放速度 + isfullscreenchange: false,// 是否全屏 + inputValue: "", + leaveMsg: "", + commentText: false, + title: "", + inputVal: "", //留言框内的数据 + msgData: [], //所有留言数据 + msgData1: "", + date: "", + }, + async onInit() { + await this.requestNewsList(); + }, + async onNewRequest() { + if (this.newsUrl != '') { + await router.push({ + uri: 'pages/detail/detail', + params: { + newsUrl: this.newsUrl, + currentIndex: this.currentIndex + }, + }); + } + this.newsUrl = ''; + }, + makeAction(bundleName, abilityName, code, data) { + const action = {}; + action.bundleName = bundleName; + action.abilityName = abilityName; + action.messageCode = code; + action.abilityType = 1; + action.data = data; + return action; + }, + showDetail(url) { + router.push({ + uri: 'pages/detail/detail', + params: { + newsUrl: url, + currentIndex: this.currentIndex, + }, + }); + }, + async onShow() { + if (this.newsUrl && this.containsVideo == false) { + this.showDetail(this.newsUrl); + this.newsUrl = ''; + } + }, + async requestNewsList() { + const action = this.makeAction('com.example.myapplication.newsdata', + 'NewsInfoInternalAbility', ACTION_REQUEST_NEWS_LIST, {}); + try { + const result = await FeatureAbility.callAbility(action); + const resData = JSON.parse(result); + if (resData.code == 0) { + const listArray = resData.list; + for (let i = 0; i < listArray.length; i++) { + this.newsList.push(listArray[i]); + this.videoPlayingStatus.push(false); + this.webPage = this.newsList[i].web_page; + } + } else { + console.error('RequestNews fail'); + } + } catch (e) { + console.error("RequestNews caught exception" + e); + } + }, + async onListClick(idx, item) { + if (this.newsList[idx].contains_webpage) { + const target = {}; + target.bundleName = 'com.example.myapplication'; + target.abilityName = 'WebViewAbility'; + target.deviceId = ""; + target.deviceType = 1; + target.data = { + index: idx, + web_page: item.web_page, + }; + var res1 = await FeatureAbility.startAbility(target); + if (res1.code == 0) { + console.log("Start Webview success") + } else { + console.error("Start Webview Error code: " + res1.code + " data: " + res1.data); + } + } else { + if (!this.newsList[idx].contains_video) { + this.showDetail(item.url); + } + } + }, + + videoPrepared(idx) { + this.newsList[idx].videoPrepared = true; + }, + + async videoOnClick(idx) { + if (this.newsList[idx].videoPrepared) { + if (this.videoPlayingStatus[idx] == true) { + this.videoPlayFlag = true; + this.$element("video" + idx).pause(); + this.videoPlayingStatus.splice(idx, 1, false); + this.currentPlaying = -1; + } else { + this.videoPlayFlag = false; + if (this.currentPlaying >= 0) { + this.$element("video" + this.currentPlaying).pause(); + this.videoPlayFlag = true; + this.videoPlayingStatus.splice(this.currentPlaying, 1, false); + } + this.$element("video" + idx).start(); + this.currentPlaying = idx; + this.videoPlayingStatus.splice(idx, 1, true); + } + } + }, + + async transfer(idx, item) { + var forwardCompatible = false; + device.getInfo({ + success: function (data) { + if (data.apiVersion >= 5) { + forwardCompatible = false; + } else { + forwardCompatible = true; + } + }, + fail: function (data, code) { + console.error("index.js get Device API version failed"); + } + }); + if (this.videoPlayingStatus[idx] == true) { + this.$element("video" + idx).pause(); + this.videoPlayingStatus.splice(idx, 1, false); + } + const target = {}; + target.bundleName = 'com.example.myapplication'; + target.abilityName = 'DeviceSelectAbility'; + target.deviceType = 1; + target.data = { + title: item.title, + transferName: 'HUAWEI News', + transferIcon: item.title_image, + }; + this.deviceId = ''; + var res = await FeatureAbility.startAbilityForResult(target); + if (!!forwardCompatible == true) { + res = JSON.parse(res); + } + if (res.code == 0) { + var dataRemote = JSON.parse(res.data); + var data; + if (!!forwardCompatible == true) { + data = dataRemote; + } else { + data = dataRemote.result; + } + const targetDeviceId = data.deviceId; + const targetDeviceType = data.deviceType; + const deviceDebugMode = data.deviceDebugMode; + if (!!targetDeviceId && (targetDeviceId != this.deviceId)) { + this.deviceId = targetDeviceId; + const target = {}; + target.bundleName = 'com.example.myapplication'; + target.abilityName = 'MainAbility'; + target.deviceId = this.deviceId; + target.data = { + newsUrl: item.url, + onTransfer: true, + containsVideo: this.newsList[idx].contains_video, + }; + if (targetDeviceType == 'SMART_TV' || deviceDebugMode == true) { + await FeatureAbility.startAbility(target); + } else { + prompt.showToast({ + message: 'Video News can only be transferred to TV', + duration: 2000, + }); + } + + } + } + }, + videoOnPause() { + if (this.videoPlayFlag == false) { + this.videoPlayingStatus.splice(this.currentPlaying, 1, false); + this.videoPlayFlag = true; + } + + }, + // ============= + prepared(e) { + this.showPrompt('视频时长:' + e.duration + '秒'); + }, + // 视频开始播放 + start() { + this.showPrompt('视频开始播放'); + }, + // 视频暂停播放 + pause() { + this.showPrompt('视频暂停播放'); + }, + // 视频播放完成 + finish() { + this.$element('confirmDialog').show(); + }, + // 拖动进度条调用 + seeked(e) { + this.showPrompt('设置播放进度:' + e.currenttime + '秒'); + }, + // 播放进度变化调用 + timeupdate(e) { + + }, + // 自带组件进入全屏和退出全屏 + fullscreenchange(e) { + if (e.fullscreen === 1) { + this.isfullscreenchange = true; + } else { + this.isfullscreenchange = false; + } + }, + // 长按屏幕视频进入和退出全屏调用 + longPressFullscreenchange() { + if (this.isfullscreenchange) { // 全屏 + this.$element('video').exitFullscreen(); + this.isfullscreenchange = false; + } else { // 非全屏 + this.$element('video').requestFullscreen({ screenOrientation: 'default' }); + this.isfullscreenchange = true; + } + }, + + // dialog确定 + confirm() { + this.$element('video').start(); + this.$element('confirmDialog').close(); + }, + // dialog取消 + cancel() { + this.$element('confirmDialog').close(); + }, + // 弹框 + showPrompt(msg) { + prompt.showToast({ + message: msg, + duration: 1000 + }); + }, + // 点击视频 + hideControls() { + this.controlShow = !this.controlShow; + }, + //=============================== + //获取当前输入信息 + updateValue(e) { + this.inputValue = e.text; + }, + //发送留言岁的法国 + addMsg() { + var now = new Date(); + var year = now.getFullYear(); //得到年份 + var month = now.getMonth(); //得到月份 + var date = now.getDate(); //得到日期 + month = month + 1; + if (month < 10) month = "0" + month; + if (date < 10) date = "0" + date; + var time = year + "-" + month + "-" + date; //(格式化"yyyy-MM-dd") + + + console.log(time) + this.date = time + //把当前留言添加到leaveMsg里面 + this.leaveMsg = this.inputValue; + + var list = this.msgData //获取所有留言 + list.push({ //向list中添加当前添加的留言 + msg: this.inputValue + }) + ///将所有留言更新到msgData中。 + this.msgData = list; + //清空留输入框的内容 + this.inputValue = ""; + + + var list1 = this.data.msgData1; + for (var i = 0; i < list.length; i++) { + list1.push({ + msg: list[i].msg + }); + } + // 把新添加的数据添加到要存入stroage的数组中 + this.setStorage({ + key: 'msgData1', + data: list1, + }) + // 把数据存至stroage + var that = this; + this.getStorage({ + key: 'msgData1', + success: function (res) { + that.setData({ + msgData1: res.data + }); + }, + }) + + }, +}; \ No newline at end of file diff --git "a/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/default/pages/remote_controller/controller.css" "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/default/pages/remote_controller/controller.css" new file mode 100644 index 0000000000000000000000000000000000000000..b7eba48e788ff13c5004a7774c1779c13462d498 --- /dev/null +++ "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/default/pages/remote_controller/controller.css" @@ -0,0 +1,448 @@ +.body { + flex-direction: column; + align-items: center; + width: 100%; + height: 100%; + background-color: #f7f7f7; +} + +.container { + flex-direction: column; + align-items: center; + width: 360px; + height: 780px; + background-color: #f7f7f7; +} + +.header_area { + width: 360px; + height: 26px; + top: 18.8px; + left: 0px; + flex-direction: row; + align-items: center; +} + +#head_device_icon { + position: absolute; + left: 26px; + top: 3px; + width: 20px; + height: 20px; + opacity: 1; +} + +#head_title { + position: absolute; + left: 64px; + top: 0px; + width: 197px; + height: 26px; + opacity: 1; + font-family: HWtext-65ST; + font-size: 20px; + text-overflow: ellipsis; + max-lines: 1; + min-font-size: 10px; + max-font-size: 20px; + letter-spacing: 0px; + line-height: 26px; + text-color: #000000; +} + +#head_transfer_image { + position: absolute; + left: 278.3px; + top: 3px; + width: 20px; + height: 20px; + opacity: 1; +} + +#head_menu_image { + position: absolute; + width: 12px; + height: 20px; + left: 328.5px; + top: 3px; + opacity: 1; + background-size: 3px 20px; +} + +.middle_area { + align-items: center; + width: 236px; + height: 52px; + top: 39px; +} + +#goback_button { + position: absolute; + left: 0px; + top: 0px; + width: 52px; + height: 52px; + radius: 26px; + opacity: 1; + background-color: #ffffff; +} + +#middle_back_image { + position: absolute; + left: 16px; + top: 16px; + width: 20px; + height: 20px; + opacity: 1; +} + +#microphone_button { + position: absolute; + left: 92px; + top: 0px; + width: 52px; + height: 52px; + radius: 26px; + opacity: 1; + background-color: #ffffff; +} + +#middle_microphone_image { + position: absolute; + left: 108px; + top: 16px; + width: 20px; + height: 20px; + opacity: 1; +} + +#menu_button { + position: absolute; + left: 184px; + top: 0px; + width: 52px; + height: 52px; + radius: 26px; + opacity: 1; + background-color: #ffffff; +} + +#middle_menu_image { + position: absolute; + left: 200px; + top: 16px; + width: 20px; + height: 20px; + opacity: 1; + border-radius: 0.75px; +} + +.circle_control_area { + width: 219px; + height: 219px; + top: 95.3px; + background-color: #ffffff; + align-items: center; + + display: grid; + grid-template-columns: 1fr 1fr 1fr; + grid-columns-gap: 0px; + grid-template-rows: 1fr 1fr 1fr; + grid-columns-gap: 0px; + + border-radius: 109.5px; +} + +.grid-child { + width: 100%; + height: 100%; + align-items: center; + justify-content: center; + border-radius: 36.5px; +} + +.transparent-div { + opacity: 0; +} + +.grid-left-top { + grid-row-start: 0; + grid-column-start: 0; + grid-row-end: 0; + grid-column-end: 0; + background-color: #3f56ea; +} + +.grid-left-middle { + grid-row-start: 1; + grid-column-start: 0; + grid-row-end: 1; + grid-column-end: 0; +} + +.grid-left-bottom { + grid-row-start: 2; + grid-column-start: 0; + grid-row-end: 2; + grid-column-end: 0; + background-color: #00aaee; +} + +.grid-middle-top { + grid-row-start: 0; + grid-column-start: 1; + grid-row-end: 0; + grid-column-end: 1; +} + +.grid-middle-middle { + grid-row-start: 1; + grid-column-start: 1; + grid-row-end: 1; + grid-column-end: 1; + border-color: #dbdbdb; + border-width: 1px; + opacity: 1; +} + +.grid-middle-bottom { + grid-row-start: 2; + grid-column-start: 1; + grid-row-end: 2; + grid-column-end: 1; +} + +.grid-right-top { + grid-row-start: 0; + grid-column-start: 2; + grid-row-end: 0; + grid-column-end: 2; + background-color: #265FC9; +} + +.grid-right-middle { + grid-row-start: 1; + grid-column-start: 2; + grid-row-end: 1; + grid-column-end: 2; +} + +.grid-right-bottom { + grid-row-start: 2; + grid-column-start: 2; + grid-row-end: 2; + grid-column-end: 2; + background-color: #20CBCC; +} + +#last_page_circle_button { + position: absolute; + left: 33px; + top: 33px; + width: 7px; + height: 7px; + radius: 3.5px; + background-color: #666666; + opacity: 1; +} + +#last_page_circle_button_shadow { + position: absolute; + left: 0px; + top: 0px; + width: 73px; + height: 73px; + radius: 36.5px; + opacity: 1; + background-color: #ffffff; +} + +#next_page_circle_button { + position: absolute; + left: 33px; + top: 33px; + width: 7px; + height: 7px; + radius: 3.5px; + background-color: #666666; + opacity: 1; +} + +#next_page_circle_button_shadow { + position: absolute; + left: 0px; + top: 0px; + width: 73px; + height: 73px; + radius: 36.5px; + opacity: 1; + background-color: #ffffff; +} + +#last_news_circle_button { + position: absolute; + left: 33px; + top: 33px; + width: 7px; + height: 7px; + radius: 3.5px; + background-color: #666666; + opacity: 1; +} + +#last_news_circle_button_shadow { + position: absolute; + left: 0px; + top: 0px; + width: 73px; + height: 73px; + radius: 36.5px; + opacity: 1; + background-color: #ffffff; +} + +#next_news_circle_button { + position: absolute; + left: 33px; + top: 33px; + width: 7px; + height: 7px; + radius: 3.5px; + background-color: #666666; + opacity: 1; +} + +#next_news_circle_button_shadow { + position: absolute; + left: 0px; + top: 0px; + width: 73px; + height: 73px; + radius: 36.5px; + opacity: 1; + background-color: #ffffff; +} + +#ok_button { + width: 72px; + height: 72px; + radius: 36px; + opacity: 0.6; + font-family: HWtext-55ST; + font-size: 20px; + letter-spacing: 0px; + line-height: 26px; + text-color: #000000; + background-color: #ffffff; +} + +.show_content { + width: 316px; + height: 67px; + top: 144px; + align-items: center; + background-color: #ffffff; + border-radius: 12px; +} + +#show_image { + width: 40px; + height: 40px; + position: absolute; + left: 10px; + top: 16px; +} + +#showing { + width: 244px; + height: 16px; + position: absolute; + left: 62px; + top: 10px; + opacity: 0.6; + font-family: HarmonyHeiTi; + font-size: 12px; + letter-spacing: 0px; + line-height: 16px; + text-color: #000000; +} + +#news_content { + width: 244px; + position: absolute; + left: 62px; + top: 26px; + opacity: 1; + font-family: HarmonyHeiTi; + font-size: 14px; + letter-spacing: 0px; + line-height: 20px; + text-color: #000000; + text-overflow: ellipsis; + max-lines: 2; + allow-scale: true; +} + +#last_page_button { + border-radius: 12px; + background-color: #ffffff; + text-color: #000000; + + width: 153px; + height: 52px; + left: -80px; + top: 154px; + + font-family: HWtext-55ST; + font-size: 16px; + letter-spacing: 0px; + line-height: 21px; +} + +#next_page_button { + border-radius: 12px; + background-color: #ffffff; + text-color: #000000; + + width: 153px; + height: 52px; + left: 80px; + top: 102px; + + font-family: HWtext-55ST; + font-size: 16px; + letter-spacing: 0px; + line-height: 21px; +} + +#last_news_button { + border-radius: 12px; + background-color: #ffffff; + text-color: #000000; + + width: 153px; + height: 52px; + left: -80px; + top: 112px; + + font-family: HWtext-55ST; + font-size: 16px; + letter-spacing: 0px; + line-height: 21px; +} + +#next_news_button { + border-radius: 12px; + background-color: #ffffff; + text-color: #000000; + + width: 153px; + height: 52px; + left: 80px; + top: 60px; + + font-family: HWtext-55ST; + font-size: 16px; + letter-spacing: 0px; + line-height: 21px; +} diff --git "a/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/default/pages/remote_controller/controller.hml" "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/default/pages/remote_controller/controller.hml" new file mode 100644 index 0000000000000000000000000000000000000000..3dc563ca1e5b1b0a35ecea5cac4e602b8a4548e1 --- /dev/null +++ "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/default/pages/remote_controller/controller.hml" @@ -0,0 +1,55 @@ +
+
+
+ + + + + +
+
+ + + + + + +
+
+
+
+ + +
+
+
+ + +
+
+ +
+
+ + +
+
+
+ + +
+
+
+
+ + {{ description }} + + {{ newsTitle }} + +
+ + + + +
+
diff --git "a/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/default/pages/remote_controller/controller.js" "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/default/pages/remote_controller/controller.js" new file mode 100644 index 0000000000000000000000000000000000000000..536492e58ab075a78f4bdbc1f24a2745bdcc4711 --- /dev/null +++ "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/default/pages/remote_controller/controller.js" @@ -0,0 +1,131 @@ +import prompt from '@system.prompt'; +import router from '@system.router'; + +// abilityType: 0-Ability; 1-Internal Ability +const ABILITY_TYPE_EXTERNAL = 0; +const ABILITY_TYPE_INTERNAL = 1; +// syncOption(Optional, default sync): 0-Sync; 1-Async +const ACTION_SYNC = 0; +const ACTION_ASYNC = 1; +const ACTION_MESSAGE_CODE_CONNECT_ABILITY = 2000; +const ACTION_MESSAGE_CODE_DISCONNECT_ABILITY = 2001; +const ACTION_MESSAGE_CODE_SEND_MSG = 2002; +const COMMAND_PAGE_SCROLL_UP = 1; +const COMMAND_PAGE_SCROLL_DOWN = 2; +const COMMAND_PREV_NEWS = 3; +const COMMAND_NEXT_NEWS = 4; + +const COMMAND_KEY_UP = 101; +const COMMAND_KEY_DOWN = 102; +const COMMAND_KEY_LEFT = 103; +const COMMAND_KEY_RIGHT = 104; +const COMMAND_KEY_OK = 105; + +export default { + data: { + deviceId: '', + description: '', + newsTitle: 'Huawei News', + newsImage: 'common/images/hwlogo.png', + newsUrl: '', + newsIdx: 0, + newsNum: 0, + deviceTypeName: '', + }, + async onInit() { + this.description = this.$t('strings.on_showing'); + if (this.deviceType == 'SMART_TV') { + this.deviceTypeName = ''; + } else { + this.deviceTypeName = this.$t('strings.phone'); + } + }, + async onShow() { + await this.connectServiceAbility(); + }, + async onDestroy() { + const call_action = this.makeAction(ACTION_MESSAGE_CODE_DISCONNECT_ABILITY, {}); + await FeatureAbility.callAbility(call_action); + }, + makeAction(code, data) { + const action = {}; + action.bundleName = 'com.example.myapplication.phone'; + action.abilityName = 'DistributeInternalAbility'; + action.messageCode = code; + action.data = data; + action.abilityType = ABILITY_TYPE_INTERNAL; + action.syncOption = ACTION_SYNC; + return action; + }, + async connectServiceAbility() { + const actionData = { + deviceId: this.deviceId, + newsUrl: this.newsUrl, + }; + const callAction = this.makeAction(ACTION_MESSAGE_CODE_CONNECT_ABILITY, actionData); + const result = await FeatureAbility.callAbility(callAction); + const ret = JSON.parse(result); + if (ret.code == 0) { + prompt.showToast({ + message: 'Connect remote PA succeed', + duration: 2000, + }); + } else { + prompt.showToast({ + message: 'Connect remote PA failed', + duration: 2000, + }); + router.back(); + } + }, + async sendMsg(mesg) { + const actionData = { + message: mesg, + }; + const callAction = this.makeAction(ACTION_MESSAGE_CODE_SEND_MSG, actionData); + const result = await FeatureAbility.callAbility(callAction); + const ret = JSON.parse(result); + if (ret.code == 0) { + prompt.showToast({ + message: 'Send command succeed', + duration: 2000, + }); + } else { + prompt.showToast({ + message: 'Send command failed', + duration: 2000, + }); + router.back(); + } + }, + async lastPageAction() { + await this.sendMsg(COMMAND_PAGE_SCROLL_UP); + }, + async nextPageAction() { + await this.sendMsg(COMMAND_PAGE_SCROLL_DOWN); + }, + async lastNewsAction() { + await this.sendMsg(COMMAND_PREV_NEWS); + }, + async nextNewsAction() { + await this.sendMsg(COMMAND_NEXT_NEWS); + }, + async keyUpAction() { + await this.sendMsg(COMMAND_KEY_UP); + }, + async keyDownAction() { + await this.sendMsg(COMMAND_KEY_DOWN); + }, + async keyLeftAction() { + await this.sendMsg(COMMAND_KEY_LEFT); + }, + async keyRightAction() { + await this.sendMsg(COMMAND_KEY_RIGHT); + }, + async keyOkAction() { + await this.sendMsg(COMMAND_KEY_OK); + }, + back() { + router.back(); + }, +}; diff --git "a/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/selectdevice/app.js" "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/selectdevice/app.js" new file mode 100644 index 0000000000000000000000000000000000000000..aedcefe0054c6e16c40491f4d1abc20a4dc1c6ef --- /dev/null +++ "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/selectdevice/app.js" @@ -0,0 +1,8 @@ +export default { + onCreate() { + console.info('AceApplication onCreate'); + }, + onDestroy() { + console.info('AceApplication onDestroy'); + } +}; diff --git "a/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/selectdevice/common/images/ic_device_matebook.png" "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/selectdevice/common/images/ic_device_matebook.png" new file mode 100644 index 0000000000000000000000000000000000000000..8be6cf916b17de6303924cdce635cf3ec76f4f44 Binary files /dev/null and "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/selectdevice/common/images/ic_device_matebook.png" differ diff --git "a/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/selectdevice/common/images/ic_device_phone.png" "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/selectdevice/common/images/ic_device_phone.png" new file mode 100644 index 0000000000000000000000000000000000000000..ba1df19f6585d203347b66c146968a8c5b2b7aab Binary files /dev/null and "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/selectdevice/common/images/ic_device_phone.png" differ diff --git "a/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/selectdevice/common/images/ic_device_tv.png" "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/selectdevice/common/images/ic_device_tv.png" new file mode 100644 index 0000000000000000000000000000000000000000..d549ddb789387467f45a4b955d91a22d9812f2ce Binary files /dev/null and "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/selectdevice/common/images/ic_device_tv.png" differ diff --git "a/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/selectdevice/common/images/ic_news_share.svg" "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/selectdevice/common/images/ic_news_share.svg" new file mode 100644 index 0000000000000000000000000000000000000000..32b7731e3aa2979cf9855e8d5146923a23854adc --- /dev/null +++ "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/selectdevice/common/images/ic_news_share.svg" @@ -0,0 +1,34 @@ + + + grouping + + + + + + + + + \ No newline at end of file diff --git "a/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/selectdevice/common/images/ic_pad.png" "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/selectdevice/common/images/ic_pad.png" new file mode 100644 index 0000000000000000000000000000000000000000..6620e3392b6dde9aaaf6d68adf9b16774284fdfe Binary files /dev/null and "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/selectdevice/common/images/ic_pad.png" differ diff --git "a/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/selectdevice/common/images/ic_sound.png" "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/selectdevice/common/images/ic_sound.png" new file mode 100644 index 0000000000000000000000000000000000000000..199488504dbba63d39c88b75a872a9be02011301 Binary files /dev/null and "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/selectdevice/common/images/ic_sound.png" differ diff --git "a/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/selectdevice/common/images/ic_soundx.png" "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/selectdevice/common/images/ic_soundx.png" new file mode 100644 index 0000000000000000000000000000000000000000..2e5564721b2362183097c217b5147236f7d29f56 Binary files /dev/null and "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/selectdevice/common/images/ic_soundx.png" differ diff --git "a/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/selectdevice/common/images/ic_watch.png" "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/selectdevice/common/images/ic_watch.png" new file mode 100644 index 0000000000000000000000000000000000000000..2e942a925348b8068d7c80a5bf14f73dbe217932 Binary files /dev/null and "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/selectdevice/common/images/ic_watch.png" differ diff --git "a/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/selectdevice/i18n/en-US.json" "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/selectdevice/i18n/en-US.json" new file mode 100644 index 0000000000000000000000000000000000000000..462542a4e9263c2d8a35f5fb7d6d411df17b13d2 --- /dev/null +++ "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/selectdevice/i18n/en-US.json" @@ -0,0 +1,10 @@ +{ + "strings": { + "hello": "Hello", + "world": "World", + "native": "Native", + "my_device": "My device" + }, + "Files": { + } +} \ No newline at end of file diff --git "a/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/selectdevice/i18n/zh-CN.json" "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/selectdevice/i18n/zh-CN.json" new file mode 100644 index 0000000000000000000000000000000000000000..ebf2a586804921757a7d942170ad38aaa2fd4947 --- /dev/null +++ "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/selectdevice/i18n/zh-CN.json" @@ -0,0 +1,10 @@ +{ + "strings": { + "hello": "您好", + "world": "世界", + "native": "本机", + "my_device": "我的设备" + }, + "Files": { + } +} \ No newline at end of file diff --git "a/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/selectdevice/pages/selectdevice/selectdevice.css" "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/selectdevice/pages/selectdevice/selectdevice.css" new file mode 100644 index 0000000000000000000000000000000000000000..33db77ccee08f134f74eeeb8a16a61b1186d9aef --- /dev/null +++ "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/selectdevice/pages/selectdevice/selectdevice.css" @@ -0,0 +1,124 @@ +.container { + flex-direction: column; + justify-content: center; + align-items: center; + width: 100%; + flex: 1; + background-color: #99000000; + window-filter: blur(100%); +} + +.info-box { + margin-top: 200px; + flex-direction: column; + justify-content: flex-start; + width: 93%; + height: 18%; + background-color: #FFFFFF; + border-radius: 16px; + padding-left: 24px; + padding-right: 24px; + padding-top: 12px; +} + +.device-info { + font-size: 14px; + line-height: 20px; + color: #000000; + font-family: PingFangSC-Regular; +} + +.transfer-info { + margin-top: 12px; + width: 100%; + height: 40px; +} + +.transfer-image { + width: 40px; + height: 40px; + object-fit: contain; + position: absolute; + left: 0; + top: 0; + border-radius: 2px; +} + +.transfer-title { + position: absolute; + width: 212px; + left: 52px; + top: 23px; + font-size: 14px; + line-height: 20px; + color: #000000; + font-family: PingFangSC-Regular; + text-overflow: ellipsis; + max-lines: 1; +} + +.transfer-page { + position: absolute; + left: 52px; + top: 1px; + font-size: 12px; + line-height: 17px; + color: #99000000; + font-family: PingFangSC-Regular; +} + +.select-box { + margin-top: 12px; + margin-bottom: 200px; + width: 93%; + background-color: #FFFFFF; + padding: 24px; + border-radius: 16px; + flex-direction: column; +} + +.mydevice-text { + font-size: 16px; + line-height: 23px; + color: #000000; + font-family: PingFangSC-Regular; +} + +.device-item { + height: 48px; + width: 100%; + flex-direction: row; + justify-content: flex-start; +} + +.device-icon { + margin-top: 12px; + width: 24px; + height: 24px; +} + +.device-name { + margin-left: 16px; + height: 48px; + text-align: left; + max-lines: 2; + text-overflow: ellipsis; + width: 160px; + font-size: 16px; + max-font-size: 20px; + line-height: 24px; + color: #E6000000; + font-family: HarmonyHeiTi-Medium; +} + +.device-box { + flex-direction: column; + +} + +.device-radio { + position: absolute; + right: 0px; + width: 48px; + height: 48px; +} \ No newline at end of file diff --git "a/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/selectdevice/pages/selectdevice/selectdevice.hml" "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/selectdevice/pages/selectdevice/selectdevice.hml" new file mode 100644 index 0000000000000000000000000000000000000000..2d2fd67422dc438745a55d70260098759106dff6 --- /dev/null +++ "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/selectdevice/pages/selectdevice/selectdevice.hml" @@ -0,0 +1,31 @@ +
+
+ + {{ $t('strings.native') }} + +
+ + + {{ title }} + + + {{ appName }} + +
+
+
+ + {{ $t('strings.my_device') }} + + +
+ + + {{ $item.name }} + + +
+
+
+
\ No newline at end of file diff --git "a/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/selectdevice/pages/selectdevice/selectdevice.js" "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/selectdevice/pages/selectdevice/selectdevice.js" new file mode 100644 index 0000000000000000000000000000000000000000..0bf1270c4c2dbe2b4b0210d1fc9bc895f447f09d --- /dev/null +++ "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/js/selectdevice/pages/selectdevice/selectdevice.js" @@ -0,0 +1,106 @@ +import device from '@system.device'; +import app from '@system.app'; + +const ACTION_REQUEST_DEVICE_LIST = 1001; + +export default { + data: { + title: '', + devices: new Array(), + currentSelect: 0, + appName: app.getInfo().appName, + deviceIcon: { + "SMART_PHONE": "common/images/ic_device_phone.png", + "SMART_TV": "common/images/ic_device_tv.png", + "LAPTOP": "common/images/ic_device_matebook.png", + "SMART_PAD": "common/images/ic_pad.png", + "SOUND": "common/images/ic_sound.png", + "SOUNDX": "common/images/ic_soundx.png", + "WATCH": "common/images/ic_watch.png" + }, + }, + async onInit() { + this.devices.push({ + name: this.$t('strings.native'), + type: 0, + checked: true, + icon: "common/images/ic_device_phone.png", + id: "", + debugMode: true + }) + await this.requestDevice(); + }, + makeAction(code, data) { + let action = {}; + action.bundleName = "com.example.myapplication.phone"; + action.abilityName = "DeviceSelectInternalAbility"; + action.messageCode = code; + action.abilityType = 1; + action.data = data; + return action; + }, + async requestDevice() { + let action = this.makeAction(ACTION_REQUEST_DEVICE_LIST, {}); + try { + var result = await FeatureAbility.callAbility(action); + var resData = JSON.parse(result); + if (resData.code == 0) { + var deviceList = resData.devices; + for (var i = 0; i < deviceList.length; i++) { + var deviceInfo = {}; + deviceInfo.type = deviceList[i].type; + deviceInfo.name = deviceList[i].name; + deviceInfo.id = deviceList[i].id; + deviceInfo.icon = this.getDeviceIcon(deviceInfo.type); + deviceInfo.debugMode = deviceList[i].debugMode; + deviceInfo.checked = false; + this.devices.push(deviceInfo); + } + } else { + console.error("requestDevice fail"); + } + } catch (e) { + console.error("requestDevice caught exception" + e); + } + }, + getDeviceIcon(type) { + return this.deviceIcon[type]; + }, + async select(index) { + this.devices[this.currentSelect].checked = false; + this.devices[index].checked = true; + this.currentSelect = index; + let request = {} + request.result = { + deviceId: this.devices[index].id, + deviceName: this.devices[index].name, + deviceType: this.devices[index].type, + deviceDebugMode: this.devices[index].debugMode, + newsImage: this.transferIcon, + newsTitle: this.title + }; + var forwardCompatible = false; + device.getInfo({ + success: function (data) { + if (data.apiVersion >= 5) { + forwardCompatible = false; + } else { + forwardCompatible = true; + } + }, + fail: function (data, code) { + console.error("selectdevice.js get Device API version failed"); + } + }); + var res; + if (!!forwardCompatible == true) { + request.code = 0; + res = await FeatureAbility.finishWithResult(request); + } else { + res = await FeatureAbility.finishWithResult(0, request); + } + if (res.code != 0) { + console.error("Select device fail" + res.code); + } + } +} \ No newline at end of file diff --git "a/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/resources/base/element/string.json" "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/resources/base/element/string.json" new file mode 100644 index 0000000000000000000000000000000000000000..144580a386ac633c4e1a734093d67fc51669e1cb --- /dev/null +++ "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/resources/base/element/string.json" @@ -0,0 +1,20 @@ +{ + "string": [ + { + "name": "entry_MainAbility", + "value": "entry_MainAbility" + }, + { + "name": "mainability_description", + "value": "JS_Phone_News Share Ability" + }, + { + "name": "deviceselectability_description", + "value": "JS_Phone_News Share Ability" + }, + { + "name": "webviewability_description", + "value": "JS_Phone_News Share Ability" + } + ] +} \ No newline at end of file diff --git "a/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/resources/base/layout/webview_detail.xml" "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/resources/base/layout/webview_detail.xml" new file mode 100644 index 0000000000000000000000000000000000000000..df8cc45c907e8a6869a16369fdeebe6b847109dc --- /dev/null +++ "b/\351\231\210\344\275\263\347\232\204\345\217\202\350\265\233\344\275\234\345\223\201/MyApplication2/entry/src/main/resources/base/layout/webview_detail.xml" @@ -0,0 +1,62 @@ + + + + +