Android Open Source - GeoNote Note Info Window Adapter






From Project

Back to project page GeoNote.

License

The source code is released under:

Apache License

If you think the Android project GeoNote 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 geonote.app;
//from   w ww  . j  a  va 2  s . com
import android.graphics.Color;
import android.text.SpannableString;
import android.text.style.ForegroundColorSpan;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.TextView;

import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.model.Marker;

public class NoteInfoWindowAdapter implements GoogleMap.InfoWindowAdapter {

    private LayoutInflater layoutInflater;
    private NotesRepository notesRepository;

    public NoteInfoWindowAdapter(LayoutInflater layoutInflater, NotesRepository notesRepository)
    {
        this.layoutInflater = layoutInflater;
        this.notesRepository = notesRepository;
    }

    @Override
    public View getInfoWindow(Marker marker) {

        View contents = this.layoutInflater.inflate(R.layout.note_info_window, null);
        NoteInfo note = this.notesRepository.Notes.get(marker.getPosition());

        String title = marker.getTitle();

        TextView txtTitle = ((TextView) contents.findViewById(R.id.txtInfoWindowTitle));

        if (title != null) {
            // Spannable string allows us to edit the formatting of the text.
            SpannableString titleText = new SpannableString(title);
            titleText.setSpan(new ForegroundColorSpan(Color.RED), 0, titleText.length(), 0);
            txtTitle.setText(titleText);
        } else {
            txtTitle.setText("");
        }

        TextView txtType = ((TextView) contents.findViewById(R.id.txtInfoWindowNoteAddress));
        txtType.setText(note.toString());

        return contents;
    }

    @Override
    public View getInfoContents(Marker marker) {
        return null;
    }
}




Java Source Code List

geonote.app.ApplicationTest.java
geonote.app.Constants.java
geonote.app.DownloadMapImageTask.java
geonote.app.GeoFenceWatcherService.java
geonote.app.GooglePlaces.java
geonote.app.NoteInfoWindowAdapter.java
geonote.app.NoteInfo.java
geonote.app.NotesRepository.java
geonote.app.Settings.java
geonote.app.Activity.LoginActivity.java
geonote.app.Activity.MainActivity.java
geonote.app.Activity.MapsActivityIntentHandler.java
geonote.app.Activity.NoteViewActivity.java
geonote.app.Activity.PlusBaseActivity.java
geonote.app.Activity.SettingsActivity.java
geonote.app.Fragments.MapViewFragment.java
geonote.app.Fragments.NoteListFragment.java
geonote.app.Fragments.SettingsFragment.java
geonote.app.Model.PlaceDetails.java
geonote.app.Model.Place.java
geonote.app.Model.PlacesList.java