package org.hansel.myAlert.Preferences; /*This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. Created by Javier Mejia @zenyagami zenyagami@gmail.com */ import org.hansel.myAlert.Login; import org.hansel.myAlert.Utils.Util; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.util.AttributeSet; public class CerrarSesion extends org.holoeverywhere.preference.DialogPreference{ @Override public void onClick(DialogInterface dialog, int which) { super.onClick(dialog, which); if(which == DialogInterface.BUTTON_POSITIVE) { //quitamos autologin Util.setLoginOkInPreferences(getContext(), false); Intent i = new Intent(getContext(),Login.class); i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP); getContext().startActivity(i); } } public CerrarSesion(Context context, AttributeSet attrs) { super(context, attrs); } @Override public void setPositiveButtonText(CharSequence positiveButtonText) { super.setPositiveButtonText(positiveButtonText); } @Override public void setPositiveButtonText(int positiveButtonTextResId) { super.setPositiveButtonText(positiveButtonTextResId); } }