Popups allow you to create simple popups with few 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
This Popup display a simple message with a button to close the popup.
This Popup displays a text with two buttons.
This Popup displays a text and multiple clickable choices.
This Popup displays a text and an EditText where you can enter number.
This Popup displays a text and an EditText where you can enter text.
This Popup displays a text and an EditText where you can enter a login and one where you can enter a password.
Add this line in your project build.gradle at the end of repositories:
allprojects {
repositories {
...
maven { url 'https://jitpack.io' } // THIS LINE
}
}
And add the dependency in your app build.gradle :
dependencies {
implementation 'com.github.Thurluth:Popups-Android:1.6.3' // THIS LINE
}
→ 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();
→ 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);
→ 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);
→ Set default value in EditText :
popup.setDefaultInput(CharSequence defaultValue);
null by default
→ Set login input prefix :
popup.setLoginPrefix(String prefix);
→ Set password input prefix :
popup.setPasswordPrefix(String prefix);
→ Set both input prefix :
popup.setPrefixes(String loginPrefix, String passwordPrefix);
→ 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
→ PopupMessage :
listener = new PopupMessage.PopupListener()
{
@Override
public void onClosed()
{
/*
* HERE YOUR CODE THAT WILL
* BE EXECUTED WHEN POPUP
* IS CLOSED
*/
}
});
→ PopupBoolean :
listener = 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 :
listener = 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 :
listener = 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 :
listener = new PopupLogin.PopupListener()
{
@Override
public String onConfirm(String login, String password)
{
/*
* HERE YOUR CODE THAT WILL
* BE EXECUTED WHEN ACCEPT
* BUTTON IS PRESSED
*
* CALL A METHOD THAT CALL popup.closePopup()
* TO CLOSE THE POPUP OR popup.setErrorMessage(CharSequence message)
* TO DISPLAY 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
*/
}
};
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.