# FancyToast-ohos **Repository Path**: HarmonyOS-tpc/FancyToast-ohos ## Basic Information - **Project Name**: FancyToast-ohos - **Description**: No description available - **Primary Language**: Unknown - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 3 - **Forks**: 2 - **Created**: 2021-04-01 - **Last Updated**: 2024-11-08 ## Categories & Tags **Categories**: harmonyos-popup **Tags**: None ## README ## FancyToast-ohos ## Usage Solution 1: local har package integration 1.Add the har package to the lib folder. 2.Add the following code to gradle of the entry: ```gradle implementation fileTree(dir: 'libs', include: ['.jar', '.har']) ``` Solution 2: ```gradle allprojects{ repositories{ mavenCentral() } } implementation 'io.openharmony.tpc.thirdlib:FancyToast-ohos:1.0.4' ``` ## entry运行要求 通过DevEco studio,并下载OpenHarmonySDK 将项目中的build.gradle文件中dependencies→classpath版本改为对应的版本(即你的IDE新建项目中所用的版本) ## Screenshot ![fancytoast.gif](fancytoast.gif) ## Usage Each method always returns a `Toast` object, so you can customize the Toast much more. **DON'T FORGET THE `show()` METHOD!** To display an default Toast: ``` java FancyToast.makeText(this,"Hello World !",3000,FancyToast.DEFAULT,false); ``` To display a success Toast: ``` java FancyToast.makeText(this,"Hello World !",3000,FancyToast.SUCCESS,false); ``` To display an info Toast: ``` java FancyToast.makeText(this,"Hello World !",3000,FancyToast.INFO,false); ``` To display a warning Toast: ``` java FancyToast.makeText(this,"Hello World !",3000,FancyToast.WARNING,false); ``` To display the error Toast: ``` java FancyToast.makeText(this,"Hello World !",3000,FancyToast.ERROR,false); ``` To display the confusing Toast: ``` java FancyToast.makeText(this,"Hello World !",3000,FancyToast.CONFUSING,false); ``` You can also remove the icon on top-right corner by passing last parameter false. ``` java FancyToast.makeText(yourContext, "I'm a Toast", duration, type, boolean value).show(); ``` You can also create your custom Toasts with passing your image with or without icon(top-right corner): ``` java FancyToast.makeText(yourContext, "I'm a custom Toast", duration, type, yourimage, isShow).show(); ``` To display the custom Toast with no icon: ``` java FancyToast.makeText(this, "This is Custom Toast with no icon", 3000, FancyToast.CONFUSING, R.drawable.ic_black_24dp, false); ``` ## License * [Apache Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.html) ``` Copyright 2020 Shashank Singhal Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.