Back to project page donatello-y-raphael.
The source code is released under:
MIT License
If you think the Android project donatello-y-raphael listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.example.ATracePath; /*from w w w . ja v a 2s.c om*/ import android.app.Activity; import android.app.AlertDialog; import android.app.ListActivity; import android.content.DialogInterface; import android.content.SharedPreferences; import android.os.Bundle; import android.view.View; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.ListView; import java.util.ArrayList; import java.util.List; /** * Created by ranrath on 21/09/14. */ public class SettingsActivity extends Activity { private Global global = Global.getInstance(); private final int CONFIRM_RESET = 42; private ProgressAdapter pa; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.settings); pa = new ProgressAdapter(this); Button vibrate = (Button) findViewById(R.id.vibrate); setVibrateText(vibrate); } public void buttonClick(View view) { if (view.getId() == R.id.vibrate) { Button vibrate = (Button) findViewById(R.id.vibrate); global.vibrate = !global.vibrate; setVibrateText(vibrate); } else if (view.getId() == R.id.reset) { dispDialog(CONFIRM_RESET); } } private void setVibrateText(Button button) { if (global.vibrate) { button.setText("Vibration ON"); } else { button.setText("Vibration OFF"); } } private void dispDialog( int id ) { AlertDialog.Builder builder = new AlertDialog.Builder(this); switch ( id ) { case CONFIRM_RESET: builder.setMessage("Are you sure?"); builder.setCancelable(true); builder.setPositiveButton( "Yes", new resetClass() ); builder.setNegativeButton( "No", null ); } AlertDialog dialog = builder.create(); dialog.show(); } private final class resetClass implements DialogInterface.OnClickListener { @Override public void onClick(DialogInterface dialog, int which) { pa.resetProgress(); } } }