Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
78052597d4
6 changed files with 90 additions and 95 deletions
|
@ -26,7 +26,6 @@
|
|||
<string name="tag_poi_name">name</string>
|
||||
<string name="hint_tag">Tag</string>
|
||||
<string name="hint_value">Value</string>
|
||||
<string name="clear_updates_proposition_message">"You can remove downloaded updates and free "</string>
|
||||
<string name="add_time_span">Add time span</string>
|
||||
<string name="road_blocked">Road blocked</string>
|
||||
|
||||
|
||||
</resources>
|
||||
|
|
|
@ -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="clear_updates_proposition_message">"You can remove downloaded updates and get back to the original map edition"</string>
|
||||
<string name="add_time_span">Add time span</string>
|
||||
<string name="road_blocked">Road blocked</string>
|
||||
<string name="shared_string_select">Select</string>
|
||||
<string name="switch_start_finish">Reverse starting point & destination</string>
|
||||
<string name="rendering_attr_hideIcons_name">Hide POI icons</string>
|
||||
|
|
|
@ -1,5 +1,32 @@
|
|||
package net.osmand.plus.liveupdates;
|
||||
|
||||
import static net.osmand.plus.liveupdates.LiveUpdatesHelper.DEFAULT_LAST_CHECK;
|
||||
import static net.osmand.plus.liveupdates.LiveUpdatesHelper.formatDateTime;
|
||||
import static net.osmand.plus.liveupdates.LiveUpdatesHelper.getNameToDisplay;
|
||||
import static net.osmand.plus.liveupdates.LiveUpdatesHelper.getPendingIntent;
|
||||
import static net.osmand.plus.liveupdates.LiveUpdatesHelper.preferenceDownloadViaWiFi;
|
||||
import static net.osmand.plus.liveupdates.LiveUpdatesHelper.preferenceForLocalIndex;
|
||||
import static net.osmand.plus.liveupdates.LiveUpdatesHelper.preferenceLastCheck;
|
||||
import static net.osmand.plus.liveupdates.LiveUpdatesHelper.preferenceTimeOfDayToUpdate;
|
||||
import static net.osmand.plus.liveupdates.LiveUpdatesHelper.preferenceUpdateFrequency;
|
||||
import static net.osmand.plus.liveupdates.LiveUpdatesHelper.setAlarmForPendingIntent;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import net.osmand.PlatformUtil;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.OsmandSettings;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.LocalIndexInfo;
|
||||
import net.osmand.plus.download.AbstractDownloadActivity;
|
||||
import net.osmand.plus.download.DownloadActivity;
|
||||
import net.osmand.plus.liveupdates.LiveUpdatesHelper.TimeOfDay;
|
||||
import net.osmand.plus.liveupdates.LiveUpdatesHelper.UpdateFrequency;
|
||||
import net.osmand.plus.resources.IncrementalChangesManager;
|
||||
import net.osmand.util.Algorithms;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
|
||||
import android.app.AlarmManager;
|
||||
import android.app.Dialog;
|
||||
import android.app.PendingIntent;
|
||||
|
@ -18,33 +45,6 @@ import android.widget.CheckBox;
|
|||
import android.widget.Spinner;
|
||||
import android.widget.TextView;
|
||||
|
||||
import net.osmand.PlatformUtil;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.OsmandSettings;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.LocalIndexInfo;
|
||||
import net.osmand.plus.download.AbstractDownloadActivity;
|
||||
import net.osmand.plus.download.DownloadActivity;
|
||||
import net.osmand.plus.resources.IncrementalChangesManager;
|
||||
import net.osmand.util.Algorithms;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import static net.osmand.plus.liveupdates.LiveUpdatesHelper.DEFAULT_LAST_CHECK;
|
||||
import static net.osmand.plus.liveupdates.LiveUpdatesHelper.TimeOfDay;
|
||||
import static net.osmand.plus.liveupdates.LiveUpdatesHelper.UpdateFrequency;
|
||||
import static net.osmand.plus.liveupdates.LiveUpdatesHelper.formatDateTime;
|
||||
import static net.osmand.plus.liveupdates.LiveUpdatesHelper.getNameToDisplay;
|
||||
import static net.osmand.plus.liveupdates.LiveUpdatesHelper.getPendingIntent;
|
||||
import static net.osmand.plus.liveupdates.LiveUpdatesHelper.preferenceDownloadViaWiFi;
|
||||
import static net.osmand.plus.liveupdates.LiveUpdatesHelper.preferenceForLocalIndex;
|
||||
import static net.osmand.plus.liveupdates.LiveUpdatesHelper.preferenceLastCheck;
|
||||
import static net.osmand.plus.liveupdates.LiveUpdatesHelper.preferenceTimeOfDayToUpdate;
|
||||
import static net.osmand.plus.liveupdates.LiveUpdatesHelper.preferenceUpdateFrequency;
|
||||
import static net.osmand.plus.liveupdates.LiveUpdatesHelper.setAlarmForPendingIntent;
|
||||
|
||||
public class LiveUpdatesSettingsDialogFragment extends DialogFragment {
|
||||
private static final Log LOG = PlatformUtil.getLog(LiveUpdatesAlarmReceiver.class);
|
||||
private static final String LOCAL_INDEX = "local_index";
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package net.osmand.plus.liveupdates.network;
|
||||
package net.osmand.plus.liveupdates;
|
||||
|
||||
/**
|
||||
* Created by GaidamakUA on 1/12/16.
|
|
@ -1,7 +1,25 @@
|
|||
package net.osmand.plus.liveupdates;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import net.osmand.PlatformUtil;
|
||||
import net.osmand.map.WorldRegion;
|
||||
import net.osmand.osm.io.NetworkUtils;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.OsmandActionBarActivity;
|
||||
import net.osmand.plus.base.BaseOsmAndFragment;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.view.LayoutInflater;
|
||||
|
@ -12,20 +30,7 @@ import android.widget.ArrayAdapter;
|
|||
import android.widget.Spinner;
|
||||
import android.widget.TextView;
|
||||
|
||||
import net.osmand.map.WorldRegion;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.OsmandActionBarActivity;
|
||||
import net.osmand.plus.base.BaseOsmAndFragment;
|
||||
import net.osmand.plus.liveupdates.network.GetJsonAsyncTask;
|
||||
import net.osmand.plus.liveupdates.network.Protocol;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import com.google.gson.Gson;
|
||||
|
||||
/**
|
||||
* A simple {@link Fragment} subclass.
|
||||
|
@ -215,4 +220,42 @@ public class ReportsFragment extends BaseOsmAndFragment {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static class GetJsonAsyncTask<P> extends AsyncTask<String, Void, P> {
|
||||
private static final Log LOG = PlatformUtil.getLog(GetJsonAsyncTask.class);
|
||||
private final Class<P> protocolClass;
|
||||
private final Gson gson = new Gson();
|
||||
private OnResponseListener<P> onResponseListener;
|
||||
|
||||
public GetJsonAsyncTask(Class<P> protocolClass) {
|
||||
this.protocolClass = protocolClass;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected P doInBackground(String... params) {
|
||||
StringBuilder response = new StringBuilder();
|
||||
String error = NetworkUtils.sendGetRequest(params[0], null, response);
|
||||
if (error == null) {
|
||||
return gson.fromJson(response.toString(), protocolClass);
|
||||
}
|
||||
LOG.error(error);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(P protocol) {
|
||||
if (onResponseListener != null) {
|
||||
onResponseListener.onResponse(protocol);
|
||||
}
|
||||
}
|
||||
|
||||
public void setOnResponseListener(OnResponseListener<P> onResponseListener) {
|
||||
this.onResponseListener = onResponseListener;
|
||||
}
|
||||
|
||||
public interface OnResponseListener<Protocol> {
|
||||
void onResponse(Protocol response);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,50 +0,0 @@
|
|||
package net.osmand.plus.liveupdates.network;
|
||||
|
||||
import android.os.AsyncTask;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
|
||||
import net.osmand.PlatformUtil;
|
||||
import net.osmand.osm.io.NetworkUtils;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
|
||||
/**
|
||||
* Created by GaidamakUA on 1/12/16.
|
||||
*/
|
||||
public class GetJsonAsyncTask<Protocol> extends AsyncTask<String, Void, Protocol> {
|
||||
private static final Log LOG = PlatformUtil.getLog(GetJsonAsyncTask.class);
|
||||
private final Class<Protocol> protocolClass;
|
||||
private final Gson gson = new Gson();
|
||||
private OnResponseListener<Protocol> onResponseListener;
|
||||
|
||||
public GetJsonAsyncTask(Class<Protocol> protocolClass) {
|
||||
this.protocolClass = protocolClass;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Protocol doInBackground(String... params) {
|
||||
StringBuilder response = new StringBuilder();
|
||||
String error = NetworkUtils.sendGetRequest(params[0], null, response);
|
||||
if (error == null) {
|
||||
return gson.fromJson(response.toString(), protocolClass);
|
||||
}
|
||||
LOG.error(error);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(Protocol protocol) {
|
||||
if (onResponseListener != null) {
|
||||
onResponseListener.onResponse(protocol);
|
||||
}
|
||||
}
|
||||
|
||||
public void setOnResponseListener(OnResponseListener<Protocol> onResponseListener) {
|
||||
this.onResponseListener = onResponseListener;
|
||||
}
|
||||
|
||||
public interface OnResponseListener<Protocol> {
|
||||
void onResponse(Protocol response);
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue