Android prompt dialog lightweight prompt box, loading, success, failure, warning, etc

Android-PromptDialog

Project address: limxing/Android-PromptDialogĀ 

Introduction: lightweight prompt box, loading, success, failure, warning, etc., as well as dialog box, non composite frame, customized ImageView implementation, thank you star

Prompt box - loading - dialog box - bottom option box - Homepage advertisement-

Prompt window, loading, confirmation dialog box, ad display, bottom Sheet option, non composite control, thank you star

1. Add dependency

allprojects {
    repositories {
        ...
        maven { url 'https://jitpack.io' }
    }
}
dependencies {
    ...
    compile 'com.github.limxing:Android-PromptDialog:1.1.3'
}

2. Creating objects and using methods

promptDialog = new PromptDialog(this);
promptDialog.showLoading("Logging in");
/**
/********************Message prompt box*************/
promptDialog.showSuccess("Landing successfully");
promptDialog.showError("Login failed");
promptDialog.showWarn("Be careful");
promptDialog.showInfo("Succeed");
promptDialog.showCustom(R.mipmap.ic_launcher, "Custom icon's");
promptDialog.dismiss();
promptDialog.dismissImmediately();

/********************Alert Pop up window*************/
final PromptButton confirm = new PromptButton("Determine", new PromptButtonListener() {
   @Override
   public void onClick(PromptButton button) {
       Toast.makeText(MainActivity.this, button.getText(), Toast.LENGTH_SHORT).show();
   }
});
confirm.setTextColor(Color.parseColor("#DAA520"));
//Button definition
PromptButton confirm = new PromptButton("Determine", new PromptButtonListener() {
    @Override
    public void onClick(PromptButton button) {
        Toast.makeText(MainActivity.this, button.getText(), Toast.LENGTH_SHORT).show();
    }
});
confirm.setFocusBacColor(Color.parseColor("#FAFAD2"));
//Call to Alert
promptDialog.showWarnAlert("Are you sure you want to log out?", new PromptButton("cancel", new PromptButtonListener() {
            @Override
            public void onClick(PromptButton button) {
                Toast.makeText(MainActivity.this, button.getText(), Toast.LENGTH_SHORT).show();
            }
  }), confirm);

/********************Bottom AlertSheet*************/
//The bottom Sheet selection of Android effect can be created. IOS effect is the default. sheetCellPad=0 is the Sheet of Android effect
//                promptDialog.getAlertDefaultBuilder().sheetCellPad(0).round(0);
//To set the characteristics and color of the button, see the member variables of the prompt button
PromptButton cancle = new PromptButton("cancel", null);
cancle.setTextColor(Color.parseColor("#0076ff"));
//Set the size and color of the displayed text
//promptDialog.getAlertDefaultBuilder().textSize(12).textColor(Color.GRAY);
//By default, two buttons are Alert dialog boxes, and those with more than three buttons are displayed in the form of bottom SHeet
promptDialog.showAlertSheet("", true, cancle,
  new PromptButton("Option 1", null), new PromptButton("Option 2", null),
  new PromptButton("Option 3", null), new PromptButton("Option 4", null));
 /********************How to display advertisements*************/
 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,"Click on the ad",Toast.LENGTH_SHORT).show();
            }
        }));
**/

3. Custom window style

/* All are single examples. Setting one time will affect the other, so if the effect is different, set one time before calling*/
//Custom prompt box Style, suitable for show
promptDialog.getDefaultBuilder().touchAble(true).round(3).loadingDuration(3000)..
//Custom pop-up dialog Style for Alert and AlertSheet (Alert pop-up, bottom AlertSheet)
promptDialog.getAlertDefaultBuilder().touchAble(false).round(5)...

4. On demand processing return key

  //The processing of return key is only the closing operation of Alert or AlertSheet
  @Override
    public void onBackPressed() {
        if (promptDialog.onBackPressed())
            super.onBackPressed();
    }

Keywords: Android Maven github iOS

Added by twigletmac on Thu, 02 Jan 2020 01:58:42 +0200