Skip to content

A library to show iOS like AlertView in Android as Dialogs

Notifications You must be signed in to change notification settings

hamedrajabpour/iOSDialogs4Android

 
 

Repository files navigation

iOSDialogs4Android

Its a library to show iOS like AlertView in Android as Dialogs with similar animations.

iosdialogs4android sample

Gradle dependency

Add this dependency in your app level build.gradle file

Download

implementation 'com.varunjohn1990.libraries:iosdialogs4android:1.0.2'

How to use

Just use this friendly builder pattern to show the Dialog.

For simple message

  new IOSDialog.Builder(this)
                .message(R.string.dialog_message)
                .build()
                .show();

All available options

  new IOSDialog.Builder(context)
                .title("iOS Dialogs")              // String or String Resource ID
                .message(R.string.dialog_message)  // String or String Resource ID
                .positiveButtonText("Yeah, sure")  // String or String Resource ID
                .negativeButtonText("No Thanks")   // String or String Resource ID
                .cancelable(true)                  // Dialog will dismiss if clicked outside
                .enableAnimation(true)             // To enable enter and exit animations
                .positiveClickListener(new IOSDialog.Listener() {
                    @Override
                    public void onClick(IOSDialog iosDialog) {
                        iosDialog.dismiss();
                        Toast.makeText(context, "Thanks :)", Toast.LENGTH_SHORT).show();
                    }
                }).negativeClickListener(new IOSDialog.Listener() {
                    @Override
                    public void onClick(IOSDialog iosDialog) {
                        iosDialog.dismiss();
                        Toast.makeText(context, ":(", Toast.LENGTH_SHORT).show();
                    }
                }).cancelListener(new IOSDialog.Listener() {
                    @Override
                    public void onClick(IOSDialog iosDialog) {
                        Toast.makeText(context, "Cancelled", Toast.LENGTH_SHORT).show();
                    }
                })
                .build()
                .show();

About Me

Varun John
Sr. Android Developer
[email protected]
Skype varun.john1990
Follow me https://github.com/varunjohn for other samples and libraries like these

If you like this library then please add a star :)

License

   Copyright 2018 Varun John

   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.

About

A library to show iOS like AlertView in Android as Dialogs

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 100.0%