winsontan520 / Android-WVersionManager

[Deprecated] Library to check new update available in background by using own content
141 stars 57 forks source link

Problem with option #15

Open rohitkhajuria opened 6 years ago

rohitkhajuria commented 6 years ago

I want to remove the label ignore this version so users will see only two options 1. update available and other is 2. Remind me Later. How to process. Thanks in advance.

QInfro commented 6 years ago

Yes you can do this, even I also liked that and using only update now & remind later options in my app, Here how can u do that, it is quit easy you can do that in showdialog(); method, just replace your method with this code,

private void showDialog() {

       AlertDialog.Builder builder = new AlertDialog.Builder(activity);
        builder.setIcon(getIcon());
        builder.setTitle(getTitle());
        builder.setMessage(Html.fromHtml(getMessage(), null, getCustomTagHandler()));

        switch (mMode) {
            case MODE_CHECK_VERSION:
                builder.setPositiveButton(getUpdateNowLabel(), listener);
                builder.setNeutralButton(getRemindMeLaterLabel(), listener);
                                break;
            case MODE_ASK_FOR_RATE:
                builder.setPositiveButton(getAskForRatePositiveLabel(), listener);
                builder.setNegativeButton(getAskForRateNegativeLabel(), listener);
                break;
            default:
                return;
        }

And if u want change dialog names like 'update now' to 'recommended update' , 'remind me later' to update later' etc, then go to .xml file and u can change there. Even I have done lot of changes to this code according my need,

Any doubts comment here.

rohitkhajuria commented 6 years ago

Thanks for your assistance. But am a beginner in this and didn't understand how to proceed. Where to insert this code. Here is my code can you please help me.

`public class MainActivity extends Activity {

private WebView mWebView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); WVersionManager versionManager = new WVersionManager(this); versionManager.setVersionContentUrl("https://customUrl/Version.txt"); versionManager.setUpdateUrl("https://app'sURL"); versionManager.checkVersion(); versionManager.setUpdateNowLabel("Update Now"); versionManager.setRemindMeLaterLabel("Remind Me Later"); versionManager.setReminderTimer(01); // this mean checkVersion() will not take effect within 01 minutes mWebView = (WebView) findViewById(R.id.mWebView); WebSettings webSettings = mWebView.getSettings(); webSettings.setJavaScriptEnabled(true); webSettings.setAllowFileAccess(true); mWebView.loadUrl("https://www.abc.com/"); `