From 68ba8052c4b660391c6faff9d0ecb85f18a9eb12 Mon Sep 17 00:00:00 2001 From: Denis Date: Tue, 23 Dec 2014 16:03:40 +0200 Subject: [PATCH] Added on click listener to notes in dashboard. Updated layout. --- OsmAnd/res/layout/dash_note_item.xml | 7 ++--- .../DashAudioVideoNotesFragment.java | 27 ++++++++++--------- 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/OsmAnd/res/layout/dash_note_item.xml b/OsmAnd/res/layout/dash_note_item.xml index a444674569..f889db83f8 100644 --- a/OsmAnd/res/layout/dash_note_item.xml +++ b/OsmAnd/res/layout/dash_note_item.xml @@ -4,7 +4,7 @@ android:orientation="vertical" android:layout_width="match_parent" android:background="@drawable/dashboard_button" - android:layout_height="@dimen/dashHeaderHeight"> + android:layout_height="@dimen/dashListItemHeight"> @@ -43,9 +43,10 @@ + android:layout_width="@dimen/dashListItemHeight" + android:layout_height="@dimen/dashListItemHeight"/> diff --git a/OsmAnd/src/net/osmand/plus/dashboard/DashAudioVideoNotesFragment.java b/OsmAnd/src/net/osmand/plus/dashboard/DashAudioVideoNotesFragment.java index f9751307ae..7f0084a4a9 100644 --- a/OsmAnd/src/net/osmand/plus/dashboard/DashAudioVideoNotesFragment.java +++ b/OsmAnd/src/net/osmand/plus/dashboard/DashAudioVideoNotesFragment.java @@ -16,6 +16,7 @@ import android.widget.TextView; import net.osmand.plus.OsmAndAppCustomization; import net.osmand.plus.OsmandPlugin; import net.osmand.plus.R; +import net.osmand.plus.activities.MapActivity; import net.osmand.plus.audionotes.AudioVideoNotesPlugin; import net.osmand.plus.helpers.FontCache; @@ -118,24 +119,26 @@ public class DashAudioVideoNotesFragment extends DashBaseFragment { icon.setImageResource(R.drawable.ic_type_img); } - View.OnClickListener playListener = new View.OnClickListener() { + view.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + getMyApplication().getSettings().setMapLocationToShow(recording.getLatitude(), recording.getLongitude(), 15, null, + recording.name != null ? recording.name : recording.getDescription(getActivity()), + recording); //$NON-NLS-1$ + MapActivity.launchMapActivityMoveToTop(getActivity()); + } + }); + view.findViewById(R.id.play).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { plugin.playRecording(getActivity(), recording); } - }; + }); - if (allNotes){ - view.findViewById(R.id.play).setVisibility(View.GONE); - view.setOnClickListener(playListener); - } else { - view.findViewById(R.id.play).setOnClickListener(playListener); - } + //int height = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 50, getResources().getDisplayMetrics()); - int height = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 50, getResources().getDisplayMetrics()); - - LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, height); - view.setLayoutParams(lp); + //LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, height); + //view.setLayoutParams(lp); notesLayout.addView(view); }