Skip to content

Instantly share code, notes, and snippets.

private void showSeekbarSettingsDialog(Activity activity, final ApplicationMode mode) {
if (activity == null || mode == null) {
return;
}
final OsmandApplication app = (OsmandApplication) activity.getApplication();
final float[] angleValue = new float[] {mode.getStrAngle()};
boolean nightMode = !app.getSettings().isLightContentForMode(mode);
Context themedContext = UiUtilities.getThemedContext(activity, nightMode);
AlertDialog.Builder builder = new AlertDialog.Builder(themedContext);
View seekbarView = LayoutInflater.from(themedContext).inflate(R.layout.recalculation_angle_dialog, null, false);
Preference straightAngle = new Preference(app.getApplicationContext());
straightAngle.setPersistent(false);
straightAngle.setKey(settings.ROUTE_STRAIGHT_ANGLE.getId());
straightAngle.setTitle(getString(R.string.recalc_angle_dialog_title));
straightAngle.setSummary(String.format(getString(R.string.shared_string_angle_param), (int) am.getStrAngle()));
straightAngle.setLayoutResource(R.layout.preference_with_descr);
getPreferenceScreen().addPreference(straightAngle);
private void setupRoutingPrefs() {
OsmandApplication app = getMyApplication();
if (app == null) {
return;
}
PreferenceScreen screen = getPreferenceScreen();
SwitchPreferenceEx fastRoute = createSwitchPreferenceEx(app.getSettings().FAST_ROUTE_MODE.getId(), R.string.fast_route_mode, R.layout.preference_with_descr_dialog_and_switch);
fastRoute.setIcon(getRoutingPrefIcon(app.getSettings().FAST_ROUTE_MODE.getId()));
fastRoute.setDescription(getString(R.string.fast_route_mode_descr));
private void setupSelectRouteRecalcDistance(PreferenceScreen screen) {
Float[] entryValues = new Float[] {10.f, 20.0f, 30.0f, 50.0f, 100.0f, 200.0f, 500.0f, 1000.0f, 1500.0f};
String[] entries = new String[entryValues.length];
entries[0] = getString(R.string.shared_string_not_selected);
for (int i = 1; i < entryValues.length; i++) {
entries[i] = entryValues[i].intValue() + " " + getString(R.string.m) + " (" + Math.round(entryValues[i] / 0.3048f) + " " + getString(R.string.foot) + ")";
}
ListPreferenceEx routeRecalculationDist = (ListPreferenceEx) findPreference(settings.ROUTE_RECALCULATION_DISTANCE.getId());
routeRecalculationDist.setEntries(entries);
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2019-01-15 14:23:12.443 11141-15475/net.osmand E/net.osmand: TransportIndexRepositoryBinary Disk error
com.google.protobuf.InvalidProtocolBufferException: While parsing a protocol message, the input ended unexpectedly in the middle of a field. This could mean either than the input has been truncated or that an embedded message misreported its own length.
at com.google.protobuf.CodedInputStream.skipRawBytes(CodedInputStream.java:932)
at net.osmand.binary.BinaryMapIndexReader.skipUnknownField(BinaryMapIndexReader.java:464)
at net.osmand.binary.BinaryMapTransportReaderAdapter.skipUnknownField(BinaryMapTransportReaderAdapter.java:35)
at net.osmand.binary.BinaryMapTransportReaderAdapter.initializeStringTable(BinaryMapTransportReaderAdapter.java:422)
at net.osmand.binary.BinaryMapIndexReader.searchTransportIndex(BinaryMapIndexReader.java:572)
at net.osmand.plus.resources.TransportIndexRepositoryBinary.searchTransportStops(TransportIndexRepositoryBinary.java:53)
org.gradle.api.ProjectConfigurationException: A problem occurred configuring project ':app'.
at org.gradle.configuration.project.LifecycleProjectEvaluator.addConfigurationFailure(LifecycleProjectEvaluator.java:94)
at org.gradle.configuration.project.LifecycleProjectEvaluator.notifyAfterEvaluate(LifecycleProjectEvaluator.java:89)
at org.gradle.configuration.project.LifecycleProjectEvaluator.doConfigure(LifecycleProjectEvaluator.java:70)
at org.gradle.configuration.project.LifecycleProjectEvaluator.access$100(LifecycleProjectEvaluator.java:34)
at org.gradle.configuration.project.LifecycleProjectEvaluator$ConfigureProject.run(LifecycleProjectEvaluator.java:110)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(D
import java.util.ArrayList
import java.util.Arrays
//val solutionList: ArrayList<String> = arrayListOf()
fun main(args: Array<String>) {
val numArray = arrayOf(0,1,3,2) // <-- изначальный массив
val target = 5 // <-- цель
sumUp(ArrayList(Arrays.asList(*numArray)), target)
// println(solutionList.toString())
val passwordList: ArrayList<String> = arrayListOf()
fun main(args: Array<String>) {
val charArray = charArrayOf('a', 'b', 'c')
val passLength = 3
findAllPasswords(charArray, passLength)
println("Overall number of possible passwords of length up to $passLength from charset of length ${charArray.size} is: ${passwordList.size} ")
println(passwordList.toString())
}