/*******************************************************************************
* 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;
import android.app.Activity;
import android.appwidget.AppWidgetManager;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
public class CadenasActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.lock_popup);
final SharedPreferences prefs = getSharedPreferences("fr.gotorennes.Application", 0);
final int appWidgetId = getIntent().getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, 0);
String codeCadenas = prefs.getString("codeCadenas" + appWidgetId, "");
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" + appWidgetId, code.getText().toString()).commit();
finish();
}
});
}
}