Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
Hello UTS
提交
1685eb3a
H
Hello UTS
项目概览
DCloud
/
Hello UTS
通知
1598
Star
27
Fork
9
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
2
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
H
Hello UTS
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
2
Issue
2
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
1685eb3a
编写于
9月 01, 2022
作者:
杜庆泉
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
lifecycle add
上级
1c4d58e0
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
79 addition
and
56 deletion
+79
-56
pages.json
pages.json
+0
-9
pages/lifecycle/lifecycle.vue
pages/lifecycle/lifecycle.vue
+43
-5
pages/resource/resource.vue
pages/resource/resource.vue
+4
-7
pages/static/static.vue
pages/static/static.vue
+0
-10
uni_modules/uts-advance/readme.md
uni_modules/uts-advance/readme.md
+3
-1
uni_modules/uts-advance/utssdk/app-android/index.uts
uni_modules/uts-advance/utssdk/app-android/index.uts
+26
-17
uni_modules/uts-advance/utssdk/app-android/res/value-zh/strings.xml
...s/uts-advance/utssdk/app-android/res/value-zh/strings.xml
+0
-3
uni_modules/uts-advance/utssdk/app-android/res/values-en/strings.xml
.../uts-advance/utssdk/app-android/res/values-en/strings.xml
+0
-3
uni_modules/uts-helloworld/readme.md
uni_modules/uts-helloworld/readme.md
+3
-1
未找到文件。
pages.json
浏览文件 @
1685eb3a
...
...
@@ -37,15 +37,6 @@
"enablePullDownRefresh"
:
false
}
},
{
"path"
:
"pages/static/static"
,
"style"
:
{
"navigationBarTitleText"
:
""
,
"enablePullDownRefresh"
:
false
}
},
{
"path"
:
"pages/lifecycle/lifecycle"
,
...
...
pages/lifecycle/lifecycle.vue
浏览文件 @
1685eb3a
<
template
>
<view>
当前电量:
</view>
<view>
<page-head
:title=
"title"
></page-head>
<view
class=
"uni-padding-wrap uni-common-mt"
>
<view
class=
"text-box"
scroll-y=
"true"
>
<text>
{{
text
}}
</text>
</view>
</view>
</view>
</
template
>
<
script
lang=
"ts"
setup
>
import
{
initAppLifecycle
}
from
'
../../uni_modules/uts-advance
'
initAppLifecycle
();
</
script
>
\ No newline at end of file
<
script
>
import
{
initAppLifecycle
}
from
'
../../uni_modules/uts-advance
'
;
export
default
{
data
()
{
return
{
title
:
'
生命周期监听
'
,
text
:
''
,
}
},
onLoad
:
function
(){
let
that
=
this
;
initAppLifecycle
(
function
(
name
){
that
.
text
=
that
.
text
+=
name
;
that
.
text
=
that
.
text
+=
'
\n
'
;
});
}
}
</
script
>
<
style
>
.text-box
{
margin-bottom
:
40
rpx
;
padding
:
40
rpx
0
;
display
:
flex
;
min-height
:
300
rpx
;
background-color
:
#FFFFFF
;
justify-content
:
center
;
align-items
:
center
;
text-align
:
center
;
font-size
:
30
rpx
;
color
:
#353535
;
line-height
:
1.8
;
}
</
style
>
pages/resource/resource.vue
浏览文件 @
1685eb3a
...
...
@@ -3,15 +3,14 @@
<page-head
:title=
"title"
></page-head>
<image
:src=
"logo"
mode=
"aspectFit"
style=
"width: 100%;"
></image>
<view
class=
"uni-btn-v uni-common-mt"
>
<button
type=
"primary"
>
展示插件内置图片
</button>
<button
type=
"primary"
@
tap=
"testLogoLoad"
>
展示插件内置图片
</button>
<button
type=
"primary"
@
tap=
"testAssetLoad"
>
播放asset音频(需自定义基座)
</button>
<button
type=
"primary"
@
tap=
"testResText"
>
获取res目录资源(需自定义基座)
</button>
</view>
</view>
</
template
>
<
script
>
import
{
getLogoPath
,
playAssetAudio
,
getResText
}
from
'
../../uni_modules/uts-advance
'
import
{
getLogoPath
,
playAssetAudio
}
from
'
../../uni_modules/uts-advance
'
export
default
{
...
...
@@ -28,11 +27,9 @@
testAssetLoad
(){
playAssetAudio
();
},
testResText
(){
let
resText
=
getResText
();
console
.
log
(
resText
);
testLogoLoad
(){
this
.
logo
=
getLogoPath
()
}
}
}
</
script
>
...
...
pages/static/static.vue
已删除
100644 → 0
浏览文件 @
1c4d58e0
<
template
>
<view>
<view></view>
</view>
<image
:src=
"logo"
></image>
</
template
>
<
script
lang=
"ts"
setup
>
import
{
getLogoPath
}
from
'
../../uni_modules/uts-advance
'
const
logo
=
getLogoPath
()
</
script
>
\ No newline at end of file
uni_modules/uts-advance/readme.md
浏览文件 @
1685eb3a
# uts-advance
\ No newline at end of file
# uts-advance
UTS进阶示例插件
\ No newline at end of file
uni_modules/uts-advance/utssdk/app-android/index.uts
浏览文件 @
1685eb3a
...
...
@@ -10,13 +10,18 @@ import Runnable from 'java.lang.Runnable';
import Exception from 'java.lang.Exception';
import MediaPlayer from 'android.media.MediaPlayer';
/**
* 定时任务参数封装
*/
type TimerOptions = {
start: (res: string) => void;
work: (res: string) => void;
};
/**
* 执行延时任务
*/
export function doTimerTask(opts:TimerOptions) {
opts.start('doTimerTask start');
setTimeout(function() {
...
...
@@ -26,7 +31,9 @@ export function doTimerTask(opts:TimerOptions) {
return { name: "doTimerTask" };
}
/**
* 执行周期任务
*/
export function doIntervalTask(opts:TimerOptions) {
let taskRet = setInterval(function() {
...
...
@@ -37,6 +44,9 @@ export function doIntervalTask(opts:TimerOptions) {
return { name: "doIntervalTask",taskId:taskRet};
}
/**
* 清除周期任务
*/
export function clearIntervalTask(taskId:number) {
clearInterval(taskId);
...
...
@@ -85,14 +95,12 @@ class RemoveUIRunnable extends Runnable {
export function addViewToDecorView() {
let uiRunable = new AddUIRunnable();
// 获取android环境下 宿主decorview的基本信息
getUniActivity()!.runOnUiThread(uiRunable)
}
export function removeViewToDecorView() {
var uiRunable = new RemoveUIRunnable();
// 获取android环境下 宿主decorview的基本信息
getUniActivity()!.runOnUiThread(uiRunable)
}
...
...
@@ -124,31 +132,32 @@ export function playAssetAudio() {
}
const RTEXT:number = 10020;
export function getResText() :string{
// let text = "aaa " + com.sina.weibo.sdk.R2.string.com_sina_weibo_sdk_logout;
// let resText = getAppContext()!.getString(io.dcloud.uni_modules.uts_advance.R.string.dcloud_common_app_res_download_failed)
return "222";
}
export function initAppLifecycle() {
console.log("initAppLifecycle");
export function initAppLifecycle(onLifecycleChange: (event:string) => void) {
onAppActivityDestroy(() => {
console.log("onAppActivityDestroy");
let eventName = "onAppActivityDestroy - " + Date.now();
onLifecycleChange(eventName);
console.log(eventName);
});
onAppActivityPause(() => {
console.log("onAppActivityPause");
let eventName = "onAppActivityPause - " + Date.now();
onLifecycleChange(eventName);
console.log(eventName);
});
onAppActivityResume(() => {
console.log("onAppActivityResume");
let eventName = "onAppActivityResume - " + Date.now();
onLifecycleChange(eventName);
console.log(eventName);
});
onAppActivityBack(() => {
console.log("onAppActivityBack");
let eventName = "onAppActivityBack - " + Date.now();
onLifecycleChange(eventName);
console.log(eventName);
});
}
...
...
uni_modules/uts-advance/utssdk/app-android/res/value-zh/strings.xml
已删除
100644 → 0
浏览文件 @
1c4d58e0
<resources>
<string
name=
"uts_resource_text"
>
Chinese Text
</string>
</resources>
\ No newline at end of file
uni_modules/uts-advance/utssdk/app-android/res/values-en/strings.xml
已删除
100644 → 0
浏览文件 @
1c4d58e0
<resources>
<string
name=
"uts_resource_text"
>
English Text
</string>
</resources>
\ No newline at end of file
uni_modules/uts-helloworld/readme.md
浏览文件 @
1685eb3a
# uts-helloworld
\ No newline at end of file
# uts-helloworld
UTS入门示例插件
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录