Added notes to my places(functionality not finished)
This commit is contained in:
parent
1299e7c265
commit
55177fc6f1
13 changed files with 249 additions and 23 deletions
|
@ -18,7 +18,6 @@
|
|||
<ExpandableListView
|
||||
android:id="@android:id/list"
|
||||
style="@style/OsmandListView"
|
||||
android:divider="@drawable/divider"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="0dp"
|
||||
android:background="?attr/expandable_list_background"
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:minHeight="@dimen/list_header_height"
|
||||
android:paddingRight="@dimen/list_content_padding"
|
||||
android:paddingLeft="@dimen/list_header_padding">
|
||||
|
||||
<ImageView
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<LinearLayout
|
||||
|
|
|
@ -6,8 +6,7 @@
|
|||
android:background="?attr/expandable_list_item_background"
|
||||
android:minHeight="@dimen/list_item_height"
|
||||
android:orientation="horizontal"
|
||||
android:paddingLeft="@dimen/list_content_padding"
|
||||
android:paddingRight="@dimen/list_content_padding">
|
||||
android:paddingLeft="@dimen/list_content_padding">
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/check_local_index"
|
||||
|
@ -69,8 +68,7 @@
|
|||
android:id="@+id/options"
|
||||
android:layout_width="@dimen/list_item_height"
|
||||
android:layout_height="@dimen/list_item_height"
|
||||
style="?attr/dashboardGeneralButtonStyle"
|
||||
android:layout_marginRight="0dp"
|
||||
android:background="?attr/options_button_background"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:focusable="false"
|
||||
android:src="?attr/list_settings_icon"/>
|
||||
|
|
66
OsmAnd/res/layout/note.xml
Normal file
66
OsmAnd/res/layout/note.xml
Normal file
|
@ -0,0 +1,66 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/expandable_list_item_background"
|
||||
android:minHeight="@dimen/list_item_height"
|
||||
android:orientation="horizontal"
|
||||
android:paddingLeft="@dimen/list_content_padding">
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/check_local_index"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginRight="@dimen/local_index_check_right_margin"
|
||||
android:focusable="false"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginRight="@dimen/favorites_icon_right_margin"
|
||||
android:focusable="false"
|
||||
android:src="@drawable/ic_sdcard"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/name"
|
||||
style="@style/ListText.Small"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:maxLines="1"
|
||||
android:ellipsize="end"
|
||||
tools:text="@string/app_version"/>
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/descr"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:maxLines="25"
|
||||
tools:text="@string/app_mode_aircraft"/>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/options"
|
||||
android:layout_width="@dimen/list_item_height"
|
||||
android:layout_height="@dimen/list_item_height"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:background="?attr/options_button_background"
|
||||
android:focusable="false"
|
||||
android:src="?attr/list_settings_icon"/>
|
||||
|
||||
</LinearLayout>
|
|
@ -6,7 +6,7 @@
|
|||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/header"
|
||||
android:id="@+id/header_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
|
@ -15,14 +15,14 @@
|
|||
<CheckBox
|
||||
android:id="@+id/select_all"
|
||||
android:focusable="false"
|
||||
android:layout_marginRight="@dimen/list_header_text_left_margin"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/updates"
|
||||
android:id="@+id/header"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="@dimen/list_header_text_left_margin"
|
||||
android:text="@string/download_tab_updates"/>
|
||||
</LinearLayout>
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
<attr name="ic_overflow_menu" format="reference" />
|
||||
<attr name="ic_plugin_options" format="reference" />
|
||||
<attr name="dashboardGeneralButtonStyle" format="reference" />
|
||||
<attr name="options_button_background" format="reference"/>
|
||||
<attr name="dashboardSubHeaderStyle" format="reference" />
|
||||
<attr name="dashboard_divider" format="reference" />
|
||||
<attr name="dashboard_button" format="reference" />
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
3. All your modified/created strings are in the top of the file (to make easier find what\'s translated).
|
||||
PLEASE: Have a look at http://code.google.com/p/osmand/wiki/UIConsistency, it may really improve your and our work :-) Thx - Hardy
|
||||
-->
|
||||
<string name="watch">Watch</string>
|
||||
<string name="notes">Notes</string>
|
||||
<string name="online_map">Online map</string>
|
||||
<string name="roads_only">Roads only</string>
|
||||
<string name="rendering_attr_pisteRoutes_name">Piste routes</string>
|
||||
|
|
|
@ -119,6 +119,7 @@
|
|||
</style>
|
||||
|
||||
<style name="OsmandLightTheme" parent="Theme.AppCompat.Light">
|
||||
<item name="options_button_background">@drawable/dashboard_button_light</item>
|
||||
<item name="list_divider">@color/list_divider_dark</item>
|
||||
<item name="reset_image">@drawable/ic_action_delete_light</item> <!-- @drawable/a_1_navigation_cancel_light -->
|
||||
<item name="expandable_category_color">?android:attr/colorBackground</item>
|
||||
|
@ -168,6 +169,7 @@
|
|||
</style>
|
||||
|
||||
<style name="OsmandDarkTheme" parent="Theme.AppCompat">
|
||||
<item name="options_button_background">@drawable/dashboard_button_dark</item>
|
||||
<item name="list_divider">@color/list_divider_light</item>
|
||||
<item name="reset_image">@drawable/ic_action_delete_dark</item> <!-- @drawable/a_1_navigation_cancel_dark -->
|
||||
<item name="expandable_category_color">?android:attr/colorBackground</item>
|
||||
|
|
|
@ -5,7 +5,6 @@ package net.osmand.plus.activities;
|
|||
|
||||
import java.io.File;
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
@ -19,27 +18,20 @@ import android.text.SpannableStringBuilder;
|
|||
import android.text.style.ImageSpan;
|
||||
import android.view.MenuItem;
|
||||
|
||||
import net.osmand.Location;
|
||||
import net.osmand.plus.GpxSelectionHelper;
|
||||
import net.osmand.plus.OsmAndLocationProvider;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.OsmandSettings;
|
||||
import net.osmand.plus.R;
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.app.FragmentActivity;
|
||||
import android.support.v4.app.FragmentPagerAdapter;
|
||||
import android.support.v4.view.ViewPager;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TabHost;
|
||||
import android.widget.TabHost.TabSpec;
|
||||
import android.widget.TabWidget;
|
||||
import android.widget.TextView;
|
||||
|
||||
import net.osmand.plus.dashboard.DashLocationFragment;
|
||||
import net.osmand.plus.activities.places.NotesFragment;
|
||||
import net.osmand.plus.views.controls.PagerSlidingTabStrip;
|
||||
|
||||
/**
|
||||
|
@ -89,6 +81,8 @@ public class FavoritesActivity extends TabActivity {
|
|||
List<TabItem> mTabs = new ArrayList<TabItem>();
|
||||
mTabs.add(getTabIndicator(R.string.my_favorites, FavoritesTreeFragment.class));
|
||||
mTabs.add(getTabIndicator(R.string.my_tracks, AvailableGPXFragment.class));
|
||||
|
||||
mTabs.add(getTabIndicator(R.string.notes, NotesFragment.class));
|
||||
mTabs.add(getTabIndicator(R.string.selected_track, SelectedGPXFragment.class));
|
||||
|
||||
setViewPagerAdapter(mViewPager, mTabs);
|
||||
|
|
|
@ -25,14 +25,11 @@ import net.osmand.util.Algorithms;
|
|||
import net.osmand.util.MapUtils;
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.text.Spannable;
|
||||
import android.text.style.ForegroundColorSpan;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.ListView;
|
||||
import android.widget.TextView;
|
||||
import android.widget.TextView.BufferType;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
165
OsmAnd/src/net/osmand/plus/activities/places/NotesFragment.java
Normal file
165
OsmAnd/src/net/osmand/plus/activities/places/NotesFragment.java
Normal file
|
@ -0,0 +1,165 @@
|
|||
package net.osmand.plus.activities.places;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v7.widget.PopupMenu;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.ImageButton;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.OsmandPlugin;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.audionotes.AudioVideoNotesPlugin;
|
||||
import net.osmand.plus.dialogs.DirectionsDialogs;
|
||||
|
||||
import android.support.v4.app.ListFragment;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by Denis
|
||||
* on 18.02.2015.
|
||||
*/
|
||||
public class NotesFragment extends ListFragment {
|
||||
AudioVideoNotesPlugin plugin;
|
||||
List<AudioVideoNotesPlugin.Recording> items;
|
||||
NotesAdapter listAdapter;
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
plugin = OsmandPlugin.getEnabledPlugin(AudioVideoNotesPlugin.class);
|
||||
|
||||
View view = getActivity().getLayoutInflater().inflate(R.layout.update_index, container, false);
|
||||
view.findViewById(R.id.select_all).setVisibility(View.GONE);
|
||||
((TextView) view.findViewById(R.id.header)).setText(R.string.notes);
|
||||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
items = new ArrayList<>(plugin.getAllRecordings());
|
||||
listAdapter = new NotesAdapter(items);
|
||||
getListView().setAdapter(listAdapter);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
}
|
||||
|
||||
|
||||
public OsmandApplication getMyApplication() {
|
||||
return (OsmandApplication)getActivity().getApplication();
|
||||
}
|
||||
|
||||
class NotesAdapter extends ArrayAdapter<AudioVideoNotesPlugin.Recording> {
|
||||
NotesAdapter(List<AudioVideoNotesPlugin.Recording> recordingList) {
|
||||
super(getActivity(), R.layout.dash_audio_video_notes_item, recordingList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(final int position, View convertView, ViewGroup parent) {
|
||||
LayoutInflater inflater = getActivity().getLayoutInflater();
|
||||
View row = convertView;
|
||||
if (row == null){
|
||||
row = inflater.inflate(R.layout.note, parent, false);
|
||||
}
|
||||
|
||||
final AudioVideoNotesPlugin.Recording recording = getItem(position);
|
||||
if (recording.name != null){
|
||||
((TextView) row.findViewById(R.id.name)).setText(recording.name);
|
||||
((TextView) row.findViewById(R.id.descr)).setText(recording.getDescription(getActivity()));
|
||||
} else {
|
||||
((TextView) row.findViewById(R.id.name)).setText(recording.getDescription(getActivity()));
|
||||
row.findViewById(R.id.descr).setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
ImageView icon = (ImageView) row.findViewById(R.id.icon);
|
||||
if (recording.isAudio()){
|
||||
icon.setImageResource(R.drawable.ic_type_audio);
|
||||
} else if (recording.isVideo()){
|
||||
icon.setImageResource(R.drawable.ic_type_video);
|
||||
} else {
|
||||
icon.setImageResource(R.drawable.ic_type_img);
|
||||
}
|
||||
ImageButton options = (ImageButton) row.findViewById(R.id.options);
|
||||
options.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
openPopUpMenu(v, recording);
|
||||
}
|
||||
});
|
||||
return row;
|
||||
}
|
||||
}
|
||||
|
||||
private void openPopUpMenu(View v,final AudioVideoNotesPlugin.Recording recording) {
|
||||
boolean light = getMyApplication().getSettings().isLightContent();
|
||||
final PopupMenu optionsMenu = new PopupMenu(getActivity(), v);
|
||||
DirectionsDialogs.setupPopUpMenuIcon(optionsMenu);
|
||||
MenuItem item;
|
||||
boolean isPhoto = recording.isPhoto();
|
||||
final int playIcon;
|
||||
if(isPhoto){
|
||||
playIcon = light ? R.drawable.ic_action_eye_light : R.drawable.ic_action_eye_dark;
|
||||
} else {
|
||||
playIcon = light ? R.drawable.ic_play_light : R.drawable.ic_play_dark;
|
||||
}
|
||||
item = optionsMenu.getMenu().add(isPhoto ? R.string.watch : R.string.recording_context_menu_play)
|
||||
.setIcon(playIcon);
|
||||
item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
|
||||
@Override
|
||||
public boolean onMenuItemClick(MenuItem item) {
|
||||
plugin.playRecording(getActivity(), recording);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
item = optionsMenu.getMenu().add(R.string.search_shown_on_map)
|
||||
.setIcon(light ? R.drawable.ic_action_map_marker_light : R.drawable.ic_action_map_marker_dark);
|
||||
item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
|
||||
@Override
|
||||
public boolean onMenuItemClick(MenuItem item) {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
item = optionsMenu.getMenu().add(R.string.share_fav)
|
||||
.setIcon(light ? R.drawable.ic_action_gshare_light : R.drawable.ic_action_gshare_dark);
|
||||
item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
|
||||
@Override
|
||||
public boolean onMenuItemClick(MenuItem item) {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
item = optionsMenu.getMenu().add(R.string.local_index_mi_rename)
|
||||
.setIcon(light ? R.drawable.ic_action_edit_light : R.drawable.ic_action_edit_dark);
|
||||
item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
|
||||
@Override
|
||||
public boolean onMenuItemClick(MenuItem item) {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
item = optionsMenu.getMenu().add(R.string.recording_context_menu_delete)
|
||||
.setIcon(light ? R.drawable.ic_action_delete_light : R.drawable.ic_action_delete_dark);
|
||||
item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
|
||||
@Override
|
||||
public boolean onMenuItemClick(MenuItem item) {
|
||||
plugin.deleteRecording(recording);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
optionsMenu.show();
|
||||
}
|
||||
|
||||
}
|
|
@ -75,9 +75,9 @@ public class UpdatesIndexFragment extends ListFragment {
|
|||
return;
|
||||
}
|
||||
if (visible) {
|
||||
view.findViewById(R.id.header).setVisibility(View.VISIBLE);
|
||||
view.findViewById(R.id.header_layout).setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
view.findViewById(R.id.header).setVisibility(View.GONE);
|
||||
view.findViewById(R.id.header_layout).setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -115,7 +115,7 @@ public class UpdatesIndexFragment extends ListFragment {
|
|||
return;
|
||||
}
|
||||
String header = getActivity().getString(R.string.download_tab_updates) + " - " + indexItems.size();
|
||||
((TextView) view.findViewById(R.id.updates)).
|
||||
((TextView) view.findViewById(R.id.header)).
|
||||
setText(header);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue