MythTV-Clients / MythTV-Android-Frontend

Implementation of MythTV .25+ Services API for Android
GNU General Public License v3.0
66 stars 16 forks source link

IRC beta user: Changing from WiFi to 4G brings up ProgressDialog that can't be dismissed #234

Closed billmeek closed 11 years ago

billmeek commented 11 years ago

If there is a network problem, or the backend isn't running, or in the case of skd5aner on the MythTV users channel when switching from WiFi to his phones 4G, the ProgressDialog doesn't exit.

Ideally, there would be three changes:

1.Use a STYLE_HORIZONTAL rather than a spinner (perhaps a 60 second timer)

  1. Allow Cancelling the attempt and
  2. Mention the hostname that's being contacted

I can find two places where the involved ProgressDialog text appears:

https://github.com/MythTV-Clients/MythTV-Android-Frontend/blob/master/src/org/mythtv/client/ui/preferences/MythtvPreferenceActivity.java#L639
https://github.com/MythTV-Clients/MythTV-Android-Frontend/blob/master/src/org/mythtv/client/ui/navigationDrawer/ProfileRow.java#L292
billmeek commented 11 years ago

@dmfrey, I can get everything but the stopProbe() part, any suggestions?

        private void startProbe() throws IOException {
            Log.v( TAG, "startProbe : enter" );

            if( zeroConf != null ) {
                stopProbe();
            }

            try {
                mProgressDialog = new ProgressDialog( wrActivity.get() );
                mProgressDialog.setTitle( getString( R.string.please_wait_title_str ) );
                mProgressDialog.setMessage(getString( R.string.preference_home_profiles_scan_scanning ) );
                mProgressDialog.setCancelable(false);
                mProgressDialog.setButton(DialogInterface.BUTTON_NEGATIVE, getString( R.string.btn_cancel ), new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        //stopProbe(); <---------------------------------------------------------------------
                        dialog.dismiss();
                    }
                });
                mProgressDialog.show();

            } catch( Exception e )
pot8oe commented 11 years ago

@billmeek is the onclick not being called? If not it's probably related to setCancelable(false).

billmeek commented 11 years ago

@pot8oe, pretty vague report on my part. No eclipse just wasn't letting me use stopProbe() inside onClick(). Wrapping the stopProbe() inside of a try/catch got me past that problem. And it seems to work. With no mythbackend running, I get the option to Cancel and when I start a backend, the probe isn't running so I don't get a setup screen asking to Save/Cancel.

If this makes sense, I'll push it and find the case the beta user reported.

dmfrey commented 11 years ago

@billmeek Yes, this makes sense. Please commit the changes.

On Thu, Oct 17, 2013 at 8:46 AM, billmeek notifications@github.com wrote:

@pot8oe https://github.com/pot8oe, pretty vague report on my part. No eclipse just wasn't letting me use stopProbe() inside onClick(). Wrapping the stopProbe() inside of a try/catch got me past that problem. And it seems to work. With no mythbackend running, I get the option to Cancel and when I start a backend, the probe isn't running so I don't get a setup screen asking to Save/Cancel.

If this makes sense, I'll push it and find the case the beta user reported.

— Reply to this email directly or view it on GitHubhttps://github.com/MythTV-Clients/MythTV-Android-Frontend/issues/234#issuecomment-26500860 .

My Google Profile http://www.google.com/profiles/dmfrey