Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
Hello UTS
提交
1685eb3a
H
Hello UTS
项目概览
DCloud
/
Hello UTS
通知
1595
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 @@
...
@@ -37,15 +37,6 @@
"enablePullDownRefresh"
:
false
"enablePullDownRefresh"
:
false
}
}
},
{
"path"
:
"pages/static/static"
,
"style"
:
{
"navigationBarTitleText"
:
""
,
"enablePullDownRefresh"
:
false
}
},
},
{
{
"path"
:
"pages/lifecycle/lifecycle"
,
"path"
:
"pages/lifecycle/lifecycle"
,
...
...
pages/lifecycle/lifecycle.vue
浏览文件 @
1685eb3a
<
template
>
<
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
>
</
template
>
<
script
lang=
"ts"
setup
>
<
script
>
import
{
initAppLifecycle
}
from
'
../../uni_modules/uts-advance
'
import
{
initAppLifecycle
}
from
'
../../uni_modules/uts-advance
'
;
initAppLifecycle
();
export
default
{
</
script
>
data
()
{
\ No newline at end of file
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 @@
...
@@ -3,15 +3,14 @@
<page-head
:title=
"title"
></page-head>
<page-head
:title=
"title"
></page-head>
<image
:src=
"logo"
mode=
"aspectFit"
style=
"width: 100%;"
></image>
<image
:src=
"logo"
mode=
"aspectFit"
style=
"width: 100%;"
></image>
<view
class=
"uni-btn-v uni-common-mt"
>
<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=
"testAssetLoad"
>
播放asset音频(需自定义基座)
</button>
<button
type=
"primary"
@
tap=
"testResText"
>
获取res目录资源(需自定义基座)
</button>
</view>
</view>
</view>
</view>
</
template
>
</
template
>
<
script
>
<
script
>
import
{
getLogoPath
,
playAssetAudio
,
getResText
}
from
'
../../uni_modules/uts-advance
'
import
{
getLogoPath
,
playAssetAudio
}
from
'
../../uni_modules/uts-advance
'
export
default
{
export
default
{
...
@@ -28,11 +27,9 @@
...
@@ -28,11 +27,9 @@
testAssetLoad
(){
testAssetLoad
(){
playAssetAudio
();
playAssetAudio
();
},
},
testResText
(){
testLogoLoad
(){
let
resText
=
getResText
();
this
.
logo
=
getLogoPath
()
console
.
log
(
resText
);
}
}
}
}
}
}
</
script
>
</
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
# uts-advance
\ No newline at end of file
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';
...
@@ -10,13 +10,18 @@ import Runnable from 'java.lang.Runnable';
import Exception from 'java.lang.Exception';
import Exception from 'java.lang.Exception';
import MediaPlayer from 'android.media.MediaPlayer';
import MediaPlayer from 'android.media.MediaPlayer';
/**
* 定时任务参数封装
*/
type TimerOptions = {
type TimerOptions = {
start: (res: string) => void;
start: (res: string) => void;
work: (res: string) => void;
work: (res: string) => void;
};
};
/**
* 执行延时任务
*/
export function doTimerTask(opts:TimerOptions) {
export function doTimerTask(opts:TimerOptions) {
opts.start('doTimerTask start');
opts.start('doTimerTask start');
setTimeout(function() {
setTimeout(function() {
...
@@ -26,7 +31,9 @@ export function doTimerTask(opts:TimerOptions) {
...
@@ -26,7 +31,9 @@ export function doTimerTask(opts:TimerOptions) {
return { name: "doTimerTask" };
return { name: "doTimerTask" };
}
}
/**
* 执行周期任务
*/
export function doIntervalTask(opts:TimerOptions) {
export function doIntervalTask(opts:TimerOptions) {
let taskRet = setInterval(function() {
let taskRet = setInterval(function() {
...
@@ -37,6 +44,9 @@ export function doIntervalTask(opts:TimerOptions) {
...
@@ -37,6 +44,9 @@ export function doIntervalTask(opts:TimerOptions) {
return { name: "doIntervalTask",taskId:taskRet};
return { name: "doIntervalTask",taskId:taskRet};
}
}
/**
* 清除周期任务
*/
export function clearIntervalTask(taskId:number) {
export function clearIntervalTask(taskId:number) {
clearInterval(taskId);
clearInterval(taskId);
...
@@ -85,14 +95,12 @@ class RemoveUIRunnable extends Runnable {
...
@@ -85,14 +95,12 @@ class RemoveUIRunnable extends Runnable {
export function addViewToDecorView() {
export function addViewToDecorView() {
let uiRunable = new AddUIRunnable();
let uiRunable = new AddUIRunnable();
// 获取android环境下 宿主decorview的基本信息
getUniActivity()!.runOnUiThread(uiRunable)
getUniActivity()!.runOnUiThread(uiRunable)
}
}
export function removeViewToDecorView() {
export function removeViewToDecorView() {
var uiRunable = new RemoveUIRunnable();
var uiRunable = new RemoveUIRunnable();
// 获取android环境下 宿主decorview的基本信息
getUniActivity()!.runOnUiThread(uiRunable)
getUniActivity()!.runOnUiThread(uiRunable)
}
}
...
@@ -124,31 +132,32 @@ export function playAssetAudio() {
...
@@ -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(onLifecycleChange: (event:string) => void) {
export function initAppLifecycle() {
console.log("initAppLifecycle");
onAppActivityDestroy(() => {
onAppActivityDestroy(() => {
console.log("onAppActivityDestroy");
let eventName = "onAppActivityDestroy - " + Date.now();
onLifecycleChange(eventName);
console.log(eventName);
});
});
onAppActivityPause(() => {
onAppActivityPause(() => {
console.log("onAppActivityPause");
let eventName = "onAppActivityPause - " + Date.now();
onLifecycleChange(eventName);
console.log(eventName);
});
});
onAppActivityResume(() => {
onAppActivityResume(() => {
console.log("onAppActivityResume");
let eventName = "onAppActivityResume - " + Date.now();
onLifecycleChange(eventName);
console.log(eventName);
});
});
onAppActivityBack(() => {
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
# uts-helloworld
\ No newline at end of file
UTS入门示例插件
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录