6 Star 6 Fork 1

HarmonyOS-TPC / material-intro-screen

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
ShowDemoAbilitySlice.java 1.58 KB
AI 代码解读
一键复制 编辑 原始数据 按行查看 历史
package agency.tango.materialintro.slice;
import agency.tango.materialintro.ResourceTable;
import ohos.aafwk.ability.AbilitySlice;
import ohos.aafwk.content.Intent;
import ohos.aafwk.content.Operation;
import ohos.agp.components.Component;
public class ShowDemoAbilitySlice extends AbilitySlice {
@Override
public void onStart(Intent intent) {
super.onStart(intent);
super.setUIContent(ResourceTable.Layout_ability_show);
initView();
}
private void initView() {
jumpToAnotherPage(ResourceTable.Id_bt1, "ComponentDemoAbility");
jumpToAnotherPage(ResourceTable.Id_bt2, "AbilitySliceDemoAbility");
jumpToAnotherPage(ResourceTable.Id_bt3, "FractionDemoAbility");
}
private void jumpToAnotherPage(int id, String abilityName) {
findComponentById(id).setClickedListener(new Component.ClickedListener() {
@Override
public void onClick(Component component) {
Intent jumpIntent = new Intent();
Operation operation = new Intent.OperationBuilder()
.withDeviceId("")
.withBundleName("agency.tango.materialintro")
.withAbilityName("agency.tango.materialintro." + abilityName)
.build();
jumpIntent.setOperation(operation);
startAbility(jumpIntent);
}
});
}
@Override
public void onActive() {
super.onActive();
}
@Override
public void onForeground(Intent intent) {
super.onForeground(intent);
}
}
1
https://gitee.com/HarmonyOS-tpc/material-intro-screen.git
git@gitee.com:HarmonyOS-tpc/material-intro-screen.git
HarmonyOS-tpc
material-intro-screen
material-intro-screen
master

搜索帮助