/* MultiWii EZ-GUI Copyright (C) <2012> Bartosz Szczygiel (eziosoft) 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/>. */ package com.ezio.multiwii.advanced; import android.app.Activity; import android.app.AlertDialog; import android.content.DialogInterface; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.EditText; import com.ezio.multiwii.R; import com.ezio.multiwii.app.App; public class AdvancedActivity extends Activity { App app; @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.advanced_layout); app=(App)getApplication(); app.Say(getString(R.string.AdvancedWarning).toLowerCase()); } public void ControlOnClick(View v) { AlertDialog.Builder alert = new AlertDialog.Builder(this); alert.setTitle(getString(R.string.Caution)); alert.setMessage((getString(R.string.ControlWarning))); // Set an EditText view to get user input final EditText input = new EditText(this); alert.setView(input); alert.setPositiveButton(getString(R.string.OK), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { String value = input.getText().toString(); if (value.equals("multiwii")) { // mHandler.removeCallbacksAndMessages(null); startActivity(new Intent(getApplicationContext(), ControlActivity.class)); } } }); alert.setNegativeButton(getString(R.string.Cancel), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { // Canceled. } }); alert.show(); } }