/*******************************************************************************
* Copyright (c) 2011 Michel DAVID mimah35-at-gmail.com
*
* 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.
*
* 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/>.
******************************************************************************/
package fr.gotorennes.view;
import android.app.Dialog;
import android.content.Context;
import android.content.SharedPreferences;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import fr.gotorennes.R;
public class LockPopupWindow extends Dialog {
public LockPopupWindow(Context context) {
super(context);
setTitle(R.string.codeCadenas);
setContentView(R.layout.lock_popup);
final SharedPreferences prefs = context.getSharedPreferences("fr.gotorennes.Application", 0);
String codeCadenas = prefs.getString("codeCadenas", "");
final EditText code = (EditText) findViewById(R.id.code);
code.setText(codeCadenas);
Button valider = (Button) findViewById(R.id.buttonValid);
valider.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
prefs.edit().putString("codeCadenas", code.getText().toString()).commit();
LockPopupWindow.this.dismiss();
}
});
}
}