package edu.nettester;

import android.content.Context;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.preference.DialogPreference;
import android.preference.PreferenceManager;
import android.util.AttributeSet;

public class LogoutDialog extends DialogPreference {
    
    private Context mContext;

    public LogoutDialog(Context context, AttributeSet attrs) {
        super(context, attrs);
        
        this.mContext = context;
        
        setDialogTitle("Logout really?");
        setPositiveButtonText("Yes");
        setNegativeButtonText("No");
    }
    
    @Override
    protected void onDialogClosed(boolean positiveResult) {
        if (positiveResult) {
            SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(mContext);
            Editor editor = sharedPref.edit();
            editor.remove(SettingsFragment.KEY_PREF_USERNAME);
            editor.commit();
        }
    }

}

@@ -17,16 +17,93 @@
 ester;%0A%0A
+import edu.nettester.util.CommonMethod;%0Aimport edu.nettester.util.Constant;%0A%0A
 import a
@@ -392,16 +392,36 @@
 ference 
+implements Constant 
 %7B%0A    %0A 
@@ -1060,16 +1060,230 @@
 tor.
-commit()
+remove(PREF_MUID);%0A            editor.remove(PREF_MHASH);%0A            editor.commit();%0A            %0A            CommonMethod.M_UID = %220%22;%0A            CommonMethod.M_UNAME = %22Anonymous%22;%0A            CommonMethod.M_HASH = %22%22
 ;%0A  

delete more info when log out