• Stars
    star
    551
  • Rank 80,726 (Top 2 %)
  • Language
    Java
  • Created over 7 years ago
  • Updated over 7 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

提示窗口,正在加载中,主页广告,IOS 底部弹出选择,确认对话框,轻量View,非组合框架

Android-PromptDialog

提示窗口,正在加载中,确认对话框,广告展示,底部Sheet选项,非组合控件,感谢star

1、添加依赖

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


dependencies {
    ...
    compile 'com.github.limxing:Android-PromptDialog:1.1.3'
}

2、创建对象及使用方法

promptDialog = new PromptDialog(this);
promptDialog.showLoading("正在登录");
/**
/********************消息提示框*************/
promptDialog.showSuccess("登陆成功");
promptDialog.showError("登录失败");
promptDialog.showWarn("注意");
promptDialog.showInfo("成功了");
promptDialog.showCustom(R.mipmap.ic_launcher, "自定义图标的");
promptDialog.dismiss();
promptDialog.dismissImmediately();

/********************Alert弹窗*************/
final PromptButton confirm = new PromptButton("确定", new PromptButtonListener() {
   @Override
   public void onClick(PromptButton button) {
       Toast.makeText(MainActivity.this, button.getText(), Toast.LENGTH_SHORT).show();
   }
});
confirm.setTextColor(Color.parseColor("#DAA520"));
//按钮的定义
PromptButton confirm = new PromptButton("确定", new PromptButtonListener() {
    @Override
    public void onClick(PromptButton button) {
        Toast.makeText(MainActivity.this, button.getText(), Toast.LENGTH_SHORT).show();
    }
});
confirm.setFocusBacColor(Color.parseColor("#FAFAD2"));
//Alert的调用
promptDialog.showWarnAlert("你确定要退出登录?", new PromptButton("取消", new PromptButtonListener() {
            @Override
            public void onClick(PromptButton button) {
                Toast.makeText(MainActivity.this, button.getText(), Toast.LENGTH_SHORT).show();
            }
  }), confirm);
  
/********************底部AlertSheet*************/
//可创建android效果的底部Sheet选择,默认IOS效果,sheetCellPad=0为Android效果的Sheet
//                promptDialog.getAlertDefaultBuilder().sheetCellPad(0).round(0);
//设置按钮的特点,颜色大小什么的,具体看PromptButton的成员变量
PromptButton cancle = new PromptButton("取消", null);
cancle.setTextColor(Color.parseColor("#0076ff"));
//设置显示的文字大小及颜色
//promptDialog.getAlertDefaultBuilder().textSize(12).textColor(Color.GRAY);
//默认两个按钮为Alert对话框,大于三个按钮的为底部SHeet形式展现
promptDialog.showAlertSheet("", true, cancle,
  new PromptButton("选项1", null), new PromptButton("选项2", null),
  new PromptButton("选项3", null), new PromptButton("选项4", null));
 /********************展示广告的方法*************/
 promptDialog.getDefaultBuilder().backAlpha(150);
Glide.with(MainActivity.this).load("https://timgsa.baidu.com/timg?image&quality=80&" +
        "size=b9999_10000&sec=1495518782659&di=25b120262114749ae8543652d2de5715&" +
        "imgtype=0&src=http%3A%2F%2Fimg.tupianzj.com%2Fuploads%2Fallimg%2F160316%2F9-160316152R5.jpg")
        .into(promptDialog.showAd(true, new OnAdClickListener() {
            @Override
            public void onAdClick() {
                Toast.makeText(MainActivity.this,"点击了广告",Toast.LENGTH_SHORT).show();
            }
        }));
**/

3、自定义窗口style

/* 均为单例,设置一次后会影响另一个,因此如果效果不同那么调用前设置一次*/
//自定义提示框Style,适应于show...(消息提示框,展示广告)
promptDialog.getDefaultBuilder().touchAble(true).round(3).loadingDuration(3000)..
//自定义弹窗对话框Style,适应于Alert 及AlertSheet(Alert弹窗,底部AlertSheet)
promptDialog.getAlertDefaultBuilder().touchAble(false).round(5)...

4、按需处理返回键

  //返回键的处理仅是Alert 或AlertSheet的关闭操作
  @Override
    public void onBackPressed() {
        if (promptDialog.onBackPressed())
            super.onBackPressed();
    }

License

Copyright  2017 Limxing

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.

More Repositories

1

LaplaceKLine

Android K线图 基于MPAndroidChart
Java
194
star
2

XListView

android-XListView的修改版,下拉刷新上拉加载增加仿IOS的等待圈,和IOS一样,一张图片实现,感谢start
Java
96
star
3

LFRecyclerView-Android

RecyclerView下拉刷新,上拉加载recyclerview
Java
86
star
4

CityPickerWebView

省市县三级联动,JS实现
JavaScript
60
star
5

Swift-IJKPlayer

基于IJKPlayer Swift 视频播放器 仿今日头条视频播放器
Swift
51
star
6

DatePickerView

DatePickerView,PickerView。Android日期选择器,滚轮选择器。同学别再找了,你的选择器该更换了,基于recyclerview的滚轮选择器。
Kotlin
46
star
7

DatePicker

从底部弹出的日期选择器
Java
39
star
8

Kotlin-VerificationView

android 手机验证码输入框
Kotlin
27
star
9

Kotlin-PickerView

android选择器基于recyclerview,kotlin-PickerView
Kotlin
5
star
10

LeefengLibrary

Android开发集成,包含常见的工具包得封装使用,还有特殊功能的自定义控件等
Java
4
star
11

IOS-LoadingView

android-loadingView IOSloadingView
Java
3
star
12

XMDBModel

基于SQLite.swift的数据库orm增删改查
Swift
2
star
13

ExpandableView

android ExpandableView能够让子View隐藏和展开,伸缩菜单
Java
2
star
14

service_chat_xiaomi

flutter plugin of xiaomi chat service
Dart
2
star
15

flutter_keyboard_done

Dart
2
star
16

PEditTextView

用于密码输入框,数字输入框,验证码输入框的自定义View
Java
1
star
17

ImageSelectorDemo

Androd ImageSelector
Java
1
star
18

MVPHelper

Java
1
star
19

big-planet-tracks

Automatically exported from code.google.com/p/big-planet-tracks
Java
1
star
20

github_client_flutter

initial commit
Dart
1
star
21

LoadMoreSliver

LoadMoreSliver can LoadMore data from net for CustomScrollView.flutter上拉加载更多
C++
1
star
22

ChatDemo

这是一个集聊天软件集成和下载管理的Demo
Java
1
star