Explore DialogV3 in HarmonyOS

Introduction

Kongzue themes

Background

iOS Theme
Material theme
MIUI theme

Step by Step Implementation

Ability Template
  • API version to 5
Project Setup
dependencies {implementation fileTree(dir: 'libs', include: ['*.har'])
implementation 'io.openharmony.tpc.thirdlib:DialogV3:1.0.0'
testCompile 'junit:junit:4.12'
}
  1. Input Dialog Box — The input dialog box can be used to get input from users or can be used to validate passwords.
// set the theme IOS,Material,kongzue or MIUI
DialogSettings.style = DialogSettings.STYLE.STYLE_IOS;
// set the mode light or dark
DialogSettings.theme = DialogSettings.THEME.LIGHT;
// Onclick display the messege
InputDialog.build(getContext())
//set the prompt messege
.setTitle("prompt").setMessage("Please
enter the password(123456)")
//set input text to show in prompt messge
.setInputText("111111")
.setOkButton("ok", new
OnInputDialogButtonClickListener(){
@Override public boolean onClick(String inputStr)
{
// check validation of input string
if (inputStr.equals("123456")) {
TipDialog.show(getContext(), "success!",
TipDialog.TYPE.SUCCESS);
return false;
}
else {
TipDialog.show(getContext(), "Incorrect
password", TipDialog.TYPE.ERROR);
return true;
}
}
})
.setCancelButton("cancel")
//Hint for helping user
.setHintText("Please enter the password")
.setInputInfo(new InputInfo()
//maximum length of the input string
.setMAX_LENGTH(6)
)
.setCancelable(true)
.show(getContext());
Input Dialog Box
// set the theme IOS,Material,kongzue or MIUI
DialogSettings.style = DialogSettings.STYLE.STYLE_IOS;
// set the mode light or dark
DialogSettings.theme = DialogSettings.THEME.LIGHT;
// Onclick Wait Dialog crash will apper with messege
MessageDialog.show(getContext(), "Tips", "Crash Messege", "cancel")
.setMessageTextInfo(new TextInfo().setGravity(TextAlignment.LEFT))
.setOnOkButtonClickListener(new OnDialogButtonClickListener() {
@Override public boolean onClick()
{
WaitDialog.show(getContext(),
"Preparing to crash...");
WaitDialog.show(getContext(), "Please wait...");
EventHandler handler = new EventHandler(
EventRunner.getMainEventRunner());
handler.postTask(new Runnable() {
@Override public void run()
{
getUITaskDispatcher().asyncDispatch(() -> {
TipDialog.show(getContext(), "success", TipDialog.TYPE.SUCCESS)
.setOnDismissListener(new OnDismissListener() {
@Override public void onDismiss()
{
// jump(MainActivity.class);
Crash DialogBox Display
// set the theme IOS,Material,kongzue or MIUI
DialogSettings.style = DialogSettings.STYLE.STYLE_IOS;
// set the mode light or dark
DialogSettings.theme = DialogSettings.THEME.LIGHT;
// set the the items to be presesnt in share dialog
itemList.add(new ShareDialog.Item(
getContext(), ResourceTable.Media_img_email_ios,
"email"));
itemList.add(new ShareDialog.Item(
getContext(), ResourceTable.Media_img_qq_ios, "QQ"));
// Show the shared content
ShareDialog.show(getContext(), itemList, (shareDialog,
index, item) -> {
toast("Clicked:" + item.getText());
return false;
Share DialogBox Display

List of public APIs for app developers

Public APIs

Conclusion

--

--

--

World’s Innovative open collaborate Platform, build reusable application components to reduce effort and fast track application development on multiplatform.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Developed a Setup so that we can ping google but not able to ping Facebook from the same system.

Improving VSCode Workflow on Mac for Beginners

Github Notes

ProductHunt’s 17 Most Exciting Upcoming Products For Developers

How Computers Deal With Floating Point Numbers?

web2.0s links

CTF challenges: Dockerizing and Repository structure

Pickle Rick[THM]: Writeup

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Application Library Engineering Group

Application Library Engineering Group

World’s Innovative open collaborate Platform, build reusable application components to reduce effort and fast track application development on multiplatform.

More from Medium

👨🏼‍💻LibGDX Demo Game Application With ML Kit Hand Gesture Detection and Ashley System Library…

Integrating HUAWEI Account Kit to your Android Studio project

Create Puskesmas Searching Application using HMS Location Kit

Integration of Text to Speech feature of Huawei ML Kit in Book Reading Android app (Kotlin)- Part 4