Android Open Source - wigle-wifi-wardriving-badfork Speech Activity






From Project

Back to project page wigle-wifi-wardriving-badfork.

License

The source code is released under:

/* * Copyright (c) 2010-2012, Andrew Carra, Robert Hagemann, Hugh Kennedy * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permi...

If you think the Android project wigle-wifi-wardriving-badfork listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package net.wigle.wigleandroid;
/*  w  w  w .  j a v  a  2  s  . co m*/
import android.app.Activity;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.media.AudioManager;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.CompoundButton.OnCheckedChangeListener;

public class SpeechActivity extends Activity {
  private static final int MENU_RETURN = 12;
  
  // used for shutting extraneous activities down on an error
  public static SpeechActivity speechActivity;
  
  /** Called when the activity is first created. */
  @Override
  public void onCreate( final Bundle savedInstanceState) {
    super.onCreate( savedInstanceState );
    // set language
    MainActivity.setLocale( this );      
    setContentView( R.layout.speech );
    speechActivity = this;
    
    // force media volume controls
    this.setVolumeControlStream( AudioManager.STREAM_MUSIC );
    
    final SharedPreferences prefs = this.getSharedPreferences( ListActivity.SHARED_PREFS, 0);
    doCheckbox( prefs, R.id.speech_run, ListActivity.PREF_SPEAK_RUN );
    doCheckbox( prefs, R.id.speech_new_wifi, ListActivity.PREF_SPEAK_NEW_WIFI );
    doCheckbox( prefs, R.id.speech_new_cell, ListActivity.PREF_SPEAK_NEW_CELL );
    doCheckbox( prefs, R.id.speech_queue, ListActivity.PREF_SPEAK_QUEUE );
    doCheckbox( prefs, R.id.speech_miles, ListActivity.PREF_SPEAK_MILES );
    doCheckbox( prefs, R.id.speech_time, ListActivity.PREF_SPEAK_TIME );
    doCheckbox( prefs, R.id.speech_battery, ListActivity.PREF_SPEAK_BATTERY );
    doCheckbox( prefs, R.id.speech_ssid, ListActivity.PREF_SPEAK_SSID, false );
    doCheckbox( prefs, R.id.speech_wifi_restart, ListActivity.PREF_SPEAK_WIFI_RESTART );
  }
  
  public void onDestroy() {    
    speechActivity = null;
    super.onDestroy();
  }
  
  private void doCheckbox( final SharedPreferences prefs, final int id, final String pref ) {
    doCheckbox( prefs, id, pref, true );
  }
  
  private void doCheckbox( final SharedPreferences prefs, final int id, final String pref, final boolean defaultVal ) {
    final CheckBox box = (CheckBox) findViewById( id );
    box.setChecked( prefs.getBoolean( pref, defaultVal ) );
    box.setOnCheckedChangeListener( new OnCheckedChangeListener() {
      public void onCheckedChanged( final CompoundButton buttonView, final boolean isChecked ) {
        final Editor editor = prefs.edit();
        editor.putBoolean( pref, isChecked );
        editor.commit();
      }
    });
  }
  
  /* Creates the menu items */
  @Override
  public boolean onCreateOptionsMenu( final Menu menu ) {
      MenuItem item = menu.add(0, MENU_RETURN, 0, getString(R.string.menu_return));
      item.setIcon( android.R.drawable.ic_media_previous );
      
      return true;
  }

  /* Handles item selections */
  @Override
  public boolean onOptionsItemSelected( final MenuItem item ) {
      switch ( item.getItemId() ) {
        case MENU_RETURN:
          finish();
          return true;
      }
      return false;
  }
}




Java Source Code List

net.wigle.wigleandroid.ConcurrentLinkedHashMap.java
net.wigle.wigleandroid.DBException.java
net.wigle.wigleandroid.DBResultActivity.java
net.wigle.wigleandroid.DashboardActivity.java
net.wigle.wigleandroid.DataActivity.java
net.wigle.wigleandroid.DatabaseHelper.java
net.wigle.wigleandroid.ErrorReportActivity.java
net.wigle.wigleandroid.LatLon.java
net.wigle.wigleandroid.ListActivity.java
net.wigle.wigleandroid.MainActivity.java
net.wigle.wigleandroid.MappingActivity.java
net.wigle.wigleandroid.NetworkActivity.java
net.wigle.wigleandroid.NetworkListAdapter.java
net.wigle.wigleandroid.NetworkType.java
net.wigle.wigleandroid.Network.java
net.wigle.wigleandroid.OpenStreetMapViewWrapper.java
net.wigle.wigleandroid.Pair.java
net.wigle.wigleandroid.QueryArgs.java
net.wigle.wigleandroid.QueryThread.java
net.wigle.wigleandroid.SSLConfigurator.java
net.wigle.wigleandroid.SettingsActivity.java
net.wigle.wigleandroid.SpeechActivity.java
net.wigle.wigleandroid.TTS.java
net.wigle.wigleandroid.WigleAndroid.java
net.wigle.wigleandroid.WigleService.java
net.wigle.wigleandroid.WigleUncaughtExceptionHandler.java
net.wigle.wigleandroid.background.AbstractBackgroundTask.java
net.wigle.wigleandroid.background.AlertSettable.java
net.wigle.wigleandroid.background.BackgroundGuiHandler.java
net.wigle.wigleandroid.background.FileUploaderListener.java
net.wigle.wigleandroid.background.FileUploaderTask.java
net.wigle.wigleandroid.background.HttpDownloader.java
net.wigle.wigleandroid.background.HttpFileUploader.java
net.wigle.wigleandroid.background.KmlWriter.java
net.wigle.wigleandroid.background.Status.java
net.wigle.wigleandroid.listener.BatteryLevelReceiver.java
net.wigle.wigleandroid.listener.GPSListener.java
net.wigle.wigleandroid.listener.PhoneState7.java
net.wigle.wigleandroid.listener.PhoneStateFactory.java
net.wigle.wigleandroid.listener.PhoneState.java
net.wigle.wigleandroid.listener.SsidSpeaker.java
net.wigle.wigleandroid.listener.WifiReceiver.java