Merge remote-tracking branch 'origin/master'

This commit is contained in:
Weblate 2015-02-18 17:03:52 +01:00
commit ee28074d81
17 changed files with 290 additions and 62 deletions

View file

@ -5,10 +5,8 @@
android:layout_height="wrap_content"
android:background="?attr/expandable_list_item_background"
android:minHeight="@dimen/list_item_height"
android:paddingBottom="1dp"
android:paddingLeft="@dimen/list_content_padding"
android:paddingRight="@dimen/list_content_padding"
android:paddingTop="1dp">
android:paddingRight="@dimen/list_content_padding">
<CheckBox
android:id="@+id/check_download_item"
@ -21,6 +19,7 @@
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:orientation="vertical">
<TextView
@ -28,7 +27,6 @@
style="@style/ListText.Small"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
tools:text="@string/lorem_ipsum"/>
<LinearLayout

View file

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

View file

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

View file

@ -29,6 +29,7 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:orientation="horizontal">
<LinearLayout

View file

@ -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"
@ -39,7 +38,6 @@
style="@style/ListText.Small"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical"
tools:text="@string/app_version"/>
@ -70,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"/>

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

View file

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

View file

@ -6,10 +6,8 @@
android:layout_height="wrap_content"
android:background="?attr/expandable_list_item_background"
android:minHeight="@dimen/list_item_height"
android:paddingBottom="1dp"
android:paddingLeft="@dimen/list_content_padding"
android:paddingRight="@dimen/list_content_padding"
android:paddingTop="1dp">
android:paddingRight="@dimen/list_content_padding">
<CheckBox
android:id="@+id/check_download_item"
@ -31,7 +29,6 @@
style="@style/ListText.Small"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="center_vertical"
tools:text="@string/app_version"
android:maxLines="7"/>

View file

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

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="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>
<string name="free">Free %1$s </string>

View file

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

View file

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

View file

