Android Open Source - android-location-notes Note Map Fragment






From Project

Back to project page android-location-notes.

License

The source code is released under:

Apache License

If you think the Android project android-location-notes 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.nearsoft.examenboom;
/* w w  w  .  jav  a2s.c om*/
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.google.android.gms.maps.CameraUpdate;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.MapFragment;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.Marker;
import com.google.android.gms.maps.model.MarkerOptions;
import com.nearsoft.examenboom.common.Note;
import com.nearsoft.examenboom.database.NotesSQLite;
import com.nearsoft.examenboom.database.repository.NoteRepository;
import com.nearsoft.examenboom.database.repository.NoteRepositoryImpl;

/**
 * Created by jsalcido on 7/27/14.
 */
public class NoteMapFragment extends MapFragment {

    private NoteRepository mNotesRepository;
    private Note mNote;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        mNotesRepository = new NoteRepositoryImpl(getActivity());
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        int noteId = getArguments().getInt(NotesSQLite.COLUMN_NOTE_ID);
        mNote = mNotesRepository.getNoteById(noteId);
        return super.onCreateView(inflater, container, savedInstanceState);
    }

    @Override
    public void onResume() {
        super.onResume();
        MarkerOptions options = new MarkerOptions();
        options.title(mNote.getTitle());
        options.snippet(mNote.getText());
        LatLng latLn = new LatLng(mNote.getLatitude(), mNote.getLongitude());
        options.position(latLn);
        Marker marker = getMap().addMarker(options);
        marker.showInfoWindow();
        CameraUpdate update = CameraUpdateFactory.newLatLngZoom(latLn,14);
        getMap().animateCamera(update);
    }
}




Java Source Code List

com.nearsoft.examenboom.ApplicationTest.java
com.nearsoft.examenboom.DrawerAdapter.java
com.nearsoft.examenboom.ExamenApplication.java
com.nearsoft.examenboom.MainActivity.java
com.nearsoft.examenboom.NewNoteActivity.java
com.nearsoft.examenboom.NoteMapFragment.java
com.nearsoft.examenboom.NotesAdapter.java
com.nearsoft.examenboom.NotesFragment.java
com.nearsoft.examenboom.NotesMapFragment.java
com.nearsoft.examenboom.ViewNoteActivity.java
com.nearsoft.examenboom.common.Note.java
com.nearsoft.examenboom.database.NoteDatabaseAccess.java
com.nearsoft.examenboom.database.NotesSQLite.java
com.nearsoft.examenboom.database.repository.NoteRepositoryImpl.java
com.nearsoft.examenboom.database.repository.NoteRepository.java