Updated styles of my places and dashboard
This commit is contained in:
parent
13d8286c94
commit
daf30e54ab
14 changed files with 92 additions and 80 deletions
|
@ -0,0 +1,6 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<item android:drawable="@color/actionbar_light_color" android:state_pressed="true"/>
|
||||||
|
<item android:drawable="@color/actionbar_light_color" android:state_focused="true"/>
|
||||||
|
<item android:drawable="@color/list_item_background_dark"/>
|
||||||
|
</selector>
|
|
@ -0,0 +1,6 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<item android:state_pressed="true" android:drawable="@color/actionbar_light_color" />
|
||||||
|
<item android:state_focused="true" android:drawable="@color/actionbar_light_color" />
|
||||||
|
<item android:drawable="@color/expandable_list_item_light" />
|
||||||
|
</selector>
|
|
@ -19,8 +19,8 @@
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/icon"
|
android:id="@+id/icon"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="@dimen/favorite_icon_size"
|
||||||
android:layout_height="fill_parent"
|
android:layout_height="@dimen/favorite_icon_size"
|
||||||
android:layout_gravity="center_vertical"
|
android:layout_gravity="center_vertical"
|
||||||
android:layout_marginLeft="@dimen/dashFavIconMargin"
|
android:layout_marginLeft="@dimen/dashFavIconMargin"
|
||||||
android:layout_marginRight="@dimen/dashFavIconMargin"/>
|
android:layout_marginRight="@dimen/dashFavIconMargin"/>
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:id="@+id/main_scroll"
|
android:id="@+id/main_scroll"
|
||||||
android:background="@color/dashboard_background">
|
android:background="?attr/expandable_list_background">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="@dimen/list_header_settings_top_margin"
|
android:layout_marginTop="@dimen/list_header_settings_top_margin"
|
||||||
|
android:background="?attr/options_button_background"
|
||||||
android:focusable="false"
|
android:focusable="false"
|
||||||
android:visibility="gone"/>
|
android:visibility="gone"/>
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,8 @@
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:layout_width="fill_parent"
|
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">
|
android:paddingLeft="@dimen/list_header_padding">
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
|
@ -17,7 +18,6 @@
|
||||||
android:id="@+id/category_name"
|
android:id="@+id/category_name"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginBottom="@dimen/list_header_bottom_margin"
|
|
||||||
android:layout_marginLeft="@dimen/list_header_text_left_margin"
|
android:layout_marginLeft="@dimen/list_header_text_left_margin"
|
||||||
android:layout_marginTop="@dimen/list_header_top_margin"
|
android:layout_marginTop="@dimen/list_header_top_margin"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
|
@ -30,6 +30,8 @@
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="@dimen/list_header_settings_top_margin"
|
android:layout_marginTop="@dimen/list_header_settings_top_margin"
|
||||||
|
android:layout_marginRight="@dimen/list_header_settings_top_margin"
|
||||||
|
android:background="?attr/options_button_background"
|
||||||
android:focusable="false"
|
android:focusable="false"
|
||||||
android:src="?attr/list_settings_icon"/>
|
android:src="?attr/list_settings_icon"/>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
|
@ -9,6 +9,9 @@
|
||||||
3. All your modified/created strings are in the top of the file (to make easier find what\'s translated).
|
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
|
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="audio">Audio</string>
|
||||||
|
<string name="video">Video</string>
|
||||||
|
<string name="photo">Photo</string>
|
||||||
<string name="share_note">Share note</string>
|
<string name="share_note">Share note</string>
|
||||||
<string name="rename_recording">Rename recording</string>
|
<string name="rename_recording">Rename recording</string>
|
||||||
<string name="watch">Watch</string>
|
<string name="watch">Watch</string>
|
||||||
|
|
|
@ -162,7 +162,7 @@
|
||||||
<item name="plugin_details_install_header_bg">@color/plugin_details_install_header_bg_light</item>
|
<item name="plugin_details_install_header_bg">@color/plugin_details_install_header_bg_light</item>
|
||||||
<item name="ic_world_globe">@drawable/ic_world_globe_light</item>
|
<item name="ic_world_globe">@drawable/ic_world_globe_light</item>
|
||||||
<item name="plugin_description_header_text_color">#727272</item>
|
<item name="plugin_description_header_text_color">#727272</item>
|
||||||
<item name="expandable_list_item_background">@color/expandable_list_item_light</item>
|
<item name="expandable_list_item_background">@drawable/expandable_list_item_background_light</item>
|
||||||
<item name="expandable_list_background">@color/color_white</item>
|
<item name="expandable_list_background">@color/color_white</item>
|
||||||
<item name="list_settings_icon">@drawable/ic_overflow_menu_light</item>
|
<item name="list_settings_icon">@drawable/ic_overflow_menu_light</item>
|
||||||
<item name="size_progress_bar">@drawable/size_progressbar_light</item>
|
<item name="size_progress_bar">@drawable/size_progressbar_light</item>
|
||||||
|
@ -205,7 +205,7 @@
|
||||||
<item name="plugin_details_install_header_bg">@color/plugin_details_install_header_bg_dark</item>
|
<item name="plugin_details_install_header_bg">@color/plugin_details_install_header_bg_dark</item>
|
||||||
<item name="ic_world_globe">@drawable/ic_world_globe_dark</item>
|
<item name="ic_world_globe">@drawable/ic_world_globe_dark</item>
|
||||||
<item name="plugin_description_header_text_color">#70818c</item>
|
<item name="plugin_description_header_text_color">#70818c</item>
|
||||||
<item name="expandable_list_item_background">@color/list_item_background_dark</item>
|
<item name="expandable_list_item_background">@drawable/expandable_list_item_background_dark</item>
|
||||||
<item name="expandable_list_background">@color/list_background_dark</item>
|
<item name="expandable_list_background">@color/list_background_dark</item>
|
||||||
<item name="list_settings_icon">@drawable/ic_overflow_menu_dark</item>
|
<item name="list_settings_icon">@drawable/ic_overflow_menu_dark</item>
|
||||||
<item name="size_progress_bar">@drawable/size_progressbar_dark</item>
|
<item name="size_progress_bar">@drawable/size_progressbar_dark</item>
|
||||||
|
|
|
@ -34,6 +34,7 @@ import net.osmand.plus.R;
|
||||||
import net.osmand.plus.dialogs.DirectionsDialogs;
|
import net.osmand.plus.dialogs.DirectionsDialogs;
|
||||||
import net.osmand.plus.helpers.GpxUiHelper;
|
import net.osmand.plus.helpers.GpxUiHelper;
|
||||||
import net.osmand.plus.helpers.ScreenOrientationHelper;
|
import net.osmand.plus.helpers.ScreenOrientationHelper;
|
||||||
|
import net.osmand.plus.osmedit.OsmEditingPlugin;
|
||||||
import net.osmand.util.Algorithms;
|
import net.osmand.util.Algorithms;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
|
@ -99,12 +100,6 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
|
||||||
return selectedItems;
|
return selectedItems;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
|
||||||
View vs = super.onCreateView(inflater, container, savedInstanceState);
|
|
||||||
return vs;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onResume() {
|
public void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
|
@ -731,6 +726,7 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
|
||||||
viewName.setTextColor(defaultColor);
|
viewName.setTextColor(defaultColor);
|
||||||
viewName.setTypeface(Typeface.DEFAULT, Typeface.NORMAL);
|
viewName.setTypeface(Typeface.DEFAULT, Typeface.NORMAL);
|
||||||
}
|
}
|
||||||
|
TextView sizeText = (TextView) v.findViewById(R.id.local_index_size);
|
||||||
if (child.getSize() >= 0) {
|
if (child.getSize() >= 0) {
|
||||||
String size;
|
String size;
|
||||||
if (child.getSize() > 100) {
|
if (child.getSize() > 100) {
|
||||||
|
@ -738,16 +734,18 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
|
||||||
} else {
|
} else {
|
||||||
size = child.getSize() + " kB";
|
size = child.getSize() + " kB";
|
||||||
}
|
}
|
||||||
((TextView) v.findViewById(R.id.local_index_size)).setText(size);
|
sizeText.setText(size);
|
||||||
} else {
|
} else {
|
||||||
((TextView) v.findViewById(R.id.local_index_size)).setText("");
|
sizeText.setText("");
|
||||||
}
|
}
|
||||||
TextView descr = ((TextView) v.findViewById(R.id.local_index_descr));
|
TextView descr = ((TextView) v.findViewById(R.id.local_index_descr));
|
||||||
if (child.isExpanded()) {
|
if (child.isExpanded()) {
|
||||||
descr.setVisibility(View.VISIBLE);
|
descr.setVisibility(View.VISIBLE);
|
||||||
descr.setText(child.getHtmlDescription());
|
descr.setText(child.getHtmlDescription());
|
||||||
|
sizeText.setVisibility(View.GONE);
|
||||||
} else {
|
} else {
|
||||||
descr.setVisibility(View.GONE);
|
descr.setVisibility(View.GONE);
|
||||||
|
sizeText.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
ImageButton options = (ImageButton) v.findViewById(R.id.options);
|
ImageButton options = (ImageButton) v.findViewById(R.id.options);
|
||||||
options.setOnClickListener(new View.OnClickListener() {
|
options.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@ -902,15 +900,19 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
item = optionsMenu.getMenu().add(R.string.export)
|
final OsmEditingPlugin osmEditingPlugin = OsmandPlugin.getEnabledPlugin(OsmEditingPlugin.class);
|
||||||
.setIcon(light ? R.drawable.ic_action_gup_light : R.drawable.ic_action_gup_dark);
|
if (osmEditingPlugin != null && osmEditingPlugin.isActive()){
|
||||||
item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
|
item = optionsMenu.getMenu().add(R.string.export)
|
||||||
@Override
|
.setIcon(light ? R.drawable.ic_action_gup_light : R.drawable.ic_action_gup_dark);
|
||||||
public boolean onMenuItemClick(MenuItem item) {
|
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)
|
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);
|
.setIcon(light ? R.drawable.ic_action_delete_light : R.drawable.ic_action_delete_dark);
|
||||||
|
|
|
@ -28,7 +28,6 @@ import android.support.v4.app.Fragment;
|
||||||
import android.support.v4.view.ViewPager;
|
import android.support.v4.view.ViewPager;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.TabHost.TabSpec;
|
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import net.osmand.plus.audionotes.AudioVideoNotesPlugin;
|
import net.osmand.plus.audionotes.AudioVideoNotesPlugin;
|
||||||
|
@ -40,14 +39,13 @@ import net.osmand.plus.views.controls.PagerSlidingTabStrip;
|
||||||
*/
|
*/
|
||||||
public class FavoritesActivity extends TabActivity {
|
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 TRACKS = "TRACKS";
|
||||||
private static final String SELECTED_TRACK = "SELECTED_TRACK";
|
// private static final String SELECTED_TRACK = "SELECTED_TRACK";
|
||||||
public static int FAVORITES_TAB = 0;
|
// public static int FAVORITES_TAB = 0;
|
||||||
public static int GPX_TAB = 1;
|
// public static int GPX_TAB = 1;
|
||||||
public static int SELECTED_GPX_TAB = 2;
|
// public static int SELECTED_GPX_TAB = 2;
|
||||||
public static String TAB_PARAM = "TAB_PARAM";
|
public static String TAB_PARAM = "TAB_PARAM";
|
||||||
private TabSpec selectedTrack;
|
|
||||||
protected List<WeakReference<Fragment>> fragList = new ArrayList<WeakReference<Fragment>>();
|
protected List<WeakReference<Fragment>> fragList = new ArrayList<WeakReference<Fragment>>();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -81,12 +79,12 @@ public class FavoritesActivity extends TabActivity {
|
||||||
|
|
||||||
List<TabItem> mTabs = new ArrayList<TabItem>();
|
List<TabItem> mTabs = new ArrayList<TabItem>();
|
||||||
mTabs.add(getTabIndicator(R.string.my_favorites, FavoritesTreeFragment.class));
|
mTabs.add(getTabIndicator(R.string.my_favorites, FavoritesTreeFragment.class));
|
||||||
mTabs.add(getTabIndicator(R.string.my_tracks, AvailableGPXFragment.class));
|
|
||||||
AudioVideoNotesPlugin audioVideoNotesPlugin = OsmandPlugin.getEnabledPlugin(AudioVideoNotesPlugin.class);
|
AudioVideoNotesPlugin audioVideoNotesPlugin = OsmandPlugin.getEnabledPlugin(AudioVideoNotesPlugin.class);
|
||||||
if (audioVideoNotesPlugin != null && audioVideoNotesPlugin.isActive()
|
if (audioVideoNotesPlugin != null && audioVideoNotesPlugin.isActive()
|
||||||
&& audioVideoNotesPlugin.getAllRecordings().size() > 0){
|
&& audioVideoNotesPlugin.getAllRecordings().size() > 0){
|
||||||
mTabs.add(getTabIndicator(R.string.notes, NotesFragment.class));
|
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));
|
mTabs.add(getTabIndicator(R.string.selected_track, SelectedGPXFragment.class));
|
||||||
|
|
||||||
setViewPagerAdapter(mViewPager, mTabs);
|
setViewPagerAdapter(mViewPager, mTabs);
|
||||||
|
@ -205,7 +203,7 @@ public class FavoritesActivity extends TabActivity {
|
||||||
stopHint.setSpan(new ImageSpan(searchIcon), 1, 2, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
stopHint.setSpan(new ImageSpan(searchIcon), 1, 2, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||||
searchEdit.setHint(stopHint);
|
searchEdit.setHint(stopHint);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -173,10 +173,6 @@ public class FavoritesTreeFragment extends OsmandExpandableListFragment {
|
||||||
DirectionsDialogs.createDirectionActionsPopUpMenu(optionsMenu, location, point, name, settings.getLastKnownMapZoom(),
|
DirectionsDialogs.createDirectionActionsPopUpMenu(optionsMenu, location, point, name, settings.getLastKnownMapZoom(),
|
||||||
getActivity(), true, false);
|
getActivity(), true, false);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// DirectionsDialogs.createDirectionsActions(qa, location, point, name, settings.getLastKnownMapZoom(),
|
|
||||||
// getActivity(), true, false);
|
|
||||||
boolean light = getMyApplication().getSettings().isLightContent();
|
boolean light = getMyApplication().getSettings().isLightContent();
|
||||||
MenuItem item = optionsMenu.getMenu().add(R.string.favourites_context_menu_edit)
|
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);
|
.setIcon(light ? R.drawable.ic_action_edit_light : R.drawable.ic_action_edit_dark);
|
||||||
|
|
|
@ -246,25 +246,6 @@ public class SelectedGPXFragment extends OsmandExpandableListFragment {
|
||||||
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
|
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
|
||||||
menu.clear();
|
menu.clear();
|
||||||
((FavoritesActivity) getActivity()).getClearToolbar(false);
|
((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() {
|
public void showProgressBar() {
|
||||||
|
@ -534,8 +515,8 @@ public class SelectedGPXFragment extends OsmandExpandableListFragment {
|
||||||
} else if(model.getType() == GpxDisplayItemType.TRACK_SEGMENT) {
|
} else if(model.getType() == GpxDisplayItemType.TRACK_SEGMENT) {
|
||||||
ch.setVisibility(View.VISIBLE);
|
ch.setVisibility(View.VISIBLE);
|
||||||
ch.setImageDrawable(getMyActivity().getResources().getDrawable(
|
ch.setImageDrawable(getMyActivity().getResources().getDrawable(
|
||||||
app.getSettings().isLightContent() ? R.drawable.ic_action_settings_enabled_light
|
app.getSettings().isLightContent() ? R.drawable.ic_overflow_menu_light
|
||||||
: R.drawable.ic_action_settings_enabled_dark));
|
: R.drawable.ic_overflow_menu_dark));
|
||||||
ch.setOnClickListener(new View.OnClickListener() {
|
ch.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
|
@ -547,8 +528,8 @@ public class SelectedGPXFragment extends OsmandExpandableListFragment {
|
||||||
model.getType() == GpxDisplayItemType.TRACK_ROUTE_POINTS) {
|
model.getType() == GpxDisplayItemType.TRACK_ROUTE_POINTS) {
|
||||||
ch.setVisibility(View.VISIBLE);
|
ch.setVisibility(View.VISIBLE);
|
||||||
ch.setImageDrawable(getMyActivity().getResources().getDrawable(
|
ch.setImageDrawable(getMyActivity().getResources().getDrawable(
|
||||||
app.getSettings().isLightContent() ? R.drawable.ic_action_fav_light
|
app.getSettings().isLightContent() ? R.drawable.ic_overflow_menu_light
|
||||||
: R.drawable.ic_action_fav_dark));
|
: R.drawable.ic_overflow_menu_dark));
|
||||||
ch.setOnClickListener(new View.OnClickListener() {
|
ch.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
|
|
|
@ -277,13 +277,12 @@ public class AudioVideoNotesPlugin extends OsmandPlugin {
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDescription(Context ctx) {
|
public String getDescription(Context ctx) {
|
||||||
String nm = name == null ? "" : name;
|
|
||||||
String time = AndroidUtils.formatDateTime(ctx, file.lastModified());
|
String time = AndroidUtils.formatDateTime(ctx, file.lastModified());
|
||||||
if (isPhoto()) {
|
if (isPhoto()) {
|
||||||
return ctx.getString(R.string.recording_photo_description, nm, time).trim();
|
return ctx.getString(R.string.recording_photo_description, "", time).trim();
|
||||||
}
|
}
|
||||||
updateInternalDescription();
|
updateInternalDescription();
|
||||||
return ctx.getString(R.string.recording_description, nm, getDuration(ctx), time)
|
return ctx.getString(R.string.recording_description, "", getDuration(ctx), time)
|
||||||
.trim();
|
.trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,7 @@ import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.ArrayAdapter;
|
import android.widget.ArrayAdapter;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
|
import android.widget.ExpandableListView;
|
||||||
import android.widget.ImageButton;
|
import android.widget.ImageButton;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
@ -26,6 +27,7 @@ import net.osmand.plus.activities.FavoritesActivity;
|
||||||
import net.osmand.plus.activities.MapActivity;
|
import net.osmand.plus.activities.MapActivity;
|
||||||
import net.osmand.plus.audionotes.AudioVideoNotesPlugin.Recording;
|
import net.osmand.plus.audionotes.AudioVideoNotesPlugin.Recording;
|
||||||
import net.osmand.plus.dialogs.DirectionsDialogs;
|
import net.osmand.plus.dialogs.DirectionsDialogs;
|
||||||
|
|
||||||
import android.support.v4.app.ListFragment;
|
import android.support.v4.app.ListFragment;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -42,8 +44,8 @@ public class NotesFragment extends ListFragment {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||||
|
setHasOptionsMenu(true);
|
||||||
plugin = OsmandPlugin.getEnabledPlugin(AudioVideoNotesPlugin.class);
|
plugin = OsmandPlugin.getEnabledPlugin(AudioVideoNotesPlugin.class);
|
||||||
|
|
||||||
View view = getActivity().getLayoutInflater().inflate(R.layout.update_index, container, false);
|
View view = getActivity().getLayoutInflater().inflate(R.layout.update_index, container, false);
|
||||||
view.findViewById(R.id.select_all).setVisibility(View.GONE);
|
view.findViewById(R.id.select_all).setVisibility(View.GONE);
|
||||||
((TextView) view.findViewById(R.id.header)).setText(R.string.notes);
|
((TextView) view.findViewById(R.id.header)).setText(R.string.notes);
|
||||||
|
@ -60,6 +62,7 @@ public class NotesFragment extends ListFragment {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
|
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
|
||||||
|
menu.clear();
|
||||||
((FavoritesActivity) getActivity()).getClearToolbar(false);
|
((FavoritesActivity) getActivity()).getClearToolbar(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -70,7 +73,7 @@ public class NotesFragment extends ListFragment {
|
||||||
|
|
||||||
|
|
||||||
public OsmandApplication getMyApplication() {
|
public OsmandApplication getMyApplication() {
|
||||||
return (OsmandApplication)getActivity().getApplication();
|
return (OsmandApplication) getActivity().getApplication();
|
||||||
}
|
}
|
||||||
|
|
||||||
class NotesAdapter extends ArrayAdapter<AudioVideoNotesPlugin.Recording> {
|
class NotesAdapter extends ArrayAdapter<AudioVideoNotesPlugin.Recording> {
|
||||||
|
@ -82,24 +85,28 @@ public class NotesFragment extends ListFragment {
|
||||||
public View getView(final int position, View convertView, ViewGroup parent) {
|
public View getView(final int position, View convertView, ViewGroup parent) {
|
||||||
LayoutInflater inflater = getActivity().getLayoutInflater();
|
LayoutInflater inflater = getActivity().getLayoutInflater();
|
||||||
View row = convertView;
|
View row = convertView;
|
||||||
if (row == null){
|
if (row == null) {
|
||||||
row = inflater.inflate(R.layout.note, parent, false);
|
row = inflater.inflate(R.layout.note, parent, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
final AudioVideoNotesPlugin.Recording recording = getItem(position);
|
final AudioVideoNotesPlugin.Recording recording = getItem(position);
|
||||||
if (recording.getName() != null){
|
String name = recording.getName();
|
||||||
((TextView) row.findViewById(R.id.name)).setText(recording.getName());
|
TextView nameText = ((TextView) row.findViewById(R.id.name));
|
||||||
((TextView) row.findViewById(R.id.descr)).setText(recording.getDescription(getActivity()));
|
if (name != null) {
|
||||||
row.findViewById(R.id.descr).setVisibility(View.VISIBLE);
|
nameText.setText(name);
|
||||||
} else {
|
} else if (recording.isAudio()) {
|
||||||
((TextView) row.findViewById(R.id.name)).setText(recording.getDescription(getActivity()));
|
nameText.setText(R.string.audio);
|
||||||
row.findViewById(R.id.descr).setVisibility(View.GONE);
|
} 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);
|
ImageView icon = (ImageView) row.findViewById(R.id.icon);
|
||||||
if (recording.isAudio()){
|
if (recording.isAudio()) {
|
||||||
icon.setImageResource(R.drawable.ic_type_audio);
|
icon.setImageResource(R.drawable.ic_type_audio);
|
||||||
} else if (recording.isVideo()){
|
} else if (recording.isVideo()) {
|
||||||
icon.setImageResource(R.drawable.ic_type_video);
|
icon.setImageResource(R.drawable.ic_type_video);
|
||||||
} else {
|
} else {
|
||||||
icon.setImageResource(R.drawable.ic_type_img);
|
icon.setImageResource(R.drawable.ic_type_img);
|
||||||
|
@ -111,23 +118,35 @@ public class NotesFragment extends ListFragment {
|
||||||
openPopUpMenu(v, recording);
|
openPopUpMenu(v, recording);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
row.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
showOnMap(recording);
|
||||||
|
}
|
||||||
|
});
|
||||||
return row;
|
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();
|
boolean light = getMyApplication().getSettings().isLightContent();
|
||||||
final PopupMenu optionsMenu = new PopupMenu(getActivity(), v);
|
final PopupMenu optionsMenu = new PopupMenu(getActivity(), v);
|
||||||
DirectionsDialogs.setupPopUpMenuIcon(optionsMenu);
|
DirectionsDialogs.setupPopUpMenuIcon(optionsMenu);
|
||||||
MenuItem item;
|
MenuItem item;
|
||||||
boolean isPhoto = recording.isPhoto();
|
boolean isPhoto = recording.isPhoto();
|
||||||
final int playIcon;
|
final int playIcon;
|
||||||
if(isPhoto){
|
if (isPhoto) {
|
||||||
playIcon = light ? R.drawable.ic_action_eye_light : R.drawable.ic_action_eye_dark;
|
playIcon = light ? R.drawable.ic_action_eye_light : R.drawable.ic_action_eye_dark;
|
||||||
} else {
|
} else {
|
||||||
playIcon = light ? R.drawable.ic_play_light : R.drawable.ic_play_dark;
|
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);
|
.setIcon(playIcon);
|
||||||
item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
|
item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -142,9 +161,7 @@ public class NotesFragment extends ListFragment {
|
||||||
item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
|
item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onMenuItemClick(MenuItem item) {
|
public boolean onMenuItemClick(MenuItem item) {
|
||||||
getMyApplication().getSettings().setMapLocationToShow(recording.getLatitude(), recording.getLongitude(), 15, null, recording.getName(),
|
showOnMap(recording);
|
||||||
recording); //$NON-NLS-1$
|
|
||||||
MapActivity.launchMapActivityMoveToTop(getActivity());
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -226,4 +243,5 @@ public class NotesFragment extends ListFragment {
|
||||||
editText.requestFocus();
|
editText.requestFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue