Giter Site home page Giter Site logo

kdialog's Introduction

KDialog

封装了一个日常用的对话框组合控件,免得每次都重复造一遍轮子。

这个轮子中规中矩,没什么新意,但本人平时开发使用频率却比那些花里胡哨的的对话框用的多。

为了方便使用,便在JitPack 上做了个依赖

1.依赖

在根 build.gradle添加JitPack 依赖

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

2.引入

在根 app.gradle

dependencies {
	implementation 'com.github.KosmoSakura:KDialog:1.0.0'
}

3.栗子

展示模块可任意组合,下面列出几个常用的例子

3.1.消息正文+单个按钮
 UDialog
 .builder(this, "消息正文内容消息正文内容消息正文内容消息正文内容")
 .build();

demo1

3.2.消息正文+两个按钮
 UDialog
 .builder(this, "消息正文内容消息正文内容消息正文内容消息正文内容")
 .button()
 .build();

demo1

3.3.消息正文+标题
 UDialog
     .builder(this, "今天放假")
     .title("通知通知")
     .build();

demo1

3.4.消息正文+图标
UDialog
    .builder(this, "上面有个圈圈")
    .icon(R.mipmap.ic_launcher_round)
    .build();

demo1

3.5.消息正文+输入框
UDialog
	.builder(this, "输入密码")
    .input("这个是密码", true)
    .button("确定", "取消")
    .cancelClick(dia -> {
        toast("操作已取消");
        dia.dismiss();
    })
    .confirmClick((result, dia) -> {
        toast("输入密码为:" + result);
        dia.dismiss();
    })
    .build();

demo1

3.6.全部展示
 UDialog
 	.builder(this)
     .title("我是个标题")
     .icon(R.mipmap.ic_launcher_round)
     .msg("我是消息正文")
     .input("输入点什么")
     .button("按钮一", "按钮二")
     .build();

demo1


License

   Copyright 2019 Kosmos

   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.

kdialog's People

Contributors

kosmosakura avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.