Giter Club home page Giter Club logo

bottomdialog's Introduction

BottomDialog

build license

中文版

BottomDialog is a bottom dialog layout implemented with DialogFragment,And supports pop-up animation, support any layout

Preview

BottomDialogShare BottomDialogShare

Import

Maven

<dependency>
  <groupId>me.shaohui</groupId>
  <artifactId>bottomdialog</artifactId>
  <version>1.1.9</version>
  <type>pom</type>
</dependency>

or Gradle

compile 'me.shaohui:bottomdialog:1.1.9'

Uasge

You can use BottomDialog in two different ways :

1.Use directly BottomDialog

A simple three lines of code can be done:

BottomDialog.create(getSupportFragmentManager())
                .setLayoutRes(R.layout.dialog_layout)      // dialog layout
                .show();

Of course, you can also make simple settings:

BottomDialog.create(getSupportFragmentManager())
                .setViewListener(new BottomDialog.ViewListener() {    
                    @Override
                    public void bindView(View v) {
                        // // You can do any of the necessary the operation with the view
                    }
                })
                .setLayoutRes(R.layout.dialog_layout)  
                .setDimAmount(0.1f)            // Dialog window dim amount(can change window background color), range:0 to 1,default is : 0.2f
                .setCancelOutside(false)     // click the external area whether is closed, default is : true
                .setTag("BottomDialog")     // setting the DialogFragment tag
                .show();

So Easy!

2.or extends BaseBottomDialog to use

First of all, according to your needs to define a class,extends BaseBottomDialog,For example below ShareBottomDialog

public class ShareBottomDialog extends BaseBottomDialog{

    @Override
    public int getLayoutRes() {
        return R.layout.dialog_layout;
    }

    @Override
    public void bindView(View v) {
        // do any thing you want
    }
}

So simple, only two abstract methods needed to achieve, the rest is to add your logic. Of course, you can also rewrite some of the necessary methods to meet your needs, You can manipulate this Dialog as you would a Fragment

int getHeight()                 // return your bottomDialog height

float getDimAmount()            // set dialog dim amount(can change window background color), default is 0.2f

boolean getCancelOutside()      // click the external area whether is closed, default is : true

String getFragmentTag()         // set dialogFragment tag

The rest is use it:

    ShareBottomDialog dialog = new ShareBottomDialog();
    dialog.show(getFragmentManager());

That is all!

Issue

If you are in the process of using, encountered any problems, welcome to put forward issue

License

Copyright 2016 shaohui10086

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.

bottomdialog's People

Contributors

shaohui10086 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bottomdialog's Issues

No resource found ,图没传上来?

Error:(42, 54) No resource found that matches the given name (at 'src' with value '@mipmap/share_wechat_solid').
Error:(68, 54) No resource found that matches the given name (at 'src' with value '@mipmap/share_weixin_friends_solid').
Error:(94, 54) No resource found that matches the given name (at 'src' with value '@mipmap/share_weibo_solid').
Error:(120, 54) No resource found that matches the given name (at 'src' with value '@mipmap/share_qq_solid').
Error:(146, 54) No resource found that matches the given name (at 'src' with value '@mipmap/share_qqzone_solid').

点击外部区域无法隐藏dialog

dialog.setCancelOutside(true); // 点击外部区域是否关闭,默认true
点击外部区域好像无法隐藏dialog
dialog显示的view好像是铺满整个屏幕的,所以点击其他地方没有反应。

bug

setViewListener(new BottomDialog.ViewListener() {
@OverRide
public void bindView(View v) {
//do somthing
}
})
setViewListener监听接口方法里做的事情,设置的点击事件,横屏之后(弹窗虽然还在)点击事件无效,你可以拿您的弹窗微信R.id.mRlWechat设置试一下点击事件,横竖屏切换就无效了

你好

怎么设置这个属性:
当点击BottomDialog中的任何一个控件后,BottomDialog自动消失。

.setCancelOutside(true)参数设置不起作用

你好,有两个问题需要请教下:
1.我是在fragment中弹出的dialog的,.setCancelOutside(true)设置之后点击空白区域dialog不消失;
2.点击事件是在bindView中触发的?
谢谢!

dismiss相关

怎么在bindview几调用BottomDialog的dismiss??

导入报错,难道必须使用com.android.support:support-v4:24.2.1吗?

Error:Could not find com.android.support:support-v4:24.2.1.
Required by:
ActivityTest1013:app:unspecified > com.android.support:appcompat-v7:23.4.0
ActivityTest1013:app:unspecified > com.android.support:design:23.4.0
ActivityTest1013:app:unspecified > com.android.support:appcompat-v7:23.4.0 > com.android.support:support-vector-drawable:23.4.0
ActivityTest1013:app:unspecified > com.android.support:design:23.4.0 > com.android.support:recyclerview-v7:23.4.0

Please install the Android Support Repository from the Android SDK Manager.
Open Android SDK Manager

错误log如上,貌似必须安装24.2.1的v4包?可是我的开发版本是23.4.0
请问如何解决?

关于setCancelOutside方法

在运行example的时候,showDialog方法中把布局改为dialog_edit_text后,setCancelOutside方法是生效的;当布局是dialog_layout的时候,setCancelOutside方法是不生效的,测试手机:魅蓝,华为

hey

你好 怎么为layout中的某个Imageview设置监听器呢
麻烦写下代码,谢谢、

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.