From ae4e3f3837c1d8ea6022c3e1419e6ba5dec19807 Mon Sep 17 00:00:00 2001 From: Denis Date: Tue, 23 Dec 2014 13:33:25 +0200 Subject: [PATCH] Added audio-video notes activity --- OsmAnd/AndroidManifest.xml | 1 + OsmAnd/res/layout/audio_video_notes_all.xml | 15 ++++++ .../layout/dash_audio_video_notes_plugin.xml | 3 +- .../DashAudioVideoNotesActivity.java | 38 ++++++++++++++ .../DashAudioVideoNotesFragment.java | 49 +++++++++++++------ 5 files changed, 91 insertions(+), 15 deletions(-) create mode 100644 OsmAnd/res/layout/audio_video_notes_all.xml create mode 100644 OsmAnd/src/net/osmand/plus/dashboard/DashAudioVideoNotesActivity.java diff --git a/OsmAnd/AndroidManifest.xml b/OsmAnd/AndroidManifest.xml index e1905ebb8e..e2d7494ed0 100644 --- a/OsmAnd/AndroidManifest.xml +++ b/OsmAnd/AndroidManifest.xml @@ -128,6 +128,7 @@ + diff --git a/OsmAnd/res/layout/audio_video_notes_all.xml b/OsmAnd/res/layout/audio_video_notes_all.xml new file mode 100644 index 0000000000..e244ce646b --- /dev/null +++ b/OsmAnd/res/layout/audio_video_notes_all.xml @@ -0,0 +1,15 @@ + + + + + + \ No newline at end of file diff --git a/OsmAnd/res/layout/dash_audio_video_notes_plugin.xml b/OsmAnd/res/layout/dash_audio_video_notes_plugin.xml index 926b742694..704f2517c1 100644 --- a/OsmAnd/res/layout/dash_audio_video_notes_plugin.xml +++ b/OsmAnd/res/layout/dash_audio_video_notes_plugin.xml @@ -6,7 +6,8 @@ android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="vertical"> - 3){ + if (notes.size() > 3 && !allNotes){ while (notes.size() != 3){ notes.remove(3); } @@ -95,6 +106,7 @@ public class DashAudioVideoNotesFragment extends DashBaseFragment { ((TextView) view.findViewById(R.id.descr)).setText(recording.getDescription(getActivity())); } else { ((TextView) view.findViewById(R.id.name)).setText(recording.getDescription(getActivity())); + view.findViewById(R.id.descr).setVisibility(View.GONE); } ImageView icon = (ImageView) view.findViewById(R.id.icon); @@ -105,12 +117,21 @@ public class DashAudioVideoNotesFragment extends DashBaseFragment { } else { icon.setImageResource(R.drawable.ic_type_img); } - view.findViewById(R.id.play).setOnClickListener(new View.OnClickListener() { + + View.OnClickListener playListener = new View.OnClickListener() { @Override - public void onClick(View view) { + 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()); LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, height);