From daf30e54ab0996bbe9f3f055c3d1cb722c5dccca Mon Sep 17 00:00:00 2001 From: Denis Date: Fri, 20 Feb 2015 16:54:02 +0200 Subject: [PATCH] Updated styles of my places and dashboard --- .../expandable_list_item_background_dark.xml | 6 +++ .../expandable_list_item_background_light.xml | 6 +++ OsmAnd/res/layout/dash_favorites_item.xml | 4 +- OsmAnd/res/layout/dashboard.xml | 2 +- .../layout/expandable_list_item_category.xml | 1 + .../expandable_list_item_category_btn.xml | 6 ++- OsmAnd/res/values/strings.xml | 3 ++ OsmAnd/res/values/styles.xml | 4 +- .../plus/activities/AvailableGPXFragment.java | 34 ++++++------ .../plus/activities/FavoritesActivity.java | 16 +++--- .../activities/FavoritesTreeFragment.java | 4 -- .../plus/activities/SelectedGPXFragment.java | 27 ++-------- .../audionotes/AudioVideoNotesPlugin.java | 5 +- .../osmand/plus/audionotes/NotesFragment.java | 54 ++++++++++++------- 14 files changed, 92 insertions(+), 80 deletions(-) create mode 100644 OsmAnd/res/drawable/expandable_list_item_background_dark.xml create mode 100644 OsmAnd/res/drawable/expandable_list_item_background_light.xml diff --git a/OsmAnd/res/drawable/expandable_list_item_background_dark.xml b/OsmAnd/res/drawable/expandable_list_item_background_dark.xml new file mode 100644 index 0000000000..82da2aa69a --- /dev/null +++ b/OsmAnd/res/drawable/expandable_list_item_background_dark.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/OsmAnd/res/drawable/expandable_list_item_background_light.xml b/OsmAnd/res/drawable/expandable_list_item_background_light.xml new file mode 100644 index 0000000000..ed5e00a7e1 --- /dev/null +++ b/OsmAnd/res/drawable/expandable_list_item_background_light.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/OsmAnd/res/layout/dash_favorites_item.xml b/OsmAnd/res/layout/dash_favorites_item.xml index 79b1d01a01..20eacc6ec6 100644 --- a/OsmAnd/res/layout/dash_favorites_item.xml +++ b/OsmAnd/res/layout/dash_favorites_item.xml @@ -19,8 +19,8 @@ diff --git a/OsmAnd/res/layout/dashboard.xml b/OsmAnd/res/layout/dashboard.xml index 08d3127632..26d8a01a30 100644 --- a/OsmAnd/res/layout/dashboard.xml +++ b/OsmAnd/res/layout/dashboard.xml @@ -3,7 +3,7 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/main_scroll" - android:background="@color/dashboard_background"> + android:background="?attr/expandable_list_background"> diff --git a/OsmAnd/res/layout/expandable_list_item_category_btn.xml b/OsmAnd/res/layout/expandable_list_item_category_btn.xml index 5cdce8360a..adb3d6811e 100644 --- a/OsmAnd/res/layout/expandable_list_item_category_btn.xml +++ b/OsmAnd/res/layout/expandable_list_item_category_btn.xml @@ -3,7 +3,8 @@ xmlns:tools="http://schemas.android.com/tools" android:orientation="horizontal" android:layout_width="fill_parent" - android:layout_height="@dimen/list_header_height" + android:layout_height="wrap_content" + android:minHeight="@dimen/list_header_height" android:paddingLeft="@dimen/list_header_padding"> \ No newline at end of file diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml index 8e7472a972..7f3db87367 100644 --- a/OsmAnd/res/values/strings.xml +++ b/OsmAnd/res/values/strings.xml @@ -9,6 +9,9 @@ 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 --> + Audio + Video + Photo Share note Rename recording Watch diff --git a/OsmAnd/res/values/styles.xml b/OsmAnd/res/values/styles.xml index b01e84490f..7601728488 100644 --- a/OsmAnd/res/values/styles.xml +++ b/OsmAnd/res/values/styles.xml @@ -162,7 +162,7 @@ @color/plugin_details_install_header_bg_light @drawable/ic_world_globe_light #727272 - @color/expandable_list_item_light + @drawable/expandable_list_item_background_light @color/color_white @drawable/ic_overflow_menu_light @drawable/size_progressbar_light @@ -205,7 +205,7 @@ @color/plugin_details_install_header_bg_dark @drawable/ic_world_globe_dark #70818c - @color/list_item_background_dark + @drawable/expandable_list_item_background_dark @color/list_background_dark @drawable/ic_overflow_menu_dark @drawable/size_progressbar_dark diff --git a/OsmAnd/src/net/osmand/plus/activities/AvailableGPXFragment.java b/OsmAnd/src/net/osmand/plus/activities/AvailableGPXFragment.java index 301bc9e5f1..05a7fa7dca 100644 --- a/OsmAnd/src/net/osmand/plus/activities/AvailableGPXFragment.java +++ b/OsmAnd/src/net/osmand/plus/activities/AvailableGPXFragment.java @@ -34,6 +34,7 @@ import net.osmand.plus.R; import net.osmand.plus.dialogs.DirectionsDialogs; import net.osmand.plus.helpers.GpxUiHelper; import net.osmand.plus.helpers.ScreenOrientationHelper; +import net.osmand.plus.osmedit.OsmEditingPlugin; import net.osmand.util.Algorithms; import android.app.Activity; import android.app.AlertDialog; @@ -99,12 +100,6 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment { return selectedItems; } - @Override - public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { - View vs = super.onCreateView(inflater, container, savedInstanceState); - return vs; - } - @Override public void onResume() { super.onResume(); @@ -731,6 +726,7 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment { viewName.setTextColor(defaultColor); viewName.setTypeface(Typeface.DEFAULT, Typeface.NORMAL); } + TextView sizeText = (TextView) v.findViewById(R.id.local_index_size); if (child.getSize() >= 0) { String size; if (child.getSize() > 100) { @@ -738,16 +734,18 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment { } else { size = child.getSize() + " kB"; } - ((TextView) v.findViewById(R.id.local_index_size)).setText(size); + sizeText.setText(size); } else { - ((TextView) v.findViewById(R.id.local_index_size)).setText(""); + sizeText.setText(""); } TextView descr = ((TextView) v.findViewById(R.id.local_index_descr)); if (child.isExpanded()) { descr.setVisibility(View.VISIBLE); descr.setText(child.getHtmlDescription()); + sizeText.setVisibility(View.GONE); } else { descr.setVisibility(View.GONE); + sizeText.setVisibility(View.VISIBLE); } ImageButton options = (ImageButton) v.findViewById(R.id.options); options.setOnClickListener(new View.OnClickListener() { @@ -902,15 +900,19 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment { } }); - item = optionsMenu.getMenu().add(R.string.export) - .setIcon(light ? R.drawable.ic_action_gup_light : R.drawable.ic_action_gup_dark); - item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() { - @Override - public boolean onMenuItemClick(MenuItem item) { + final OsmEditingPlugin osmEditingPlugin = OsmandPlugin.getEnabledPlugin(OsmEditingPlugin.class); + if (osmEditingPlugin != null && osmEditingPlugin.isActive()){ + item = optionsMenu.getMenu().add(R.string.export) + .setIcon(light ? R.drawable.ic_action_gup_light : R.drawable.ic_action_gup_dark); + item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() { + @Override + public boolean onMenuItemClick(MenuItem item) { + osmEditingPlugin.sendGPXFiles(getActivity(), AvailableGPXFragment.this, gpxInfo); + return true; + } + }); - return true; - } - }); + } item = optionsMenu.getMenu().add(R.string.edit_filter_delete_menu_item) .setIcon(light ? R.drawable.ic_action_delete_light : R.drawable.ic_action_delete_dark); diff --git a/OsmAnd/src/net/osmand/plus/activities/FavoritesActivity.java b/OsmAnd/src/net/osmand/plus/activities/FavoritesActivity.java index ff3943338d..77100ac825 100644 --- a/OsmAnd/src/net/osmand/plus/activities/FavoritesActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/FavoritesActivity.java @@ -28,7 +28,6 @@ import android.support.v4.app.Fragment; import android.support.v4.view.ViewPager; import android.view.View; import android.widget.ImageView; -import android.widget.TabHost.TabSpec; import android.widget.TextView; import net.osmand.plus.audionotes.AudioVideoNotesPlugin; @@ -40,14 +39,13 @@ import net.osmand.plus.views.controls.PagerSlidingTabStrip; */ public class FavoritesActivity extends TabActivity { - private static final String FAVOURITES_INFO = "FAVOURITES_INFO"; +// private static final String FAVOURITES_INFO = "FAVOURITES_INFO"; private static final String TRACKS = "TRACKS"; - private static final String SELECTED_TRACK = "SELECTED_TRACK"; - public static int FAVORITES_TAB = 0; - public static int GPX_TAB = 1; - public static int SELECTED_GPX_TAB = 2; +// private static final String SELECTED_TRACK = "SELECTED_TRACK"; +// public static int FAVORITES_TAB = 0; +// public static int GPX_TAB = 1; +// public static int SELECTED_GPX_TAB = 2; public static String TAB_PARAM = "TAB_PARAM"; - private TabSpec selectedTrack; protected List> fragList = new ArrayList>(); @Override @@ -81,12 +79,12 @@ public class FavoritesActivity extends TabActivity { List mTabs = new ArrayList(); mTabs.add(getTabIndicator(R.string.my_favorites, FavoritesTreeFragment.class)); - mTabs.add(getTabIndicator(R.string.my_tracks, AvailableGPXFragment.class)); AudioVideoNotesPlugin audioVideoNotesPlugin = OsmandPlugin.getEnabledPlugin(AudioVideoNotesPlugin.class); if (audioVideoNotesPlugin != null && audioVideoNotesPlugin.isActive() && audioVideoNotesPlugin.getAllRecordings().size() > 0){ mTabs.add(getTabIndicator(R.string.notes, NotesFragment.class)); } + mTabs.add(getTabIndicator(R.string.my_tracks, AvailableGPXFragment.class)); mTabs.add(getTabIndicator(R.string.selected_track, SelectedGPXFragment.class)); setViewPagerAdapter(mViewPager, mTabs); @@ -205,7 +203,7 @@ public class FavoritesActivity extends TabActivity { stopHint.setSpan(new ImageSpan(searchIcon), 1, 2, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); searchEdit.setHint(stopHint); } catch (Exception e) { - + e.printStackTrace(); } } } diff --git a/OsmAnd/src/net/osmand/plus/activities/FavoritesTreeFragment.java b/OsmAnd/src/net/osmand/plus/activities/FavoritesTreeFragment.java index 19d7f4f745..d4d798068e 100644 --- a/OsmAnd/src/net/osmand/plus/activities/FavoritesTreeFragment.java +++ b/OsmAnd/src/net/osmand/plus/activities/FavoritesTreeFragment.java @@ -173,10 +173,6 @@ public class FavoritesTreeFragment extends OsmandExpandableListFragment { DirectionsDialogs.createDirectionActionsPopUpMenu(optionsMenu, location, point, name, settings.getLastKnownMapZoom(), getActivity(), true, false); - - -// DirectionsDialogs.createDirectionsActions(qa, location, point, name, settings.getLastKnownMapZoom(), -// getActivity(), true, false); boolean light = getMyApplication().getSettings().isLightContent(); MenuItem item = optionsMenu.getMenu().add(R.string.favourites_context_menu_edit) .setIcon(light ? R.drawable.ic_action_edit_light : R.drawable.ic_action_edit_dark); diff --git a/OsmAnd/src/net/osmand/plus/activities/SelectedGPXFragment.java b/OsmAnd/src/net/osmand/plus/activities/SelectedGPXFragment.java index 8a2deae381..80995fd720 100644 --- a/OsmAnd/src/net/osmand/plus/activities/SelectedGPXFragment.java +++ b/OsmAnd/src/net/osmand/plus/activities/SelectedGPXFragment.java @@ -246,25 +246,6 @@ public class SelectedGPXFragment extends OsmandExpandableListFragment { public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { menu.clear(); ((FavoritesActivity) getActivity()).getClearToolbar(false); -// MenuItem mi = createMenuItem(menu, SEARCH_ID, R.string.search_poi_filter, R.drawable.ic_action_search_light, -// R.drawable.ic_action_search_dark, MenuItem.SHOW_AS_ACTION_ALWAYS -// | MenuItem.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW); -// searchView = new com.actionbarsherlock.widget.SearchView(getDownloadActivity()); -// mi.setActionView(searchView); -// searchView.setOnQueryTextListener(new OnQueryTextListener() { -// -// @Override -// public boolean onQueryTextSubmit(String query) { -// return true; -// } -// -// @Override -// public boolean onQueryTextChange(String newText) { -// return true; -// } -// }); -// createMenuItem(menu, ACTION_ID, R.string.export_fav, R.drawable.ic_action_gsave_light, -// R.drawable.ic_action_gsave_dark, MenuItem.SHOW_AS_ACTION_IF_ROOM); } public void showProgressBar() { @@ -534,8 +515,8 @@ public class SelectedGPXFragment extends OsmandExpandableListFragment { } else if(model.getType() == GpxDisplayItemType.TRACK_SEGMENT) { ch.setVisibility(View.VISIBLE); ch.setImageDrawable(getMyActivity().getResources().getDrawable( - app.getSettings().isLightContent() ? R.drawable.ic_action_settings_enabled_light - : R.drawable.ic_action_settings_enabled_dark)); + app.getSettings().isLightContent() ? R.drawable.ic_overflow_menu_light + : R.drawable.ic_overflow_menu_dark)); ch.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { @@ -547,8 +528,8 @@ public class SelectedGPXFragment extends OsmandExpandableListFragment { model.getType() == GpxDisplayItemType.TRACK_ROUTE_POINTS) { ch.setVisibility(View.VISIBLE); ch.setImageDrawable(getMyActivity().getResources().getDrawable( - app.getSettings().isLightContent() ? R.drawable.ic_action_fav_light - : R.drawable.ic_action_fav_dark)); + app.getSettings().isLightContent() ? R.drawable.ic_overflow_menu_light + : R.drawable.ic_overflow_menu_dark)); ch.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { diff --git a/OsmAnd/src/net/osmand/plus/audionotes/AudioVideoNotesPlugin.java b/OsmAnd/src/net/osmand/plus/audionotes/AudioVideoNotesPlugin.java index 25e81e6984..631a695575 100644 --- a/OsmAnd/src/net/osmand/plus/audionotes/AudioVideoNotesPlugin.java +++ b/OsmAnd/src/net/osmand/plus/audionotes/AudioVideoNotesPlugin.java @@ -277,13 +277,12 @@ public class AudioVideoNotesPlugin extends OsmandPlugin { } public String getDescription(Context ctx) { - String nm = name == null ? "" : name; String time = AndroidUtils.formatDateTime(ctx, file.lastModified()); if (isPhoto()) { - return ctx.getString(R.string.recording_photo_description, nm, time).trim(); + return ctx.getString(R.string.recording_photo_description, "", time).trim(); } updateInternalDescription(); - return ctx.getString(R.string.recording_description, nm, getDuration(ctx), time) + return ctx.getString(R.string.recording_description, "", getDuration(ctx), time) .trim(); } diff --git a/OsmAnd/src/net/osmand/plus/audionotes/NotesFragment.java b/OsmAnd/src/net/osmand/plus/audionotes/NotesFragment.java index e7b665ba16..2678c5f484 100644 --- a/OsmAnd/src/net/osmand/plus/audionotes/NotesFragment.java +++ b/OsmAnd/src/net/osmand/plus/audionotes/NotesFragment.java @@ -15,6 +15,7 @@ import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.EditText; +import android.widget.ExpandableListView; import android.widget.ImageButton; import android.widget.ImageView; import android.widget.TextView; @@ -26,6 +27,7 @@ import net.osmand.plus.activities.FavoritesActivity; import net.osmand.plus.activities.MapActivity; import net.osmand.plus.audionotes.AudioVideoNotesPlugin.Recording; import net.osmand.plus.dialogs.DirectionsDialogs; + import android.support.v4.app.ListFragment; import java.util.ArrayList; @@ -42,8 +44,8 @@ public class NotesFragment extends ListFragment { @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { + setHasOptionsMenu(true); 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); @@ -60,6 +62,7 @@ public class NotesFragment extends ListFragment { @Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { + menu.clear(); ((FavoritesActivity) getActivity()).getClearToolbar(false); } @@ -70,7 +73,7 @@ public class NotesFragment extends ListFragment { public OsmandApplication getMyApplication() { - return (OsmandApplication)getActivity().getApplication(); + return (OsmandApplication) getActivity().getApplication(); } class NotesAdapter extends ArrayAdapter { @@ -82,24 +85,28 @@ public class NotesFragment extends ListFragment { public View getView(final int position, View convertView, ViewGroup parent) { LayoutInflater inflater = getActivity().getLayoutInflater(); View row = convertView; - if (row == null){ + if (row == null) { row = inflater.inflate(R.layout.note, parent, false); } final AudioVideoNotesPlugin.Recording recording = getItem(position); - if (recording.getName() != null){ - ((TextView) row.findViewById(R.id.name)).setText(recording.getName()); - ((TextView) row.findViewById(R.id.descr)).setText(recording.getDescription(getActivity())); - row.findViewById(R.id.descr).setVisibility(View.VISIBLE); - } else { - ((TextView) row.findViewById(R.id.name)).setText(recording.getDescription(getActivity())); - row.findViewById(R.id.descr).setVisibility(View.GONE); + String name = recording.getName(); + TextView nameText = ((TextView) row.findViewById(R.id.name)); + if (name != null) { + nameText.setText(name); + } else if (recording.isAudio()) { + nameText.setText(R.string.audio); + } else if (recording.isVideo()) { + nameText.setText(R.string.video); + } else if (recording.isPhoto()) { + nameText.setText(R.string.photo); } + ((TextView) row.findViewById(R.id.descr)).setText(recording.getDescription(getActivity())); ImageView icon = (ImageView) row.findViewById(R.id.icon); - if (recording.isAudio()){ + if (recording.isAudio()) { icon.setImageResource(R.drawable.ic_type_audio); - } else if (recording.isVideo()){ + } else if (recording.isVideo()) { icon.setImageResource(R.drawable.ic_type_video); } else { icon.setImageResource(R.drawable.ic_type_img); @@ -111,23 +118,35 @@ public class NotesFragment extends ListFragment { openPopUpMenu(v, recording); } }); + row.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + showOnMap(recording); + } + }); return row; } } - private void openPopUpMenu(View v,final AudioVideoNotesPlugin.Recording recording) { + private void showOnMap(Recording recording) { + getMyApplication().getSettings().setMapLocationToShow(recording.getLatitude(), recording.getLongitude(), 15, null, recording.getName(), + recording); //$NON-NLS-1$ + MapActivity.launchMapActivityMoveToTop(getActivity()); + } + + 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){ + 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) + item = optionsMenu.getMenu().add(isPhoto ? R.string.watch : R.string.recording_context_menu_play) .setIcon(playIcon); item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() { @Override @@ -142,9 +161,7 @@ public class NotesFragment extends ListFragment { item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() { @Override public boolean onMenuItemClick(MenuItem item) { - getMyApplication().getSettings().setMapLocationToShow(recording.getLatitude(), recording.getLongitude(), 15, null, recording.getName(), - recording); //$NON-NLS-1$ - MapActivity.launchMapActivityMoveToTop(getActivity()); + showOnMap(recording); return true; } }); @@ -226,4 +243,5 @@ public class NotesFragment extends ListFragment { editText.requestFocus(); } + }