@ -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;
/**
*

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

View file

@ -271,14 +271,14 @@ public class DownloadIndexAdapter extends OsmandBaseExpandableListAdapter implem
if (updatableResource && !DownloadActivity.downloadListIndexThread.checkIfItemOutdated(e)) {
description.setText(indexActivatedFileNames.get(sfName) + " " + e.getSizeDescription(clctx));
//up to date
uptodate.setText(downloadFragment.getResources().getString(R.string.local_index_installed) + " : "
uptodate.setText(downloadFragment.getResources().getString(R.string.local_index_installed) + ": "
+ indexActivatedFileNames.get(sfName));
uptodate.setVisibility(View.VISIBLE);
update.setVisibility(View.GONE);
} else if (indexFileNames.containsKey(sfName) && !DownloadActivity.downloadListIndexThread.checkIfItemOutdated(e)) {
description.setText(indexFileNames.get(sfName) + " " + e.getSizeDescription(clctx));
//up to date
uptodate.setText(downloadFragment.getResources().getString(R.string.local_index_installed) + " : "
uptodate.setText(downloadFragment.getResources().getString(R.string.local_index_installed) + ": "
+ indexFileNames.get(sfName));
uptodate.setVisibility(View.VISIBLE);
update.setVisibility(View.GONE);
@ -286,15 +286,15 @@ public class DownloadIndexAdapter extends OsmandBaseExpandableListAdapter implem
String updatedDescr = indexActivatedFileNames.get(sfName) + " " + e.getSizeDescription(clctx);
description.setText(updatedDescr);
//needed to be updated
update.setText(downloadFragment.getResources().getString(R.string.local_index_installed) + " : "
update.setText(downloadFragment.getResources().getString(R.string.local_index_installed) + ": "
+ e.getDate(format));
uptodate.setVisibility(View.GONE);
update.setVisibility(View.VISIBLE);
} else {
description.setText(name.getText() + "\n" + downloadFragment.getResources().getString(R.string.local_index_installed) + " : "
description.setText(name.getText() + "\n" + downloadFragment.getResources().getString(R.string.local_index_installed) + ": "
+ indexFileNames.get(sfName));
//needed to be updated
update.setText(downloadFragment.getResources().getString(R.string.local_index_installed) + " : "
update.setText(downloadFragment.getResources().getString(R.string.local_index_installed) + ": "
+ e.getDate(format));
uptodate.setVisibility(View.GONE);
update.setVisibility(View.VISIBLE);

View file

@ -287,6 +287,10 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment {
@Override
protected void onProgressUpdate(LocalIndexInfo... values) {
for (LocalIndexInfo v : values) {
//do not show recordings
if (v.getType() == LocalIndexType.AV_DATA){
continue;
}
listAdapter.addLocalIndexInfo(v);
descriptionLoader = new LoadLocalIndexDescriptionTask();
descriptionLoader.execute(v);
@ -301,6 +305,10 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment {
listAdapter.clear();
} else {
for (LocalIndexInfo v : result) {
//do not show recordings
if (v.getType() == LocalIndexType.AV_DATA){
continue;
}
listAdapter.addLocalIndexInfo(v);
descriptionLoader = new LoadLocalIndexDescriptionTask();
descriptionLoader.execute(v);
@ -502,13 +510,6 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment {
descriptionLoader.cancel(true);
}
// @Override
// public Object onRetainNonConfigurationInstance() {
// if(asyncLoader != null){
// return asyncLoader.getResult();
// }
// return super.onRetainNonConfigurationInstance();
// }
@SuppressWarnings("deprecation")
@Override
@ -521,6 +522,10 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment {
//Next line throws NPE in some circumstances when called from dashboard and listAdpater=null is not checked for. (Checking !this.isAdded above is not sufficient!)
if (listAdapter != null && listAdapter.getGroupCount() == 0 && getDownloadActivity().getLocalIndexInfos().size() > 0) {
for(LocalIndexInfo info : getDownloadActivity().getLocalIndexInfos()) {
//do not show recordings
if (info.getType() == LocalIndexType.AV_DATA){
continue;
}
listAdapter.addLocalIndexInfo(info);
}
listAdapter.sortData();
@ -805,7 +810,6 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment {
List<LocalIndexInfo> filterCategory = null;
int warningColor;
int okColor;
int defaultColor;
int corruptedColor;
Context ctx;
@ -814,7 +818,6 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment {
warningColor = ctx.getResources().getColor(R.color.color_warning);
okColor = ctx.getResources().getColor(R.color.color_ok);
TypedArray ta = ctx.getTheme().obtainStyledAttributes(new int[]{android.R.attr.textColorPrimary});
defaultColor = ta.getColor(0, ctx.getResources().getColor(R.color.color_unknown));
ta.recycle();
corruptedColor = ctx.getResources().getColor(R.color.color_invalid);
}
@ -970,17 +973,12 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment {
viewName.setText(getNameToDisplay(child));
if (child.isNotSupported()) {
viewName.setTextColor(warningColor);
viewName.setTypeface(Typeface.DEFAULT, Typeface.NORMAL);
} else if (child.isCorrupted()) {
viewName.setTextColor(corruptedColor);
viewName.setTypeface(Typeface.DEFAULT, Typeface.NORMAL);
} else if (child.isLoaded()) {
// users confused okColor here with "uptodate", so let's leave white (black in dark app theme) as "isLoaded"
//viewName.setTextColor(okColor);
viewName.setTextColor(defaultColor);
} else {
viewName.setTextColor(defaultColor);
viewName.setTypeface(Typeface.DEFAULT, Typeface.NORMAL);
if (child.isBackupedData()) {
viewName.setTypeface(Typeface.DEFAULT, Typeface.ITALIC);
}
@ -998,9 +996,15 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment {
} else {
sizeText.setVisibility(View.GONE);
}
TextView descr = ((TextView) v.findViewById(R.id.local_index_descr));
descr.setVisibility(View.VISIBLE);
descr.setText(child.getDescription());
if (child.getType() == LocalIndexType.TILES_DATA) {
descr.setText(R.string.online_map);
} else {
descr.setVisibility(View.VISIBLE);
descr.setText(child.getDescription());
}
final CheckBox checkbox = (CheckBox) v.findViewById(R.id.check_local_index);
@ -1040,16 +1044,19 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment {
final PopupMenu optionsMenu = new PopupMenu(getActivity(), v);
DirectionsDialogs.setupPopUpMenuIcon(optionsMenu);
final boolean restore = info.isBackupedData();
MenuItem item;
if (info.getType() == LocalIndexType.MAP_DATA) {
item = optionsMenu.getMenu().add(restore? R.string.local_index_mi_restore : R.string.local_index_mi_backup)
.setIcon(backup);
item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
performBasicOperation(restore ? R.string.local_index_mi_restore : R.string.local_index_mi_backup, info);
return true;
}
});
}
MenuItem item = optionsMenu.getMenu().add(restore? R.string.local_index_mi_restore : R.string.local_index_mi_backup)
.setIcon(backup);
item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
performBasicOperation(restore ? R.string.local_index_mi_restore : R.string.local_index_mi_backup, info);
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() {

View file

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