Android Open Source - android-gps-test-tool G P S Tester Activity






From Project

Back to project page android-gps-test-tool.

License

The source code is released under:

Apache License ? 2.0 TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by...

If you think the Android project android-gps-test-tool 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 com.agup.gps;
/*from   w ww  . j  a v a 2s  .  c om*/
import android.app.Activity;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.view.KeyEvent;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;

import com.agup.gps.controllers.GPSTesterActivityController;
import com.esri.android.map.MapView;

public class GPSTesterActivity extends Activity {
  
  private GPSTesterActivityController _activityController = null;
  private MapView _map; 
  private static SharedPreferences _preferences;
  
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

    _map = (MapView)findViewById(R.id.map);
    
    _activityController = new GPSTesterActivityController(this,GPSTesterActivity.this,_map);  
    
    _preferences = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
    PreferenceManager.setDefaultValues(this,R.xml.preferences , false);      
    
    }
    
    @Override
    public boolean onCreateOptionsMenu(Menu menu){
      super.onCreateOptionsMenu(menu);
      MenuInflater inflator = getMenuInflater();
      inflator.inflate(R.menu.options_menu, menu);

      return true;            
    }
    
    @Override
    public boolean onKeyDown(int keycode, KeyEvent event){
      if(keycode == KeyEvent.KEYCODE_MENU)
      {
          Intent intent = new Intent(getApplicationContext(), SettingsActivity.class);
          startActivity(intent);
      }
      return super.onKeyDown(keycode, event);
    }
    
    @Override
    public boolean onOptionsItemSelected(MenuItem item){
      
      return true;
    }

  @Override 
  protected void onDestroy() { 
    super.onDestroy();
  }
  
  @Override
  protected void onPause() {
    if(_activityController != null){
      _activityController.stopLocation();
    }
    _map.pause();
    super.onPause();
  }
  
  @Override
  protected void onStop(){
    super.onStop();
    if(_activityController != null){
      _activityController.stopLocation();
    }
  }
  
  @Override   
  protected void onResume() {
    super.onResume(); 
    _map.unpause();
    if(_activityController != null && _preferences.getBoolean("pref_key_autostart", true)){
      _activityController.startLocation();
    }
  }

}




Java Source Code List

com.agup.gps.GPSTesterActivity.java
com.agup.gps.SatelliteDataActivity.java
com.agup.gps.SettingsActivity.java
com.agup.gps.controllers.GPSTesterActivityController.java
com.agup.gps.controllers.SatelliteDataActivityController.java
com.agup.gps.fragments.GPSAlertDialogFragment.java
com.agup.gps.fragments.NetworkAlertDialogFragment.java
com.agup.gps.utils.CheckConnectivity.java
com.agup.gps.utils.DrawCircle.java
com.agup.gps.utils.ElapsedTimer.java
com.agup.gps.utils.Preferences.java