source: other-projects/tipple-android/src/org/mapsforge/android/maps/MarkerPopup.java@ 26523

Last change on this file since 26523 was 26523, checked in by davidb, 11 years ago

A version of Tipple with the mods Casey made for her Masters work

File size: 1.8 KB
Line 
1package org.mapsforge.android.maps;
2
3import org.tipple.mapDisplay.R;
4
5import android.content.Context;
6import android.text.method.ScrollingMovementMethod;
7import android.view.Gravity;
8import android.view.LayoutInflater;
9import android.view.View;
10import android.view.ViewGroup;
11import android.widget.ImageView;
12import android.widget.LinearLayout;
13import android.widget.TextView;
14
15public class MarkerPopup extends LinearLayout {
16
17 private TextView title;
18 private TextView snippet;
19 private ImageView image;
20
21 public MarkerPopup(MapView mapView) {
22 super(mapView.getContext());
23 setupPopup(mapView);
24 this.setPadding(20, 10, 20, 10);
25 this.setVisibility(View.GONE);
26 }
27
28 private void setupPopup(ViewGroup mapView) {
29 LayoutInflater inflater = (LayoutInflater) mapView.getContext()
30 .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
31 View view = inflater.inflate(R.layout.markerpopup, this);
32 title = (TextView) view.findViewById(R.id.tTitle);
33 title.setGravity(Gravity.BOTTOM | Gravity.FILL_HORIZONTAL);
34 title.setTextColor(0xffffffff);
35 title.setBackgroundColor(0xCC000000);
36 title.setTextSize(14.0f);
37 title.setVerticalScrollBarEnabled(true);
38 title.setScrollBarStyle(View.SCROLLBARS_INSIDE_INSET);
39 title.setMovementMethod(new ScrollingMovementMethod());
40 image = (ImageView) view.findViewById(R.id.iPopupImage);
41 image.setImageDrawable(null);
42
43 }
44
45 public void setData(OverlayMarkerItem item) {
46 this.setVisibility(VISIBLE);
47 setObjects(item);
48 }
49
50 private void setObjects(OverlayMarkerItem item) {
51 if (item.getTitle() != null) {
52 title.setVisibility(VISIBLE);
53 String text_desc = item.getDescription();
54 text_desc += "\n" + item.getContent();
55 title.setText(text_desc);
56 title.setSelected(true);
57 } else {
58 title.setText("");
59 title.setVisibility(INVISIBLE);
60 }
61 }
62}
Note: See TracBrowser for help on using the repository browser.