/Popups-Android

Primary LanguageJavaMIT LicenseMIT

Popups-Android

Popups allows you to display some popups with simple lines of code
Minimum API : 23

You can dowload the APK in order to test the popups

You also have custom ScrollView / EditText / ViewPager in the library


Avaible Popups

PopupMessage

This Popup just display a simple message with a button to close the popup.


PopupBoolean

This Popup display a text with two buttons.


PopupChoice

This Popup display a text and multiple clickable choices.


PopupInputInt

This Popup display a text and an EditText where you can enter number.


PopupInputString

This Popup display a text and an EditText where you can enter text.


PopupLogin

This Popup display a text and an EditText where you can enter a login and one where you can enter a password.


USAGE

How to use it in your project ?

Add this line in your project build.gradle at the end of repositories:

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

And add the dependency in your app build.gradle :

dependencies {
    compile 'com.github.Thurluth:Popups-Android:1.6.1' // THIS LINE
}

General usage


→ Create Popup :

PopupType popup = new PopupType(Activity activity, PopupListener listener);

See different listeners bellow


→ Set Popup message text :

popup.setMessageText(String text);

Set on Text by default


→ Set message color :

popup.setMessageTextColor(int color);


→ Set message size :

popup.setMessageTextSize(int size);

Set on 20 by default


→ Set Popup background color :

popup.setPopupBackgroundColor(int color);


→ Set Popup outline width :

popup.setPopupOutlineWidth(int width);

Set on 2 by default


→ Set Popup outline color :

popup.setPopupOutlineColor(int color);


→ Set Popup outline :

popup.setPopupOutline(int width, int color);

Default width set on 2


→ Set Popup corner radius :

popup.setPopupCornerRadius(int radius);

Set on 20 by default


→ Display Popup :

popup.display();


Popups having an accept button usage


→ Set accept button icon color :

popup.setAcceptColor(int color);


→ Set accept button background color when not pressed :

popup.setAcceptBackgroundColorNotPressed(int colorNotPressed);


→ Set accept button background color when pressed :

popup.setAcceptBackgroundColorPressed(int colorPressed);


→ Set accept button background color :

popup.setAcceptBackgroundColor(int colorNotPressed, int colorPressed);


Popups having a cancel button usage


→ Set cancel button icon color :

popup.setCancelColor(int color);


→ Set cancel button background color when not pressed :

popup.setCancelBackgroundColorNotPressed(int colorNotPressed);


→ Set cancel button background color when pressed :

popup.setCancelBackgroundColorPressed(int colorPressed);


→ Set cancel button background color :

popup.setCancelBackgroundColor(int colorNotPressed, int colorPressed);


PopupInput usage


→ Set default value in EditText :

popup.setDefaultInput(CharSequence defaultValue);

null by default


PopupLogin usage


→ Set problems (forgotten password / not register yet) text size :

popup.setProblemsTextSize(float size);

or

popup.setProblemsTextSize(float forgotSize, float registerSize);


→ Set forgotten password text :

popup.setForgotText(CharSequence text);

Set on Forgot your password ? by default


→ Set register text :

popup.setRegisterText(CharSequence text);

Set on Not registered yet ? by default


→ Set problems text color :

popup.setProblemsTextColor(int color);

or

popup.setProblemsTextColor(int forgotColor, int registerColor);


→ Set error message text size :

popup.setErrorTextSize(float size);

Set on 18 by default


→ Set error message text color :

popup.setErrorTextColor(int color);


→ Set error message in italic or not :

popup.setErrorTextItalic(boolean inItalic);

Set on true by default


Different listeners


→ PopupMessage :

lister = new PopupMessage.PopupListener()
{
    @Override
    public void onClosed()
    {
         /*
         *   HERE YOUR CODE THAT WILL
         *   BE EXECUTED WHEN POPUP
         *   IS CLOSED
         */
    }
});


→ PopupBoolean :

lister = new PopupBoolean.PopupListener()
{
    @Override
    public void onAccept()
    {
         /*
         *   HERE YOUR CODE THAT WILL
         *   BE EXECUTED WHEN ACCEPT
         *   BUTTON IS PRESSED
         */
    }
    
    @Override
    public void onRefuse()
    {
         /*
         *   HERE YOUR CODE THAT WILL
         *   BE EXECUTED WHEN REFUSE
         *   BUTTON IS PRESSED
         */    
    }
});


→ PopupChoice :

lister = new PopupChoice.PopupListener()
{
    @Override
    public String[] setChoices()
    {
        return new String[] {
                "Here",
                "You",
                "Put",
                "Your",
                "Choices",
                "List"
        };
    }
    
    @Override
    public int setDisplayableChoices()
    {
        return {int};
    }
    
    @Override
    public void onSelected(String choice)
    {
         /*
         *   HERE YOUR CODE THAT WILL
         *   BE EXECUTED WHEN A CHOICE
         *   IS SELECTED
         */
    }
    
    @Override
    public void onCancel()
    {
         /*
         *    HERE YOUR CODE THAT WILL
         *    BE EXECUTED WHEN CANCEL
         *    BUTTON IS PRESSED
         */
    }
};


→ PopupInput :

lister = new PopupInput.PopupListener()
{
    @Override
    public void onConfirm(Object value)
    {
         /*
         *   HERE YOUR CODE THAT WILL
         *   BE EXECUTED WHEN CONFIRM
         *   BUTTON IS PRESSED
         */
    }
    
    @Override
    public void onRefuse()
    {
         /*
         *   HERE YOUR CODE THAT WILL
         *   BE EXECUTED WHEN CANCEL
         *   BUTTON IS PRESSED
         */    
    }
});


→ PopupLogin :

lister = new PopupLogin.PopupListener()
{
    @Override
    public String onConfirm(String login, String password)
    {
         /*
         *    HERE YOUR CODE THAT WILL
         *    BE EXECUTED WHEN ACCEPT
         *    BUTTON IS PRESSED
         *
         *    RETURN "" OR null IF YOU WANT
         *    TO CLOSE THE POPUP.
         *    OTHERWISE RETURN AN ERROR MESSAGE
         */
    }
 
    @Override
    public void onCancel()
    {
         /*
         *    HERE YOUR CODE THAT WILL
         *    BE EXECUTED WHEN CANCEL
         *    BUTTON IS PRESSED
         */
    }
 
    @Override
    public void onForgot()
    {
         /*
         *    HERE YOUR CODE THAT WILL
         *    BE EXECUTED IF USER SAYS
         *    HE FORGOT HIS PASSWORD
         */
    }
 
    @Override
    public void onRegister()
    {
         /*
         *    HERE YOUR CODE THAT WILL
         *    BE EXECUTED IF USER SAYS
         *    HE WANTS TO REGISTER
         */
    }
};

DEVELOP BY

Thurluth - thurluth@gmail.com


LICENSE

MIT License

Copyright (c) 2017 Thurluth

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.