Merge remote-tracking branch 'origin/master'
BIN
OsmAnd/res/drawable-hdpi/ic_action_type_add_16.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
OsmAnd/res/drawable-hdpi/ic_action_type_delete_16.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
OsmAnd/res/drawable-hdpi/ic_action_type_edit_16.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
OsmAnd/res/drawable-mdpi/ic_action_type_add_16.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
OsmAnd/res/drawable-mdpi/ic_action_type_delete_16.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
OsmAnd/res/drawable-mdpi/ic_action_type_edit_16.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
OsmAnd/res/drawable-xhdpi/ic_action_type_add_16.png
Normal file
After Width: | Height: | Size: 1.4 KiB |
BIN
OsmAnd/res/drawable-xhdpi/ic_action_type_delete_16.png
Normal file
After Width: | Height: | Size: 1.4 KiB |
BIN
OsmAnd/res/drawable-xhdpi/ic_action_type_edit_16.png
Normal file
After Width: | Height: | Size: 1.5 KiB |
BIN
OsmAnd/res/drawable-xxhdpi/ic_action_type_add_16.png
Normal file
After Width: | Height: | Size: 1.6 KiB |
BIN
OsmAnd/res/drawable-xxhdpi/ic_action_type_delete_16.png
Normal file
After Width: | Height: | Size: 1.6 KiB |
BIN
OsmAnd/res/drawable-xxhdpi/ic_action_type_edit_16.png
Normal file
After Width: | Height: | Size: 1.8 KiB |
|
@ -275,6 +275,64 @@
|
||||||
android:background="?attr/dashboard_divider"/>
|
android:background="?attr/dashboard_divider"/>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:id="@+id/donationsTotal"
|
||||||
|
android:visibility="gone"
|
||||||
|
android:minHeight="60dp"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:minHeight="60dp"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/donationsTotalIcon"
|
||||||
|
android:layout_width="56dp"
|
||||||
|
android:layout_height="56dp"
|
||||||
|
android:scaleType="center"
|
||||||
|
android:src="@drawable/ic_action_bitcoin"/>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginRight="16dp"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/donationsTotalTitle"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/total_donations"
|
||||||
|
android:textColor="?android:textColorSecondary"
|
||||||
|
android:textSize="@dimen/default_sub_text_size"/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/donationsTotalTextView"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="-"
|
||||||
|
android:textColor="?android:textColorPrimary"
|
||||||
|
android:textSize="@dimen/default_list_text_size"/>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="1dp"
|
||||||
|
android:layout_marginLeft="56dp"
|
||||||
|
android:background="?attr/dashboard_divider"/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/numberOfRecipientsLayout"
|
||||||
|
android:background="?attr/selectableItemBackground"
|
||||||
|
android:clickable="true"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
|
@ -289,7 +347,6 @@
|
||||||
android:src="@drawable/ic_group"/>
|
android:src="@drawable/ic_group"/>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/numberOfRecipientsLayout"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginRight="16dp"
|
android:layout_marginRight="16dp"
|
||||||
|
|
|
@ -9,8 +9,9 @@
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="@dimen/bottom_sheet_selected_item_title_height"
|
android:layout_height="wrap_content"
|
||||||
android:background="?attr/selectableItemBackground">
|
android:background="?attr/selectableItemBackground"
|
||||||
|
android:minHeight="@dimen/bottom_sheet_selected_item_title_height">
|
||||||
|
|
||||||
<CheckBox
|
<CheckBox
|
||||||
android:id="@+id/check_box"
|
android:id="@+id/check_box"
|
||||||
|
@ -34,11 +35,12 @@
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center_vertical"
|
android:layout_gravity="center_vertical"
|
||||||
android:layout_marginEnd="@dimen/content_padding"
|
android:layout_marginEnd="@dimen/content_padding"
|
||||||
android:layout_marginRight="@dimen/content_padding"
|
android:layout_marginRight="@dimen/content_padding"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
|
android:minHeight="@dimen/bottom_sheet_selected_item_title_height"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
|
@ -56,9 +58,9 @@
|
||||||
android:id="@+id/description"
|
android:id="@+id/description"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:ellipsize="end"
|
|
||||||
android:maxLines="1"
|
|
||||||
android:layout_marginTop="@dimen/map_widget_icon_margin"
|
android:layout_marginTop="@dimen/map_widget_icon_margin"
|
||||||
|
android:ellipsize="end"
|
||||||
|
android:maxLines="3"
|
||||||
android:textColor="?android:textColorSecondary"
|
android:textColor="?android:textColorSecondary"
|
||||||
android:textSize="@dimen/default_desc_text_size"
|
android:textSize="@dimen/default_desc_text_size"
|
||||||
tools:text="Oct 13, 2017 * 3 MB * 01:14"/>
|
tools:text="Oct 13, 2017 * 3 MB * 01:14"/>
|
||||||
|
|
|
@ -107,7 +107,7 @@
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center"
|
android:layout_gravity="center"
|
||||||
android:src="@drawable/ic_action_polygom_dark"/>
|
android:src="@drawable/ic_action_route_distance"/>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
<?xml version='1.0' encoding='UTF-8'?>
|
<?xml version='1.0' encoding='UTF-8'?>
|
||||||
<resources>
|
<resources>
|
||||||
|
<string name="av_locations_selected_desc">Файл GPX с координатами и данными выбранных заметок.</string>
|
||||||
|
<string name="av_locations_all_desc">Файл GPX с координатами и данными всех заметок.</string>
|
||||||
<string name="favorite_empty_place_name">Место</string>
|
<string name="favorite_empty_place_name">Место</string>
|
||||||
<string name="private_access_routing_req">Ваш пункт назначения находится на частной территории. Вы хотите разрешить доступ к частным дорогам для этой поездки?</string>
|
<string name="private_access_routing_req">Ваш пункт назначения находится на частной территории. Вы хотите разрешить доступ к частным дорогам для этой поездки?</string>
|
||||||
<string name="restart_search">Искать снова</string>
|
<string name="restart_search">Искать снова</string>
|
||||||
|
@ -432,7 +434,7 @@
|
||||||
<string name="amenity_type_user_defined">Пользовательские</string>
|
<string name="amenity_type_user_defined">Пользовательские</string>
|
||||||
<string name="fav_export_confirmation">Файл с избранными уже существует. Вы хотите его заменить?</string>
|
<string name="fav_export_confirmation">Файл с избранными уже существует. Вы хотите его заменить?</string>
|
||||||
<string name="profile_settings">Настройка профиля</string>
|
<string name="profile_settings">Настройка профиля</string>
|
||||||
<string name="settings_preset">Профиль</string>
|
<string name="settings_preset">Профиль по умолчанию</string>
|
||||||
<string name="settings_preset_descr">Выберите профиль работы приложения (в каждом профиле настройки хранятся отдельно).</string>
|
<string name="settings_preset_descr">Выберите профиль работы приложения (в каждом профиле настройки хранятся отдельно).</string>
|
||||||
<string name="global_settings">Общие настройки</string>
|
<string name="global_settings">Общие настройки</string>
|
||||||
<string name="global_app_settings">Общие настройки приложения</string>
|
<string name="global_app_settings">Общие настройки приложения</string>
|
||||||
|
|
|
@ -9,6 +9,8 @@
|
||||||
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="av_locations_selected_desc">GPX file with coordinates and data of the selected notes.</string>
|
||||||
|
<string name="av_locations_all_desc">GPX file with coordinates and data of all notes.</string>
|
||||||
<string name="release_3_0">
|
<string name="release_3_0">
|
||||||
\u2022 Detection of stop signs now considers driving direction\n\n
|
\u2022 Detection of stop signs now considers driving direction\n\n
|
||||||
\u2022 New algorithm providing meaningful ascent/descent values for GPX tracks\n\n
|
\u2022 New algorithm providing meaningful ascent/descent values for GPX tracks\n\n
|
||||||
|
@ -554,6 +556,7 @@
|
||||||
<string name="donations">Donations</string>
|
<string name="donations">Donations</string>
|
||||||
<string name="number_of_recipients">Number of recipients</string>
|
<string name="number_of_recipients">Number of recipients</string>
|
||||||
<string name="osm_user_stat">Edits %1$s, rank %2$s, total edits %3$s</string>
|
<string name="osm_user_stat">Edits %1$s, rank %2$s, total edits %3$s</string>
|
||||||
|
<string name="osm_recipient_stat">Edits %1$s, sum %2$s mBTC</string>
|
||||||
<string name="osm_editors_ranking">OSM Editors ranking</string>
|
<string name="osm_editors_ranking">OSM Editors ranking</string>
|
||||||
<string name="osm_live_subscription">OsmAnd Live subscription</string>
|
<string name="osm_live_subscription">OsmAnd Live subscription</string>
|
||||||
<string name="osm_live_subscribe_btn">Subscribe</string>
|
<string name="osm_live_subscribe_btn">Subscribe</string>
|
||||||
|
@ -2819,4 +2822,6 @@
|
||||||
<string name="import_track_desc">File %1$s does not contain waypoints, import it as a track?</string>
|
<string name="import_track_desc">File %1$s does not contain waypoints, import it as a track?</string>
|
||||||
<string name="move_point">Move Point</string>
|
<string name="move_point">Move Point</string>
|
||||||
<string name="add_segment_to_the_track">Add to a GPX track</string>
|
<string name="add_segment_to_the_track">Add to a GPX track</string>
|
||||||
|
<string name="osm_recipients_label">OSM Recipients</string>
|
||||||
|
<string name="total_donations">Total Donations</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -3,6 +3,9 @@
|
||||||
|
|
||||||
<cache-path
|
<cache-path
|
||||||
name="share"
|
name="share"
|
||||||
path="share" />
|
path="share"/>
|
||||||
|
|
||||||
|
<external-files-path
|
||||||
|
name="files"
|
||||||
|
path="/"/>
|
||||||
</paths>
|
</paths>
|
|
@ -118,7 +118,7 @@ public class ShowRouteInfoDialogFragment extends DialogFragment {
|
||||||
});
|
});
|
||||||
|
|
||||||
((ImageView) view.findViewById(R.id.distance_icon))
|
((ImageView) view.findViewById(R.id.distance_icon))
|
||||||
.setImageDrawable(app.getIconsCache().getThemedIcon(R.drawable.ic_action_polygom_dark));
|
.setImageDrawable(app.getIconsCache().getThemedIcon(R.drawable.ic_action_route_distance));
|
||||||
((ImageView) view.findViewById(R.id.time_icon))
|
((ImageView) view.findViewById(R.id.time_icon))
|
||||||
.setImageDrawable(app.getIconsCache().getThemedIcon(R.drawable.ic_action_time_span));
|
.setImageDrawable(app.getIconsCache().getThemedIcon(R.drawable.ic_action_time_span));
|
||||||
|
|
||||||
|
|
|
@ -481,6 +481,15 @@ public class AudioVideoNotesPlugin extends OsmandPlugin {
|
||||||
return date + " • " + sz + " • " + getDuration(ctx, false);
|
return date + " • " + sz + " • " + getDuration(ctx, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getTypeWithDuration(Context ctx) {
|
||||||
|
StringBuilder res = new StringBuilder(getType(ctx));
|
||||||
|
if (isAudio() || isVideo()) {
|
||||||
|
updateInternalDescription();
|
||||||
|
res.append(", ").append(getDuration(ctx, false));
|
||||||
|
}
|
||||||
|
return res.toString();
|
||||||
|
}
|
||||||
|
|
||||||
public String getPlainDuration(boolean accessibilityEnabled) {
|
public String getPlainDuration(boolean accessibilityEnabled) {
|
||||||
updateInternalDescription();
|
updateInternalDescription();
|
||||||
if (duration > 0) {
|
if (duration > 0) {
|
||||||
|
|
|
@ -10,6 +10,7 @@ import android.os.Bundle;
|
||||||
import android.support.annotation.Nullable;
|
import android.support.annotation.Nullable;
|
||||||
import android.support.v4.app.Fragment;
|
import android.support.v4.app.Fragment;
|
||||||
import android.support.v4.app.FragmentManager;
|
import android.support.v4.app.FragmentManager;
|
||||||
|
import android.support.v4.content.FileProvider;
|
||||||
import android.support.v7.app.AlertDialog;
|
import android.support.v7.app.AlertDialog;
|
||||||
import android.support.v7.view.ActionMode;
|
import android.support.v7.view.ActionMode;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
|
@ -453,16 +454,17 @@ public class NotesFragment extends OsmAndListFragment {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void shareItems(Set<Recording> selected) {
|
private void shareItems(Set<Recording> selected) {
|
||||||
ArrayList<Uri> files = new ArrayList<>();
|
ArrayList<Uri> uris = new ArrayList<>();
|
||||||
for (Recording rec : selected) {
|
for (Recording rec : selected) {
|
||||||
File file = rec == SHARE_LOCATION_FILE ? generateGPXForRecordings(selected) : rec.getFile();
|
File file = rec == SHARE_LOCATION_FILE ? generateGPXForRecordings(selected) : rec.getFile();
|
||||||
if (file != null) {
|
if (file != null) {
|
||||||
files.add(Uri.parse(file.getAbsolutePath()));
|
uris.add(FileProvider.getUriForFile(getContext(), getActivity().getPackageName() + ".fileprovider", file));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Intent intent = new Intent(Intent.ACTION_SEND_MULTIPLE);
|
Intent intent = new Intent(Intent.ACTION_SEND_MULTIPLE);
|
||||||
intent.setType("*/*");
|
intent.setType("*/*");
|
||||||
intent.putExtra(Intent.EXTRA_STREAM, files);
|
intent.putExtra(Intent.EXTRA_STREAM, uris);
|
||||||
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
|
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
|
||||||
if (Build.VERSION.SDK_INT > 18) {
|
if (Build.VERSION.SDK_INT > 18) {
|
||||||
intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true);
|
intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true);
|
||||||
|
@ -470,16 +472,18 @@ public class NotesFragment extends OsmAndListFragment {
|
||||||
startActivity(Intent.createChooser(intent, getString(R.string.share_note)));
|
startActivity(Intent.createChooser(intent, getString(R.string.share_note)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
private Set<Recording> getRecordingsForGpx(Set<Recording> selected) {
|
||||||
private File generateGPXForRecordings(Set<Recording> selected) {
|
if (selected.size() == 1 && selected.contains(SHARE_LOCATION_FILE)) {
|
||||||
File externalCacheDir = getActivity().getExternalCacheDir();
|
return new HashSet<>(plugin.getAllRecordings());
|
||||||
if (externalCacheDir == null) {
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
File tmpFile = new File(externalCacheDir, "share/noteLocations.gpx");
|
return selected;
|
||||||
|
}
|
||||||
|
|
||||||
|
private File generateGPXForRecordings(Set<Recording> selected) {
|
||||||
|
File tmpFile = new File(getActivity().getCacheDir(), "share/noteLocations.gpx");
|
||||||
tmpFile.getParentFile().mkdirs();
|
tmpFile.getParentFile().mkdirs();
|
||||||
GPXFile file = new GPXFile();
|
GPXFile file = new GPXFile();
|
||||||
for (Recording r : selected) {
|
for (Recording r : getRecordingsForGpx(selected)) {
|
||||||
if (r != SHARE_LOCATION_FILE) {
|
if (r != SHARE_LOCATION_FILE) {
|
||||||
String desc = r.getDescriptionName(r.getFileName());
|
String desc = r.getDescriptionName(r.getFileName());
|
||||||
if (desc == null) {
|
if (desc == null) {
|
||||||
|
@ -492,6 +496,7 @@ public class NotesFragment extends OsmAndListFragment {
|
||||||
wpt.link = r.getFileName();
|
wpt.link = r.getFileName();
|
||||||
wpt.time = r.getFile().lastModified();
|
wpt.time = r.getFile().lastModified();
|
||||||
wpt.category = r.getSearchHistoryType();
|
wpt.category = r.getSearchHistoryType();
|
||||||
|
wpt.desc = r.getTypeWithDuration(getContext());
|
||||||
getMyApplication().getSelectedGpxHelper().addPoint(wpt, file);
|
getMyApplication().getSelectedGpxHelper().addPoint(wpt, file);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -205,7 +205,7 @@ public class NotesAdapter extends ArrayAdapter<Object> {
|
||||||
setupBackground(holder.view);
|
setupBackground(holder.view);
|
||||||
if (recording == NotesFragment.SHARE_LOCATION_FILE) {
|
if (recording == NotesFragment.SHARE_LOCATION_FILE) {
|
||||||
holder.title.setText(R.string.av_locations);
|
holder.title.setText(R.string.av_locations);
|
||||||
holder.description.setText(R.string.av_locations_descr);
|
holder.description.setText(getLocationsDescId());
|
||||||
} else {
|
} else {
|
||||||
holder.title.setText(recording.getName(app, true));
|
holder.title.setText(recording.getName(app, true));
|
||||||
holder.description.setText(recording.getExtendedDescription(app));
|
holder.description.setText(recording.getExtendedDescription(app));
|
||||||
|
@ -255,6 +255,13 @@ public class NotesAdapter extends ArrayAdapter<Object> {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private int getLocationsDescId() {
|
||||||
|
if (selected.contains(NotesFragment.SHARE_LOCATION_FILE)) {
|
||||||
|
return selected.size() == 1 ? R.string.av_locations_all_desc : R.string.av_locations_selected_desc;
|
||||||
|
}
|
||||||
|
return R.string.av_locations_descr;
|
||||||
|
}
|
||||||
|
|
||||||
private void setupBackground(View view) {
|
private void setupBackground(View view) {
|
||||||
if (!portrait) {
|
if (!portrait) {
|
||||||
view.setBackgroundColor(ContextCompat.getColor(getContext(), R.color.color_transparent));
|
view.setBackgroundColor(ContextCompat.getColor(getContext(), R.color.color_transparent));
|
||||||
|
|
|
@ -23,6 +23,9 @@ public final class Protocol {
|
||||||
public int regionCount;
|
public int regionCount;
|
||||||
public float regionPercentage;
|
public float regionPercentage;
|
||||||
public float btc;
|
public float btc;
|
||||||
|
public float eur;
|
||||||
|
public float eurRate;
|
||||||
|
public Recipient[] rows;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class UserRankingByMonth {
|
public static class UserRankingByMonth {
|
||||||
|
@ -48,5 +51,13 @@ public final class Protocol {
|
||||||
public int users;
|
public int users;
|
||||||
public int changes;
|
public int changes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static class Recipient {
|
||||||
|
String osmid;
|
||||||
|
int changes;
|
||||||
|
String btcaddress;
|
||||||
|
int rank;
|
||||||
|
int weight;
|
||||||
|
float btc;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,6 +18,7 @@ import android.view.ViewGroup;
|
||||||
import android.widget.AdapterView;
|
import android.widget.AdapterView;
|
||||||
import android.widget.ArrayAdapter;
|
import android.widget.ArrayAdapter;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
|
import android.widget.LinearLayout;
|
||||||
import android.widget.ProgressBar;
|
import android.widget.ProgressBar;
|
||||||
import android.widget.Spinner;
|
import android.widget.Spinner;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
@ -52,6 +53,8 @@ public class ReportsFragment extends BaseOsmAndFragment implements CountrySelect
|
||||||
|
|
||||||
private static final Log LOG = PlatformUtil.getLog(ReportsFragment.class);
|
private static final Log LOG = PlatformUtil.getLog(ReportsFragment.class);
|
||||||
public static final String OSM_LIVE_URL = "https://osmand.net/osm_live";
|
public static final String OSM_LIVE_URL = "https://osmand.net/osm_live";
|
||||||
|
public static final String EDITS_FRAGMENT = "NumberOfEditsFragment";
|
||||||
|
public static final String RECIPIENTS_FRAGMENT = "RecipientsFragment";
|
||||||
|
|
||||||
private TextView contributorsTextView;
|
private TextView contributorsTextView;
|
||||||
private TextView editsTextView;
|
private TextView editsTextView;
|
||||||
|
@ -70,11 +73,15 @@ public class ReportsFragment extends BaseOsmAndFragment implements CountrySelect
|
||||||
private ImageView numberOfEditsIcon;
|
private ImageView numberOfEditsIcon;
|
||||||
private ImageView donationsIcon;
|
private ImageView donationsIcon;
|
||||||
private ImageView numberOfRecipientsIcon;
|
private ImageView numberOfRecipientsIcon;
|
||||||
|
private ImageView donationsTotalIcon;
|
||||||
|
private TextView donationsTotalTitle;
|
||||||
|
private TextView donationsTotalTextView;
|
||||||
private TextView numberOfContributorsTitle;
|
private TextView numberOfContributorsTitle;
|
||||||
private TextView numberOfEditsTitle;
|
private TextView numberOfEditsTitle;
|
||||||
private TextView numberOfRecipientsTitle;
|
private TextView numberOfRecipientsTitle;
|
||||||
private TextView donationsTitle;
|
private TextView donationsTitle;
|
||||||
private ProgressBar progressBar;
|
private ProgressBar progressBar;
|
||||||
|
private LinearLayout donationsTotalLayout;
|
||||||
|
|
||||||
private int inactiveColor;
|
private int inactiveColor;
|
||||||
private int textColorPrimary;
|
private int textColorPrimary;
|
||||||
|
@ -129,15 +136,17 @@ public class ReportsFragment extends BaseOsmAndFragment implements CountrySelect
|
||||||
String countryUrlString = selectedCountryItem.getDownloadName();
|
String countryUrlString = selectedCountryItem.getDownloadName();
|
||||||
if (countryUrlString.length() > 0) {
|
if (countryUrlString.length() > 0) {
|
||||||
Bundle bl = new Bundle();
|
Bundle bl = new Bundle();
|
||||||
|
boolean isRecipientsReport = v.getId() == R.id.numberOfRecipientsLayout;
|
||||||
bl.putString(UsersReportFragment.URL_REQUEST,
|
bl.putString(UsersReportFragment.URL_REQUEST,
|
||||||
String.format(USERS_RANKING_BY_MONTH, monthUrlString, countryUrlString));
|
String.format(isRecipientsReport ? RECIPIENTS_BY_MONTH : USERS_RANKING_BY_MONTH, monthUrlString, countryUrlString));
|
||||||
userReportFragment.setArguments(bl);
|
userReportFragment.setArguments(bl);
|
||||||
userReportFragment.show(getChildFragmentManager(), "NumberOfEditsFramgnet");
|
userReportFragment.show(getChildFragmentManager(), isRecipientsReport ? RECIPIENTS_FRAGMENT : EDITS_FRAGMENT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
view.findViewById(R.id.numberOfContributorsLayout).setOnClickListener(listener);
|
view.findViewById(R.id.numberOfContributorsLayout).setOnClickListener(listener);
|
||||||
view.findViewById(R.id.numberOfEditsLayout).setOnClickListener(listener);
|
view.findViewById(R.id.numberOfEditsLayout).setOnClickListener(listener);
|
||||||
|
view.findViewById(R.id.numberOfRecipientsLayout).setOnClickListener(listener);
|
||||||
|
|
||||||
countrySelectionFragment.initCountries(getMyApplication());
|
countrySelectionFragment.initCountries(getMyApplication());
|
||||||
selectedCountryItem = countrySelectionFragment.getCountryItems().get(0);
|
selectedCountryItem = countrySelectionFragment.getCountryItems().get(0);
|
||||||
|
@ -155,9 +164,11 @@ public class ReportsFragment extends BaseOsmAndFragment implements CountrySelect
|
||||||
numberOfEditsIcon = (ImageView) view.findViewById(R.id.numberOfEditsIcon);
|
numberOfEditsIcon = (ImageView) view.findViewById(R.id.numberOfEditsIcon);
|
||||||
numberOfRecipientsIcon = (ImageView) view.findViewById(R.id.numberOfRecipientsIcon);
|
numberOfRecipientsIcon = (ImageView) view.findViewById(R.id.numberOfRecipientsIcon);
|
||||||
donationsIcon = (ImageView) view.findViewById(R.id.donationsIcon);
|
donationsIcon = (ImageView) view.findViewById(R.id.donationsIcon);
|
||||||
|
donationsTotalIcon = (ImageView) view.findViewById(R.id.donationsTotalIcon);
|
||||||
setThemedDrawable(numberOfContributorsIcon, R.drawable.ic_action_group2);
|
setThemedDrawable(numberOfContributorsIcon, R.drawable.ic_action_group2);
|
||||||
setThemedDrawable(numberOfRecipientsIcon, R.drawable.ic_group);
|
setThemedDrawable(numberOfRecipientsIcon, R.drawable.ic_group);
|
||||||
setThemedDrawable(donationsIcon, R.drawable.ic_action_bitcoin);
|
setThemedDrawable(donationsIcon, R.drawable.ic_action_bitcoin);
|
||||||
|
setThemedDrawable(donationsTotalIcon, R.drawable.ic_action_bitcoin);
|
||||||
setThemedDrawable(numberOfEditsIcon, R.drawable.ic_map);
|
setThemedDrawable(numberOfEditsIcon, R.drawable.ic_map);
|
||||||
|
|
||||||
|
|
||||||
|
@ -165,6 +176,10 @@ public class ReportsFragment extends BaseOsmAndFragment implements CountrySelect
|
||||||
numberOfEditsTitle = (TextView) view.findViewById(R.id.numberOfEditsTitle);
|
numberOfEditsTitle = (TextView) view.findViewById(R.id.numberOfEditsTitle);
|
||||||
donationsTitle = (TextView) view.findViewById(R.id.donationsTitle);
|
donationsTitle = (TextView) view.findViewById(R.id.donationsTitle);
|
||||||
numberOfRecipientsTitle = (TextView) view.findViewById(R.id.numberOfRecipientsTitle);
|
numberOfRecipientsTitle = (TextView) view.findViewById(R.id.numberOfRecipientsTitle);
|
||||||
|
donationsTotalLayout = (LinearLayout) view.findViewById(R.id.donationsTotal);
|
||||||
|
donationsTotalTitle = (TextView) view.findViewById(R.id.donationsTotalTitle);
|
||||||
|
donationsTotalTextView = (TextView) view.findViewById(R.id.donationsTotalTextView);
|
||||||
|
|
||||||
|
|
||||||
progressBar = (ProgressBar) view.findViewById(R.id.progress);
|
progressBar = (ProgressBar) view.findViewById(R.id.progress);
|
||||||
|
|
||||||
|
@ -203,7 +218,7 @@ public class ReportsFragment extends BaseOsmAndFragment implements CountrySelect
|
||||||
tryUpdateData(monthUrlString, countryUrlString);
|
tryUpdateData(monthUrlString, countryUrlString);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void tryUpdateData(String monthUrlString, String regionUrlString) {
|
private void tryUpdateData(String monthUrlString, final String regionUrlString) {
|
||||||
GetJsonAsyncTask.OnResponseListener<Protocol.TotalChangesByMonthResponse> onResponseListener =
|
GetJsonAsyncTask.OnResponseListener<Protocol.TotalChangesByMonthResponse> onResponseListener =
|
||||||
new GetJsonAsyncTask.OnResponseListener<Protocol.TotalChangesByMonthResponse>() {
|
new GetJsonAsyncTask.OnResponseListener<Protocol.TotalChangesByMonthResponse>() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -251,24 +266,32 @@ public class ReportsFragment extends BaseOsmAndFragment implements CountrySelect
|
||||||
recipientsTextView.setText(String.valueOf(response.regionCount));
|
recipientsTextView.setText(String.valueOf(response.regionCount));
|
||||||
}
|
}
|
||||||
if (donationsTextView != null) {
|
if (donationsTextView != null) {
|
||||||
donationsTextView.setText(String.format("%.3f", response.regionBtc*1000.0) + " mBTC");
|
donationsTextView.setText(String.format("%.3f", response.regionBtc*1000f) + " mBTC");
|
||||||
|
}
|
||||||
|
if (donationsTotalLayout != null &&
|
||||||
|
donationsTotalTextView != null) {
|
||||||
|
donationsTotalLayout.setVisibility(regionUrlString.isEmpty() ? View.VISIBLE : View.GONE);
|
||||||
|
donationsTotalTextView.setText(String.format("%.3f", response.btc*1000f) + " mBTC");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
disableProgress();
|
disableProgress();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
recChangesByMontAsyncTask.setOnResponseListener(recResponseListener);
|
recChangesByMontAsyncTask.setOnResponseListener(recResponseListener);
|
||||||
|
clearTextViewResult(recipientsTextView);
|
||||||
|
clearTextViewResult(donationsTextView);
|
||||||
|
clearTextViewResult(donationsTotalTextView);
|
||||||
|
|
||||||
if (recipientsTextView != null) {
|
|
||||||
recipientsTextView.setText("-");
|
|
||||||
}
|
|
||||||
if (donationsTextView != null) {
|
|
||||||
donationsTextView.setText("-");
|
|
||||||
}
|
|
||||||
String recfinalUrl = String.format(RECIPIENTS_BY_MONTH, monthUrlString, regionUrlString);
|
String recfinalUrl = String.format(RECIPIENTS_BY_MONTH, monthUrlString, regionUrlString);
|
||||||
recChangesByMontAsyncTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, recfinalUrl);
|
recChangesByMontAsyncTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, recfinalUrl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void clearTextViewResult(TextView textView) {
|
||||||
|
if (textView != null) {
|
||||||
|
textView.setText("-");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSearchResult(CountryItem item) {
|
public void onSearchResult(CountryItem item) {
|
||||||
selectedCountryItem = item;
|
selectedCountryItem = item;
|
||||||
|
@ -364,16 +387,19 @@ public class ReportsFragment extends BaseOsmAndFragment implements CountrySelect
|
||||||
numberOfEditsIcon.setImageDrawable(getPaintedContentIcon(R.drawable.ic_map, inactiveColor));
|
numberOfEditsIcon.setImageDrawable(getPaintedContentIcon(R.drawable.ic_map, inactiveColor));
|
||||||
numberOfRecipientsIcon.setImageDrawable(getPaintedContentIcon(R.drawable.ic_group, inactiveColor));
|
numberOfRecipientsIcon.setImageDrawable(getPaintedContentIcon(R.drawable.ic_group, inactiveColor));
|
||||||
donationsIcon.setImageDrawable(getPaintedContentIcon(R.drawable.ic_action_bitcoin, inactiveColor));
|
donationsIcon.setImageDrawable(getPaintedContentIcon(R.drawable.ic_action_bitcoin, inactiveColor));
|
||||||
|
donationsTotalIcon.setImageDrawable(getPaintedContentIcon(R.drawable.ic_action_bitcoin, inactiveColor));
|
||||||
|
|
||||||
numberOfContributorsTitle.setTextColor(inactiveColor);
|
numberOfContributorsTitle.setTextColor(inactiveColor);
|
||||||
numberOfEditsTitle.setTextColor(inactiveColor);
|
numberOfEditsTitle.setTextColor(inactiveColor);
|
||||||
numberOfRecipientsTitle.setTextColor(inactiveColor);
|
numberOfRecipientsTitle.setTextColor(inactiveColor);
|
||||||
donationsTitle.setTextColor(inactiveColor);
|
donationsTitle.setTextColor(inactiveColor);
|
||||||
|
donationsTotalTitle.setTextColor(inactiveColor);
|
||||||
|
|
||||||
progressBar.setVisibility(View.VISIBLE);
|
progressBar.setVisibility(View.VISIBLE);
|
||||||
|
|
||||||
contributorsTextView.setTextColor(inactiveColor);
|
contributorsTextView.setTextColor(inactiveColor);
|
||||||
donationsTextView.setTextColor(inactiveColor);
|
donationsTextView.setTextColor(inactiveColor);
|
||||||
|
donationsTotalTextView.setTextColor(inactiveColor);
|
||||||
recipientsTextView.setTextColor(inactiveColor);
|
recipientsTextView.setTextColor(inactiveColor);
|
||||||
editsTextView.setTextColor(inactiveColor);
|
editsTextView.setTextColor(inactiveColor);
|
||||||
}
|
}
|
||||||
|
@ -383,17 +409,20 @@ public class ReportsFragment extends BaseOsmAndFragment implements CountrySelect
|
||||||
numberOfEditsIcon.setImageDrawable(getContentIcon(R.drawable.ic_map));
|
numberOfEditsIcon.setImageDrawable(getContentIcon(R.drawable.ic_map));
|
||||||
numberOfRecipientsIcon.setImageDrawable(getContentIcon(R.drawable.ic_group));
|
numberOfRecipientsIcon.setImageDrawable(getContentIcon(R.drawable.ic_group));
|
||||||
donationsIcon.setImageDrawable(getContentIcon(R.drawable.ic_action_bitcoin));
|
donationsIcon.setImageDrawable(getContentIcon(R.drawable.ic_action_bitcoin));
|
||||||
|
donationsTotalIcon.setImageDrawable(getContentIcon(R.drawable.ic_action_bitcoin));
|
||||||
|
|
||||||
numberOfContributorsTitle.setTextColor(textColorSecondary);
|
numberOfContributorsTitle.setTextColor(textColorSecondary);
|
||||||
numberOfEditsTitle.setTextColor(textColorSecondary);
|
numberOfEditsTitle.setTextColor(textColorSecondary);
|
||||||
numberOfRecipientsTitle.setTextColor(textColorSecondary);
|
numberOfRecipientsTitle.setTextColor(textColorSecondary);
|
||||||
donationsTitle.setTextColor(textColorSecondary);
|
donationsTitle.setTextColor(textColorSecondary);
|
||||||
|
donationsTotalTitle.setTextColor(textColorSecondary);
|
||||||
|
|
||||||
progressBar.setVisibility(View.INVISIBLE);
|
progressBar.setVisibility(View.INVISIBLE);
|
||||||
|
|
||||||
contributorsTextView.setTextColor(textColorPrimary);
|
contributorsTextView.setTextColor(textColorPrimary);
|
||||||
editsTextView.setTextColor(textColorPrimary);
|
editsTextView.setTextColor(textColorPrimary);
|
||||||
donationsTextView.setTextColor(textColorPrimary);
|
donationsTextView.setTextColor(textColorPrimary);
|
||||||
|
donationsTotalTextView.setTextColor(textColorPrimary);
|
||||||
recipientsTextView.setTextColor(textColorPrimary);
|
recipientsTextView.setTextColor(textColorPrimary);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
package net.osmand.plus.liveupdates;
|
package net.osmand.plus.liveupdates;
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
|
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.base.BaseOsmAndDialogFragment;
|
import net.osmand.plus.base.BaseOsmAndDialogFragment;
|
||||||
import net.osmand.plus.liveupdates.Protocol.RankingUserByMonthResponse;
|
import net.osmand.plus.liveupdates.Protocol.RankingUserByMonthResponse;
|
||||||
|
@ -32,27 +30,48 @@ public class UsersReportFragment extends BaseOsmAndDialogFragment {
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||||
final View view = inflater.inflate(R.layout.fragment_simple_list, container, false);
|
final View view = inflater.inflate(R.layout.fragment_simple_list, container, false);
|
||||||
ListView listView = (ListView) view.findViewById(android.R.id.list);
|
ListView listView = (ListView) view.findViewById(android.R.id.list);
|
||||||
final ArrayAdapter<UserRankingByMonth> adapter = new ListAdapter(getListItemIcon());
|
final ArrayAdapter<Object> adapter = new ListAdapter(getListItemIcon());
|
||||||
String url = getArguments().getString(URL_REQUEST);
|
String url = getArguments().getString(URL_REQUEST);
|
||||||
//String reg = getArguments().getString(REGION_NAME);
|
//String reg = getArguments().getString(REGION_NAME);
|
||||||
view.findViewById(R.id.progress).setVisibility(View.VISIBLE);
|
view.findViewById(R.id.progress).setVisibility(View.VISIBLE);
|
||||||
((TextView)view.findViewById(R.id.titleTextView)).setText(R.string.osm_editors_ranking);
|
if (getTag().equals(ReportsFragment.EDITS_FRAGMENT)) {
|
||||||
GetJsonAsyncTask<RankingUserByMonthResponse> task = new GetJsonAsyncTask<>(RankingUserByMonthResponse.class);
|
((TextView) view.findViewById(R.id.titleTextView)).setText(R.string.osm_editors_ranking);
|
||||||
task.setOnResponseListener(new OnResponseListener<Protocol.RankingUserByMonthResponse>() {
|
GetJsonAsyncTask<RankingUserByMonthResponse> task = new GetJsonAsyncTask<>(RankingUserByMonthResponse.class);
|
||||||
|
task.setOnResponseListener(new OnResponseListener<Protocol.RankingUserByMonthResponse>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onResponse(RankingUserByMonthResponse response) {
|
public void onResponse(RankingUserByMonthResponse response) {
|
||||||
if (response != null && response.rows != null) {
|
if (response != null && response.rows != null) {
|
||||||
for (UserRankingByMonth rankingByMonth : response.rows) {
|
for (UserRankingByMonth rankingByMonth : response.rows) {
|
||||||
adapter.add(rankingByMonth);
|
if (rankingByMonth != null) {
|
||||||
|
adapter.add(rankingByMonth);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
view.findViewById(R.id.progress).setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
view.findViewById(R.id.progress).setVisibility(View.GONE);
|
});
|
||||||
}
|
task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, url);
|
||||||
});
|
} else if (getTag().equals(ReportsFragment.RECIPIENTS_FRAGMENT)) {
|
||||||
task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, url);
|
((TextView)view.findViewById(R.id.titleTextView)).setText(R.string.osm_recipients_label);
|
||||||
|
GetJsonAsyncTask<Protocol.RecipientsByMonth> task = new GetJsonAsyncTask<>(Protocol.RecipientsByMonth.class);
|
||||||
|
task.setOnResponseListener(new OnResponseListener<Protocol.RecipientsByMonth>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onResponse(Protocol.RecipientsByMonth response) {
|
||||||
|
if (response != null && response.rows != null) {
|
||||||
|
for (Protocol.Recipient recipient : response.rows) {
|
||||||
|
if (recipient != null) {
|
||||||
|
adapter.add(recipient);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
view.findViewById(R.id.progress).setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, url);
|
||||||
|
}
|
||||||
listView.setAdapter(adapter);
|
listView.setAdapter(adapter);
|
||||||
|
|
||||||
ImageButton clearButton = (ImageButton) view.findViewById(R.id.closeButton);
|
ImageButton clearButton = (ImageButton) view.findViewById(R.id.closeButton);
|
||||||
//setThemedDrawable(clearButton, R.drawable.ic_action_remove_dark);
|
//setThemedDrawable(clearButton, R.drawable.ic_action_remove_dark);
|
||||||
clearButton.setOnClickListener(new View.OnClickListener() {
|
clearButton.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@ -74,7 +93,7 @@ public class UsersReportFragment extends BaseOsmAndDialogFragment {
|
||||||
super.onDetach();
|
super.onDetach();
|
||||||
}
|
}
|
||||||
|
|
||||||
private class ListAdapter extends ArrayAdapter<UserRankingByMonth> {
|
private class ListAdapter extends ArrayAdapter<Object> {
|
||||||
private final Drawable drawableLeft;
|
private final Drawable drawableLeft;
|
||||||
@ColorInt
|
@ColorInt
|
||||||
private final int textColor;
|
private final int textColor;
|
||||||
|
@ -93,22 +112,28 @@ public class UsersReportFragment extends BaseOsmAndDialogFragment {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View getView(int position, View convertView, ViewGroup parent) {
|
public View getView(int position, View v, ViewGroup parent) {
|
||||||
UserRankingByMonth item = getItem(position);
|
|
||||||
View v = convertView;
|
|
||||||
if (v == null) {
|
if (v == null) {
|
||||||
LayoutInflater inflater = getActivity().getLayoutInflater();
|
v = getActivity().getLayoutInflater().inflate(android.R.layout.simple_list_item_2, parent, false);
|
||||||
v = inflater.inflate(android.R.layout.simple_list_item_2, parent, false);
|
|
||||||
}
|
}
|
||||||
TextView text1 = (TextView) v.findViewById(android.R.id.text1);
|
TextView text1 = (TextView) v.findViewById(android.R.id.text1);
|
||||||
TextView text2 = (TextView) v.findViewById(android.R.id.text2);
|
TextView text2 = (TextView) v.findViewById(android.R.id.text2);
|
||||||
text1.setText(item.user);
|
|
||||||
text2.setText(getString(R.string.osm_user_stat,
|
|
||||||
String.valueOf(item.changes), String.valueOf(item.rank), String.valueOf(item.globalchanges)));
|
|
||||||
text1.setTextColor(textColor);
|
text1.setTextColor(textColor);
|
||||||
text2.setTextColor(textSecondaryColor);
|
text2.setTextColor(textSecondaryColor);
|
||||||
text1.setCompoundDrawablesWithIntrinsicBounds(drawableLeft, null, null, null);
|
text1.setCompoundDrawablesWithIntrinsicBounds(drawableLeft, null, null, null);
|
||||||
text1.setCompoundDrawablePadding(getResources().getDimensionPixelSize(R.dimen.list_content_padding));
|
text1.setCompoundDrawablePadding(getResources().getDimensionPixelSize(R.dimen.list_content_padding));
|
||||||
|
Object item = getItem(position);
|
||||||
|
if (item instanceof UserRankingByMonth) {
|
||||||
|
UserRankingByMonth rankingByMonth = (UserRankingByMonth) item;
|
||||||
|
text1.setText(rankingByMonth.user);
|
||||||
|
text2.setText(getString(R.string.osm_user_stat,
|
||||||
|
String.valueOf(rankingByMonth.changes), String.valueOf(rankingByMonth.rank), String.valueOf(rankingByMonth.globalchanges)));
|
||||||
|
} else if (item instanceof Protocol.Recipient){
|
||||||
|
Protocol.Recipient recipient = (Protocol.Recipient) item;
|
||||||
|
text1.setText(recipient.osmid);
|
||||||
|
text2.setText(getString(R.string.osm_recipient_stat,
|
||||||
|
String.valueOf(recipient.changes), String.format("%.4f", (recipient.btc*1000f))));
|
||||||
|
}
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -201,9 +201,11 @@ public class AdvancedEditPoiFragment extends BaseOsmAndFragment
|
||||||
if (!hasFocus) {
|
if (!hasFocus) {
|
||||||
if (!editPoiData.isInEdit()) {
|
if (!editPoiData.isInEdit()) {
|
||||||
String s = tagEditText.getText().toString();
|
String s = tagEditText.getText().toString();
|
||||||
editPoiData.removeTag(previousTag[0]);
|
if (!previousTag[0].equals(s)) {
|
||||||
editPoiData.putTag(s.toString(), valueEditText.getText().toString());
|
editPoiData.removeTag(previousTag[0]);
|
||||||
previousTag[0] = s.toString();
|
editPoiData.putTag(s, valueEditText.getText().toString());
|
||||||
|
previousTag[0] = s;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
tagAdapter.getFilter().filter(tagEditText.getText());
|
tagAdapter.getFilter().filter(tagEditText.getText());
|
||||||
|
|
|
@ -37,7 +37,7 @@ public class EditPoiData {
|
||||||
category = app.getPoiTypes().getOtherPoiCategory();
|
category = app.getPoiTypes().getOtherPoiCategory();
|
||||||
entity = node;
|
entity = node;
|
||||||
initTags(node);
|
initTags(node);
|
||||||
updateTypeTag(getPoiTypeString());
|
updateTypeTag(getPoiTypeString(), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<String, PoiType> getAllTranslatedSubTypes() {
|
public Map<String, PoiType> getAllTranslatedSubTypes() {
|
||||||
|
@ -109,15 +109,18 @@ public class EditPoiData {
|
||||||
public Map<String, String> getTagValues() {
|
public Map<String, String> getTagValues() {
|
||||||
return Collections.unmodifiableMap(tagValues);
|
return Collections.unmodifiableMap(tagValues);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void putTag(String tag, String value) {
|
public void putTag(String tag, String value) {
|
||||||
checkNotInEdit();
|
checkNotInEdit();
|
||||||
try {
|
try {
|
||||||
isInEdit = true;
|
isInEdit = true;
|
||||||
tagValues.remove(REMOVE_TAG_PREFIX+tag);
|
tagValues.remove(REMOVE_TAG_PREFIX+tag);
|
||||||
|
String oldValue = tagValues.get(tag);
|
||||||
|
if (oldValue == null || !oldValue.equals(value)) {
|
||||||
|
changedTags.add(tag);
|
||||||
|
}
|
||||||
tagValues.put(tag, value);
|
tagValues.put(tag, value);
|
||||||
changedTags.add(tag);
|
|
||||||
notifyDatasetChanged(tag);
|
notifyDatasetChanged(tag);
|
||||||
} finally {
|
} finally {
|
||||||
isInEdit = false;
|
isInEdit = false;
|
||||||
|
@ -193,9 +196,11 @@ public class EditPoiData {
|
||||||
return hasChangesBeenMade;
|
return hasChangesBeenMade;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateTypeTag(String string) {
|
public void updateTypeTag(String string, boolean userChanges) {
|
||||||
tagValues.put(POI_TYPE_TAG, string);
|
tagValues.put(POI_TYPE_TAG, string);
|
||||||
changedTags.add(POI_TYPE_TAG);
|
if (userChanges) {
|
||||||
|
changedTags.add(POI_TYPE_TAG);
|
||||||
|
}
|
||||||
retrieveType();
|
retrieveType();
|
||||||
PoiType pt = getPoiTypeDefined();
|
PoiType pt = getPoiTypeDefined();
|
||||||
if(pt != null) {
|
if(pt != null) {
|
||||||
|
|
|
@ -258,6 +258,7 @@ public class EditPoiDialogFragment extends BaseOsmAndDialogFragment {
|
||||||
poiNameEditText.setText(editPoiData.getTag(OSMSettings.OSMTagKey.NAME.getValue()));
|
poiNameEditText.setText(editPoiData.getTag(OSMSettings.OSMTagKey.NAME.getValue()));
|
||||||
poiTypeTextInputLayout = (TextInputLayout) view.findViewById(R.id.poiTypeTextInputLayout);
|
poiTypeTextInputLayout = (TextInputLayout) view.findViewById(R.id.poiTypeTextInputLayout);
|
||||||
poiTypeEditText = (AutoCompleteTextView) view.findViewById(R.id.poiTypeEditText);
|
poiTypeEditText = (AutoCompleteTextView) view.findViewById(R.id.poiTypeEditText);
|
||||||
|
poiTypeEditText.setText(editPoiData.getPoiTypeString());
|
||||||
poiTypeEditText.addTextChangedListener(new TextWatcher() {
|
poiTypeEditText.addTextChangedListener(new TextWatcher() {
|
||||||
@Override
|
@Override
|
||||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
||||||
|
@ -270,7 +271,7 @@ public class EditPoiDialogFragment extends BaseOsmAndDialogFragment {
|
||||||
@Override
|
@Override
|
||||||
public void afterTextChanged(Editable s) {
|
public void afterTextChanged(Editable s) {
|
||||||
if (!getEditPoiData().isInEdit()) {
|
if (!getEditPoiData().isInEdit()) {
|
||||||
getEditPoiData().updateTypeTag(s.toString());
|
getEditPoiData().updateTypeTag(s.toString(), true);
|
||||||
if (!getMyApplication().isApplicationInitializing()) {
|
if (!getMyApplication().isApplicationInitializing()) {
|
||||||
poiTypeTextInputLayout.setHint(editPoiData.getPoiCategory().getTranslation());
|
poiTypeTextInputLayout.setHint(editPoiData.getPoiCategory().getTranslation());
|
||||||
}
|
}
|
||||||
|
@ -279,7 +280,6 @@ public class EditPoiDialogFragment extends BaseOsmAndDialogFragment {
|
||||||
});
|
});
|
||||||
poiNameEditText.setOnEditorActionListener(mOnEditorActionListener);
|
poiNameEditText.setOnEditorActionListener(mOnEditorActionListener);
|
||||||
poiTypeEditText.setOnEditorActionListener(mOnEditorActionListener);
|
poiTypeEditText.setOnEditorActionListener(mOnEditorActionListener);
|
||||||
poiTypeEditText.setText(editPoiData.getPoiTypeString());
|
|
||||||
poiTypeEditText.setOnTouchListener(new View.OnTouchListener() {
|
poiTypeEditText.setOnTouchListener(new View.OnTouchListener() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onTouch(final View v, MotionEvent event) {
|
public boolean onTouch(final View v, MotionEvent event) {
|
||||||
|
|
|
@ -37,6 +37,7 @@ import java.io.StringWriter;
|
||||||
import java.net.HttpURLConnection;
|
import java.net.HttpURLConnection;
|
||||||
import java.net.MalformedURLException;
|
import java.net.MalformedURLException;
|
||||||
import java.text.MessageFormat;
|
import java.text.MessageFormat;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
@ -330,11 +331,20 @@ public class OpenstreetmapRemoteUtil implements OpenstreetmapUtil {
|
||||||
EntityId id = new Entity.EntityId(EntityType.NODE, nodeId);
|
EntityId id = new Entity.EntityId(EntityType.NODE, nodeId);
|
||||||
Node entity = (Node) st.getRegisteredEntities().get(id);
|
Node entity = (Node) st.getRegisteredEntities().get(id);
|
||||||
// merge non existing tags
|
// merge non existing tags
|
||||||
for (String rtag : entity.getTagKeySet()) {
|
Map<String, String> updatedTags = new HashMap<>();
|
||||||
if (!deletedTag(n, rtag) && (!containsTag(n, rtag) || !tagChanged(n, rtag))) {
|
for (String tagKey : entity.getTagKeySet()) {
|
||||||
n.putTagNoLC(rtag, entity.getTag(rtag));
|
if (tagKey != null && !deletedTag(n, tagKey)) {
|
||||||
|
addIfNotNull(tagKey, entity.getTag(tagKey), updatedTags);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (n.getChangedTags() != null) {
|
||||||
|
for (String tagKey : n.getChangedTags()) {
|
||||||
|
if (tagKey != null) {
|
||||||
|
addIfNotNull(tagKey, n.getTag(tagKey), updatedTags);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
n.replaceTags(updatedTags);
|
||||||
if(MapUtils.getDistance(n.getLatLon(), entity.getLatLon()) < 10) {
|
if(MapUtils.getDistance(n.getLatLon(), entity.getLatLon()) < 10) {
|
||||||
// avoid shifting due to round error
|
// avoid shifting due to round error
|
||||||
n.setLatitude(entity.getLatitude());
|
n.setLatitude(entity.getLatitude());
|
||||||
|
@ -353,18 +363,16 @@ public class OpenstreetmapRemoteUtil implements OpenstreetmapUtil {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void addIfNotNull(String key, String value, Map<String, String> tags) {
|
||||||
|
if (value != null) {
|
||||||
|
tags.put(key, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private boolean deletedTag(Node node, String tag) {
|
private boolean deletedTag(Node node, String tag) {
|
||||||
return node.getTagKeySet().contains(EditPoiData.REMOVE_TAG_PREFIX + tag);
|
return node.getTagKeySet().contains(EditPoiData.REMOVE_TAG_PREFIX + tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean containsTag(Node node, String tag) {
|
|
||||||
return node.getTagKeySet().contains(tag);
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean tagChanged(Node node, String tag) {
|
|
||||||
return node.getChangedTags() != null && node.getChangedTags().contains(tag);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Node loadNode(Amenity n) {
|
public Node loadNode(Amenity n) {
|
||||||
if (n.getId() % 2 == 1) {
|
if (n.getId() % 2 == 1) {
|
||||||
|
|