Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
Hello UTS
提交
3a1e871b
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看板
提交
3a1e871b
编写于
8月 30, 2022
作者:
杜庆泉
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
utssdk dir add
上级
dbdba79e
变更
11
隐藏空白更改
内联
并排
Showing
11 changed file
with
118 addition
and
33 deletion
+118
-33
pages/tabBar/Advance/Advance.vue
pages/tabBar/Advance/Advance.vue
+14
-1
uni_modules/uts-advance/package.json
uni_modules/uts-advance/package.json
+2
-11
uni_modules/uts-advance/utssdk/app-android/config.json
uni_modules/uts-advance/utssdk/app-android/config.json
+0
-0
uni_modules/uts-advance/utssdk/app-android/index.uts
uni_modules/uts-advance/utssdk/app-android/index.uts
+100
-0
uni_modules/uts-advance/utssdk/app-android/utils.uts
uni_modules/uts-advance/utssdk/app-android/utils.uts
+0
-0
uni_modules/uts-helloworld/package.json
uni_modules/uts-helloworld/package.json
+1
-10
uni_modules/uts-helloworld/utssdk/app-android/config.json
uni_modules/uts-helloworld/utssdk/app-android/config.json
+0
-0
uni_modules/uts-helloworld/utssdk/app-android/index.uts
uni_modules/uts-helloworld/utssdk/app-android/index.uts
+0
-0
uni_modules/uts-osapi/package.json
uni_modules/uts-osapi/package.json
+1
-11
uni_modules/uts-osapi/utssdk/app-android/config.json
uni_modules/uts-osapi/utssdk/app-android/config.json
+0
-0
uni_modules/uts-osapi/utssdk/app-android/index.uts
uni_modules/uts-osapi/utssdk/app-android/index.uts
+0
-0
未找到文件。
pages/tabBar/Advance/Advance.vue
浏览文件 @
3a1e871b
...
...
@@ -7,6 +7,11 @@
<button
type=
"primary"
@
tap=
"testClearInterval"
>
关闭定时任务
</button>
</view>
<view
class=
"uni-btn-v uni-common-mt"
>
<button
type=
"primary"
@
tap=
"testAddToDecorView"
>
添加TextView至视图顶层
</button>
<button
type=
"primary"
@
tap=
"testRemoveToDecorView"
>
移除视图顶层的TextView
</button>
</view>
</view>
</
template
>
<
script
>
...
...
@@ -14,7 +19,8 @@
doTimerTask
,
doIntervalTask
,
clearIntervalTask
,
getDecorViewInfo
addViewToDecorView
,
removeViewToDecorView
}
from
"
../../../uni_modules/uts-advance
"
;
export
default
{
...
...
@@ -66,6 +72,13 @@
clearIntervalTask
(
this
.
taskId
);
},
testAddToDecorView
:
function
()
{
addViewToDecorView
();
},
testRemoveToDecorView
:
function
()
{
removeViewToDecorView
();
},
}
...
...
uni_modules/uts-advance/package.json
浏览文件 @
3a1e871b
...
...
@@ -76,16 +76,7 @@
"联盟"
:
"u"
}
}
},
"type"
:
"uts"
,
"uts"
:
{
"android"
:
{
"libs"
:
[],
"dependencies"
:
[]
},
"ios"
:
{
"libs"
:
[]
}
}
}
}
}
\ No newline at end of file
uni_modules/uts-advance/app-android/config.json
→
uni_modules/uts-advance/
utssdk/
app-android/config.json
浏览文件 @
3a1e871b
文件已移动
uni_modules/uts-advance/app-android/index.uts
→
uni_modules/uts-advance/
utssdk/
app-android/index.uts
浏览文件 @
3a1e871b
import { getActivity } from "io.dcloud.uts.android";
import { get
Uni
Activity } from "io.dcloud.uts.android";
import Rect from "android.graphics.Rect";
import Color from "android.graphics.Color";
import TextView from "android.widget.TextView";
import FrameLayout from "android.widget.FrameLayout";
import ViewGroup from "android.view.ViewGroup";
import Gravity from "android.view.Gravity";
type TimerOptions = {
start: (res: string) => void;
...
...
@@ -41,4 +43,58 @@ export function clearIntervalTask(taskId:number) {
class AddUIRunnable extends Runnable {
override run():void {
var textView = TextView(getUniActivity())
textView.text = "HELLO WORLD"
textView.textSize = 30.0.toFloat();
textView.setBackgroundColor(Color.RED)
textView.tag = "helloText"
textView.gravity = Gravity.CENTER
var decorView = getUniActivity()!.window.decorView;
var frameContent = decorView.findViewById(android.R.id.content) as FrameLayout
var layoutParam = FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,ViewGroup.LayoutParams.WRAP_CONTENT);
layoutParam.topMargin = 200;
frameContent.addView(textView,layoutParam)
}
};
class RemoveUIRunnable extends Runnable {
override run():void {
var decorView = getUniActivity()!.window.decorView;
var frameContent = decorView.findViewById(android.R.id.content) as FrameLayout
var targetTV = frameContent.findViewWithTag("helloText") as TextView
if(targetTV != null){
frameContent.removeView(targetTV)
}
}
};
export function addViewToDecorView() {
var uiRunable = AddUIRunnable();
// 获取android环境下 宿主decorview的基本信息
getUniActivity()!.runOnUiThread(uiRunable)
}
export function removeViewToDecorView() {
var uiRunable = RemoveUIRunnable();
// 获取android环境下 宿主decorview的基本信息
getUniActivity()!.runOnUiThread(uiRunable)
}
uni_modules/uts-advance/app-android/utils.uts
→
uni_modules/uts-advance/
utssdk/
app-android/utils.uts
浏览文件 @
3a1e871b
文件已移动
uni_modules/uts-helloworld/package.json
浏览文件 @
3a1e871b
...
...
@@ -76,16 +76,7 @@
"联盟"
:
"u"
}
}
},
"type"
:
"uts"
,
"uts"
:
{
"android"
:
{
"libs"
:
[],
"dependencies"
:
[]
},
"ios"
:
{
"libs"
:
[]
}
}
}
}
uni_modules/uts-helloworld/app-android/config.json
→
uni_modules/uts-helloworld/
utssdk/
app-android/config.json
浏览文件 @
3a1e871b
文件已移动
uni_modules/uts-helloworld/app-android/index.uts
→
uni_modules/uts-helloworld/
utssdk/
app-android/index.uts
浏览文件 @
3a1e871b
文件已移动
uni_modules/uts-osapi/package.json
浏览文件 @
3a1e871b
...
...
@@ -76,17 +76,7 @@
"联盟"
:
"u"
}
}
},
"type"
:
"uts"
,
"uts"
:
{
"android"
:
{
"libs"
:
[],
"dependencies"
:
[]
},
"ios"
:
{
"libs"
:
[]
}
}
}
}
}
\ No newline at end of file
uni_modules/uts-osapi/app-android/config.json
→
uni_modules/uts-osapi/
utssdk/
app-android/config.json
浏览文件 @
3a1e871b
文件已移动
uni_modules/uts-osapi/app-android/index.uts
→
uni_modules/uts-osapi/
utssdk/
app-android/index.uts
浏览文件 @
3a1e871b
文件已移动
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录