1 Star 0 Fork 0

coder-ice/GlobalDialog

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

GlobalDialog

A dialog can create by ApplicationContext in Android. It developed by Kotlin language.

You can use GlobalDialog like AlertDialog, but GlobalDialog can be created by ApplicationContext, you can create it in anywhere don't think how to find your Activity, it will be very flexible just like Toast.

However, not all features have yet been fully implemented, but it will get stronger and stronger over time.

Android全局对话框,可通过ApplicationContext创建。Kotlin语言开发。

你可以像使用AlertDialog一样使用GlobalDialog,但是GlobalDialog可以使用ApplicationContext创建,你可以在任何地方创建对话框而不需要想怎么去拿到Activity对象,它可以像Toast一样非常灵活的使用。

但是目前还没有完全实现AlertDialog拥有的全部功能,但是它会随着时间变得越来越健壮。

Usage

Step 1. Add the JitPack repository to your build file

Add it in your root build.gradle at the end of repositories:

	allprojects {
		repositories {
			...
			maven { url 'https://jitpack.io' }
		}
	}

Step 2. Add the dependency

	dependencies {
	        implementation 'com.github.hwb0011:GlobalDialog:Tag'
	}

ChangeHistory

v1.0.0

Support 支持的功能

  • class Builder(applicationContext: Context?)
  • setTitle(@StringRes titleId: Int)
  • setTitle(title: CharSequence?)
  • setMessage(@StringRes messageId: Int)
  • setMessage(message: CharSequence?)
  • setIcon(@DrawableRes iconId: Int)
  • setIcon(iconUrl: String?)
  • setPositiveButton(@StringRes textId: Int, listener: DialogInterface.OnClickListener)
  • setPositiveButton(text: CharSequence, listener: DialogInterface.OnClickListener)
  • setNegativeButton(@StringRes textId: Int, listener: DialogInterface.OnClickListener)
  • setNegativeButton(text: CharSequence, listener: DialogInterface.OnClickListener)
  • setNeutralButton(@StringRes textId: Int, listener: DialogInterface.OnClickListener)
  • setNeutralButton(text: CharSequence, listener: DialogInterface.OnClickListener)
  • setCancelable(cancelable: Boolean)
  • setOnCancelListener(onCancelListener: DialogInterface.OnCancelListener)
  • setOnDismissListener(onDismissListener: DialogInterface.OnDismissListener)

Something special 一些特殊之处

  • GlobalDialog support setGravity(gravity: Int), you can specify it's location, currently supported are DIALOG_GRAVITY_CENTER / DIALOG_GRAVITY_TOP / DIALOG_GRAVITY_BOTTOM, corresponding animations are also provided, default config is DIALOG_GRAVITY_CENTER.

  • GlobalDialog support setShowType(showType: Int), used to set the time it appears on the screen just like Toast, currently supported are DIALOG_TYPE_ALWAYS_SHOW / DIALOG_TYPE_SHORT_SHOW / DIALOG_TYPE_LONG_SHOW, default config is DIALOG_TYPE_ALWAYS_SHOW.

  • GlobalDialog support setOutsideTouchable(outsideTouchable: Boolean), default config is false, if you want the TouchEvent or ClickEvent can dispatch to other View but don't effect GlobalDialog, you can use setOutsideTouchable(true).

  • GlobalDialog支持setGravity(gravity: Int)方法,你可以指定它弹出的位置,目前支持DIALOG_GRAVITY_CENTER / DIALOG_GRAVITY_TOP / DIALOG_GRAVITY_BOTTOM这三个参数,并且提供了对应的弹出动画,默认配置是DIALOG_GRAVITY_CENTER

  • GlobalDialog支持setShowType(showType: Int)方法,用来设置对话框在屏幕上显示的时间,以实现Toast一样的效果,目前支持DIALOG_TYPE_ALWAYS_SHOW / DIALOG_TYPE_SHORT_SHOW / DIALOG_TYPE_LONG_SHOW,默认配置是DIALOG_TYPE_ALWAYS_SHOW

  • GlobalDialog支持setOutsideTouchable(outsideTouchable: Boolean)方法,默认配置是false,如果你希望触摸事件或者点击事件可以在不影响对话框的前提下分发给对话框之外的View的话,可以调用setOutsideTouchable(true)

MIT License Copyright (c) 2021 hwb0011 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

Android全局对话框 展开 收起
README
MIT
取消

发行版 (1)

全部

贡献者

全部

语言

近期动态

不能加载更多了
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Android
1
https://gitee.com/coder-ice/GlobalDialog.git
git@gitee.com:coder-ice/GlobalDialog.git
coder-ice
GlobalDialog
GlobalDialog
master

搜索帮助