Fix #9698
This commit is contained in:
parent
5a64dcbc84
commit
25f4426625
3 changed files with 16 additions and 13 deletions
|
@ -23,14 +23,15 @@ import androidx.appcompat.app.AlertDialog.Builder;
|
||||||
|
|
||||||
import net.osmand.AndroidUtils;
|
import net.osmand.AndroidUtils;
|
||||||
import net.osmand.PlatformUtil;
|
import net.osmand.PlatformUtil;
|
||||||
import net.osmand.plus.settings.backend.ApplicationMode;
|
import net.osmand.plus.OsmAndFormatter;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings;
|
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings.CommonPreference;
|
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings.OsmandPreference;
|
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.profiles.AppProfileArrayAdapter;
|
import net.osmand.plus.profiles.AppProfileArrayAdapter;
|
||||||
import net.osmand.plus.profiles.ProfileDataObject;
|
import net.osmand.plus.profiles.ProfileDataObject;
|
||||||
|
import net.osmand.plus.settings.backend.ApplicationMode;
|
||||||
|
import net.osmand.plus.settings.backend.OsmandSettings;
|
||||||
|
import net.osmand.plus.settings.backend.OsmandSettings.CommonPreference;
|
||||||
|
import net.osmand.plus.settings.backend.OsmandSettings.OsmandPreference;
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
|
|
||||||
|
@ -287,8 +288,9 @@ public abstract class SettingsBaseActivity extends ActionBarPreferenceActivity
|
||||||
public ListPreference createTimeListPreference(OsmandPreference<Integer> b, int[] seconds, int[] minutes, int coeff, int title, int summary) {
|
public ListPreference createTimeListPreference(OsmandPreference<Integer> b, int[] seconds, int[] minutes, int coeff, int title, int summary) {
|
||||||
return createTimeListPreference(b, seconds, minutes, coeff, null, title, summary);
|
return createTimeListPreference(b, seconds, minutes, coeff, null, title, summary);
|
||||||
}
|
}
|
||||||
public ListPreference createTimeListPreference(OsmandPreference<Integer> b, int[] seconds, int[] minutes, int coeff, CommonPreference<Boolean> disable, int title,
|
|
||||||
int summary) {
|
public ListPreference createTimeListPreference(OsmandPreference<Integer> b, int[] seconds, int[] minutes,
|
||||||
|
int coeff, CommonPreference<Boolean> disable, int title, int summary) {
|
||||||
int minutesLength = minutes == null ? 0 : minutes.length;
|
int minutesLength = minutes == null ? 0 : minutes.length;
|
||||||
int secondsLength = seconds == null ? 0 : seconds.length;
|
int secondsLength = seconds == null ? 0 : seconds.length;
|
||||||
Integer[] ints = new Integer[secondsLength + minutesLength];
|
Integer[] ints = new Integer[secondsLength + minutesLength];
|
||||||
|
@ -299,9 +301,10 @@ public abstract class SettingsBaseActivity extends ActionBarPreferenceActivity
|
||||||
intDescriptions[k] = seconds[i] + " " + getString(R.string.int_seconds); //$NON-NLS-1$
|
intDescriptions[k] = seconds[i] + " " + getString(R.string.int_seconds); //$NON-NLS-1$
|
||||||
k++;
|
k++;
|
||||||
}
|
}
|
||||||
|
OsmandApplication app = getMyApplication();
|
||||||
for (int i = 0; i < minutesLength; i++) {
|
for (int i = 0; i < minutesLength; i++) {
|
||||||
ints[k] = (minutes[i] * 60) * coeff;
|
ints[k] = (minutes[i] * 60) * coeff;
|
||||||
intDescriptions[k] = minutes[i] + " " + getString(R.string.int_min); //$NON-NLS-1$
|
intDescriptions[k] = OsmAndFormatter.getFormattedDuration(minutes[i] * 60, app);
|
||||||
k++;
|
k++;
|
||||||
}
|
}
|
||||||
ListPreference lp = createListPreference(b, intDescriptions, ints, title, summary);
|
ListPreference lp = createListPreference(b, intDescriptions, ints, title, summary);
|
||||||
|
@ -311,7 +314,6 @@ public abstract class SettingsBaseActivity extends ActionBarPreferenceActivity
|
||||||
return lp;
|
return lp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
int itemId = item.getItemId();
|
int itemId = item.getItemId();
|
||||||
|
|
|
@ -43,9 +43,9 @@ import net.osmand.plus.dashboard.tools.DashFragmentData;
|
||||||
import net.osmand.plus.settings.backend.ApplicationMode;
|
import net.osmand.plus.settings.backend.ApplicationMode;
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings;
|
import net.osmand.plus.settings.backend.OsmandSettings;
|
||||||
import net.osmand.plus.settings.fragments.BaseSettingsFragment;
|
import net.osmand.plus.settings.fragments.BaseSettingsFragment;
|
||||||
import net.osmand.plus.views.layers.MapInfoLayer;
|
|
||||||
import net.osmand.plus.views.OsmandMapLayer.DrawSettings;
|
import net.osmand.plus.views.OsmandMapLayer.DrawSettings;
|
||||||
import net.osmand.plus.views.OsmandMapTileView;
|
import net.osmand.plus.views.OsmandMapTileView;
|
||||||
|
import net.osmand.plus.views.layers.MapInfoLayer;
|
||||||
import net.osmand.plus.views.mapwidgets.widgets.TextInfoWidget;
|
import net.osmand.plus.views.mapwidgets.widgets.TextInfoWidget;
|
||||||
import net.osmand.util.Algorithms;
|
import net.osmand.util.Algorithms;
|
||||||
|
|
||||||
|
@ -164,7 +164,7 @@ public class OsmandMonitoringPlugin extends OsmandPlugin {
|
||||||
|
|
||||||
public static final int[] SECONDS = new int[] {0, 1, 2, 3, 5, 10, 15, 20, 30, 60, 90};
|
public static final int[] SECONDS = new int[] {0, 1, 2, 3, 5, 10, 15, 20, 30, 60, 90};
|
||||||
public static final int[] MINUTES = new int[] {2, 3, 5};
|
public static final int[] MINUTES = new int[] {2, 3, 5};
|
||||||
public static final int[] MAX_INTERVAL_TO_SEND_MINUTES = new int[] {1, 2, 5, 10, 15, 20, 30, 60};
|
public static final int[] MAX_INTERVAL_TO_SEND_MINUTES = new int[] {1, 2, 5, 10, 15, 20, 30, 60, 90, 2 * 60, 3 * 60, 4 * 60, 6 * 60, 12 * 60, 24 * 60};
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -11,6 +11,7 @@ import androidx.core.content.ContextCompat;
|
||||||
import androidx.preference.Preference;
|
import androidx.preference.Preference;
|
||||||
|
|
||||||
import net.osmand.AndroidUtils;
|
import net.osmand.AndroidUtils;
|
||||||
|
import net.osmand.plus.OsmAndFormatter;
|
||||||
import net.osmand.plus.settings.backend.ApplicationMode;
|
import net.osmand.plus.settings.backend.ApplicationMode;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.UiUtilities;
|
import net.osmand.plus.UiUtilities;
|
||||||
|
@ -128,10 +129,10 @@ public class LiveMonitoringFragment extends BaseSettingsFragment {
|
||||||
for (int i = 0; i < MAX_INTERVAL_TO_SEND_MINUTES.length; i++) {
|
for (int i = 0; i < MAX_INTERVAL_TO_SEND_MINUTES.length; i++) {
|
||||||
int minute = MAX_INTERVAL_TO_SEND_MINUTES[i];
|
int minute = MAX_INTERVAL_TO_SEND_MINUTES[i];
|
||||||
entryValues[i] = (minute * 60) * 1000;
|
entryValues[i] = (minute * 60) * 1000;
|
||||||
entries[i] = minute + " " + getString(R.string.int_min);
|
entries[i] = OsmAndFormatter.getFormattedDuration(minute * 60, app);
|
||||||
}
|
}
|
||||||
|
|
||||||
ListPreferenceEx liveMonitoringBuffer = (ListPreferenceEx) findPreference(settings.LIVE_MONITORING_MAX_INTERVAL_TO_SEND.getId());
|
ListPreferenceEx liveMonitoringBuffer = findPreference(settings.LIVE_MONITORING_MAX_INTERVAL_TO_SEND.getId());
|
||||||
liveMonitoringBuffer.setEntries(entries);
|
liveMonitoringBuffer.setEntries(entries);
|
||||||
liveMonitoringBuffer.setEntryValues(entryValues);
|
liveMonitoringBuffer.setEntryValues(entryValues);
|
||||||
liveMonitoringBuffer.setIcon(getPersistentPrefIcon(R.drawable.ic_action_time_span));
|
liveMonitoringBuffer.setIcon(getPersistentPrefIcon(R.drawable.ic_action_time_span));
|
||||||
|
|
Loading…
Reference in a new issue