Updated styles of my places and dashboard

This commit is contained in:
Denis 2015-02-20 16:54:02 +02:00
parent 13d8286c94
commit daf30e54ab
14 changed files with 92 additions and 80 deletions

View file

@ -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>

View file

@ -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>

View file

@ -19,8 +19,8 @@
<ImageView
android:id="@+id/icon"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_width="@dimen/favorite_icon_size"
android:layout_height="@dimen/favorite_icon_size"
android:layout_gravity="center_vertical"
android:layout_marginLeft="@dimen/dashFavIconMargin"
android:layout_marginRight="@dimen/dashFavIconMargin"/>

View file

@ -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">
<LinearLayout
android:layout_width="match_parent"

View file

@ -29,6 +29,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/list_header_settings_top_margin"
android:background="?attr/options_button_background"
android:focusable="false"
android:visibility="gone"/>

View file

@ -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">
<ImageView
@ -17,7 +18,6 @@
android:id="@+id/category_name"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/list_header_bottom_margin"
android:layout_marginLeft="@dimen/list_header_text_left_margin"
android:layout_marginTop="@dimen/list_header_top_margin"
android:layout_weight="1"
@ -30,6 +30,8 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
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:src="?attr/list_settings_icon"/>
</LinearLayout>

View file

@ -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
-->
<string name="audio">Audio</string>
<string name="video">Video</string>
<string name="photo">Photo</string>
<string name="share_note">Share note</string>
<string name="rename_recording">Rename recording</string>
<string name="watch">Watch</string>

View file

@ -162,7 +162,7 @@
<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="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="list_settings_icon">@drawable/ic_overflow_menu_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="ic_world_globe">@drawable/ic_world_globe_dark</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="list_settings_icon">@drawable/ic_overflow_menu_dark</item>
<item name="size_progress_bar">@drawable/size_progressbar_dark</item>

View file

@ -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);

View file

@ -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<WeakReference<Fragment>> fragList = new ArrayList<WeakReference<Fragment>>();
@Override
@ -81,12 +79,12 @@ 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));
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();
}
}
}

View file

@ -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);

View file

@ -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) {

View file

@ -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();
}

View file

@ -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<AudioVideoNotesPlugin.Recording> {
@ -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();
}
}