/*
 * Copyright (C) 2012 Pixmob (http://github.com/pixmob)
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.pixmob.freemobile.netstat.ui;

import org.pixmob.freemobile.netstat.R;

import android.app.Dialog;
import android.app.ProgressDialog;
import android.os.Bundle;
import android.support.v4.app.DialogFragment;

/**
 * Fragment for exporting the application database, showing a progress dialog.
 * @author Pixmob
 * @see ExportTask
 */
public class ExportDialogFragment extends DialogFragment {
    public void update(int current, int total) {
        final ProgressDialog dialog = (ProgressDialog) getDialog();
        dialog.setIndeterminate(false);
        dialog.setMax(total);
        dialog.setProgress(current);
    }
    
    public Dialog onCreateDialog(Bundle savedInstanceState) {
        final ProgressDialog dialog = new ProgressDialog(getActivity());
        dialog.setMessage(getString(R.string.exporting_data));
        dialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
        dialog.setIndeterminate(true);
        dialog.setCancelable(false);
        return dialog;
    }
}

@@ -1134,16 +1134,50 @@
 alog();%0A
+        if (dialog != null) %7B%0A    
         
@@ -1208,32 +1208,36 @@
 false);%0A        
+    
 dialog.setMax(to
@@ -1242,32 +1242,36 @@
 total);%0A        
+ 
+   
 dialog.setProgre
@@ -1283,16 +1283,20 @@
 rrent);%0A
+    
     %7D%0A  
@@ -1297,16 +1297,32 @@
   %7D%0A    
+%7D%0A%0A    @Override
 %0A    pub

Fix NPE