Skip to content

Commit

Permalink
added comments
Browse files Browse the repository at this point in the history
  • Loading branch information
JoakimKLarsson committed May 29, 2017
1 parent 65a9c52 commit debe400
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
2 changes: 1 addition & 1 deletion project/.idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ protected void onCreate(Bundle savedInstanceState) {
.findFragmentById(R.id.map);
mapFragment.getMapAsync(this);

//read the intent extra (user position) and add marker.
double[] userPos = getIntent().getDoubleArrayExtra("LOCATION");
Log.d("USER LAT: ", Double.toString(userPos[0]));
Log.d("USER LON:", Double.toString(userPos[1]));
Expand All @@ -56,6 +57,10 @@ protected void onCreate(Bundle savedInstanceState) {
* If Google Play services is not installed on the device, the user will be prompted to install
* it inside the SupportMapFragment. This method will only be triggered once the user has
* installed Google Play services and returned to the app.
*
*
* Add a marker where the users is located.
* And add a listner for clicks on map. Upon clicking add a marker and ask save and exit
*/
@Override
public void onMapReady(GoogleMap googleMap) {
Expand All @@ -72,6 +77,7 @@ public void onMapClick(LatLng point) {
List<Address> addresses = geo.getFromLocation(point.latitude, point.longitude, 1);

if (addresses.size() > 0) {
//TODO: Set the markerText based on region text.
String region = addresses.get(0).getLocality();
String country = addresses.get(0).getCountryName();
Log.d("REGION",region);
Expand All @@ -89,14 +95,17 @@ public void onMapClick(LatLng point) {

}
} catch(Exception e) {
//Toast.makeText(this, "No Location Name Found", 600).show();
}

}
});

}

/*
creates a popup window for save and exit
Upon save send marker as intent extra to main.
*/
public void comfirm() {
new AlertDialog.Builder(this)
.setTitle("Location Chosen:")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,18 @@ public class SettingsActivity extends AppCompatActivity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_settings);

//Add toolbar and its functions.
Toolbar myToolbar = (Toolbar) findViewById(R.id.my_toolbar);
setSupportActionBar(myToolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setDisplayShowHomeEnabled(true);


//get the sharedpreference (user range)
sharedpreferences = getSharedPreferences("chatonymousSettings", Context.MODE_PRIVATE);
rangeValue = sharedpreferences.getInt("userRange", 10);

//read and write seekbar value to userrange upon update.
SeekBar seekBar = (SeekBar)findViewById(R.id.range_seekBar);
seekBar.setProgress(rangeValue);
final TextView seekBarValue = (TextView)findViewById(R.id.seekbarvalue);
Expand All @@ -55,6 +58,7 @@ public void onStopTrackingTouch(SeekBar seekBar) {
});
}

//save and exit. Saving to sharedpref.
protected void saveAndExit(View view) {
SharedPreferences.Editor editor = sharedpreferences.edit();
editor.putInt("userRange", rangeValue);
Expand Down

0 comments on commit debe400

Please sign in to comment.