id
int32
0
165k
repo
stringlengths
7
58
path
stringlengths
12
218
func_name
stringlengths
3
140
original_string
stringlengths
73
34.1k
language
stringclasses
1 value
code
stringlengths
73
34.1k
code_tokens
list
docstring
stringlengths
3
16k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
105
339
23,100
willowtreeapps/Hyperion-Android
hyperion-geiger-counter/src/main/java/com/willowtreeapps/hyperion/geigercounter/DroppedFrameDetector.java
DroppedFrameDetector.doFrame
@Override public void doFrame(long timestampNanoseconds) { long frameIntervalNanoseconds = timestampNanoseconds - lastTimestampNanoseconds; // To detect a dropped frame, we need to know the interval between two frame callbacks. // If this is the first, wait for the second. if (lastTimestampNanoseconds != NEVER) { // With no dropped frames, frame intervals will roughly equal the hardware interval. // 2x the hardware interval means we definitely dropped one frame. // So our measuring stick is 1.5x. double droppedFrameIntervalSeconds = hardwareFrameIntervalSeconds * 1.5; double frameIntervalSeconds = frameIntervalNanoseconds / 1_000_000_000.0; if (droppedFrameIntervalSeconds < frameIntervalSeconds) { playTickSound(); if (areHapticsEnabled) { playTickHaptics(); } } } lastTimestampNanoseconds = timestampNanoseconds; Choreographer.getInstance().postFrameCallback(this); }
java
@Override public void doFrame(long timestampNanoseconds) { long frameIntervalNanoseconds = timestampNanoseconds - lastTimestampNanoseconds; // To detect a dropped frame, we need to know the interval between two frame callbacks. // If this is the first, wait for the second. if (lastTimestampNanoseconds != NEVER) { // With no dropped frames, frame intervals will roughly equal the hardware interval. // 2x the hardware interval means we definitely dropped one frame. // So our measuring stick is 1.5x. double droppedFrameIntervalSeconds = hardwareFrameIntervalSeconds * 1.5; double frameIntervalSeconds = frameIntervalNanoseconds / 1_000_000_000.0; if (droppedFrameIntervalSeconds < frameIntervalSeconds) { playTickSound(); if (areHapticsEnabled) { playTickHaptics(); } } } lastTimestampNanoseconds = timestampNanoseconds; Choreographer.getInstance().postFrameCallback(this); }
[ "@", "Override", "public", "void", "doFrame", "(", "long", "timestampNanoseconds", ")", "{", "long", "frameIntervalNanoseconds", "=", "timestampNanoseconds", "-", "lastTimestampNanoseconds", ";", "// To detect a dropped frame, we need to know the interval between two frame callbacks.", "// If this is the first, wait for the second.", "if", "(", "lastTimestampNanoseconds", "!=", "NEVER", ")", "{", "// With no dropped frames, frame intervals will roughly equal the hardware interval.", "// 2x the hardware interval means we definitely dropped one frame.", "// So our measuring stick is 1.5x.", "double", "droppedFrameIntervalSeconds", "=", "hardwareFrameIntervalSeconds", "*", "1.5", ";", "double", "frameIntervalSeconds", "=", "frameIntervalNanoseconds", "/", "1_000_000_000.0", ";", "if", "(", "droppedFrameIntervalSeconds", "<", "frameIntervalSeconds", ")", "{", "playTickSound", "(", ")", ";", "if", "(", "areHapticsEnabled", ")", "{", "playTickHaptics", "(", ")", ";", "}", "}", "}", "lastTimestampNanoseconds", "=", "timestampNanoseconds", ";", "Choreographer", ".", "getInstance", "(", ")", ".", "postFrameCallback", "(", "this", ")", ";", "}" ]
Choreographer.FrameCallback
[ "Choreographer", ".", "FrameCallback" ]
1910f53869a53f1395ba90588a0b4db7afdec79c
https://github.com/willowtreeapps/Hyperion-Android/blob/1910f53869a53f1395ba90588a0b4db7afdec79c/hyperion-geiger-counter/src/main/java/com/willowtreeapps/hyperion/geigercounter/DroppedFrameDetector.java#L158-L183
23,101
rsocket/rsocket-java
rsocket-load-balancer/src/main/java/io/rsocket/client/LoadBalancedRSocketMono.java
LoadBalancedRSocketMono.updateAperture
private void updateAperture(int newValue, long now) { int previous = targetAperture; targetAperture = newValue; targetAperture = Math.max(minAperture, targetAperture); int maxAperture = Math.min(this.maxAperture, activeSockets.size() + pool.poolSize()); targetAperture = Math.min(maxAperture, targetAperture); lastApertureRefresh = now; pendings.reset((minPendings + maxPendings) / 2); if (targetAperture != previous) { logger.debug( "Current pending={}, new target={}, previous target={}", pendings.value(), targetAperture, previous); } }
java
private void updateAperture(int newValue, long now) { int previous = targetAperture; targetAperture = newValue; targetAperture = Math.max(minAperture, targetAperture); int maxAperture = Math.min(this.maxAperture, activeSockets.size() + pool.poolSize()); targetAperture = Math.min(maxAperture, targetAperture); lastApertureRefresh = now; pendings.reset((minPendings + maxPendings) / 2); if (targetAperture != previous) { logger.debug( "Current pending={}, new target={}, previous target={}", pendings.value(), targetAperture, previous); } }
[ "private", "void", "updateAperture", "(", "int", "newValue", ",", "long", "now", ")", "{", "int", "previous", "=", "targetAperture", ";", "targetAperture", "=", "newValue", ";", "targetAperture", "=", "Math", ".", "max", "(", "minAperture", ",", "targetAperture", ")", ";", "int", "maxAperture", "=", "Math", ".", "min", "(", "this", ".", "maxAperture", ",", "activeSockets", ".", "size", "(", ")", "+", "pool", ".", "poolSize", "(", ")", ")", ";", "targetAperture", "=", "Math", ".", "min", "(", "maxAperture", ",", "targetAperture", ")", ";", "lastApertureRefresh", "=", "now", ";", "pendings", ".", "reset", "(", "(", "minPendings", "+", "maxPendings", ")", "/", "2", ")", ";", "if", "(", "targetAperture", "!=", "previous", ")", "{", "logger", ".", "debug", "(", "\"Current pending={}, new target={}, previous target={}\"", ",", "pendings", ".", "value", "(", ")", ",", "targetAperture", ",", "previous", ")", ";", "}", "}" ]
Update the aperture value and ensure its value stays in the right range. @param newValue new aperture value @param now time of the change (for rate limiting purposes)
[ "Update", "the", "aperture", "value", "and", "ensure", "its", "value", "stays", "in", "the", "right", "range", "." ]
5101748fbd224ec86570351cebd24d079b63fbfc
https://github.com/rsocket/rsocket-java/blob/5101748fbd224ec86570351cebd24d079b63fbfc/rsocket-load-balancer/src/main/java/io/rsocket/client/LoadBalancedRSocketMono.java#L318-L334
23,102
spotify/docker-client
src/main/java/com/spotify/docker/client/DefaultLogStream.java
DefaultLogStream.writeAndFlush
private static void writeAndFlush( final ByteBuffer buffer, final OutputStream outputStream) throws IOException { if (buffer.hasArray()) { outputStream.write(buffer.array(), buffer.position(), buffer.remaining()); } else { // cannot access underlying byte array, need to copy into a temporary array while (buffer.hasRemaining()) { // figure out how much to read, but use an upper limit of 8kb. LogMessages should be rather // small so we don't expect this to get hit but avoid large temporary buffers, just in case. final int size = Math.min(buffer.remaining(), 8 * 1024); final byte[] chunk = new byte[size]; buffer.get(chunk); outputStream.write(chunk); } } outputStream.flush(); }
java
private static void writeAndFlush( final ByteBuffer buffer, final OutputStream outputStream) throws IOException { if (buffer.hasArray()) { outputStream.write(buffer.array(), buffer.position(), buffer.remaining()); } else { // cannot access underlying byte array, need to copy into a temporary array while (buffer.hasRemaining()) { // figure out how much to read, but use an upper limit of 8kb. LogMessages should be rather // small so we don't expect this to get hit but avoid large temporary buffers, just in case. final int size = Math.min(buffer.remaining(), 8 * 1024); final byte[] chunk = new byte[size]; buffer.get(chunk); outputStream.write(chunk); } } outputStream.flush(); }
[ "private", "static", "void", "writeAndFlush", "(", "final", "ByteBuffer", "buffer", ",", "final", "OutputStream", "outputStream", ")", "throws", "IOException", "{", "if", "(", "buffer", ".", "hasArray", "(", ")", ")", "{", "outputStream", ".", "write", "(", "buffer", ".", "array", "(", ")", ",", "buffer", ".", "position", "(", ")", ",", "buffer", ".", "remaining", "(", ")", ")", ";", "}", "else", "{", "// cannot access underlying byte array, need to copy into a temporary array", "while", "(", "buffer", ".", "hasRemaining", "(", ")", ")", "{", "// figure out how much to read, but use an upper limit of 8kb. LogMessages should be rather", "// small so we don't expect this to get hit but avoid large temporary buffers, just in case.", "final", "int", "size", "=", "Math", ".", "min", "(", "buffer", ".", "remaining", "(", ")", ",", "8", "*", "1024", ")", ";", "final", "byte", "[", "]", "chunk", "=", "new", "byte", "[", "size", "]", ";", "buffer", ".", "get", "(", "chunk", ")", ";", "outputStream", ".", "write", "(", "chunk", ")", ";", "}", "}", "outputStream", ".", "flush", "(", ")", ";", "}" ]
Write the contents of the given ByteBuffer to the OutputStream and flush the stream.
[ "Write", "the", "contents", "of", "the", "given", "ByteBuffer", "to", "the", "OutputStream", "and", "flush", "the", "stream", "." ]
f297361891f3bb6a2980b08057eede628d681791
https://github.com/spotify/docker-client/blob/f297361891f3bb6a2980b08057eede628d681791/src/main/java/com/spotify/docker/client/DefaultLogStream.java#L120-L137
23,103
spotify/docker-client
src/main/java/com/spotify/docker/client/DefaultDockerClient.java
DefaultDockerClient.urlEncode
private String urlEncode(final String unencoded) throws DockerException { try { final String encode = URLEncoder.encode(unencoded, UTF_8.name()); return encode.replaceAll("\\+", "%20"); } catch (UnsupportedEncodingException e) { throw new DockerException(e); } }
java
private String urlEncode(final String unencoded) throws DockerException { try { final String encode = URLEncoder.encode(unencoded, UTF_8.name()); return encode.replaceAll("\\+", "%20"); } catch (UnsupportedEncodingException e) { throw new DockerException(e); } }
[ "private", "String", "urlEncode", "(", "final", "String", "unencoded", ")", "throws", "DockerException", "{", "try", "{", "final", "String", "encode", "=", "URLEncoder", ".", "encode", "(", "unencoded", ",", "UTF_8", ".", "name", "(", ")", ")", ";", "return", "encode", ".", "replaceAll", "(", "\"\\\\+\"", ",", "\"%20\"", ")", ";", "}", "catch", "(", "UnsupportedEncodingException", "e", ")", "{", "throw", "new", "DockerException", "(", "e", ")", ";", "}", "}" ]
URL-encodes a string when used as a URL query parameter's value. @param unencoded A string that may contain characters not allowed in URL query parameters. @return URL-encoded String @throws DockerException if there's an UnsupportedEncodingException
[ "URL", "-", "encodes", "a", "string", "when", "used", "as", "a", "URL", "query", "parameter", "s", "value", "." ]
f297361891f3bb6a2980b08057eede628d681791
https://github.com/spotify/docker-client/blob/f297361891f3bb6a2980b08057eede628d681791/src/main/java/com/spotify/docker/client/DefaultDockerClient.java#L681-L688
23,104
spotify/docker-client
src/main/java/com/spotify/docker/client/DefaultDockerClient.java
DefaultDockerClient.urlEncodeFilters
private String urlEncodeFilters(final Map<String, List<String>> filters) throws DockerException { try { final String unencodedFilters = objectMapper().writeValueAsString(filters); if (!unencodedFilters.isEmpty()) { return urlEncode(unencodedFilters); } } catch (IOException e) { throw new DockerException(e); } return null; }
java
private String urlEncodeFilters(final Map<String, List<String>> filters) throws DockerException { try { final String unencodedFilters = objectMapper().writeValueAsString(filters); if (!unencodedFilters.isEmpty()) { return urlEncode(unencodedFilters); } } catch (IOException e) { throw new DockerException(e); } return null; }
[ "private", "String", "urlEncodeFilters", "(", "final", "Map", "<", "String", ",", "List", "<", "String", ">", ">", "filters", ")", "throws", "DockerException", "{", "try", "{", "final", "String", "unencodedFilters", "=", "objectMapper", "(", ")", ".", "writeValueAsString", "(", "filters", ")", ";", "if", "(", "!", "unencodedFilters", ".", "isEmpty", "(", ")", ")", "{", "return", "urlEncode", "(", "unencodedFilters", ")", ";", "}", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "new", "DockerException", "(", "e", ")", ";", "}", "return", "null", ";", "}" ]
Takes a map of filters and URL-encodes them. If the map is empty or an exception occurs, return null. @param filters A map of filters. @return String @throws DockerException if there's an IOException
[ "Takes", "a", "map", "of", "filters", "and", "URL", "-", "encodes", "them", ".", "If", "the", "map", "is", "empty", "or", "an", "exception", "occurs", "return", "null", "." ]
f297361891f3bb6a2980b08057eede628d681791
https://github.com/spotify/docker-client/blob/f297361891f3bb6a2980b08057eede628d681791/src/main/java/com/spotify/docker/client/DefaultDockerClient.java#L698-L708
23,105
spotify/docker-client
src/main/java/com/spotify/docker/client/DockerConfigReader.java
DockerConfigReader.fromConfig
@Deprecated public RegistryAuth fromConfig(final Path configPath, final String serverAddress) throws IOException { return authForRegistry(configPath, serverAddress); }
java
@Deprecated public RegistryAuth fromConfig(final Path configPath, final String serverAddress) throws IOException { return authForRegistry(configPath, serverAddress); }
[ "@", "Deprecated", "public", "RegistryAuth", "fromConfig", "(", "final", "Path", "configPath", ",", "final", "String", "serverAddress", ")", "throws", "IOException", "{", "return", "authForRegistry", "(", "configPath", ",", "serverAddress", ")", ";", "}" ]
Returns the RegistryAuth for the config file for the given registry server name. @throws IllegalArgumentException if the config file does not contain registry auth info for the registry @deprecated In favor of {@link #authForRegistry(Path, String)}
[ "Returns", "the", "RegistryAuth", "for", "the", "config", "file", "for", "the", "given", "registry", "server", "name", "." ]
f297361891f3bb6a2980b08057eede628d681791
https://github.com/spotify/docker-client/blob/f297361891f3bb6a2980b08057eede628d681791/src/main/java/com/spotify/docker/client/DockerConfigReader.java#L71-L75
23,106
spotify/docker-client
src/main/java/com/spotify/docker/client/DockerConfigReader.java
DockerConfigReader.authWithCredentialHelper
private RegistryAuth authWithCredentialHelper(final String credsStore, final String registry) throws IOException { final DockerCredentialHelperAuth dockerCredentialHelperAuth = DockerCredentialHelper.get(credsStore, registry); return dockerCredentialHelperAuth == null ? null : dockerCredentialHelperAuth.toRegistryAuth(); }
java
private RegistryAuth authWithCredentialHelper(final String credsStore, final String registry) throws IOException { final DockerCredentialHelperAuth dockerCredentialHelperAuth = DockerCredentialHelper.get(credsStore, registry); return dockerCredentialHelperAuth == null ? null : dockerCredentialHelperAuth.toRegistryAuth(); }
[ "private", "RegistryAuth", "authWithCredentialHelper", "(", "final", "String", "credsStore", ",", "final", "String", "registry", ")", "throws", "IOException", "{", "final", "DockerCredentialHelperAuth", "dockerCredentialHelperAuth", "=", "DockerCredentialHelper", ".", "get", "(", "credsStore", ",", "registry", ")", ";", "return", "dockerCredentialHelperAuth", "==", "null", "?", "null", ":", "dockerCredentialHelperAuth", ".", "toRegistryAuth", "(", ")", ";", "}" ]
Obtain auth using a credential helper. @param credsStore The name of the credential helper @param registry The registry for which we need to obtain auth @return A RegistryAuth object with a username, password, and server. @throws IOException This method attempts to execute "docker-credential-" + credsStore + " get". If you don't have the proper credential helper installed and on your path, this will fail.
[ "Obtain", "auth", "using", "a", "credential", "helper", "." ]
f297361891f3bb6a2980b08057eede628d681791
https://github.com/spotify/docker-client/blob/f297361891f3bb6a2980b08057eede628d681791/src/main/java/com/spotify/docker/client/DockerConfigReader.java#L279-L284
23,107
spotify/docker-client
src/main/java/com/spotify/docker/client/messages/ProgressMessage.java
ProgressMessage.buildImageId
public String buildImageId() { // stream messages end with new line, so call trim to remove it final String stream = stream(); return stream != null && stream.startsWith("Successfully built") ? stream.substring(stream.lastIndexOf(' ') + 1).trim() : null; }
java
public String buildImageId() { // stream messages end with new line, so call trim to remove it final String stream = stream(); return stream != null && stream.startsWith("Successfully built") ? stream.substring(stream.lastIndexOf(' ') + 1).trim() : null; }
[ "public", "String", "buildImageId", "(", ")", "{", "// stream messages end with new line, so call trim to remove it", "final", "String", "stream", "=", "stream", "(", ")", ";", "return", "stream", "!=", "null", "&&", "stream", ".", "startsWith", "(", "\"Successfully built\"", ")", "?", "stream", ".", "substring", "(", "stream", ".", "lastIndexOf", "(", "'", "'", ")", "+", "1", ")", ".", "trim", "(", ")", ":", "null", ";", "}" ]
Checks if the stream field contains a string a like "Successfully built 2d6e00052167", and if so, returns the image id. Otherwise null is returned. This string is expected when an image is built successfully. @return The image id if this is a build success message, otherwise null.
[ "Checks", "if", "the", "stream", "field", "contains", "a", "string", "a", "like", "Successfully", "built", "2d6e00052167", "and", "if", "so", "returns", "the", "image", "id", ".", "Otherwise", "null", "is", "returned", ".", "This", "string", "is", "expected", "when", "an", "image", "is", "built", "successfully", "." ]
f297361891f3bb6a2980b08057eede628d681791
https://github.com/spotify/docker-client/blob/f297361891f3bb6a2980b08057eede628d681791/src/main/java/com/spotify/docker/client/messages/ProgressMessage.java#L116-L122
23,108
spotify/docker-client
src/main/java/com/spotify/docker/client/ImageRef.java
ImageRef.parseRegistryUrl
@VisibleForTesting static String parseRegistryUrl(final String url) { if (url.equals("docker.io") || url.equals("index.docker.io")) { return DEFAULT_REGISTRY_URL; } else if (url.matches("(^|(\\w+)\\.)gcr\\.io$") || url.equals("gcr.kubernetes.io")) { // GCR uses https return "https://" + url; } else if (url.equals("quay.io")) { // Quay doesn't use any protocol in credentials file return "quay.io"; } else if (!url.contains("http://") && !url.contains("https://")) { // Assume https return "https://" + url; } else { return url; } }
java
@VisibleForTesting static String parseRegistryUrl(final String url) { if (url.equals("docker.io") || url.equals("index.docker.io")) { return DEFAULT_REGISTRY_URL; } else if (url.matches("(^|(\\w+)\\.)gcr\\.io$") || url.equals("gcr.kubernetes.io")) { // GCR uses https return "https://" + url; } else if (url.equals("quay.io")) { // Quay doesn't use any protocol in credentials file return "quay.io"; } else if (!url.contains("http://") && !url.contains("https://")) { // Assume https return "https://" + url; } else { return url; } }
[ "@", "VisibleForTesting", "static", "String", "parseRegistryUrl", "(", "final", "String", "url", ")", "{", "if", "(", "url", ".", "equals", "(", "\"docker.io\"", ")", "||", "url", ".", "equals", "(", "\"index.docker.io\"", ")", ")", "{", "return", "DEFAULT_REGISTRY_URL", ";", "}", "else", "if", "(", "url", ".", "matches", "(", "\"(^|(\\\\w+)\\\\.)gcr\\\\.io$\"", ")", "||", "url", ".", "equals", "(", "\"gcr.kubernetes.io\"", ")", ")", "{", "// GCR uses https", "return", "\"https://\"", "+", "url", ";", "}", "else", "if", "(", "url", ".", "equals", "(", "\"quay.io\"", ")", ")", "{", "// Quay doesn't use any protocol in credentials file", "return", "\"quay.io\"", ";", "}", "else", "if", "(", "!", "url", ".", "contains", "(", "\"http://\"", ")", "&&", "!", "url", ".", "contains", "(", "\"https://\"", ")", ")", "{", "// Assume https", "return", "\"https://\"", "+", "url", ";", "}", "else", "{", "return", "url", ";", "}", "}" ]
Return registry server address given first part of image.
[ "Return", "registry", "server", "address", "given", "first", "part", "of", "image", "." ]
f297361891f3bb6a2980b08057eede628d681791
https://github.com/spotify/docker-client/blob/f297361891f3bb6a2980b08057eede628d681791/src/main/java/com/spotify/docker/client/ImageRef.java#L98-L114
23,109
spotify/docker-client
src/main/java/com/spotify/docker/client/DockerCredentialHelper.java
DockerCredentialHelper.store
public static int store(final String credsStore, final DockerCredentialHelperAuth auth) throws IOException, InterruptedException { return credentialHelperDelegate.store(credsStore, auth); }
java
public static int store(final String credsStore, final DockerCredentialHelperAuth auth) throws IOException, InterruptedException { return credentialHelperDelegate.store(credsStore, auth); }
[ "public", "static", "int", "store", "(", "final", "String", "credsStore", ",", "final", "DockerCredentialHelperAuth", "auth", ")", "throws", "IOException", ",", "InterruptedException", "{", "return", "credentialHelperDelegate", ".", "store", "(", "credsStore", ",", "auth", ")", ";", "}" ]
Store an auth value in the credsStore. @param credsStore Name of the docker credential helper @param auth Auth object to store @return Exit code of the process @throws IOException When we cannot read from the credential helper @throws InterruptedException When writing to the credential helper is interrupted
[ "Store", "an", "auth", "value", "in", "the", "credsStore", "." ]
f297361891f3bb6a2980b08057eede628d681791
https://github.com/spotify/docker-client/blob/f297361891f3bb6a2980b08057eede628d681791/src/main/java/com/spotify/docker/client/DockerCredentialHelper.java#L91-L94
23,110
spotify/docker-client
src/main/java/com/spotify/docker/client/DockerCredentialHelper.java
DockerCredentialHelper.erase
public static int erase(final String credsStore, final String registry) throws IOException, InterruptedException { return credentialHelperDelegate.erase(credsStore, registry); }
java
public static int erase(final String credsStore, final String registry) throws IOException, InterruptedException { return credentialHelperDelegate.erase(credsStore, registry); }
[ "public", "static", "int", "erase", "(", "final", "String", "credsStore", ",", "final", "String", "registry", ")", "throws", "IOException", ",", "InterruptedException", "{", "return", "credentialHelperDelegate", ".", "erase", "(", "credsStore", ",", "registry", ")", ";", "}" ]
Erase an auth value from a credsStore matching a registry. @param credsStore Name of the docker credential helper @param registry The registry for which you want to erase the auth @return Exit code of the process @throws IOException When we cannot read from the credential helper @throws InterruptedException When writing to the credential helper is interrupted
[ "Erase", "an", "auth", "value", "from", "a", "credsStore", "matching", "a", "registry", "." ]
f297361891f3bb6a2980b08057eede628d681791
https://github.com/spotify/docker-client/blob/f297361891f3bb6a2980b08057eede628d681791/src/main/java/com/spotify/docker/client/DockerCredentialHelper.java#L105-L108
23,111
spotify/docker-client
src/main/java/com/spotify/docker/client/DockerCredentialHelper.java
DockerCredentialHelper.get
public static DockerCredentialHelperAuth get(final String credsStore, final String registry) throws IOException { return credentialHelperDelegate.get(credsStore, registry); }
java
public static DockerCredentialHelperAuth get(final String credsStore, final String registry) throws IOException { return credentialHelperDelegate.get(credsStore, registry); }
[ "public", "static", "DockerCredentialHelperAuth", "get", "(", "final", "String", "credsStore", ",", "final", "String", "registry", ")", "throws", "IOException", "{", "return", "credentialHelperDelegate", ".", "get", "(", "credsStore", ",", "registry", ")", ";", "}" ]
Get an auth value from a credsStore for a registry. @param credsStore Name of the docker credential helper @param registry The registry for which you want to auth @return A {@link DockerCredentialHelperAuth} auth object @throws IOException When we cannot read from the credential helper
[ "Get", "an", "auth", "value", "from", "a", "credsStore", "for", "a", "registry", "." ]
f297361891f3bb6a2980b08057eede628d681791
https://github.com/spotify/docker-client/blob/f297361891f3bb6a2980b08057eede628d681791/src/main/java/com/spotify/docker/client/DockerCredentialHelper.java#L117-L120
23,112
spotify/docker-client
src/main/java/com/spotify/docker/client/DockerCredentialHelper.java
DockerCredentialHelper.list
public static Map<String, String> list(final String credsStore) throws IOException { return credentialHelperDelegate.list(credsStore); }
java
public static Map<String, String> list(final String credsStore) throws IOException { return credentialHelperDelegate.list(credsStore); }
[ "public", "static", "Map", "<", "String", ",", "String", ">", "list", "(", "final", "String", "credsStore", ")", "throws", "IOException", "{", "return", "credentialHelperDelegate", ".", "list", "(", "credsStore", ")", ";", "}" ]
Lists credentials stored in the credsStore. @param credsStore Name of the docker credential helper @return Map of registries to auth identifiers. (For instance, usernames for which you have signed in.) @throws IOException When we cannot read from the credential helper
[ "Lists", "credentials", "stored", "in", "the", "credsStore", "." ]
f297361891f3bb6a2980b08057eede628d681791
https://github.com/spotify/docker-client/blob/f297361891f3bb6a2980b08057eede628d681791/src/main/java/com/spotify/docker/client/DockerCredentialHelper.java#L129-L131
23,113
spotify/docker-client
src/main/java/com/spotify/docker/client/messages/RegistryAuth.java
RegistryAuth.forAuth
public static Builder forAuth(final String auth) { // split with limit=2 to catch case where password contains a colon final String[] authParams = Base64.decodeAsString(auth).split(":", 2); if (authParams.length != 2) { return builder(); } return builder() .username(authParams[0].trim()) .password(authParams[1].trim()); }
java
public static Builder forAuth(final String auth) { // split with limit=2 to catch case where password contains a colon final String[] authParams = Base64.decodeAsString(auth).split(":", 2); if (authParams.length != 2) { return builder(); } return builder() .username(authParams[0].trim()) .password(authParams[1].trim()); }
[ "public", "static", "Builder", "forAuth", "(", "final", "String", "auth", ")", "{", "// split with limit=2 to catch case where password contains a colon", "final", "String", "[", "]", "authParams", "=", "Base64", ".", "decodeAsString", "(", "auth", ")", ".", "split", "(", "\":\"", ",", "2", ")", ";", "if", "(", "authParams", ".", "length", "!=", "2", ")", "{", "return", "builder", "(", ")", ";", "}", "return", "builder", "(", ")", ".", "username", "(", "authParams", "[", "0", "]", ".", "trim", "(", ")", ")", ".", "password", "(", "authParams", "[", "1", "]", ".", "trim", "(", ")", ")", ";", "}" ]
Construct a Builder based upon the "auth" field of the docker client config file.
[ "Construct", "a", "Builder", "based", "upon", "the", "auth", "field", "of", "the", "docker", "client", "config", "file", "." ]
f297361891f3bb6a2980b08057eede628d681791
https://github.com/spotify/docker-client/blob/f297361891f3bb6a2980b08057eede628d681791/src/main/java/com/spotify/docker/client/messages/RegistryAuth.java#L144-L155
23,114
spotify/docker-client
src/main/java/com/spotify/docker/client/auth/gcr/ContainerRegistryAuthSupplier.java
ContainerRegistryAuthSupplier.fromStream
public static Builder fromStream(final InputStream credentialsStream) throws IOException { final GoogleCredentials credentials = GoogleCredentials.fromStream(credentialsStream); return new Builder(credentials); }
java
public static Builder fromStream(final InputStream credentialsStream) throws IOException { final GoogleCredentials credentials = GoogleCredentials.fromStream(credentialsStream); return new Builder(credentials); }
[ "public", "static", "Builder", "fromStream", "(", "final", "InputStream", "credentialsStream", ")", "throws", "IOException", "{", "final", "GoogleCredentials", "credentials", "=", "GoogleCredentials", ".", "fromStream", "(", "credentialsStream", ")", ";", "return", "new", "Builder", "(", "credentials", ")", ";", "}" ]
Constructs a ContainerRegistryAuthSupplier for the account with the given credentials. @see Builder
[ "Constructs", "a", "ContainerRegistryAuthSupplier", "for", "the", "account", "with", "the", "given", "credentials", "." ]
f297361891f3bb6a2980b08057eede628d681791
https://github.com/spotify/docker-client/blob/f297361891f3bb6a2980b08057eede628d681791/src/main/java/com/spotify/docker/client/auth/gcr/ContainerRegistryAuthSupplier.java#L90-L93
23,115
spotify/docker-client
src/main/java/com/spotify/docker/client/auth/gcr/ContainerRegistryAuthSupplier.java
ContainerRegistryAuthSupplier.getAccessToken
private AccessToken getAccessToken() throws IOException { // synchronize attempts to refresh the accessToken synchronized (credentials) { if (needsRefresh(credentials.getAccessToken())) { credentialRefresher.refresh(credentials); } } return credentials.getAccessToken(); }
java
private AccessToken getAccessToken() throws IOException { // synchronize attempts to refresh the accessToken synchronized (credentials) { if (needsRefresh(credentials.getAccessToken())) { credentialRefresher.refresh(credentials); } } return credentials.getAccessToken(); }
[ "private", "AccessToken", "getAccessToken", "(", ")", "throws", "IOException", "{", "// synchronize attempts to refresh the accessToken", "synchronized", "(", "credentials", ")", "{", "if", "(", "needsRefresh", "(", "credentials", ".", "getAccessToken", "(", ")", ")", ")", "{", "credentialRefresher", ".", "refresh", "(", "credentials", ")", ";", "}", "}", "return", "credentials", ".", "getAccessToken", "(", ")", ";", "}" ]
Get an accessToken to use, possibly refreshing the token if it expires within the minimumExpiryMillis.
[ "Get", "an", "accessToken", "to", "use", "possibly", "refreshing", "the", "token", "if", "it", "expires", "within", "the", "minimumExpiryMillis", "." ]
f297361891f3bb6a2980b08057eede628d681791
https://github.com/spotify/docker-client/blob/f297361891f3bb6a2980b08057eede628d681791/src/main/java/com/spotify/docker/client/auth/gcr/ContainerRegistryAuthSupplier.java#L221-L229
23,116
mapbox/mapbox-navigation-android
libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/utils/DistanceFormatter.java
DistanceFormatter.formatDistance
public SpannableString formatDistance(double distance) { double distanceSmallUnit = TurfConversion.convertLength(distance, TurfConstants.UNIT_METERS, smallUnit); double distanceLargeUnit = TurfConversion.convertLength(distance, TurfConstants.UNIT_METERS, largeUnit); // If the distance is greater than 10 miles/kilometers, then round to nearest mile/kilometer if (distanceLargeUnit > LARGE_UNIT_THRESHOLD) { return getDistanceString(roundToDecimalPlace(distanceLargeUnit, 0), largeUnit); // If the distance is less than 401 feet/meters, round by fifty feet/meters } else if (distanceSmallUnit < SMALL_UNIT_THRESHOLD) { return getDistanceString(roundToClosestIncrement(distanceSmallUnit), smallUnit); // If the distance is between 401 feet/meters and 10 miles/kilometers, then round to one decimal place } else { return getDistanceString(roundToDecimalPlace(distanceLargeUnit, 1), largeUnit); } }
java
public SpannableString formatDistance(double distance) { double distanceSmallUnit = TurfConversion.convertLength(distance, TurfConstants.UNIT_METERS, smallUnit); double distanceLargeUnit = TurfConversion.convertLength(distance, TurfConstants.UNIT_METERS, largeUnit); // If the distance is greater than 10 miles/kilometers, then round to nearest mile/kilometer if (distanceLargeUnit > LARGE_UNIT_THRESHOLD) { return getDistanceString(roundToDecimalPlace(distanceLargeUnit, 0), largeUnit); // If the distance is less than 401 feet/meters, round by fifty feet/meters } else if (distanceSmallUnit < SMALL_UNIT_THRESHOLD) { return getDistanceString(roundToClosestIncrement(distanceSmallUnit), smallUnit); // If the distance is between 401 feet/meters and 10 miles/kilometers, then round to one decimal place } else { return getDistanceString(roundToDecimalPlace(distanceLargeUnit, 1), largeUnit); } }
[ "public", "SpannableString", "formatDistance", "(", "double", "distance", ")", "{", "double", "distanceSmallUnit", "=", "TurfConversion", ".", "convertLength", "(", "distance", ",", "TurfConstants", ".", "UNIT_METERS", ",", "smallUnit", ")", ";", "double", "distanceLargeUnit", "=", "TurfConversion", ".", "convertLength", "(", "distance", ",", "TurfConstants", ".", "UNIT_METERS", ",", "largeUnit", ")", ";", "// If the distance is greater than 10 miles/kilometers, then round to nearest mile/kilometer", "if", "(", "distanceLargeUnit", ">", "LARGE_UNIT_THRESHOLD", ")", "{", "return", "getDistanceString", "(", "roundToDecimalPlace", "(", "distanceLargeUnit", ",", "0", ")", ",", "largeUnit", ")", ";", "// If the distance is less than 401 feet/meters, round by fifty feet/meters", "}", "else", "if", "(", "distanceSmallUnit", "<", "SMALL_UNIT_THRESHOLD", ")", "{", "return", "getDistanceString", "(", "roundToClosestIncrement", "(", "distanceSmallUnit", ")", ",", "smallUnit", ")", ";", "// If the distance is between 401 feet/meters and 10 miles/kilometers, then round to one decimal place", "}", "else", "{", "return", "getDistanceString", "(", "roundToDecimalPlace", "(", "distanceLargeUnit", ",", "1", ")", ",", "largeUnit", ")", ";", "}", "}" ]
Returns a formatted SpannableString with bold and size formatting. I.e., "10 mi", "350 m" @param distance in meters @return SpannableString representation which has a bolded number and units which have a relative size of .65 times the size of the number
[ "Returns", "a", "formatted", "SpannableString", "with", "bold", "and", "size", "formatting", ".", "I", ".", "e", ".", "10", "mi", "350", "m" ]
375a89c017d360b9defc2c90d0c03468165162ec
https://github.com/mapbox/mapbox-navigation-android/blob/375a89c017d360b9defc2c90d0c03468165162ec/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/utils/DistanceFormatter.java#L92-L106
23,117
mapbox/mapbox-navigation-android
libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/utils/DistanceFormatter.java
DistanceFormatter.roundToClosestIncrement
private String roundToClosestIncrement(double distance) { int roundedNumber = ((int) Math.round(distance)) / roundingIncrement * roundingIncrement; return String.valueOf(roundedNumber < roundingIncrement ? roundingIncrement : roundedNumber); }
java
private String roundToClosestIncrement(double distance) { int roundedNumber = ((int) Math.round(distance)) / roundingIncrement * roundingIncrement; return String.valueOf(roundedNumber < roundingIncrement ? roundingIncrement : roundedNumber); }
[ "private", "String", "roundToClosestIncrement", "(", "double", "distance", ")", "{", "int", "roundedNumber", "=", "(", "(", "int", ")", "Math", ".", "round", "(", "distance", ")", ")", "/", "roundingIncrement", "*", "roundingIncrement", ";", "return", "String", ".", "valueOf", "(", "roundedNumber", "<", "roundingIncrement", "?", "roundingIncrement", ":", "roundedNumber", ")", ";", "}" ]
Returns number rounded to closest specified rounding increment, unless the number is less than the rounding increment, then the rounding increment is returned @param distance to round to closest specified rounding increment @return number rounded to closest rounding increment, or rounding increment if distance is less
[ "Returns", "number", "rounded", "to", "closest", "specified", "rounding", "increment", "unless", "the", "number", "is", "less", "than", "the", "rounding", "increment", "then", "the", "rounding", "increment", "is", "returned" ]
375a89c017d360b9defc2c90d0c03468165162ec
https://github.com/mapbox/mapbox-navigation-android/blob/375a89c017d360b9defc2c90d0c03468165162ec/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/utils/DistanceFormatter.java#L128-L132
23,118
mapbox/mapbox-navigation-android
libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/utils/DistanceFormatter.java
DistanceFormatter.roundToDecimalPlace
private String roundToDecimalPlace(double distance, int decimalPlace) { numberFormat.setMaximumFractionDigits(decimalPlace); return numberFormat.format(distance); }
java
private String roundToDecimalPlace(double distance, int decimalPlace) { numberFormat.setMaximumFractionDigits(decimalPlace); return numberFormat.format(distance); }
[ "private", "String", "roundToDecimalPlace", "(", "double", "distance", ",", "int", "decimalPlace", ")", "{", "numberFormat", ".", "setMaximumFractionDigits", "(", "decimalPlace", ")", ";", "return", "numberFormat", ".", "format", "(", "distance", ")", ";", "}" ]
Rounds given number to the given decimal place @param distance to round @param decimalPlace number of decimal places to round @return distance rounded to given decimal places
[ "Rounds", "given", "number", "to", "the", "given", "decimal", "place" ]
375a89c017d360b9defc2c90d0c03468165162ec
https://github.com/mapbox/mapbox-navigation-android/blob/375a89c017d360b9defc2c90d0c03468165162ec/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/utils/DistanceFormatter.java#L141-L145
23,119
mapbox/mapbox-navigation-android
libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/utils/DistanceFormatter.java
DistanceFormatter.getDistanceString
private SpannableString getDistanceString(String distance, String unit) { SpannableString spannableString = new SpannableString(String.format("%s %s", distance, unitStrings.get(unit))); spannableString.setSpan(new StyleSpan(Typeface.BOLD), 0, distance.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); spannableString.setSpan(new RelativeSizeSpan(0.65f), distance.length() + 1, spannableString.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); return spannableString; }
java
private SpannableString getDistanceString(String distance, String unit) { SpannableString spannableString = new SpannableString(String.format("%s %s", distance, unitStrings.get(unit))); spannableString.setSpan(new StyleSpan(Typeface.BOLD), 0, distance.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); spannableString.setSpan(new RelativeSizeSpan(0.65f), distance.length() + 1, spannableString.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); return spannableString; }
[ "private", "SpannableString", "getDistanceString", "(", "String", "distance", ",", "String", "unit", ")", "{", "SpannableString", "spannableString", "=", "new", "SpannableString", "(", "String", ".", "format", "(", "\"%s %s\"", ",", "distance", ",", "unitStrings", ".", "get", "(", "unit", ")", ")", ")", ";", "spannableString", ".", "setSpan", "(", "new", "StyleSpan", "(", "Typeface", ".", "BOLD", ")", ",", "0", ",", "distance", ".", "length", "(", ")", ",", "Spanned", ".", "SPAN_EXCLUSIVE_EXCLUSIVE", ")", ";", "spannableString", ".", "setSpan", "(", "new", "RelativeSizeSpan", "(", "0.65f", ")", ",", "distance", ".", "length", "(", ")", "+", "1", ",", "spannableString", ".", "length", "(", ")", ",", "Spanned", ".", "SPAN_EXCLUSIVE_EXCLUSIVE", ")", ";", "return", "spannableString", ";", "}" ]
Takes in a distance and units and returns a formatted SpannableString where the number is bold and the unit is shrunked to .65 times the size @param distance formatted with appropriate decimal places @param unit string from TurfConstants. This will be converted to the abbreviated form. @return String with bolded distance and shrunken units
[ "Takes", "in", "a", "distance", "and", "units", "and", "returns", "a", "formatted", "SpannableString", "where", "the", "number", "is", "bold", "and", "the", "unit", "is", "shrunked", "to", ".", "65", "times", "the", "size" ]
375a89c017d360b9defc2c90d0c03468165162ec
https://github.com/mapbox/mapbox-navigation-android/blob/375a89c017d360b9defc2c90d0c03468165162ec/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/utils/DistanceFormatter.java#L155-L163
23,120
mapbox/mapbox-navigation-android
libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/navigation/MapboxNavigation.java
MapboxNavigation.onDestroy
public void onDestroy() { stopNavigation(); removeOffRouteListener(null); removeProgressChangeListener(null); removeMilestoneEventListener(null); removeNavigationEventListener(null); removeFasterRouteListener(null); removeRawLocationListener(null); }
java
public void onDestroy() { stopNavigation(); removeOffRouteListener(null); removeProgressChangeListener(null); removeMilestoneEventListener(null); removeNavigationEventListener(null); removeFasterRouteListener(null); removeRawLocationListener(null); }
[ "public", "void", "onDestroy", "(", ")", "{", "stopNavigation", "(", ")", ";", "removeOffRouteListener", "(", "null", ")", ";", "removeProgressChangeListener", "(", "null", ")", ";", "removeMilestoneEventListener", "(", "null", ")", ";", "removeNavigationEventListener", "(", "null", ")", ";", "removeFasterRouteListener", "(", "null", ")", ";", "removeRawLocationListener", "(", "null", ")", ";", "}" ]
Critical to place inside your navigation activity so that when your application gets destroyed the navigation service unbinds and gets destroyed, preventing any memory leaks. Calling this also removes all listeners that have been attached.
[ "Critical", "to", "place", "inside", "your", "navigation", "activity", "so", "that", "when", "your", "application", "gets", "destroyed", "the", "navigation", "service", "unbinds", "and", "gets", "destroyed", "preventing", "any", "memory", "leaks", ".", "Calling", "this", "also", "removes", "all", "listeners", "that", "have", "been", "attached", "." ]
375a89c017d360b9defc2c90d0c03468165162ec
https://github.com/mapbox/mapbox-navigation-android/blob/375a89c017d360b9defc2c90d0c03468165162ec/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/navigation/MapboxNavigation.java#L174-L182
23,121
mapbox/mapbox-navigation-android
libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/navigation/MapboxNavigation.java
MapboxNavigation.removeMilestone
@SuppressWarnings("WeakerAccess") // Public exposed for usage outside SDK public void removeMilestone(int milestoneIdentifier) { for (Milestone milestone : milestones) { if (milestoneIdentifier == milestone.getIdentifier()) { removeMilestone(milestone); return; } } Timber.w("No milestone found with the specified identifier."); }
java
@SuppressWarnings("WeakerAccess") // Public exposed for usage outside SDK public void removeMilestone(int milestoneIdentifier) { for (Milestone milestone : milestones) { if (milestoneIdentifier == milestone.getIdentifier()) { removeMilestone(milestone); return; } } Timber.w("No milestone found with the specified identifier."); }
[ "@", "SuppressWarnings", "(", "\"WeakerAccess\"", ")", "// Public exposed for usage outside SDK", "public", "void", "removeMilestone", "(", "int", "milestoneIdentifier", ")", "{", "for", "(", "Milestone", "milestone", ":", "milestones", ")", "{", "if", "(", "milestoneIdentifier", "==", "milestone", ".", "getIdentifier", "(", ")", ")", "{", "removeMilestone", "(", "milestone", ")", ";", "return", ";", "}", "}", "Timber", ".", "w", "(", "\"No milestone found with the specified identifier.\"", ")", ";", "}" ]
Remove a specific milestone by passing in the identifier associated with the milestone you'd like to remove. If the identifier passed in does not match one of the milestones in the list, a warning will return in the log. @param milestoneIdentifier identifier matching one of the milestones @since 0.5.0
[ "Remove", "a", "specific", "milestone", "by", "passing", "in", "the", "identifier", "associated", "with", "the", "milestone", "you", "d", "like", "to", "remove", ".", "If", "the", "identifier", "passed", "in", "does", "not", "match", "one", "of", "the", "milestones", "in", "the", "list", "a", "warning", "will", "return", "in", "the", "log", "." ]
375a89c017d360b9defc2c90d0c03468165162ec
https://github.com/mapbox/mapbox-navigation-android/blob/375a89c017d360b9defc2c90d0c03468165162ec/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/navigation/MapboxNavigation.java#L252-L261
23,122
mapbox/mapbox-navigation-android
libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/map/NavigationMapboxMap.java
NavigationMapboxMap.updateWaynameQueryMap
public void updateWaynameQueryMap(boolean isEnabled) { if (mapWayName != null) { mapWayName.updateWayNameQueryMap(isEnabled); } else { settings.updateWayNameEnabled(isEnabled); } }
java
public void updateWaynameQueryMap(boolean isEnabled) { if (mapWayName != null) { mapWayName.updateWayNameQueryMap(isEnabled); } else { settings.updateWayNameEnabled(isEnabled); } }
[ "public", "void", "updateWaynameQueryMap", "(", "boolean", "isEnabled", ")", "{", "if", "(", "mapWayName", "!=", "null", ")", "{", "mapWayName", ".", "updateWayNameQueryMap", "(", "isEnabled", ")", ";", "}", "else", "{", "settings", ".", "updateWayNameEnabled", "(", "isEnabled", ")", ";", "}", "}" ]
Enables or disables the way name chip underneath the location icon. @param isEnabled true to enable, false to disable
[ "Enables", "or", "disables", "the", "way", "name", "chip", "underneath", "the", "location", "icon", "." ]
375a89c017d360b9defc2c90d0c03468165162ec
https://github.com/mapbox/mapbox-navigation-android/blob/375a89c017d360b9defc2c90d0c03468165162ec/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/map/NavigationMapboxMap.java#L453-L459
23,123
mapbox/mapbox-navigation-android
libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/navigation/TileUnpacker.java
TileUnpacker.unpack
void unpack(File src, String destPath, UnpackUpdateTask.ProgressUpdateListener updateListener) { new UnpackerTask(offlineNavigator).executeOnExecutor( AsyncTask.THREAD_POOL_EXECUTOR, src.getAbsolutePath(), destPath + File.separator); new UnpackUpdateTask(updateListener).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, src); }
java
void unpack(File src, String destPath, UnpackUpdateTask.ProgressUpdateListener updateListener) { new UnpackerTask(offlineNavigator).executeOnExecutor( AsyncTask.THREAD_POOL_EXECUTOR, src.getAbsolutePath(), destPath + File.separator); new UnpackUpdateTask(updateListener).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, src); }
[ "void", "unpack", "(", "File", "src", ",", "String", "destPath", ",", "UnpackUpdateTask", ".", "ProgressUpdateListener", "updateListener", ")", "{", "new", "UnpackerTask", "(", "offlineNavigator", ")", ".", "executeOnExecutor", "(", "AsyncTask", ".", "THREAD_POOL_EXECUTOR", ",", "src", ".", "getAbsolutePath", "(", ")", ",", "destPath", "+", "File", ".", "separator", ")", ";", "new", "UnpackUpdateTask", "(", "updateListener", ")", ".", "executeOnExecutor", "(", "AsyncTask", ".", "THREAD_POOL_EXECUTOR", ",", "src", ")", ";", "}" ]
Unpacks a TAR file at the srcPath into the destination directory. @param src where TAR file is located @param destPath to the destination directory @param updateListener listener to listen for progress updates
[ "Unpacks", "a", "TAR", "file", "at", "the", "srcPath", "into", "the", "destination", "directory", "." ]
375a89c017d360b9defc2c90d0c03468165162ec
https://github.com/mapbox/mapbox-navigation-android/blob/375a89c017d360b9defc2c90d0c03468165162ec/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/navigation/TileUnpacker.java#L21-L25
23,124
mapbox/mapbox-navigation-android
libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/navigation/NavigationService.java
NavigationService.onStartCommand
@Override public int onStartCommand(Intent intent, int flags, int startId) { NavigationTelemetry.getInstance().initializeLifecycleMonitor(getApplication()); return START_STICKY; }
java
@Override public int onStartCommand(Intent intent, int flags, int startId) { NavigationTelemetry.getInstance().initializeLifecycleMonitor(getApplication()); return START_STICKY; }
[ "@", "Override", "public", "int", "onStartCommand", "(", "Intent", "intent", ",", "int", "flags", ",", "int", "startId", ")", "{", "NavigationTelemetry", ".", "getInstance", "(", ")", ".", "initializeLifecycleMonitor", "(", "getApplication", "(", ")", ")", ";", "return", "START_STICKY", ";", "}" ]
Only should be called once since we want the service to continue running until the navigation session ends.
[ "Only", "should", "be", "called", "once", "since", "we", "want", "the", "service", "to", "continue", "running", "until", "the", "navigation", "session", "ends", "." ]
375a89c017d360b9defc2c90d0c03468165162ec
https://github.com/mapbox/mapbox-navigation-android/blob/375a89c017d360b9defc2c90d0c03468165162ec/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/navigation/NavigationService.java#L49-L53
23,125
mapbox/mapbox-navigation-android
libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/navigation/OfflineRoute.java
OfflineRoute.buildUrl
public String buildUrl() { String onlineUrl = onlineRoute.getCall().request().url().toString(); String offlineUrl = buildOfflineUrl(onlineUrl); return offlineUrl; }
java
public String buildUrl() { String onlineUrl = onlineRoute.getCall().request().url().toString(); String offlineUrl = buildOfflineUrl(onlineUrl); return offlineUrl; }
[ "public", "String", "buildUrl", "(", ")", "{", "String", "onlineUrl", "=", "onlineRoute", ".", "getCall", "(", ")", ".", "request", "(", ")", ".", "url", "(", ")", ".", "toString", "(", ")", ";", "String", "offlineUrl", "=", "buildOfflineUrl", "(", "onlineUrl", ")", ";", "return", "offlineUrl", ";", "}" ]
Builds a URL string for offline. @return the offline url string
[ "Builds", "a", "URL", "string", "for", "offline", "." ]
375a89c017d360b9defc2c90d0c03468165162ec
https://github.com/mapbox/mapbox-navigation-android/blob/375a89c017d360b9defc2c90d0c03468165162ec/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/navigation/OfflineRoute.java#L65-L69
23,126
mapbox/mapbox-navigation-android
libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/InstructionView.java
InstructionView.showRerouteState
public void showRerouteState() { if (rerouteLayout.getVisibility() == INVISIBLE) { rerouteLayout.startAnimation(rerouteSlideDownTop); rerouteLayout.setVisibility(VISIBLE); } }
java
public void showRerouteState() { if (rerouteLayout.getVisibility() == INVISIBLE) { rerouteLayout.startAnimation(rerouteSlideDownTop); rerouteLayout.setVisibility(VISIBLE); } }
[ "public", "void", "showRerouteState", "(", ")", "{", "if", "(", "rerouteLayout", ".", "getVisibility", "(", ")", "==", "INVISIBLE", ")", "{", "rerouteLayout", ".", "startAnimation", "(", "rerouteSlideDownTop", ")", ";", "rerouteLayout", ".", "setVisibility", "(", "VISIBLE", ")", ";", "}", "}" ]
Will slide the reroute view down from the top of the screen and make it visible @since 0.6.0
[ "Will", "slide", "the", "reroute", "view", "down", "from", "the", "top", "of", "the", "screen", "and", "make", "it", "visible" ]
375a89c017d360b9defc2c90d0c03468165162ec
https://github.com/mapbox/mapbox-navigation-android/blob/375a89c017d360b9defc2c90d0c03468165162ec/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/InstructionView.java#L279-L284
23,127
mapbox/mapbox-navigation-android
libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/InstructionView.java
InstructionView.hideRerouteState
public void hideRerouteState() { if (rerouteLayout.getVisibility() == VISIBLE) { rerouteLayout.startAnimation(rerouteSlideUpTop); rerouteLayout.setVisibility(INVISIBLE); } }
java
public void hideRerouteState() { if (rerouteLayout.getVisibility() == VISIBLE) { rerouteLayout.startAnimation(rerouteSlideUpTop); rerouteLayout.setVisibility(INVISIBLE); } }
[ "public", "void", "hideRerouteState", "(", ")", "{", "if", "(", "rerouteLayout", ".", "getVisibility", "(", ")", "==", "VISIBLE", ")", "{", "rerouteLayout", ".", "startAnimation", "(", "rerouteSlideUpTop", ")", ";", "rerouteLayout", ".", "setVisibility", "(", "INVISIBLE", ")", ";", "}", "}" ]
Will slide the reroute view up to the top of the screen and hide it @since 0.6.0
[ "Will", "slide", "the", "reroute", "view", "up", "to", "the", "top", "of", "the", "screen", "and", "hide", "it" ]
375a89c017d360b9defc2c90d0c03468165162ec
https://github.com/mapbox/mapbox-navigation-android/blob/375a89c017d360b9defc2c90d0c03468165162ec/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/InstructionView.java#L292-L297
23,128
mapbox/mapbox-navigation-android
libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/InstructionView.java
InstructionView.initialize
private void initialize() { LocaleUtils localeUtils = new LocaleUtils(); String language = localeUtils.inferDeviceLanguage(getContext()); String unitType = localeUtils.getUnitTypeForDeviceLocale(getContext()); int roundingIncrement = NavigationConstants.ROUNDING_INCREMENT_FIFTY; distanceFormatter = new DistanceFormatter(getContext(), language, unitType, roundingIncrement); inflate(getContext(), R.layout.instruction_view_layout, this); }
java
private void initialize() { LocaleUtils localeUtils = new LocaleUtils(); String language = localeUtils.inferDeviceLanguage(getContext()); String unitType = localeUtils.getUnitTypeForDeviceLocale(getContext()); int roundingIncrement = NavigationConstants.ROUNDING_INCREMENT_FIFTY; distanceFormatter = new DistanceFormatter(getContext(), language, unitType, roundingIncrement); inflate(getContext(), R.layout.instruction_view_layout, this); }
[ "private", "void", "initialize", "(", ")", "{", "LocaleUtils", "localeUtils", "=", "new", "LocaleUtils", "(", ")", ";", "String", "language", "=", "localeUtils", ".", "inferDeviceLanguage", "(", "getContext", "(", ")", ")", ";", "String", "unitType", "=", "localeUtils", ".", "getUnitTypeForDeviceLocale", "(", "getContext", "(", ")", ")", ";", "int", "roundingIncrement", "=", "NavigationConstants", ".", "ROUNDING_INCREMENT_FIFTY", ";", "distanceFormatter", "=", "new", "DistanceFormatter", "(", "getContext", "(", ")", ",", "language", ",", "unitType", ",", "roundingIncrement", ")", ";", "inflate", "(", "getContext", "(", ")", ",", "R", ".", "layout", ".", "instruction_view_layout", ",", "this", ")", ";", "}" ]
Inflates this layout needed for this view and initializes the locale as the device locale.
[ "Inflates", "this", "layout", "needed", "for", "this", "view", "and", "initializes", "the", "locale", "as", "the", "device", "locale", "." ]
375a89c017d360b9defc2c90d0c03468165162ec
https://github.com/mapbox/mapbox-navigation-android/blob/375a89c017d360b9defc2c90d0c03468165162ec/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/InstructionView.java#L397-L404
23,129
mapbox/mapbox-navigation-android
libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/InstructionView.java
InstructionView.initializeLandscapeListListener
private void initializeLandscapeListListener() { instructionLayoutText.setOnClickListener(new OnClickListener() { @Override public void onClick(View instructionLayoutText) { boolean instructionsVisible = instructionListLayout.getVisibility() == VISIBLE; if (!instructionsVisible) { showInstructionList(); } else { hideInstructionList(); } } }); }
java
private void initializeLandscapeListListener() { instructionLayoutText.setOnClickListener(new OnClickListener() { @Override public void onClick(View instructionLayoutText) { boolean instructionsVisible = instructionListLayout.getVisibility() == VISIBLE; if (!instructionsVisible) { showInstructionList(); } else { hideInstructionList(); } } }); }
[ "private", "void", "initializeLandscapeListListener", "(", ")", "{", "instructionLayoutText", ".", "setOnClickListener", "(", "new", "OnClickListener", "(", ")", "{", "@", "Override", "public", "void", "onClick", "(", "View", "instructionLayoutText", ")", "{", "boolean", "instructionsVisible", "=", "instructionListLayout", ".", "getVisibility", "(", ")", "==", "VISIBLE", ";", "if", "(", "!", "instructionsVisible", ")", "{", "showInstructionList", "(", ")", ";", "}", "else", "{", "hideInstructionList", "(", ")", ";", "}", "}", "}", ")", ";", "}" ]
For landscape orientation, the click listener is attached to the instruction text layout and the constraints are adjusted before animating
[ "For", "landscape", "orientation", "the", "click", "listener", "is", "attached", "to", "the", "instruction", "text", "layout", "and", "the", "constraints", "are", "adjusted", "before", "animating" ]
375a89c017d360b9defc2c90d0c03468165162ec
https://github.com/mapbox/mapbox-navigation-android/blob/375a89c017d360b9defc2c90d0c03468165162ec/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/InstructionView.java#L564-L576
23,130
mapbox/mapbox-navigation-android
libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/InstructionView.java
InstructionView.newDistanceText
private boolean newDistanceText(InstructionModel model) { return !upcomingDistanceText.getText().toString().isEmpty() && !TextUtils.isEmpty(model.retrieveStepDistanceRemaining()) && !upcomingDistanceText.getText().toString() .contentEquals(model.retrieveStepDistanceRemaining().toString()); }
java
private boolean newDistanceText(InstructionModel model) { return !upcomingDistanceText.getText().toString().isEmpty() && !TextUtils.isEmpty(model.retrieveStepDistanceRemaining()) && !upcomingDistanceText.getText().toString() .contentEquals(model.retrieveStepDistanceRemaining().toString()); }
[ "private", "boolean", "newDistanceText", "(", "InstructionModel", "model", ")", "{", "return", "!", "upcomingDistanceText", ".", "getText", "(", ")", ".", "toString", "(", ")", ".", "isEmpty", "(", ")", "&&", "!", "TextUtils", ".", "isEmpty", "(", "model", ".", "retrieveStepDistanceRemaining", "(", ")", ")", "&&", "!", "upcomingDistanceText", ".", "getText", "(", ")", ".", "toString", "(", ")", ".", "contentEquals", "(", "model", ".", "retrieveStepDistanceRemaining", "(", ")", ".", "toString", "(", ")", ")", ";", "}" ]
Looks to see if we have a new distance text. @param model provides distance text
[ "Looks", "to", "see", "if", "we", "have", "a", "new", "distance", "text", "." ]
375a89c017d360b9defc2c90d0c03468165162ec
https://github.com/mapbox/mapbox-navigation-android/blob/375a89c017d360b9defc2c90d0c03468165162ec/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/InstructionView.java#L583-L588
23,131
mapbox/mapbox-navigation-android
libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/InstructionView.java
InstructionView.updateDistanceText
private void updateDistanceText(InstructionModel model) { if (newDistanceText(model)) { distanceText(model); } else if (upcomingDistanceText.getText().toString().isEmpty()) { distanceText(model); } }
java
private void updateDistanceText(InstructionModel model) { if (newDistanceText(model)) { distanceText(model); } else if (upcomingDistanceText.getText().toString().isEmpty()) { distanceText(model); } }
[ "private", "void", "updateDistanceText", "(", "InstructionModel", "model", ")", "{", "if", "(", "newDistanceText", "(", "model", ")", ")", "{", "distanceText", "(", "model", ")", ";", "}", "else", "if", "(", "upcomingDistanceText", ".", "getText", "(", ")", ".", "toString", "(", ")", ".", "isEmpty", "(", ")", ")", "{", "distanceText", "(", "model", ")", ";", "}", "}" ]
Looks to see if we have a new distance text. Sets new distance text if found. @param model provides distance text
[ "Looks", "to", "see", "if", "we", "have", "a", "new", "distance", "text", ".", "Sets", "new", "distance", "text", "if", "found", "." ]
375a89c017d360b9defc2c90d0c03468165162ec
https://github.com/mapbox/mapbox-navigation-android/blob/375a89c017d360b9defc2c90d0c03468165162ec/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/InstructionView.java#L798-L804
23,132
mapbox/mapbox-navigation-android
libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/InstructionView.java
InstructionView.updateInstructionList
private void updateInstructionList(InstructionModel model) { RouteProgress routeProgress = model.retrieveProgress(); boolean isListShowing = instructionListLayout.getVisibility() == VISIBLE; rvInstructions.stopScroll(); instructionListAdapter.updateBannerListWith(routeProgress, isListShowing); }
java
private void updateInstructionList(InstructionModel model) { RouteProgress routeProgress = model.retrieveProgress(); boolean isListShowing = instructionListLayout.getVisibility() == VISIBLE; rvInstructions.stopScroll(); instructionListAdapter.updateBannerListWith(routeProgress, isListShowing); }
[ "private", "void", "updateInstructionList", "(", "InstructionModel", "model", ")", "{", "RouteProgress", "routeProgress", "=", "model", ".", "retrieveProgress", "(", ")", ";", "boolean", "isListShowing", "=", "instructionListLayout", ".", "getVisibility", "(", ")", "==", "VISIBLE", ";", "rvInstructions", ".", "stopScroll", "(", ")", ";", "instructionListAdapter", ".", "updateBannerListWith", "(", "routeProgress", ",", "isListShowing", ")", ";", "}" ]
Used to update the instructions list with the current steps. @param model to provide the current steps and unit type
[ "Used", "to", "update", "the", "instructions", "list", "with", "the", "current", "steps", "." ]
375a89c017d360b9defc2c90d0c03468165162ec
https://github.com/mapbox/mapbox-navigation-android/blob/375a89c017d360b9defc2c90d0c03468165162ec/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/InstructionView.java#L817-L822
23,133
mapbox/mapbox-navigation-android
libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/navigation/NavigationHelper.java
NavigationHelper.buildInstructionString
static String buildInstructionString(RouteProgress routeProgress, Milestone milestone) { if (milestone.getInstruction() != null) { // Create a new custom instruction based on the Instruction packaged with the Milestone return milestone.getInstruction().buildInstruction(routeProgress); } return EMPTY_STRING; }
java
static String buildInstructionString(RouteProgress routeProgress, Milestone milestone) { if (milestone.getInstruction() != null) { // Create a new custom instruction based on the Instruction packaged with the Milestone return milestone.getInstruction().buildInstruction(routeProgress); } return EMPTY_STRING; }
[ "static", "String", "buildInstructionString", "(", "RouteProgress", "routeProgress", ",", "Milestone", "milestone", ")", "{", "if", "(", "milestone", ".", "getInstruction", "(", ")", "!=", "null", ")", "{", "// Create a new custom instruction based on the Instruction packaged with the Milestone", "return", "milestone", ".", "getInstruction", "(", ")", ".", "buildInstruction", "(", "routeProgress", ")", ";", "}", "return", "EMPTY_STRING", ";", "}" ]
When a milestones triggered, it's instruction needs to be built either using the provided string or an empty string.
[ "When", "a", "milestones", "triggered", "it", "s", "instruction", "needs", "to", "be", "built", "either", "using", "the", "provided", "string", "or", "an", "empty", "string", "." ]
375a89c017d360b9defc2c90d0c03468165162ec
https://github.com/mapbox/mapbox-navigation-android/blob/375a89c017d360b9defc2c90d0c03468165162ec/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/navigation/NavigationHelper.java#L51-L57
23,134
mapbox/mapbox-navigation-android
libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/navigation/NavigationHelper.java
NavigationHelper.routeDistanceRemaining
static double routeDistanceRemaining(double legDistanceRemaining, int legIndex, DirectionsRoute directionsRoute) { if (directionsRoute.legs().size() < 2) { return legDistanceRemaining; } for (int i = legIndex + 1; i < directionsRoute.legs().size(); i++) { legDistanceRemaining += directionsRoute.legs().get(i).distance(); } return legDistanceRemaining; }
java
static double routeDistanceRemaining(double legDistanceRemaining, int legIndex, DirectionsRoute directionsRoute) { if (directionsRoute.legs().size() < 2) { return legDistanceRemaining; } for (int i = legIndex + 1; i < directionsRoute.legs().size(); i++) { legDistanceRemaining += directionsRoute.legs().get(i).distance(); } return legDistanceRemaining; }
[ "static", "double", "routeDistanceRemaining", "(", "double", "legDistanceRemaining", ",", "int", "legIndex", ",", "DirectionsRoute", "directionsRoute", ")", "{", "if", "(", "directionsRoute", ".", "legs", "(", ")", ".", "size", "(", ")", "<", "2", ")", "{", "return", "legDistanceRemaining", ";", "}", "for", "(", "int", "i", "=", "legIndex", "+", "1", ";", "i", "<", "directionsRoute", ".", "legs", "(", ")", ".", "size", "(", ")", ";", "i", "++", ")", "{", "legDistanceRemaining", "+=", "directionsRoute", ".", "legs", "(", ")", ".", "get", "(", "i", ")", ".", "distance", "(", ")", ";", "}", "return", "legDistanceRemaining", ";", "}" ]
Takes in the leg distance remaining value already calculated and if additional legs need to be traversed along after the current one, adds those distances and returns the new distance. Otherwise, if the route only contains one leg or the users on the last leg, this value will equal the leg distance remaining.
[ "Takes", "in", "the", "leg", "distance", "remaining", "value", "already", "calculated", "and", "if", "additional", "legs", "need", "to", "be", "traversed", "along", "after", "the", "current", "one", "adds", "those", "distances", "and", "returns", "the", "new", "distance", ".", "Otherwise", "if", "the", "route", "only", "contains", "one", "leg", "or", "the", "users", "on", "the", "last", "leg", "this", "value", "will", "equal", "the", "leg", "distance", "remaining", "." ]
375a89c017d360b9defc2c90d0c03468165162ec
https://github.com/mapbox/mapbox-navigation-android/blob/375a89c017d360b9defc2c90d0c03468165162ec/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/navigation/NavigationHelper.java#L65-L75
23,135
mapbox/mapbox-navigation-android
libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/utils/DownloadTask.java
DownloadTask.saveAsFile
private File saveAsFile(ResponseBody responseBody) { if (responseBody == null) { return null; } try { File file = new File(destDirectory + File.separator + fileName + retrieveUniqueId() + "." + extension); InputStream inputStream = null; OutputStream outputStream = null; try { inputStream = responseBody.byteStream(); outputStream = new FileOutputStream(file); byte[] buffer = new byte[4096]; int numOfBufferedBytes; while ((numOfBufferedBytes = inputStream.read(buffer)) != END_OF_FILE_DENOTER) { outputStream.write(buffer, 0, numOfBufferedBytes); } outputStream.flush(); return file; } catch (IOException exception) { return null; } catch (Exception exception) { return null; } finally { if (inputStream != null) { inputStream.close(); } if (outputStream != null) { outputStream.close(); } } } catch (IOException exception) { return null; } }
java
private File saveAsFile(ResponseBody responseBody) { if (responseBody == null) { return null; } try { File file = new File(destDirectory + File.separator + fileName + retrieveUniqueId() + "." + extension); InputStream inputStream = null; OutputStream outputStream = null; try { inputStream = responseBody.byteStream(); outputStream = new FileOutputStream(file); byte[] buffer = new byte[4096]; int numOfBufferedBytes; while ((numOfBufferedBytes = inputStream.read(buffer)) != END_OF_FILE_DENOTER) { outputStream.write(buffer, 0, numOfBufferedBytes); } outputStream.flush(); return file; } catch (IOException exception) { return null; } catch (Exception exception) { return null; } finally { if (inputStream != null) { inputStream.close(); } if (outputStream != null) { outputStream.close(); } } } catch (IOException exception) { return null; } }
[ "private", "File", "saveAsFile", "(", "ResponseBody", "responseBody", ")", "{", "if", "(", "responseBody", "==", "null", ")", "{", "return", "null", ";", "}", "try", "{", "File", "file", "=", "new", "File", "(", "destDirectory", "+", "File", ".", "separator", "+", "fileName", "+", "retrieveUniqueId", "(", ")", "+", "\".\"", "+", "extension", ")", ";", "InputStream", "inputStream", "=", "null", ";", "OutputStream", "outputStream", "=", "null", ";", "try", "{", "inputStream", "=", "responseBody", ".", "byteStream", "(", ")", ";", "outputStream", "=", "new", "FileOutputStream", "(", "file", ")", ";", "byte", "[", "]", "buffer", "=", "new", "byte", "[", "4096", "]", ";", "int", "numOfBufferedBytes", ";", "while", "(", "(", "numOfBufferedBytes", "=", "inputStream", ".", "read", "(", "buffer", ")", ")", "!=", "END_OF_FILE_DENOTER", ")", "{", "outputStream", ".", "write", "(", "buffer", ",", "0", ",", "numOfBufferedBytes", ")", ";", "}", "outputStream", ".", "flush", "(", ")", ";", "return", "file", ";", "}", "catch", "(", "IOException", "exception", ")", "{", "return", "null", ";", "}", "catch", "(", "Exception", "exception", ")", "{", "return", "null", ";", "}", "finally", "{", "if", "(", "inputStream", "!=", "null", ")", "{", "inputStream", ".", "close", "(", ")", ";", "}", "if", "(", "outputStream", "!=", "null", ")", "{", "outputStream", ".", "close", "(", ")", ";", "}", "}", "}", "catch", "(", "IOException", "exception", ")", "{", "return", "null", ";", "}", "}" ]
Saves the file returned in the response body as a file in the cache directory @param responseBody containing file @return resulting file, or null if there were any IO exceptions
[ "Saves", "the", "file", "returned", "in", "the", "response", "body", "as", "a", "file", "in", "the", "cache", "directory" ]
375a89c017d360b9defc2c90d0c03468165162ec
https://github.com/mapbox/mapbox-navigation-android/blob/375a89c017d360b9defc2c90d0c03468165162ec/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/utils/DownloadTask.java#L66-L108
23,136
mapbox/mapbox-navigation-android
libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/ThemeSwitcher.java
ThemeSwitcher.retrieveThemeColor
public static int retrieveThemeColor(Context context, int resId) { TypedValue outValue = resolveAttributeFromId(context, resId); if (outValue.type >= TypedValue.TYPE_FIRST_COLOR_INT && outValue.type <= TypedValue.TYPE_LAST_COLOR_INT) { return outValue.data; } else { return ContextCompat.getColor(context, outValue.resourceId); } }
java
public static int retrieveThemeColor(Context context, int resId) { TypedValue outValue = resolveAttributeFromId(context, resId); if (outValue.type >= TypedValue.TYPE_FIRST_COLOR_INT && outValue.type <= TypedValue.TYPE_LAST_COLOR_INT) { return outValue.data; } else { return ContextCompat.getColor(context, outValue.resourceId); } }
[ "public", "static", "int", "retrieveThemeColor", "(", "Context", "context", ",", "int", "resId", ")", "{", "TypedValue", "outValue", "=", "resolveAttributeFromId", "(", "context", ",", "resId", ")", ";", "if", "(", "outValue", ".", "type", ">=", "TypedValue", ".", "TYPE_FIRST_COLOR_INT", "&&", "outValue", ".", "type", "<=", "TypedValue", ".", "TYPE_LAST_COLOR_INT", ")", "{", "return", "outValue", ".", "data", ";", "}", "else", "{", "return", "ContextCompat", ".", "getColor", "(", "context", ",", "outValue", ".", "resourceId", ")", ";", "}", "}" ]
Looks are current theme and retrieves the color attribute for the given set theme. @param context to retrieve the set theme and resolved attribute and then color res Id with {@link ContextCompat} @return color resource identifier for primary theme color
[ "Looks", "are", "current", "theme", "and", "retrieves", "the", "color", "attribute", "for", "the", "given", "set", "theme", "." ]
375a89c017d360b9defc2c90d0c03468165162ec
https://github.com/mapbox/mapbox-navigation-android/blob/375a89c017d360b9defc2c90d0c03468165162ec/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/ThemeSwitcher.java#L31-L39
23,137
mapbox/mapbox-navigation-android
libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/ThemeSwitcher.java
ThemeSwitcher.retrieveNavigationViewStyle
public static int retrieveNavigationViewStyle(Context context, int styleResId) { TypedValue outValue = resolveAttributeFromId(context, styleResId); return outValue.resourceId; }
java
public static int retrieveNavigationViewStyle(Context context, int styleResId) { TypedValue outValue = resolveAttributeFromId(context, styleResId); return outValue.resourceId; }
[ "public", "static", "int", "retrieveNavigationViewStyle", "(", "Context", "context", ",", "int", "styleResId", ")", "{", "TypedValue", "outValue", "=", "resolveAttributeFromId", "(", "context", ",", "styleResId", ")", ";", "return", "outValue", ".", "resourceId", ";", "}" ]
Looks are current theme and retrieves the style for the given resId set in the theme. @param context to retrieve the resolved attribute @param styleResId for the given style @return resolved style resource Id
[ "Looks", "are", "current", "theme", "and", "retrieves", "the", "style", "for", "the", "given", "resId", "set", "in", "the", "theme", "." ]
375a89c017d360b9defc2c90d0c03468165162ec
https://github.com/mapbox/mapbox-navigation-android/blob/375a89c017d360b9defc2c90d0c03468165162ec/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/ThemeSwitcher.java#L74-L77
23,138
mapbox/mapbox-navigation-android
libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/navigation/OfflineNavigator.java
OfflineNavigator.configure
void configure(String tilePath, OnOfflineTilesConfiguredCallback callback) { new ConfigureRouterTask(navigator, tilePath, callback).execute(); }
java
void configure(String tilePath, OnOfflineTilesConfiguredCallback callback) { new ConfigureRouterTask(navigator, tilePath, callback).execute(); }
[ "void", "configure", "(", "String", "tilePath", ",", "OnOfflineTilesConfiguredCallback", "callback", ")", "{", "new", "ConfigureRouterTask", "(", "navigator", ",", "tilePath", ",", "callback", ")", ".", "execute", "(", ")", ";", "}" ]
Configures the navigator for getting offline routes @param tilePath directory path where the tiles are located @param callback a callback that will be fired when the offline data is initialized and {@link MapboxOfflineRouter#findRoute(OfflineRoute, OnOfflineRouteFoundCallback)} can be called safely
[ "Configures", "the", "navigator", "for", "getting", "offline", "routes" ]
375a89c017d360b9defc2c90d0c03468165162ec
https://github.com/mapbox/mapbox-navigation-android/blob/375a89c017d360b9defc2c90d0c03468165162ec/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/navigation/OfflineNavigator.java#L21-L23
23,139
mapbox/mapbox-navigation-android
libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/navigation/OfflineNavigator.java
OfflineNavigator.retrieveRouteFor
void retrieveRouteFor(OfflineRoute offlineRoute, OnOfflineRouteFoundCallback callback) { new OfflineRouteRetrievalTask(navigator, callback).execute(offlineRoute); }
java
void retrieveRouteFor(OfflineRoute offlineRoute, OnOfflineRouteFoundCallback callback) { new OfflineRouteRetrievalTask(navigator, callback).execute(offlineRoute); }
[ "void", "retrieveRouteFor", "(", "OfflineRoute", "offlineRoute", ",", "OnOfflineRouteFoundCallback", "callback", ")", "{", "new", "OfflineRouteRetrievalTask", "(", "navigator", ",", "callback", ")", ".", "execute", "(", "offlineRoute", ")", ";", "}" ]
Uses libvalhalla and local tile data to generate mapbox-directions-api-like json @param offlineRoute an offline navigation route @param callback which receives a RouterResult object with the json and a success/fail bool
[ "Uses", "libvalhalla", "and", "local", "tile", "data", "to", "generate", "mapbox", "-", "directions", "-", "api", "-", "like", "json" ]
375a89c017d360b9defc2c90d0c03468165162ec
https://github.com/mapbox/mapbox-navigation-android/blob/375a89c017d360b9defc2c90d0c03468165162ec/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/navigation/OfflineNavigator.java#L31-L33
23,140
mapbox/mapbox-navigation-android
libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/location/replay/ReplayRouteLocationConverter.java
ReplayRouteLocationConverter.sliceRoute
List<Point> sliceRoute(LineString lineString) { double distanceMeters = TurfMeasurement.length(lineString, TurfConstants.UNIT_METERS); if (distanceMeters <= 0) { return Collections.emptyList(); } List<Point> points = new ArrayList<>(); for (double i = 0; i < distanceMeters; i += distance) { Point point = TurfMeasurement.along(lineString, i, TurfConstants.UNIT_METERS); points.add(point); } return points; }
java
List<Point> sliceRoute(LineString lineString) { double distanceMeters = TurfMeasurement.length(lineString, TurfConstants.UNIT_METERS); if (distanceMeters <= 0) { return Collections.emptyList(); } List<Point> points = new ArrayList<>(); for (double i = 0; i < distanceMeters; i += distance) { Point point = TurfMeasurement.along(lineString, i, TurfConstants.UNIT_METERS); points.add(point); } return points; }
[ "List", "<", "Point", ">", "sliceRoute", "(", "LineString", "lineString", ")", "{", "double", "distanceMeters", "=", "TurfMeasurement", ".", "length", "(", "lineString", ",", "TurfConstants", ".", "UNIT_METERS", ")", ";", "if", "(", "distanceMeters", "<=", "0", ")", "{", "return", "Collections", ".", "emptyList", "(", ")", ";", "}", "List", "<", "Point", ">", "points", "=", "new", "ArrayList", "<>", "(", ")", ";", "for", "(", "double", "i", "=", "0", ";", "i", "<", "distanceMeters", ";", "i", "+=", "distance", ")", "{", "Point", "point", "=", "TurfMeasurement", ".", "along", "(", "lineString", ",", "i", ",", "TurfConstants", ".", "UNIT_METERS", ")", ";", "points", ".", "add", "(", "point", ")", ";", "}", "return", "points", ";", "}" ]
Interpolates the route into even points along the route and adds these to the points list. @param lineString our route geometry. @return list of sliced {@link Point}s.
[ "Interpolates", "the", "route", "into", "even", "points", "along", "the", "route", "and", "adds", "these", "to", "the", "points", "list", "." ]
375a89c017d360b9defc2c90d0c03468165162ec
https://github.com/mapbox/mapbox-navigation-android/blob/375a89c017d360b9defc2c90d0c03468165162ec/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/location/replay/ReplayRouteLocationConverter.java#L68-L80
23,141
mapbox/mapbox-navigation-android
libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/AbbreviationCreator.java
AbbreviationCreator.addPriorityInfo
private void addPriorityInfo(BannerComponents bannerComponents, int index) { Integer abbreviationPriority = bannerComponents.abbreviationPriority(); if (abbreviations.get(abbreviationPriority) == null) { abbreviations.put(abbreviationPriority, new ArrayList<Integer>()); } abbreviations.get(abbreviationPriority).add(index); }
java
private void addPriorityInfo(BannerComponents bannerComponents, int index) { Integer abbreviationPriority = bannerComponents.abbreviationPriority(); if (abbreviations.get(abbreviationPriority) == null) { abbreviations.put(abbreviationPriority, new ArrayList<Integer>()); } abbreviations.get(abbreviationPriority).add(index); }
[ "private", "void", "addPriorityInfo", "(", "BannerComponents", "bannerComponents", ",", "int", "index", ")", "{", "Integer", "abbreviationPriority", "=", "bannerComponents", ".", "abbreviationPriority", "(", ")", ";", "if", "(", "abbreviations", ".", "get", "(", "abbreviationPriority", ")", "==", "null", ")", "{", "abbreviations", ".", "put", "(", "abbreviationPriority", ",", "new", "ArrayList", "<", "Integer", ">", "(", ")", ")", ";", "}", "abbreviations", ".", "get", "(", "abbreviationPriority", ")", ".", "add", "(", "index", ")", ";", "}" ]
Adds the given BannerComponents object to the list of abbreviations so that when the list of BannerComponentNodes is completed, text can be abbreviated properly to fit the specified TextView. @param bannerComponents object holding the abbreviation information @param index in the list of BannerComponentNodes
[ "Adds", "the", "given", "BannerComponents", "object", "to", "the", "list", "of", "abbreviations", "so", "that", "when", "the", "list", "of", "BannerComponentNodes", "is", "completed", "text", "can", "be", "abbreviated", "properly", "to", "fit", "the", "specified", "TextView", "." ]
375a89c017d360b9defc2c90d0c03468165162ec
https://github.com/mapbox/mapbox-navigation-android/blob/375a89c017d360b9defc2c90d0c03468165162ec/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/AbbreviationCreator.java#L47-L53
23,142
mapbox/mapbox-navigation-android
libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/AbbreviationCreator.java
AbbreviationCreator.abbreviateBannerText
private String abbreviateBannerText(TextView textView, List<BannerComponentNode> bannerComponentNodes) { String bannerText = join(bannerComponentNodes); if (abbreviations.isEmpty()) { return bannerText; } bannerText = abbreviateUntilTextFits(textView, bannerText, bannerComponentNodes); abbreviations.clear(); return bannerText; }
java
private String abbreviateBannerText(TextView textView, List<BannerComponentNode> bannerComponentNodes) { String bannerText = join(bannerComponentNodes); if (abbreviations.isEmpty()) { return bannerText; } bannerText = abbreviateUntilTextFits(textView, bannerText, bannerComponentNodes); abbreviations.clear(); return bannerText; }
[ "private", "String", "abbreviateBannerText", "(", "TextView", "textView", ",", "List", "<", "BannerComponentNode", ">", "bannerComponentNodes", ")", "{", "String", "bannerText", "=", "join", "(", "bannerComponentNodes", ")", ";", "if", "(", "abbreviations", ".", "isEmpty", "(", ")", ")", "{", "return", "bannerText", ";", "}", "bannerText", "=", "abbreviateUntilTextFits", "(", "textView", ",", "bannerText", ",", "bannerComponentNodes", ")", ";", "abbreviations", ".", "clear", "(", ")", ";", "return", "bannerText", ";", "}" ]
Using the abbreviations HashMap which should already be populated, abbreviates the text in the bannerComponentNodes until the text fits the given TextView. @param textView to check the text fits @param bannerComponentNodes containing the text to construct @return the properly abbreviated string that will fit in the TextView
[ "Using", "the", "abbreviations", "HashMap", "which", "should", "already", "be", "populated", "abbreviates", "the", "text", "in", "the", "bannerComponentNodes", "until", "the", "text", "fits", "the", "given", "TextView", "." ]
375a89c017d360b9defc2c90d0c03468165162ec
https://github.com/mapbox/mapbox-navigation-android/blob/375a89c017d360b9defc2c90d0c03468165162ec/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/AbbreviationCreator.java#L63-L75
23,143
mapbox/mapbox-navigation-android
libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/navigation/MapboxOfflineRouter.java
MapboxOfflineRouter.configure
public void configure(String version, OnOfflineTilesConfiguredCallback callback) { offlineNavigator.configure(new File(tilePath, version).getAbsolutePath(), callback); }
java
public void configure(String version, OnOfflineTilesConfiguredCallback callback) { offlineNavigator.configure(new File(tilePath, version).getAbsolutePath(), callback); }
[ "public", "void", "configure", "(", "String", "version", ",", "OnOfflineTilesConfiguredCallback", "callback", ")", "{", "offlineNavigator", ".", "configure", "(", "new", "File", "(", "tilePath", ",", "version", ")", ".", "getAbsolutePath", "(", ")", ",", "callback", ")", ";", "}" ]
Configures the navigator for getting offline routes. @param version version of offline tiles to use @param callback a callback that will be fired when the offline data is configured and {@link MapboxOfflineRouter#findRoute(OfflineRoute, OnOfflineRouteFoundCallback)} can be called safely
[ "Configures", "the", "navigator", "for", "getting", "offline", "routes", "." ]
375a89c017d360b9defc2c90d0c03468165162ec
https://github.com/mapbox/mapbox-navigation-android/blob/375a89c017d360b9defc2c90d0c03468165162ec/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/navigation/MapboxOfflineRouter.java#L57-L59
23,144
mapbox/mapbox-navigation-android
libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/utils/LocaleUtils.java
LocaleUtils.inferDeviceLocale
public Locale inferDeviceLocale(Context context) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { return context.getResources().getConfiguration().getLocales().get(0); } else { return context.getResources().getConfiguration().locale; } }
java
public Locale inferDeviceLocale(Context context) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { return context.getResources().getConfiguration().getLocales().get(0); } else { return context.getResources().getConfiguration().locale; } }
[ "public", "Locale", "inferDeviceLocale", "(", "Context", "context", ")", "{", "if", "(", "Build", ".", "VERSION", ".", "SDK_INT", ">=", "Build", ".", "VERSION_CODES", ".", "N", ")", "{", "return", "context", ".", "getResources", "(", ")", ".", "getConfiguration", "(", ")", ".", "getLocales", "(", ")", ".", "get", "(", "0", ")", ";", "}", "else", "{", "return", "context", ".", "getResources", "(", ")", ".", "getConfiguration", "(", ")", ".", "locale", ";", "}", "}" ]
Returns the device locale for which to use as a default if no language is specified @param context to check configuration @return locale of device
[ "Returns", "the", "device", "locale", "for", "which", "to", "use", "as", "a", "default", "if", "no", "language", "is", "specified" ]
375a89c017d360b9defc2c90d0c03468165162ec
https://github.com/mapbox/mapbox-navigation-android/blob/375a89c017d360b9defc2c90d0c03468165162ec/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/utils/LocaleUtils.java#L48-L54
23,145
mapbox/mapbox-navigation-android
libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/utils/LocaleUtils.java
LocaleUtils.getNonEmptyLanguage
public String getNonEmptyLanguage(Context context, String language) { if (language == null) { return inferDeviceLanguage(context); } return language; }
java
public String getNonEmptyLanguage(Context context, String language) { if (language == null) { return inferDeviceLanguage(context); } return language; }
[ "public", "String", "getNonEmptyLanguage", "(", "Context", "context", ",", "String", "language", ")", "{", "if", "(", "language", "==", "null", ")", "{", "return", "inferDeviceLanguage", "(", "context", ")", ";", "}", "return", "language", ";", "}" ]
Returns the locale passed in if it is not null, otherwise returns the device locale @param context to get device locale @param language to check if it is null @return a non-null locale, either the one passed in, or the device locale
[ "Returns", "the", "locale", "passed", "in", "if", "it", "is", "not", "null", "otherwise", "returns", "the", "device", "locale" ]
375a89c017d360b9defc2c90d0c03468165162ec
https://github.com/mapbox/mapbox-navigation-android/blob/375a89c017d360b9defc2c90d0c03468165162ec/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/utils/LocaleUtils.java#L63-L68
23,146
mapbox/mapbox-navigation-android
libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/utils/LocaleUtils.java
LocaleUtils.retrieveNonNullUnitType
public String retrieveNonNullUnitType(Context context, String unitType) { if (unitType == null) { return getUnitTypeForDeviceLocale(context); } return unitType; }
java
public String retrieveNonNullUnitType(Context context, String unitType) { if (unitType == null) { return getUnitTypeForDeviceLocale(context); } return unitType; }
[ "public", "String", "retrieveNonNullUnitType", "(", "Context", "context", ",", "String", "unitType", ")", "{", "if", "(", "unitType", "==", "null", ")", "{", "return", "getUnitTypeForDeviceLocale", "(", "context", ")", ";", "}", "return", "unitType", ";", "}" ]
Returns the unitType passed in if it is not null, otherwise returns the a unitType based on the device Locale. @param context to get device locale @param unitType to check if it is null @return a non-null unitType, either the one passed in, or based on the device locale
[ "Returns", "the", "unitType", "passed", "in", "if", "it", "is", "not", "null", "otherwise", "returns", "the", "a", "unitType", "based", "on", "the", "device", "Locale", "." ]
375a89c017d360b9defc2c90d0c03468165162ec
https://github.com/mapbox/mapbox-navigation-android/blob/375a89c017d360b9defc2c90d0c03468165162ec/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/utils/LocaleUtils.java#L88-L93
23,147
mapbox/mapbox-navigation-android
libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/utils/MathUtils.java
MathUtils.differenceBetweenAngles
public static double differenceBetweenAngles(double alpha, double beta) { double phi = Math.abs(beta - alpha) % 360; return phi > 180 ? 360 - phi : phi; }
java
public static double differenceBetweenAngles(double alpha, double beta) { double phi = Math.abs(beta - alpha) % 360; return phi > 180 ? 360 - phi : phi; }
[ "public", "static", "double", "differenceBetweenAngles", "(", "double", "alpha", ",", "double", "beta", ")", "{", "double", "phi", "=", "Math", ".", "abs", "(", "beta", "-", "alpha", ")", "%", "360", ";", "return", "phi", ">", "180", "?", "360", "-", "phi", ":", "phi", ";", "}" ]
Returns the smallest angle between two angles. @param alpha First angle in degrees @param beta Second angle in degrees @return Smallest angle between two angles.
[ "Returns", "the", "smallest", "angle", "between", "two", "angles", "." ]
375a89c017d360b9defc2c90d0c03468165162ec
https://github.com/mapbox/mapbox-navigation-android/blob/375a89c017d360b9defc2c90d0c03468165162ec/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/utils/MathUtils.java#L76-L79
23,148
mapbox/mapbox-navigation-android
libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/voice/MapboxSpeechPlayer.java
MapboxSpeechPlayer.play
@Override public void play(SpeechAnnouncement announcement) { boolean isInvalidAnnouncement = announcement == null; if (isInvalidAnnouncement) { return; } this.announcement = announcement; playAnnouncementTextAndTypeFrom(announcement); }
java
@Override public void play(SpeechAnnouncement announcement) { boolean isInvalidAnnouncement = announcement == null; if (isInvalidAnnouncement) { return; } this.announcement = announcement; playAnnouncementTextAndTypeFrom(announcement); }
[ "@", "Override", "public", "void", "play", "(", "SpeechAnnouncement", "announcement", ")", "{", "boolean", "isInvalidAnnouncement", "=", "announcement", "==", "null", ";", "if", "(", "isInvalidAnnouncement", ")", "{", "return", ";", "}", "this", ".", "announcement", "=", "announcement", ";", "playAnnouncementTextAndTypeFrom", "(", "announcement", ")", ";", "}" ]
Plays the specified text instruction using MapboxSpeech API, defaulting to SSML input type @param announcement with voice instruction to be synthesized and played
[ "Plays", "the", "specified", "text", "instruction", "using", "MapboxSpeech", "API", "defaulting", "to", "SSML", "input", "type" ]
375a89c017d360b9defc2c90d0c03468165162ec
https://github.com/mapbox/mapbox-navigation-android/blob/375a89c017d360b9defc2c90d0c03468165162ec/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/voice/MapboxSpeechPlayer.java#L63-L71
23,149
mapbox/mapbox-navigation-android
libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/voice/AndroidSpeechPlayer.java
AndroidSpeechPlayer.play
@Override public void play(SpeechAnnouncement speechAnnouncement) { boolean isValidAnnouncement = speechAnnouncement != null && !TextUtils.isEmpty(speechAnnouncement.announcement()); boolean canPlay = isValidAnnouncement && languageSupported && !isMuted; if (!canPlay) { return; } fireInstructionListenerIfApi14(); HashMap<String, String> params = new HashMap<>(1); params.put(TextToSpeech.Engine.KEY_PARAM_UTTERANCE_ID, DEFAULT_UTTERANCE_ID); textToSpeech.speak(speechAnnouncement.announcement(), TextToSpeech.QUEUE_ADD, params); }
java
@Override public void play(SpeechAnnouncement speechAnnouncement) { boolean isValidAnnouncement = speechAnnouncement != null && !TextUtils.isEmpty(speechAnnouncement.announcement()); boolean canPlay = isValidAnnouncement && languageSupported && !isMuted; if (!canPlay) { return; } fireInstructionListenerIfApi14(); HashMap<String, String> params = new HashMap<>(1); params.put(TextToSpeech.Engine.KEY_PARAM_UTTERANCE_ID, DEFAULT_UTTERANCE_ID); textToSpeech.speak(speechAnnouncement.announcement(), TextToSpeech.QUEUE_ADD, params); }
[ "@", "Override", "public", "void", "play", "(", "SpeechAnnouncement", "speechAnnouncement", ")", "{", "boolean", "isValidAnnouncement", "=", "speechAnnouncement", "!=", "null", "&&", "!", "TextUtils", ".", "isEmpty", "(", "speechAnnouncement", ".", "announcement", "(", ")", ")", ";", "boolean", "canPlay", "=", "isValidAnnouncement", "&&", "languageSupported", "&&", "!", "isMuted", ";", "if", "(", "!", "canPlay", ")", "{", "return", ";", "}", "fireInstructionListenerIfApi14", "(", ")", ";", "HashMap", "<", "String", ",", "String", ">", "params", "=", "new", "HashMap", "<>", "(", "1", ")", ";", "params", ".", "put", "(", "TextToSpeech", ".", "Engine", ".", "KEY_PARAM_UTTERANCE_ID", ",", "DEFAULT_UTTERANCE_ID", ")", ";", "textToSpeech", ".", "speak", "(", "speechAnnouncement", ".", "announcement", "(", ")", ",", "TextToSpeech", ".", "QUEUE_ADD", ",", "params", ")", ";", "}" ]
Plays the given voice instruction using TTS @param speechAnnouncement with voice instruction to be synthesized and played
[ "Plays", "the", "given", "voice", "instruction", "using", "TTS" ]
375a89c017d360b9defc2c90d0c03468165162ec
https://github.com/mapbox/mapbox-navigation-android/blob/375a89c017d360b9defc2c90d0c03468165162ec/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/voice/AndroidSpeechPlayer.java#L57-L71
23,150
mapbox/mapbox-navigation-android
libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/navigation/RouteProcessorThreadListener.java
RouteProcessorThreadListener.onNewRouteProgress
@Override public void onNewRouteProgress(Location location, RouteProgress routeProgress) { notificationProvider.updateNavigationNotification(routeProgress); eventDispatcher.onProgressChange(location, routeProgress); }
java
@Override public void onNewRouteProgress(Location location, RouteProgress routeProgress) { notificationProvider.updateNavigationNotification(routeProgress); eventDispatcher.onProgressChange(location, routeProgress); }
[ "@", "Override", "public", "void", "onNewRouteProgress", "(", "Location", "location", ",", "RouteProgress", "routeProgress", ")", "{", "notificationProvider", ".", "updateNavigationNotification", "(", "routeProgress", ")", ";", "eventDispatcher", ".", "onProgressChange", "(", "location", ",", "routeProgress", ")", ";", "}" ]
Corresponds to ProgressChangeListener object, updating the notification and passing information to the navigation event dispatcher.
[ "Corresponds", "to", "ProgressChangeListener", "object", "updating", "the", "notification", "and", "passing", "information", "to", "the", "navigation", "event", "dispatcher", "." ]
375a89c017d360b9defc2c90d0c03468165162ec
https://github.com/mapbox/mapbox-navigation-android/blob/375a89c017d360b9defc2c90d0c03468165162ec/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/navigation/RouteProcessorThreadListener.java#L31-L35
23,151
mapbox/mapbox-navigation-android
libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/navigation/RouteProcessorThreadListener.java
RouteProcessorThreadListener.onMilestoneTrigger
@Override public void onMilestoneTrigger(List<Milestone> triggeredMilestones, RouteProgress routeProgress) { for (Milestone milestone : triggeredMilestones) { String instruction = buildInstructionString(routeProgress, milestone); eventDispatcher.onMilestoneEvent(routeProgress, instruction, milestone); } }
java
@Override public void onMilestoneTrigger(List<Milestone> triggeredMilestones, RouteProgress routeProgress) { for (Milestone milestone : triggeredMilestones) { String instruction = buildInstructionString(routeProgress, milestone); eventDispatcher.onMilestoneEvent(routeProgress, instruction, milestone); } }
[ "@", "Override", "public", "void", "onMilestoneTrigger", "(", "List", "<", "Milestone", ">", "triggeredMilestones", ",", "RouteProgress", "routeProgress", ")", "{", "for", "(", "Milestone", "milestone", ":", "triggeredMilestones", ")", "{", "String", "instruction", "=", "buildInstructionString", "(", "routeProgress", ",", "milestone", ")", ";", "eventDispatcher", ".", "onMilestoneEvent", "(", "routeProgress", ",", "instruction", ",", "milestone", ")", ";", "}", "}" ]
With each valid and successful rawLocation update, this will get called once the work on the navigation engine thread has finished. Depending on whether or not a milestone gets triggered or not, the navigation event dispatcher will be called to notify the developer.
[ "With", "each", "valid", "and", "successful", "rawLocation", "update", "this", "will", "get", "called", "once", "the", "work", "on", "the", "navigation", "engine", "thread", "has", "finished", ".", "Depending", "on", "whether", "or", "not", "a", "milestone", "gets", "triggered", "or", "not", "the", "navigation", "event", "dispatcher", "will", "be", "called", "to", "notify", "the", "developer", "." ]
375a89c017d360b9defc2c90d0c03468165162ec
https://github.com/mapbox/mapbox-navigation-android/blob/375a89c017d360b9defc2c90d0c03468165162ec/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/navigation/RouteProcessorThreadListener.java#L42-L48
23,152
mapbox/mapbox-navigation-android
libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/BannerComponentTree.java
BannerComponentTree.parseBannerComponents
private List<BannerComponentNode> parseBannerComponents(BannerText bannerText) { int length = 0; List<BannerComponentNode> bannerComponentNodes = new ArrayList<>(); for (BannerComponents components : bannerText.components()) { BannerComponentNode node = null; for (NodeCreator nodeCreator : nodeCreators) { if (nodeCreator.isNodeType(components)) { node = nodeCreator.setupNode(components, bannerComponentNodes.size(), length, bannerText.modifier()); break; } } if (node != null) { bannerComponentNodes.add(node); length += components.text().length(); } } return bannerComponentNodes; }
java
private List<BannerComponentNode> parseBannerComponents(BannerText bannerText) { int length = 0; List<BannerComponentNode> bannerComponentNodes = new ArrayList<>(); for (BannerComponents components : bannerText.components()) { BannerComponentNode node = null; for (NodeCreator nodeCreator : nodeCreators) { if (nodeCreator.isNodeType(components)) { node = nodeCreator.setupNode(components, bannerComponentNodes.size(), length, bannerText.modifier()); break; } } if (node != null) { bannerComponentNodes.add(node); length += components.text().length(); } } return bannerComponentNodes; }
[ "private", "List", "<", "BannerComponentNode", ">", "parseBannerComponents", "(", "BannerText", "bannerText", ")", "{", "int", "length", "=", "0", ";", "List", "<", "BannerComponentNode", ">", "bannerComponentNodes", "=", "new", "ArrayList", "<>", "(", ")", ";", "for", "(", "BannerComponents", "components", ":", "bannerText", ".", "components", "(", ")", ")", "{", "BannerComponentNode", "node", "=", "null", ";", "for", "(", "NodeCreator", "nodeCreator", ":", "nodeCreators", ")", "{", "if", "(", "nodeCreator", ".", "isNodeType", "(", "components", ")", ")", "{", "node", "=", "nodeCreator", ".", "setupNode", "(", "components", ",", "bannerComponentNodes", ".", "size", "(", ")", ",", "length", ",", "bannerText", ".", "modifier", "(", ")", ")", ";", "break", ";", "}", "}", "if", "(", "node", "!=", "null", ")", "{", "bannerComponentNodes", ".", "add", "(", "node", ")", ";", "length", "+=", "components", ".", "text", "(", ")", ".", "length", "(", ")", ";", "}", "}", "return", "bannerComponentNodes", ";", "}" ]
Parses the banner components and processes them using the nodeCreators in the order they were originally passed @param bannerText to parse @return the list of nodes representing the bannerComponents
[ "Parses", "the", "banner", "components", "and", "processes", "them", "using", "the", "nodeCreators", "in", "the", "order", "they", "were", "originally", "passed" ]
375a89c017d360b9defc2c90d0c03468165162ec
https://github.com/mapbox/mapbox-navigation-android/blob/375a89c017d360b9defc2c90d0c03468165162ec/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/BannerComponentTree.java#L33-L54
23,153
mapbox/mapbox-navigation-android
libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/routeprogress/RouteLegProgress.java
RouteLegProgress.fractionTraveled
public float fractionTraveled() { float fractionTraveled = 1; if (routeLeg().distance() > 0) { fractionTraveled = (float) (distanceTraveled() / routeLeg().distance()); if (fractionTraveled < 0) { fractionTraveled = 0; } } return fractionTraveled; }
java
public float fractionTraveled() { float fractionTraveled = 1; if (routeLeg().distance() > 0) { fractionTraveled = (float) (distanceTraveled() / routeLeg().distance()); if (fractionTraveled < 0) { fractionTraveled = 0; } } return fractionTraveled; }
[ "public", "float", "fractionTraveled", "(", ")", "{", "float", "fractionTraveled", "=", "1", ";", "if", "(", "routeLeg", "(", ")", ".", "distance", "(", ")", ">", "0", ")", "{", "fractionTraveled", "=", "(", "float", ")", "(", "distanceTraveled", "(", ")", "/", "routeLeg", "(", ")", ".", "distance", "(", ")", ")", ";", "if", "(", "fractionTraveled", "<", "0", ")", "{", "fractionTraveled", "=", "0", ";", "}", "}", "return", "fractionTraveled", ";", "}" ]
Get the fraction traveled along the current leg, this is a float value between 0 and 1 and isn't guaranteed to reach 1 before the user reaches the next waypoint. @return a float value between 0 and 1 representing the fraction the user has traveled along the current leg @since 0.1.0
[ "Get", "the", "fraction", "traveled", "along", "the", "current", "leg", "this", "is", "a", "float", "value", "between", "0", "and", "1", "and", "isn", "t", "guaranteed", "to", "reach", "1", "before", "the", "user", "reaches", "the", "next", "waypoint", "." ]
375a89c017d360b9defc2c90d0c03468165162ec
https://github.com/mapbox/mapbox-navigation-android/blob/375a89c017d360b9defc2c90d0c03468165162ec/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/routeprogress/RouteLegProgress.java#L79-L89
23,154
mapbox/mapbox-navigation-android
libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/camera/NavigationCamera.java
NavigationCamera.start
public void start(DirectionsRoute route) { if (route != null) { currentRouteInformation = buildRouteInformationFromRoute(route); } navigation.addProgressChangeListener(progressChangeListener); }
java
public void start(DirectionsRoute route) { if (route != null) { currentRouteInformation = buildRouteInformationFromRoute(route); } navigation.addProgressChangeListener(progressChangeListener); }
[ "public", "void", "start", "(", "DirectionsRoute", "route", ")", "{", "if", "(", "route", "!=", "null", ")", "{", "currentRouteInformation", "=", "buildRouteInformationFromRoute", "(", "route", ")", ";", "}", "navigation", ".", "addProgressChangeListener", "(", "progressChangeListener", ")", ";", "}" ]
Called when beginning navigation with a route. @param route used to update route information
[ "Called", "when", "beginning", "navigation", "with", "a", "route", "." ]
375a89c017d360b9defc2c90d0c03468165162ec
https://github.com/mapbox/mapbox-navigation-android/blob/375a89c017d360b9defc2c90d0c03468165162ec/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/camera/NavigationCamera.java#L153-L158
23,155
mapbox/mapbox-navigation-android
libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/camera/NavigationCamera.java
NavigationCamera.resume
public void resume(Location location) { if (location != null) { currentRouteInformation = buildRouteInformationFromLocation(location, null); } navigation.addProgressChangeListener(progressChangeListener); }
java
public void resume(Location location) { if (location != null) { currentRouteInformation = buildRouteInformationFromLocation(location, null); } navigation.addProgressChangeListener(progressChangeListener); }
[ "public", "void", "resume", "(", "Location", "location", ")", "{", "if", "(", "location", "!=", "null", ")", "{", "currentRouteInformation", "=", "buildRouteInformationFromLocation", "(", "location", ",", "null", ")", ";", "}", "navigation", ".", "addProgressChangeListener", "(", "progressChangeListener", ")", ";", "}" ]
Called during rotation to update route information. @param location used to update route information
[ "Called", "during", "rotation", "to", "update", "route", "information", "." ]
375a89c017d360b9defc2c90d0c03468165162ec
https://github.com/mapbox/mapbox-navigation-android/blob/375a89c017d360b9defc2c90d0c03468165162ec/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/camera/NavigationCamera.java#L165-L170
23,156
mapbox/mapbox-navigation-android
libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/camera/NavigationCamera.java
NavigationCamera.showRouteOverview
public void showRouteOverview(int[] padding) { updateCameraTrackingMode(NAVIGATION_TRACKING_MODE_NONE); RouteInformation routeInformation = buildRouteInformationFromProgress(currentRouteProgress); animateCameraForRouteOverview(routeInformation, padding); }
java
public void showRouteOverview(int[] padding) { updateCameraTrackingMode(NAVIGATION_TRACKING_MODE_NONE); RouteInformation routeInformation = buildRouteInformationFromProgress(currentRouteProgress); animateCameraForRouteOverview(routeInformation, padding); }
[ "public", "void", "showRouteOverview", "(", "int", "[", "]", "padding", ")", "{", "updateCameraTrackingMode", "(", "NAVIGATION_TRACKING_MODE_NONE", ")", ";", "RouteInformation", "routeInformation", "=", "buildRouteInformationFromProgress", "(", "currentRouteProgress", ")", ";", "animateCameraForRouteOverview", "(", "routeInformation", ",", "padding", ")", ";", "}" ]
This method stops the map camera from tracking the current location, and then zooms out to an overview of the current route being traveled. @param padding in pixels around the bounding box of the overview (left, top, right, bottom)
[ "This", "method", "stops", "the", "map", "camera", "from", "tracking", "the", "current", "location", "and", "then", "zooms", "out", "to", "an", "overview", "of", "the", "current", "route", "being", "traveled", "." ]
375a89c017d360b9defc2c90d0c03468165162ec
https://github.com/mapbox/mapbox-navigation-android/blob/375a89c017d360b9defc2c90d0c03468165162ec/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/camera/NavigationCamera.java#L218-L222
23,157
mapbox/mapbox-navigation-android
libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/route/FasterRouteDetector.java
FasterRouteDetector.validSecondStep
private boolean validSecondStep(LegStep secondStep, RouteProgress routeProgress) { return routeProgress.currentLegProgress().upComingStep() != null && routeProgress.currentLegProgress().upComingStep().equals(secondStep); }
java
private boolean validSecondStep(LegStep secondStep, RouteProgress routeProgress) { return routeProgress.currentLegProgress().upComingStep() != null && routeProgress.currentLegProgress().upComingStep().equals(secondStep); }
[ "private", "boolean", "validSecondStep", "(", "LegStep", "secondStep", ",", "RouteProgress", "routeProgress", ")", "{", "return", "routeProgress", ".", "currentLegProgress", "(", ")", ".", "upComingStep", "(", ")", "!=", "null", "&&", "routeProgress", ".", "currentLegProgress", "(", ")", ".", "upComingStep", "(", ")", ".", "equals", "(", "secondStep", ")", ";", "}" ]
The second step of the new route is valid if it equals the current route upcoming step. @param secondStep of the new route @param routeProgress current route progress @return true if valid, false if not
[ "The", "second", "step", "of", "the", "new", "route", "is", "valid", "if", "it", "equals", "the", "current", "route", "upcoming", "step", "." ]
375a89c017d360b9defc2c90d0c03468165162ec
https://github.com/mapbox/mapbox-navigation-android/blob/375a89c017d360b9defc2c90d0c03468165162ec/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/route/FasterRouteDetector.java#L88-L91
23,158
mapbox/mapbox-navigation-android
libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/route/NavigationMapRoute.java
NavigationMapRoute.addRoute
public void addRoute(DirectionsRoute directionsRoute) { List<DirectionsRoute> routes = new ArrayList<>(); routes.add(directionsRoute); addRoutes(routes); }
java
public void addRoute(DirectionsRoute directionsRoute) { List<DirectionsRoute> routes = new ArrayList<>(); routes.add(directionsRoute); addRoutes(routes); }
[ "public", "void", "addRoute", "(", "DirectionsRoute", "directionsRoute", ")", "{", "List", "<", "DirectionsRoute", ">", "routes", "=", "new", "ArrayList", "<>", "(", ")", ";", "routes", ".", "add", "(", "directionsRoute", ")", ";", "addRoutes", "(", "routes", ")", ";", "}" ]
Allows adding a single primary route for the user to traverse along. No alternative routes will be drawn on top of the map. @param directionsRoute the directions route which you'd like to display on the map @since 0.4.0
[ "Allows", "adding", "a", "single", "primary", "route", "for", "the", "user", "to", "traverse", "along", ".", "No", "alternative", "routes", "will", "be", "drawn", "on", "top", "of", "the", "map", "." ]
375a89c017d360b9defc2c90d0c03468165162ec
https://github.com/mapbox/mapbox-navigation-android/blob/375a89c017d360b9defc2c90d0c03468165162ec/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/route/NavigationMapRoute.java#L191-L195
23,159
mapbox/mapbox-navigation-android
libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/NavigationAlertView.java
NavigationAlertView.showFeedbackSubmitted
public void showFeedbackSubmitted() { if (!isEnabled) { return; } show(getContext().getString(R.string.feedback_submitted), THREE_SECOND_DELAY_IN_MILLIS, false); }
java
public void showFeedbackSubmitted() { if (!isEnabled) { return; } show(getContext().getString(R.string.feedback_submitted), THREE_SECOND_DELAY_IN_MILLIS, false); }
[ "public", "void", "showFeedbackSubmitted", "(", ")", "{", "if", "(", "!", "isEnabled", ")", "{", "return", ";", "}", "show", "(", "getContext", "(", ")", ".", "getString", "(", "R", ".", "string", ".", "feedback_submitted", ")", ",", "THREE_SECOND_DELAY_IN_MILLIS", ",", "false", ")", ";", "}" ]
Shows this alert view for when feedback is submitted
[ "Shows", "this", "alert", "view", "for", "when", "feedback", "is", "submitted" ]
375a89c017d360b9defc2c90d0c03468165162ec
https://github.com/mapbox/mapbox-navigation-android/blob/375a89c017d360b9defc2c90d0c03468165162ec/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/NavigationAlertView.java#L52-L57
23,160
mapbox/mapbox-navigation-android
libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/NavigationAlertView.java
NavigationAlertView.showReportProblem
public void showReportProblem() { if (!isEnabled) { return; } final Handler handler = new Handler(); handler.postDelayed(new Runnable() { @Override public void run() { show(getContext().getString(R.string.report_problem), NavigationConstants.ALERT_VIEW_PROBLEM_DURATION, true); } }, THREE_SECOND_DELAY_IN_MILLIS); }
java
public void showReportProblem() { if (!isEnabled) { return; } final Handler handler = new Handler(); handler.postDelayed(new Runnable() { @Override public void run() { show(getContext().getString(R.string.report_problem), NavigationConstants.ALERT_VIEW_PROBLEM_DURATION, true); } }, THREE_SECOND_DELAY_IN_MILLIS); }
[ "public", "void", "showReportProblem", "(", ")", "{", "if", "(", "!", "isEnabled", ")", "{", "return", ";", "}", "final", "Handler", "handler", "=", "new", "Handler", "(", ")", ";", "handler", ".", "postDelayed", "(", "new", "Runnable", "(", ")", "{", "@", "Override", "public", "void", "run", "(", ")", "{", "show", "(", "getContext", "(", ")", ".", "getString", "(", "R", ".", "string", ".", "report_problem", ")", ",", "NavigationConstants", ".", "ALERT_VIEW_PROBLEM_DURATION", ",", "true", ")", ";", "}", "}", ",", "THREE_SECOND_DELAY_IN_MILLIS", ")", ";", "}" ]
Shows this alert view to let user report a problem for the given number of milliseconds
[ "Shows", "this", "alert", "view", "to", "let", "user", "report", "a", "problem", "for", "the", "given", "number", "of", "milliseconds" ]
375a89c017d360b9defc2c90d0c03468165162ec
https://github.com/mapbox/mapbox-navigation-android/blob/375a89c017d360b9defc2c90d0c03468165162ec/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/NavigationAlertView.java#L62-L74
23,161
spring-cloud/spring-cloud-consul
spring-cloud-consul-config/src/main/java/org/springframework/cloud/consul/config/ConsulPropertySource.java
ConsulPropertySource.parsePropertiesInKeyValueFormat
protected void parsePropertiesInKeyValueFormat(List<GetValue> values) { if (values == null) { return; } for (GetValue getValue : values) { String key = getValue.getKey(); if (!StringUtils.endsWithIgnoreCase(key, "/")) { key = key.replace(this.context, "").replace('/', '.'); String value = getValue.getDecodedValue(); this.properties.put(key, value); } } }
java
protected void parsePropertiesInKeyValueFormat(List<GetValue> values) { if (values == null) { return; } for (GetValue getValue : values) { String key = getValue.getKey(); if (!StringUtils.endsWithIgnoreCase(key, "/")) { key = key.replace(this.context, "").replace('/', '.'); String value = getValue.getDecodedValue(); this.properties.put(key, value); } } }
[ "protected", "void", "parsePropertiesInKeyValueFormat", "(", "List", "<", "GetValue", ">", "values", ")", "{", "if", "(", "values", "==", "null", ")", "{", "return", ";", "}", "for", "(", "GetValue", "getValue", ":", "values", ")", "{", "String", "key", "=", "getValue", ".", "getKey", "(", ")", ";", "if", "(", "!", "StringUtils", ".", "endsWithIgnoreCase", "(", "key", ",", "\"/\"", ")", ")", "{", "key", "=", "key", ".", "replace", "(", "this", ".", "context", ",", "\"\"", ")", ".", "replace", "(", "'", "'", ",", "'", "'", ")", ";", "String", "value", "=", "getValue", ".", "getDecodedValue", "(", ")", ";", "this", ".", "properties", ".", "put", "(", "key", ",", "value", ")", ";", "}", "}", "}" ]
Parses the properties in key value style i.e., values are expected to be either a sub key or a constant. @param values values to parse
[ "Parses", "the", "properties", "in", "key", "value", "style", "i", ".", "e", ".", "values", "are", "expected", "to", "be", "either", "a", "sub", "key", "or", "a", "constant", "." ]
e71a13520eae8569751cc881365fe0cfab46c7a5
https://github.com/spring-cloud/spring-cloud-consul/blob/e71a13520eae8569751cc881365fe0cfab46c7a5/spring-cloud-consul-config/src/main/java/org/springframework/cloud/consul/config/ConsulPropertySource.java#L93-L106
23,162
spring-cloud/spring-cloud-consul
spring-cloud-consul-config/src/main/java/org/springframework/cloud/consul/config/ConsulPropertySource.java
ConsulPropertySource.parsePropertiesWithNonKeyValueFormat
protected void parsePropertiesWithNonKeyValueFormat(List<GetValue> values, ConsulConfigProperties.Format format) { if (values == null) { return; } for (GetValue getValue : values) { String key = getValue.getKey().replace(this.context, ""); if (this.configProperties.getDataKey().equals(key)) { parseValue(getValue, format); } } }
java
protected void parsePropertiesWithNonKeyValueFormat(List<GetValue> values, ConsulConfigProperties.Format format) { if (values == null) { return; } for (GetValue getValue : values) { String key = getValue.getKey().replace(this.context, ""); if (this.configProperties.getDataKey().equals(key)) { parseValue(getValue, format); } } }
[ "protected", "void", "parsePropertiesWithNonKeyValueFormat", "(", "List", "<", "GetValue", ">", "values", ",", "ConsulConfigProperties", ".", "Format", "format", ")", "{", "if", "(", "values", "==", "null", ")", "{", "return", ";", "}", "for", "(", "GetValue", "getValue", ":", "values", ")", "{", "String", "key", "=", "getValue", ".", "getKey", "(", ")", ".", "replace", "(", "this", ".", "context", ",", "\"\"", ")", ";", "if", "(", "this", ".", "configProperties", ".", "getDataKey", "(", ")", ".", "equals", "(", "key", ")", ")", "{", "parseValue", "(", "getValue", ",", "format", ")", ";", "}", "}", "}" ]
Parses the properties using the format which is not a key value style i.e., either java properties style or YAML style. @param values values to parse @param format format in which the values should be parsed
[ "Parses", "the", "properties", "using", "the", "format", "which", "is", "not", "a", "key", "value", "style", "i", ".", "e", ".", "either", "java", "properties", "style", "or", "YAML", "style", "." ]
e71a13520eae8569751cc881365fe0cfab46c7a5
https://github.com/spring-cloud/spring-cloud-consul/blob/e71a13520eae8569751cc881365fe0cfab46c7a5/spring-cloud-consul-config/src/main/java/org/springframework/cloud/consul/config/ConsulPropertySource.java#L114-L126
23,163
spring-cloud/spring-cloud-consul
spring-cloud-consul-discovery/src/main/java/org/springframework/cloud/consul/discovery/TtlScheduler.java
TtlScheduler.add
public void add(String instanceId) { ScheduledFuture task = this.scheduler.scheduleAtFixedRate( new ConsulHeartbeatTask(instanceId), this.configuration .computeHearbeatInterval().toStandardDuration().getMillis()); ScheduledFuture previousTask = this.serviceHeartbeats.put(instanceId, task); if (previousTask != null) { previousTask.cancel(true); } }
java
public void add(String instanceId) { ScheduledFuture task = this.scheduler.scheduleAtFixedRate( new ConsulHeartbeatTask(instanceId), this.configuration .computeHearbeatInterval().toStandardDuration().getMillis()); ScheduledFuture previousTask = this.serviceHeartbeats.put(instanceId, task); if (previousTask != null) { previousTask.cancel(true); } }
[ "public", "void", "add", "(", "String", "instanceId", ")", "{", "ScheduledFuture", "task", "=", "this", ".", "scheduler", ".", "scheduleAtFixedRate", "(", "new", "ConsulHeartbeatTask", "(", "instanceId", ")", ",", "this", ".", "configuration", ".", "computeHearbeatInterval", "(", ")", ".", "toStandardDuration", "(", ")", ".", "getMillis", "(", ")", ")", ";", "ScheduledFuture", "previousTask", "=", "this", ".", "serviceHeartbeats", ".", "put", "(", "instanceId", ",", "task", ")", ";", "if", "(", "previousTask", "!=", "null", ")", "{", "previousTask", ".", "cancel", "(", "true", ")", ";", "}", "}" ]
Add a service to the checks loop. @param instanceId instance id
[ "Add", "a", "service", "to", "the", "checks", "loop", "." ]
e71a13520eae8569751cc881365fe0cfab46c7a5
https://github.com/spring-cloud/spring-cloud-consul/blob/e71a13520eae8569751cc881365fe0cfab46c7a5/spring-cloud-consul-discovery/src/main/java/org/springframework/cloud/consul/discovery/TtlScheduler.java#L64-L72
23,164
rey5137/material
material/src/main/java/com/rey/material/widget/TimePicker.java
TimePicker.setMode
public void setMode(int mode, boolean animation){ if(mMode != mode){ mMode = mode; if(mOnTimeChangedListener != null) mOnTimeChangedListener.onModeChanged(mMode); if(animation) startAnimation(); else invalidate(); } }
java
public void setMode(int mode, boolean animation){ if(mMode != mode){ mMode = mode; if(mOnTimeChangedListener != null) mOnTimeChangedListener.onModeChanged(mMode); if(animation) startAnimation(); else invalidate(); } }
[ "public", "void", "setMode", "(", "int", "mode", ",", "boolean", "animation", ")", "{", "if", "(", "mMode", "!=", "mode", ")", "{", "mMode", "=", "mode", ";", "if", "(", "mOnTimeChangedListener", "!=", "null", ")", "mOnTimeChangedListener", ".", "onModeChanged", "(", "mMode", ")", ";", "if", "(", "animation", ")", "startAnimation", "(", ")", ";", "else", "invalidate", "(", ")", ";", "}", "}" ]
Set the select mode of this TimePicker. @param mode The select mode. Can be {@link #MODE_HOUR} or {@link #MODE_MINUTE}. @param animation Indicate that should show animation when switch select mode or not.
[ "Set", "the", "select", "mode", "of", "this", "TimePicker", "." ]
1bbcac2686a0023ef7720d3fe455bb116d115af8
https://github.com/rey5137/material/blob/1bbcac2686a0023ef7720d3fe455bb116d115af8/material/src/main/java/com/rey/material/widget/TimePicker.java#L326-L338
23,165
rey5137/material
material/src/main/java/com/rey/material/widget/TimePicker.java
TimePicker.setHour
public void setHour(int hour){ if(m24Hour) hour = Math.max(hour, 0) % 24; else hour = Math.max(hour, 0) % 12; if(mHour != hour){ int old = mHour; mHour = hour; if(mOnTimeChangedListener != null) mOnTimeChangedListener.onHourChanged(old, mHour); if(mMode == MODE_HOUR) invalidate(); } }
java
public void setHour(int hour){ if(m24Hour) hour = Math.max(hour, 0) % 24; else hour = Math.max(hour, 0) % 12; if(mHour != hour){ int old = mHour; mHour = hour; if(mOnTimeChangedListener != null) mOnTimeChangedListener.onHourChanged(old, mHour); if(mMode == MODE_HOUR) invalidate(); } }
[ "public", "void", "setHour", "(", "int", "hour", ")", "{", "if", "(", "m24Hour", ")", "hour", "=", "Math", ".", "max", "(", "hour", ",", "0", ")", "%", "24", ";", "else", "hour", "=", "Math", ".", "max", "(", "hour", ",", "0", ")", "%", "12", ";", "if", "(", "mHour", "!=", "hour", ")", "{", "int", "old", "=", "mHour", ";", "mHour", "=", "hour", ";", "if", "(", "mOnTimeChangedListener", "!=", "null", ")", "mOnTimeChangedListener", ".", "onHourChanged", "(", "old", ",", "mHour", ")", ";", "if", "(", "mMode", "==", "MODE_HOUR", ")", "invalidate", "(", ")", ";", "}", "}" ]
Set the selected hour value. @param hour The selected hour value.
[ "Set", "the", "selected", "hour", "value", "." ]
1bbcac2686a0023ef7720d3fe455bb116d115af8
https://github.com/rey5137/material/blob/1bbcac2686a0023ef7720d3fe455bb116d115af8/material/src/main/java/com/rey/material/widget/TimePicker.java#L344-L360
23,166
rey5137/material
material/src/main/java/com/rey/material/widget/TimePicker.java
TimePicker.setMinute
public void setMinute(int minute){ minute = Math.min(Math.max(minute, 0), 59); if(mMinute != minute){ int old = mMinute; mMinute = minute; if(mOnTimeChangedListener != null) mOnTimeChangedListener.onMinuteChanged(old, mMinute); if(mMode == MODE_MINUTE) invalidate(); } }
java
public void setMinute(int minute){ minute = Math.min(Math.max(minute, 0), 59); if(mMinute != minute){ int old = mMinute; mMinute = minute; if(mOnTimeChangedListener != null) mOnTimeChangedListener.onMinuteChanged(old, mMinute); if(mMode == MODE_MINUTE) invalidate(); } }
[ "public", "void", "setMinute", "(", "int", "minute", ")", "{", "minute", "=", "Math", ".", "min", "(", "Math", ".", "max", "(", "minute", ",", "0", ")", ",", "59", ")", ";", "if", "(", "mMinute", "!=", "minute", ")", "{", "int", "old", "=", "mMinute", ";", "mMinute", "=", "minute", ";", "if", "(", "mOnTimeChangedListener", "!=", "null", ")", "mOnTimeChangedListener", ".", "onMinuteChanged", "(", "old", ",", "mMinute", ")", ";", "if", "(", "mMode", "==", "MODE_MINUTE", ")", "invalidate", "(", ")", ";", "}", "}" ]
Set the selected minute value. @param minute The selected minute value.
[ "Set", "the", "selected", "minute", "value", "." ]
1bbcac2686a0023ef7720d3fe455bb116d115af8
https://github.com/rey5137/material/blob/1bbcac2686a0023ef7720d3fe455bb116d115af8/material/src/main/java/com/rey/material/widget/TimePicker.java#L366-L379
23,167
rey5137/material
material/src/main/java/com/rey/material/widget/TimePicker.java
TimePicker.set24Hour
public void set24Hour(boolean b){ if(m24Hour != b){ m24Hour = b; if(!m24Hour && mHour > 11) setHour(mHour - 12); calculateTextLocation(); } }
java
public void set24Hour(boolean b){ if(m24Hour != b){ m24Hour = b; if(!m24Hour && mHour > 11) setHour(mHour - 12); calculateTextLocation(); } }
[ "public", "void", "set24Hour", "(", "boolean", "b", ")", "{", "if", "(", "m24Hour", "!=", "b", ")", "{", "m24Hour", "=", "b", ";", "if", "(", "!", "m24Hour", "&&", "mHour", ">", "11", ")", "setHour", "(", "mHour", "-", "12", ")", ";", "calculateTextLocation", "(", ")", ";", "}", "}" ]
Set this TimePicker use 24-hour format or not. @param b
[ "Set", "this", "TimePicker", "use", "24", "-", "hour", "format", "or", "not", "." ]
1bbcac2686a0023ef7720d3fe455bb116d115af8
https://github.com/rey5137/material/blob/1bbcac2686a0023ef7720d3fe455bb116d115af8/material/src/main/java/com/rey/material/widget/TimePicker.java#L393-L400
23,168
rey5137/material
material/src/main/java/com/rey/material/widget/TabPageIndicator.java
TabPageIndicator.setCurrentItem
public void setCurrentItem(int position) { if(mSelectedPosition != position){ CheckedTextView tv = getTabView(mSelectedPosition); if(tv != null) tv.setChecked(false); } mSelectedPosition = position; CheckedTextView tv = getTabView(mSelectedPosition); if(tv != null) tv.setChecked(true); animateToTab(position); }
java
public void setCurrentItem(int position) { if(mSelectedPosition != position){ CheckedTextView tv = getTabView(mSelectedPosition); if(tv != null) tv.setChecked(false); } mSelectedPosition = position; CheckedTextView tv = getTabView(mSelectedPosition); if(tv != null) tv.setChecked(true); animateToTab(position); }
[ "public", "void", "setCurrentItem", "(", "int", "position", ")", "{", "if", "(", "mSelectedPosition", "!=", "position", ")", "{", "CheckedTextView", "tv", "=", "getTabView", "(", "mSelectedPosition", ")", ";", "if", "(", "tv", "!=", "null", ")", "tv", ".", "setChecked", "(", "false", ")", ";", "}", "mSelectedPosition", "=", "position", ";", "CheckedTextView", "tv", "=", "getTabView", "(", "mSelectedPosition", ")", ";", "if", "(", "tv", "!=", "null", ")", "tv", ".", "setChecked", "(", "true", ")", ";", "animateToTab", "(", "position", ")", ";", "}" ]
Set the current page of this TabPageIndicator. @param position The position of current page.
[ "Set", "the", "current", "page", "of", "this", "TabPageIndicator", "." ]
1bbcac2686a0023ef7720d3fe455bb116d115af8
https://github.com/rey5137/material/blob/1bbcac2686a0023ef7720d3fe455bb116d115af8/material/src/main/java/com/rey/material/widget/TabPageIndicator.java#L443-L456
23,169
rey5137/material
material/src/main/java/com/rey/material/app/Dialog.java
Dialog.clearContent
public Dialog clearContent(){ title(0); positiveAction(0); positiveActionClickListener(null); negativeAction(0); negativeActionClickListener(null); neutralAction(0); neutralActionClickListener(null); contentView(null); return this; }
java
public Dialog clearContent(){ title(0); positiveAction(0); positiveActionClickListener(null); negativeAction(0); negativeActionClickListener(null); neutralAction(0); neutralActionClickListener(null); contentView(null); return this; }
[ "public", "Dialog", "clearContent", "(", ")", "{", "title", "(", "0", ")", ";", "positiveAction", "(", "0", ")", ";", "positiveActionClickListener", "(", "null", ")", ";", "negativeAction", "(", "0", ")", ";", "negativeActionClickListener", "(", "null", ")", ";", "neutralAction", "(", "0", ")", ";", "neutralActionClickListener", "(", "null", ")", ";", "contentView", "(", "null", ")", ";", "return", "this", ";", "}" ]
Clear the content of this Dialog. @return The Dialog for chaining methods.
[ "Clear", "the", "content", "of", "this", "Dialog", "." ]
1bbcac2686a0023ef7720d3fe455bb116d115af8
https://github.com/rey5137/material/blob/1bbcac2686a0023ef7720d3fe455bb116d115af8/material/src/main/java/com/rey/material/app/Dialog.java#L357-L367
23,170
rey5137/material
material/src/main/java/com/rey/material/app/Dialog.java
Dialog.dimAmount
public Dialog dimAmount(float amount){ Window window = getWindow(); if(amount > 0f){ window.addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND); WindowManager.LayoutParams lp = window.getAttributes(); lp.dimAmount = amount; window.setAttributes(lp); } else window.clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND); return this; }
java
public Dialog dimAmount(float amount){ Window window = getWindow(); if(amount > 0f){ window.addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND); WindowManager.LayoutParams lp = window.getAttributes(); lp.dimAmount = amount; window.setAttributes(lp); } else window.clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND); return this; }
[ "public", "Dialog", "dimAmount", "(", "float", "amount", ")", "{", "Window", "window", "=", "getWindow", "(", ")", ";", "if", "(", "amount", ">", "0f", ")", "{", "window", ".", "addFlags", "(", "WindowManager", ".", "LayoutParams", ".", "FLAG_DIM_BEHIND", ")", ";", "WindowManager", ".", "LayoutParams", "lp", "=", "window", ".", "getAttributes", "(", ")", ";", "lp", ".", "dimAmount", "=", "amount", ";", "window", ".", "setAttributes", "(", "lp", ")", ";", "}", "else", "window", ".", "clearFlags", "(", "WindowManager", ".", "LayoutParams", ".", "FLAG_DIM_BEHIND", ")", ";", "return", "this", ";", "}" ]
Set the dim amount of the region outside this Dialog. @param amount The dim amount in [0..1]. @return The Dialog for chaining methods.
[ "Set", "the", "dim", "amount", "of", "the", "region", "outside", "this", "Dialog", "." ]
1bbcac2686a0023ef7720d3fe455bb116d115af8
https://github.com/rey5137/material/blob/1bbcac2686a0023ef7720d3fe455bb116d115af8/material/src/main/java/com/rey/material/app/Dialog.java#L406-L417
23,171
rey5137/material
material/src/main/java/com/rey/material/app/Dialog.java
Dialog.elevation
public Dialog elevation(float elevation){ if(mCardView.getMaxCardElevation() < elevation) mCardView.setMaxCardElevation(elevation); mCardView.setCardElevation(elevation); return this; }
java
public Dialog elevation(float elevation){ if(mCardView.getMaxCardElevation() < elevation) mCardView.setMaxCardElevation(elevation); mCardView.setCardElevation(elevation); return this; }
[ "public", "Dialog", "elevation", "(", "float", "elevation", ")", "{", "if", "(", "mCardView", ".", "getMaxCardElevation", "(", ")", "<", "elevation", ")", "mCardView", ".", "setMaxCardElevation", "(", "elevation", ")", ";", "mCardView", ".", "setCardElevation", "(", "elevation", ")", ";", "return", "this", ";", "}" ]
Set the elevation value of this Dialog. @param elevation @return The Dialog for chaining methods.
[ "Set", "the", "elevation", "value", "of", "this", "Dialog", "." ]
1bbcac2686a0023ef7720d3fe455bb116d115af8
https://github.com/rey5137/material/blob/1bbcac2686a0023ef7720d3fe455bb116d115af8/material/src/main/java/com/rey/material/app/Dialog.java#L434-L440
23,172
rey5137/material
material/src/main/java/com/rey/material/app/Dialog.java
Dialog.actionBackground
public Dialog actionBackground(Drawable drawable){ positiveActionBackground(drawable); negativeActionBackground(drawable); neutralActionBackground(drawable); return this; }
java
public Dialog actionBackground(Drawable drawable){ positiveActionBackground(drawable); negativeActionBackground(drawable); neutralActionBackground(drawable); return this; }
[ "public", "Dialog", "actionBackground", "(", "Drawable", "drawable", ")", "{", "positiveActionBackground", "(", "drawable", ")", ";", "negativeActionBackground", "(", "drawable", ")", ";", "neutralActionBackground", "(", "drawable", ")", ";", "return", "this", ";", "}" ]
Set the background drawable of all action buttons. @param drawable The background drawable. @return The Dialog for chaining methods.
[ "Set", "the", "background", "drawable", "of", "all", "action", "buttons", "." ]
1bbcac2686a0023ef7720d3fe455bb116d115af8
https://github.com/rey5137/material/blob/1bbcac2686a0023ef7720d3fe455bb116d115af8/material/src/main/java/com/rey/material/app/Dialog.java#L549-L554
23,173
rey5137/material
material/src/main/java/com/rey/material/app/Dialog.java
Dialog.actionTextColor
public Dialog actionTextColor(ColorStateList color){ positiveActionTextColor(color); negativeActionTextColor(color); neutralActionTextColor(color); return this; }
java
public Dialog actionTextColor(ColorStateList color){ positiveActionTextColor(color); negativeActionTextColor(color); neutralActionTextColor(color); return this; }
[ "public", "Dialog", "actionTextColor", "(", "ColorStateList", "color", ")", "{", "positiveActionTextColor", "(", "color", ")", ";", "negativeActionTextColor", "(", "color", ")", ";", "neutralActionTextColor", "(", "color", ")", ";", "return", "this", ";", "}" ]
Sets the text color of all action buttons. @param color @return The Dialog for chaining methods.
[ "Sets", "the", "text", "color", "of", "all", "action", "buttons", "." ]
1bbcac2686a0023ef7720d3fe455bb116d115af8
https://github.com/rey5137/material/blob/1bbcac2686a0023ef7720d3fe455bb116d115af8/material/src/main/java/com/rey/material/app/Dialog.java#L585-L590
23,174
rey5137/material
material/src/main/java/com/rey/material/app/Dialog.java
Dialog.positiveActionBackground
public Dialog positiveActionBackground(int id){ return positiveActionBackground(id == 0 ? null : getContext().getResources().getDrawable(id)); }
java
public Dialog positiveActionBackground(int id){ return positiveActionBackground(id == 0 ? null : getContext().getResources().getDrawable(id)); }
[ "public", "Dialog", "positiveActionBackground", "(", "int", "id", ")", "{", "return", "positiveActionBackground", "(", "id", "==", "0", "?", "null", ":", "getContext", "(", ")", ".", "getResources", "(", ")", ".", "getDrawable", "(", "id", ")", ")", ";", "}" ]
Set the background drawable of positive action button. @param id The resourceId of drawable. @return The Dialog for chaining methods.
[ "Set", "the", "background", "drawable", "of", "positive", "action", "button", "." ]
1bbcac2686a0023ef7720d3fe455bb116d115af8
https://github.com/rey5137/material/blob/1bbcac2686a0023ef7720d3fe455bb116d115af8/material/src/main/java/com/rey/material/app/Dialog.java#L639-L641
23,175
rey5137/material
material/src/main/java/com/rey/material/app/Dialog.java
Dialog.positiveActionRipple
public Dialog positiveActionRipple(int resId){ RippleDrawable drawable = new RippleDrawable.Builder(getContext(), resId).build(); return positiveActionBackground(drawable); }
java
public Dialog positiveActionRipple(int resId){ RippleDrawable drawable = new RippleDrawable.Builder(getContext(), resId).build(); return positiveActionBackground(drawable); }
[ "public", "Dialog", "positiveActionRipple", "(", "int", "resId", ")", "{", "RippleDrawable", "drawable", "=", "new", "RippleDrawable", ".", "Builder", "(", "getContext", "(", ")", ",", "resId", ")", ".", "build", "(", ")", ";", "return", "positiveActionBackground", "(", "drawable", ")", ";", "}" ]
Set the RippleEffect of positive action button. @param resId The resourceId of style. @return The Dialog for chaining methods.
[ "Set", "the", "RippleEffect", "of", "positive", "action", "button", "." ]
1bbcac2686a0023ef7720d3fe455bb116d115af8
https://github.com/rey5137/material/blob/1bbcac2686a0023ef7720d3fe455bb116d115af8/material/src/main/java/com/rey/material/app/Dialog.java#L648-L651
23,176
rey5137/material
material/src/main/java/com/rey/material/app/Dialog.java
Dialog.negativeActionBackground
public Dialog negativeActionBackground(int id){ return negativeActionBackground(id == 0 ? null : getContext().getResources().getDrawable(id)); }
java
public Dialog negativeActionBackground(int id){ return negativeActionBackground(id == 0 ? null : getContext().getResources().getDrawable(id)); }
[ "public", "Dialog", "negativeActionBackground", "(", "int", "id", ")", "{", "return", "negativeActionBackground", "(", "id", "==", "0", "?", "null", ":", "getContext", "(", ")", ".", "getResources", "(", ")", ".", "getDrawable", "(", "id", ")", ")", ";", "}" ]
Set the background drawable of neagtive action button. @param id The resourceId of drawable. @return The Dialog for chaining methods.
[ "Set", "the", "background", "drawable", "of", "neagtive", "action", "button", "." ]
1bbcac2686a0023ef7720d3fe455bb116d115af8
https://github.com/rey5137/material/blob/1bbcac2686a0023ef7720d3fe455bb116d115af8/material/src/main/java/com/rey/material/app/Dialog.java#L728-L730
23,177
rey5137/material
material/src/main/java/com/rey/material/app/Dialog.java
Dialog.negativeActionRipple
public Dialog negativeActionRipple(int resId){ RippleDrawable drawable = new RippleDrawable.Builder(getContext(), resId).build(); return negativeActionBackground(drawable); }
java
public Dialog negativeActionRipple(int resId){ RippleDrawable drawable = new RippleDrawable.Builder(getContext(), resId).build(); return negativeActionBackground(drawable); }
[ "public", "Dialog", "negativeActionRipple", "(", "int", "resId", ")", "{", "RippleDrawable", "drawable", "=", "new", "RippleDrawable", ".", "Builder", "(", "getContext", "(", ")", ",", "resId", ")", ".", "build", "(", ")", ";", "return", "negativeActionBackground", "(", "drawable", ")", ";", "}" ]
Set the RippleEffect of negative action button. @param resId The resourceId of style. @return The Dialog for chaining methods.
[ "Set", "the", "RippleEffect", "of", "negative", "action", "button", "." ]
1bbcac2686a0023ef7720d3fe455bb116d115af8
https://github.com/rey5137/material/blob/1bbcac2686a0023ef7720d3fe455bb116d115af8/material/src/main/java/com/rey/material/app/Dialog.java#L737-L740
23,178
rey5137/material
material/src/main/java/com/rey/material/app/Dialog.java
Dialog.neutralActionBackground
public Dialog neutralActionBackground(int id){ return neutralActionBackground(id == 0 ? null : getContext().getResources().getDrawable(id)); }
java
public Dialog neutralActionBackground(int id){ return neutralActionBackground(id == 0 ? null : getContext().getResources().getDrawable(id)); }
[ "public", "Dialog", "neutralActionBackground", "(", "int", "id", ")", "{", "return", "neutralActionBackground", "(", "id", "==", "0", "?", "null", ":", "getContext", "(", ")", ".", "getResources", "(", ")", ".", "getDrawable", "(", "id", ")", ")", ";", "}" ]
Set the background drawable of neutral action button. @param id The resourceId of drawable. @return The Dialog for chaining methods.
[ "Set", "the", "background", "drawable", "of", "neutral", "action", "button", "." ]
1bbcac2686a0023ef7720d3fe455bb116d115af8
https://github.com/rey5137/material/blob/1bbcac2686a0023ef7720d3fe455bb116d115af8/material/src/main/java/com/rey/material/app/Dialog.java#L817-L819
23,179
rey5137/material
material/src/main/java/com/rey/material/app/Dialog.java
Dialog.neutralActionRipple
public Dialog neutralActionRipple(int resId){ RippleDrawable drawable = new RippleDrawable.Builder(getContext(), resId).build(); return neutralActionBackground(drawable); }
java
public Dialog neutralActionRipple(int resId){ RippleDrawable drawable = new RippleDrawable.Builder(getContext(), resId).build(); return neutralActionBackground(drawable); }
[ "public", "Dialog", "neutralActionRipple", "(", "int", "resId", ")", "{", "RippleDrawable", "drawable", "=", "new", "RippleDrawable", ".", "Builder", "(", "getContext", "(", ")", ",", "resId", ")", ".", "build", "(", ")", ";", "return", "neutralActionBackground", "(", "drawable", ")", ";", "}" ]
Set the RippleEffect of neutral action button. @param resId The resourceId of style. @return The Dialog for chaining methods.
[ "Set", "the", "RippleEffect", "of", "neutral", "action", "button", "." ]
1bbcac2686a0023ef7720d3fe455bb116d115af8
https://github.com/rey5137/material/blob/1bbcac2686a0023ef7720d3fe455bb116d115af8/material/src/main/java/com/rey/material/app/Dialog.java#L826-L829
23,180
rey5137/material
material/src/main/java/com/rey/material/app/Dialog.java
Dialog.contentView
public Dialog contentView(View v){ if(mContent != v) { if(mContent != null) mCardView.removeView(mContent); mContent = v; } if(mContent != null) mCardView.addView(mContent); return this; }
java
public Dialog contentView(View v){ if(mContent != v) { if(mContent != null) mCardView.removeView(mContent); mContent = v; } if(mContent != null) mCardView.addView(mContent); return this; }
[ "public", "Dialog", "contentView", "(", "View", "v", ")", "{", "if", "(", "mContent", "!=", "v", ")", "{", "if", "(", "mContent", "!=", "null", ")", "mCardView", ".", "removeView", "(", "mContent", ")", ";", "mContent", "=", "v", ";", "}", "if", "(", "mContent", "!=", "null", ")", "mCardView", ".", "addView", "(", "mContent", ")", ";", "return", "this", ";", "}" ]
Set the content view of this Dialog. @param v The content view. @return The Dialog for chaining methods.
[ "Set", "the", "content", "view", "of", "this", "Dialog", "." ]
1bbcac2686a0023ef7720d3fe455bb116d115af8
https://github.com/rey5137/material/blob/1bbcac2686a0023ef7720d3fe455bb116d115af8/material/src/main/java/com/rey/material/app/Dialog.java#L916-L928
23,181
rey5137/material
material/src/main/java/com/rey/material/app/Dialog.java
Dialog.contentMargin
public Dialog contentMargin(int left, int top, int right, int bottom){ mCardView.setContentMargin(left, top, right, bottom); return this; }
java
public Dialog contentMargin(int left, int top, int right, int bottom){ mCardView.setContentMargin(left, top, right, bottom); return this; }
[ "public", "Dialog", "contentMargin", "(", "int", "left", ",", "int", "top", ",", "int", "right", ",", "int", "bottom", ")", "{", "mCardView", ".", "setContentMargin", "(", "left", ",", "top", ",", "right", ",", "bottom", ")", ";", "return", "this", ";", "}" ]
Set the margin between content view and Dialog border. @param left The left margin size in pixels. @param top The top margin size in pixels. @param right The right margin size in pixels. @param bottom The bottom margin size in pixels. @return The Dialog for chaining methods.
[ "Set", "the", "margin", "between", "content", "view", "and", "Dialog", "border", "." ]
1bbcac2686a0023ef7720d3fe455bb116d115af8
https://github.com/rey5137/material/blob/1bbcac2686a0023ef7720d3fe455bb116d115af8/material/src/main/java/com/rey/material/app/Dialog.java#L986-L989
23,182
rey5137/material
material/src/main/java/com/rey/material/widget/Slider.java
Slider.setValueRange
public void setValueRange(int min, int max, boolean animation){ if(max < min || (min == mMinValue && max == mMaxValue)) return; float oldValue = getExactValue(); float oldPosition = getPosition(); mMinValue = min; mMaxValue = max; setValue(oldValue, animation); if(mOnPositionChangeListener != null && oldPosition == getPosition() && oldValue != getExactValue()) mOnPositionChangeListener.onPositionChanged(this, false, oldPosition, oldPosition, Math.round(oldValue), getValue()); }
java
public void setValueRange(int min, int max, boolean animation){ if(max < min || (min == mMinValue && max == mMaxValue)) return; float oldValue = getExactValue(); float oldPosition = getPosition(); mMinValue = min; mMaxValue = max; setValue(oldValue, animation); if(mOnPositionChangeListener != null && oldPosition == getPosition() && oldValue != getExactValue()) mOnPositionChangeListener.onPositionChanged(this, false, oldPosition, oldPosition, Math.round(oldValue), getValue()); }
[ "public", "void", "setValueRange", "(", "int", "min", ",", "int", "max", ",", "boolean", "animation", ")", "{", "if", "(", "max", "<", "min", "||", "(", "min", "==", "mMinValue", "&&", "max", "==", "mMaxValue", ")", ")", "return", ";", "float", "oldValue", "=", "getExactValue", "(", ")", ";", "float", "oldPosition", "=", "getPosition", "(", ")", ";", "mMinValue", "=", "min", ";", "mMaxValue", "=", "max", ";", "setValue", "(", "oldValue", ",", "animation", ")", ";", "if", "(", "mOnPositionChangeListener", "!=", "null", "&&", "oldPosition", "==", "getPosition", "(", ")", "&&", "oldValue", "!=", "getExactValue", "(", ")", ")", "mOnPositionChangeListener", ".", "onPositionChanged", "(", "this", ",", "false", ",", "oldPosition", ",", "oldPosition", ",", "Math", ".", "round", "(", "oldValue", ")", ",", "getValue", "(", ")", ")", ";", "}" ]
Set the randge of selectable value. @param min The minimum selectable value. @param max The maximum selectable value. @param animation Indicate that should show animation when thumb's current position changed.
[ "Set", "the", "randge", "of", "selectable", "value", "." ]
1bbcac2686a0023ef7720d3fe455bb116d115af8
https://github.com/rey5137/material/blob/1bbcac2686a0023ef7720d3fe455bb116d115af8/material/src/main/java/com/rey/material/widget/Slider.java#L374-L386
23,183
rey5137/material
material/src/main/java/com/rey/material/widget/Slider.java
Slider.setValue
public void setValue(float value, boolean animation){ value = Math.min(mMaxValue, Math.max(value, mMinValue)); setPosition((value - mMinValue) / (mMaxValue - mMinValue), animation); }
java
public void setValue(float value, boolean animation){ value = Math.min(mMaxValue, Math.max(value, mMinValue)); setPosition((value - mMinValue) / (mMaxValue - mMinValue), animation); }
[ "public", "void", "setValue", "(", "float", "value", ",", "boolean", "animation", ")", "{", "value", "=", "Math", ".", "min", "(", "mMaxValue", ",", "Math", ".", "max", "(", "value", ",", "mMinValue", ")", ")", ";", "setPosition", "(", "(", "value", "-", "mMinValue", ")", "/", "(", "mMaxValue", "-", "mMinValue", ")", ",", "animation", ")", ";", "}" ]
Set the selected value of this Slider. @param value The selected value. @param animation Indicate that should show animation when change thumb's position.
[ "Set", "the", "selected", "value", "of", "this", "Slider", "." ]
1bbcac2686a0023ef7720d3fe455bb116d115af8
https://github.com/rey5137/material/blob/1bbcac2686a0023ef7720d3fe455bb116d115af8/material/src/main/java/com/rey/material/widget/Slider.java#L476-L479
23,184
rey5137/material
material/src/main/java/com/rey/material/widget/FloatingActionButton.java
FloatingActionButton.setLineMorphingState
public void setLineMorphingState(int state, boolean animation){ if(mIcon != null && mIcon instanceof LineMorphingDrawable) ((LineMorphingDrawable)mIcon).switchLineState(state, animation); }
java
public void setLineMorphingState(int state, boolean animation){ if(mIcon != null && mIcon instanceof LineMorphingDrawable) ((LineMorphingDrawable)mIcon).switchLineState(state, animation); }
[ "public", "void", "setLineMorphingState", "(", "int", "state", ",", "boolean", "animation", ")", "{", "if", "(", "mIcon", "!=", "null", "&&", "mIcon", "instanceof", "LineMorphingDrawable", ")", "(", "(", "LineMorphingDrawable", ")", "mIcon", ")", ".", "switchLineState", "(", "state", ",", "animation", ")", ";", "}" ]
Set the line state of LineMorphingDrawable that is used as this button's icon. @param state The line state. @param animation Indicate should show animation when switch line state or not.
[ "Set", "the", "line", "state", "of", "LineMorphingDrawable", "that", "is", "used", "as", "this", "button", "s", "icon", "." ]
1bbcac2686a0023ef7720d3fe455bb116d115af8
https://github.com/rey5137/material/blob/1bbcac2686a0023ef7720d3fe455bb116d115af8/material/src/main/java/com/rey/material/widget/FloatingActionButton.java#L253-L256
23,185
rey5137/material
material/src/main/java/com/rey/material/widget/FloatingActionButton.java
FloatingActionButton.setIcon
public void setIcon(Drawable icon, boolean animation){ if(icon == null) return; if(animation) { mSwitchIconAnimator.startAnimation(icon); invalidate(); } else{ if(mIcon != null){ mIcon.setCallback(null); unscheduleDrawable(mIcon); } mIcon = icon; float half = mIconSize / 2f; mIcon.setBounds((int)(mBackground.getCenterX() - half), (int)(mBackground.getCenterY() - half), (int)(mBackground.getCenterX() + half), (int)(mBackground.getCenterY() + half)); mIcon.setCallback(this); invalidate(); } }
java
public void setIcon(Drawable icon, boolean animation){ if(icon == null) return; if(animation) { mSwitchIconAnimator.startAnimation(icon); invalidate(); } else{ if(mIcon != null){ mIcon.setCallback(null); unscheduleDrawable(mIcon); } mIcon = icon; float half = mIconSize / 2f; mIcon.setBounds((int)(mBackground.getCenterX() - half), (int)(mBackground.getCenterY() - half), (int)(mBackground.getCenterX() + half), (int)(mBackground.getCenterY() + half)); mIcon.setCallback(this); invalidate(); } }
[ "public", "void", "setIcon", "(", "Drawable", "icon", ",", "boolean", "animation", ")", "{", "if", "(", "icon", "==", "null", ")", "return", ";", "if", "(", "animation", ")", "{", "mSwitchIconAnimator", ".", "startAnimation", "(", "icon", ")", ";", "invalidate", "(", ")", ";", "}", "else", "{", "if", "(", "mIcon", "!=", "null", ")", "{", "mIcon", ".", "setCallback", "(", "null", ")", ";", "unscheduleDrawable", "(", "mIcon", ")", ";", "}", "mIcon", "=", "icon", ";", "float", "half", "=", "mIconSize", "/", "2f", ";", "mIcon", ".", "setBounds", "(", "(", "int", ")", "(", "mBackground", ".", "getCenterX", "(", ")", "-", "half", ")", ",", "(", "int", ")", "(", "mBackground", ".", "getCenterY", "(", ")", "-", "half", ")", ",", "(", "int", ")", "(", "mBackground", ".", "getCenterX", "(", ")", "+", "half", ")", ",", "(", "int", ")", "(", "mBackground", ".", "getCenterY", "(", ")", "+", "half", ")", ")", ";", "mIcon", ".", "setCallback", "(", "this", ")", ";", "invalidate", "(", ")", ";", "}", "}" ]
Set the drawable that is used as this button's icon. @param icon The drawable. @param animation Indicate should show animation when switch drawable or not.
[ "Set", "the", "drawable", "that", "is", "used", "as", "this", "button", "s", "icon", "." ]
1bbcac2686a0023ef7720d3fe455bb116d115af8
https://github.com/rey5137/material/blob/1bbcac2686a0023ef7720d3fe455bb116d115af8/material/src/main/java/com/rey/material/widget/FloatingActionButton.java#L277-L297
23,186
rey5137/material
app/src/main/java/com/rey/material/app/Recurring.java
Recurring.setEnabledWeekday
public void setEnabledWeekday(int dayOfWeek, boolean enable){ if(mRepeatMode != REPEAT_WEEKLY) return; if(enable) mRepeatSetting = mRepeatSetting | WEEKDAY_MASK[dayOfWeek - 1]; else mRepeatSetting = mRepeatSetting & (~WEEKDAY_MASK[dayOfWeek - 1]); }
java
public void setEnabledWeekday(int dayOfWeek, boolean enable){ if(mRepeatMode != REPEAT_WEEKLY) return; if(enable) mRepeatSetting = mRepeatSetting | WEEKDAY_MASK[dayOfWeek - 1]; else mRepeatSetting = mRepeatSetting & (~WEEKDAY_MASK[dayOfWeek - 1]); }
[ "public", "void", "setEnabledWeekday", "(", "int", "dayOfWeek", ",", "boolean", "enable", ")", "{", "if", "(", "mRepeatMode", "!=", "REPEAT_WEEKLY", ")", "return", ";", "if", "(", "enable", ")", "mRepeatSetting", "=", "mRepeatSetting", "|", "WEEKDAY_MASK", "[", "dayOfWeek", "-", "1", "]", ";", "else", "mRepeatSetting", "=", "mRepeatSetting", "&", "(", "~", "WEEKDAY_MASK", "[", "dayOfWeek", "-", "1", "]", ")", ";", "}" ]
Enable repeat on a dayOfWeek. Only apply it repeat mode is REPEAT_WEEKLY. @param dayOfWeek value of dayOfWeek, take from Calendar obj. @param enable Enable this dayOfWeek or not.
[ "Enable", "repeat", "on", "a", "dayOfWeek", ".", "Only", "apply", "it", "repeat", "mode", "is", "REPEAT_WEEKLY", "." ]
1bbcac2686a0023ef7720d3fe455bb116d115af8
https://github.com/rey5137/material/blob/1bbcac2686a0023ef7720d3fe455bb116d115af8/app/src/main/java/com/rey/material/app/Recurring.java#L157-L165
23,187
rey5137/material
app/src/main/java/com/rey/material/app/Recurring.java
Recurring.getWeekDayOrderNum
public static int getWeekDayOrderNum(Calendar cal){ return cal.get(Calendar.DAY_OF_MONTH) + 7 > cal.getActualMaximum(Calendar.DAY_OF_MONTH) ? - 1 : (cal.get(Calendar.DAY_OF_MONTH) - 1) / 7; }
java
public static int getWeekDayOrderNum(Calendar cal){ return cal.get(Calendar.DAY_OF_MONTH) + 7 > cal.getActualMaximum(Calendar.DAY_OF_MONTH) ? - 1 : (cal.get(Calendar.DAY_OF_MONTH) - 1) / 7; }
[ "public", "static", "int", "getWeekDayOrderNum", "(", "Calendar", "cal", ")", "{", "return", "cal", ".", "get", "(", "Calendar", ".", "DAY_OF_MONTH", ")", "+", "7", ">", "cal", ".", "getActualMaximum", "(", "Calendar", ".", "DAY_OF_MONTH", ")", "?", "-", "1", ":", "(", "cal", ".", "get", "(", "Calendar", ".", "DAY_OF_MONTH", ")", "-", "1", ")", "/", "7", ";", "}" ]
Get the order number of weekday. 0 mean the first, -1 mean the last.
[ "Get", "the", "order", "number", "of", "weekday", ".", "0", "mean", "the", "first", "-", "1", "mean", "the", "last", "." ]
1bbcac2686a0023ef7720d3fe455bb116d115af8
https://github.com/rey5137/material/blob/1bbcac2686a0023ef7720d3fe455bb116d115af8/app/src/main/java/com/rey/material/app/Recurring.java#L320-L322
23,188
rey5137/material
app/src/main/java/com/rey/material/app/Recurring.java
Recurring.getDay
private static int getDay(Calendar cal, int dayOfWeek, int orderNum){ int day = cal.getActualMaximum(Calendar.DAY_OF_MONTH); cal.set(Calendar.DAY_OF_MONTH, day); int lastWeekday = cal.get(Calendar.DAY_OF_WEEK); int shift = lastWeekday >= dayOfWeek ? (lastWeekday - dayOfWeek) : (lastWeekday + 7 - dayOfWeek); //find last dayOfWeek of this month day -= shift; if(orderNum < 0) return day; cal.set(Calendar.DAY_OF_MONTH, day); int lastOrderNum = (cal.get(Calendar.DAY_OF_MONTH) - 1) / 7; if(orderNum >= lastOrderNum) return day; return day - (lastOrderNum - orderNum) * 7; }
java
private static int getDay(Calendar cal, int dayOfWeek, int orderNum){ int day = cal.getActualMaximum(Calendar.DAY_OF_MONTH); cal.set(Calendar.DAY_OF_MONTH, day); int lastWeekday = cal.get(Calendar.DAY_OF_WEEK); int shift = lastWeekday >= dayOfWeek ? (lastWeekday - dayOfWeek) : (lastWeekday + 7 - dayOfWeek); //find last dayOfWeek of this month day -= shift; if(orderNum < 0) return day; cal.set(Calendar.DAY_OF_MONTH, day); int lastOrderNum = (cal.get(Calendar.DAY_OF_MONTH) - 1) / 7; if(orderNum >= lastOrderNum) return day; return day - (lastOrderNum - orderNum) * 7; }
[ "private", "static", "int", "getDay", "(", "Calendar", "cal", ",", "int", "dayOfWeek", ",", "int", "orderNum", ")", "{", "int", "day", "=", "cal", ".", "getActualMaximum", "(", "Calendar", ".", "DAY_OF_MONTH", ")", ";", "cal", ".", "set", "(", "Calendar", ".", "DAY_OF_MONTH", ",", "day", ")", ";", "int", "lastWeekday", "=", "cal", ".", "get", "(", "Calendar", ".", "DAY_OF_WEEK", ")", ";", "int", "shift", "=", "lastWeekday", ">=", "dayOfWeek", "?", "(", "lastWeekday", "-", "dayOfWeek", ")", ":", "(", "lastWeekday", "+", "7", "-", "dayOfWeek", ")", ";", "//find last dayOfWeek of this month", "day", "-=", "shift", ";", "if", "(", "orderNum", "<", "0", ")", "return", "day", ";", "cal", ".", "set", "(", "Calendar", ".", "DAY_OF_MONTH", ",", "day", ")", ";", "int", "lastOrderNum", "=", "(", "cal", ".", "get", "(", "Calendar", ".", "DAY_OF_MONTH", ")", "-", "1", ")", "/", "7", ";", "if", "(", "orderNum", ">=", "lastOrderNum", ")", "return", "day", ";", "return", "day", "-", "(", "lastOrderNum", "-", "orderNum", ")", "*", "7", ";", "}" ]
Get the day in month of the current month of Calendar. @param cal @param dayOfWeek The day of week. @param orderNum The order number, 0 mean the first, -1 mean the last. @return The day int month
[ "Get", "the", "day", "in", "month", "of", "the", "current", "month", "of", "Calendar", "." ]
1bbcac2686a0023ef7720d3fe455bb116d115af8
https://github.com/rey5137/material/blob/1bbcac2686a0023ef7720d3fe455bb116d115af8/app/src/main/java/com/rey/material/app/Recurring.java#L331-L351
23,189
rey5137/material
material/src/main/java/com/rey/material/widget/TabIndicatorView.java
TabIndicatorView.setCurrentTab
public void setCurrentTab(int position) { if(mSelectedPosition != position){ View v = mLayoutManager.findViewByPosition(mSelectedPosition); if(v != null) ((Checkable)v).setChecked(false); } mSelectedPosition = position; View v = mLayoutManager.findViewByPosition(mSelectedPosition); if(v != null) ((Checkable)v).setChecked(true); animateToTab(position); }
java
public void setCurrentTab(int position) { if(mSelectedPosition != position){ View v = mLayoutManager.findViewByPosition(mSelectedPosition); if(v != null) ((Checkable)v).setChecked(false); } mSelectedPosition = position; View v = mLayoutManager.findViewByPosition(mSelectedPosition); if(v != null) ((Checkable)v).setChecked(true); animateToTab(position); }
[ "public", "void", "setCurrentTab", "(", "int", "position", ")", "{", "if", "(", "mSelectedPosition", "!=", "position", ")", "{", "View", "v", "=", "mLayoutManager", ".", "findViewByPosition", "(", "mSelectedPosition", ")", ";", "if", "(", "v", "!=", "null", ")", "(", "(", "Checkable", ")", "v", ")", ".", "setChecked", "(", "false", ")", ";", "}", "mSelectedPosition", "=", "position", ";", "View", "v", "=", "mLayoutManager", ".", "findViewByPosition", "(", "mSelectedPosition", ")", ";", "if", "(", "v", "!=", "null", ")", "(", "(", "Checkable", ")", "v", ")", ".", "setChecked", "(", "true", ")", ";", "animateToTab", "(", "position", ")", ";", "}" ]
Set the current tab of this TabIndicatorView. @param position The position of current tab.
[ "Set", "the", "current", "tab", "of", "this", "TabIndicatorView", "." ]
1bbcac2686a0023ef7720d3fe455bb116d115af8
https://github.com/rey5137/material/blob/1bbcac2686a0023ef7720d3fe455bb116d115af8/material/src/main/java/com/rey/material/widget/TabIndicatorView.java#L253-L266
23,190
rey5137/material
material/src/main/java/com/rey/material/app/BottomSheetDialog.java
BottomSheetDialog.heightParam
public BottomSheetDialog heightParam(int height){ if(mLayoutHeight != height) { mLayoutHeight = height; if(isShowing() && mContentView != null) { mRunShowAnimation = true; mContainer.forceLayout(); mContainer.requestLayout(); } } return this; }
java
public BottomSheetDialog heightParam(int height){ if(mLayoutHeight != height) { mLayoutHeight = height; if(isShowing() && mContentView != null) { mRunShowAnimation = true; mContainer.forceLayout(); mContainer.requestLayout(); } } return this; }
[ "public", "BottomSheetDialog", "heightParam", "(", "int", "height", ")", "{", "if", "(", "mLayoutHeight", "!=", "height", ")", "{", "mLayoutHeight", "=", "height", ";", "if", "(", "isShowing", "(", ")", "&&", "mContentView", "!=", "null", ")", "{", "mRunShowAnimation", "=", "true", ";", "mContainer", ".", "forceLayout", "(", ")", ";", "mContainer", ".", "requestLayout", "(", ")", ";", "}", "}", "return", "this", ";", "}" ]
Set the height params of this BottomSheetDialog's content view. @param height The height param. Can be the size in pixels, or {@link ViewGroup.LayoutParams#WRAP_CONTENT} or {@link ViewGroup.LayoutParams#MATCH_PARENT}. @return The BottomSheetDialog for chaining methods.
[ "Set", "the", "height", "params", "of", "this", "BottomSheetDialog", "s", "content", "view", "." ]
1bbcac2686a0023ef7720d3fe455bb116d115af8
https://github.com/rey5137/material/blob/1bbcac2686a0023ef7720d3fe455bb116d115af8/material/src/main/java/com/rey/material/app/BottomSheetDialog.java#L234-L245
23,191
rey5137/material
material/src/main/java/com/rey/material/app/BottomSheetDialog.java
BottomSheetDialog.dismissImmediately
public void dismissImmediately(){ super.dismiss(); if(mAnimation != null) mAnimation.cancel(); if(mHandler != null) mHandler.removeCallbacks(mDismissAction); }
java
public void dismissImmediately(){ super.dismiss(); if(mAnimation != null) mAnimation.cancel(); if(mHandler != null) mHandler.removeCallbacks(mDismissAction); }
[ "public", "void", "dismissImmediately", "(", ")", "{", "super", ".", "dismiss", "(", ")", ";", "if", "(", "mAnimation", "!=", "null", ")", "mAnimation", ".", "cancel", "(", ")", ";", "if", "(", "mHandler", "!=", "null", ")", "mHandler", ".", "removeCallbacks", "(", "mDismissAction", ")", ";", "}" ]
Dismiss Dialog immediately without showing out animation.
[ "Dismiss", "Dialog", "immediately", "without", "showing", "out", "animation", "." ]
1bbcac2686a0023ef7720d3fe455bb116d115af8
https://github.com/rey5137/material/blob/1bbcac2686a0023ef7720d3fe455bb116d115af8/material/src/main/java/com/rey/material/app/BottomSheetDialog.java#L337-L345
23,192
rey5137/material
material/src/main/java/com/rey/material/widget/EditText.java
EditText.getCompoundPaddingEnd
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1) public int getCompoundPaddingEnd (){ if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) return mInputView.getCompoundPaddingEnd(); return mInputView.getCompoundPaddingRight(); }
java
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1) public int getCompoundPaddingEnd (){ if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) return mInputView.getCompoundPaddingEnd(); return mInputView.getCompoundPaddingRight(); }
[ "@", "TargetApi", "(", "Build", ".", "VERSION_CODES", ".", "JELLY_BEAN_MR1", ")", "public", "int", "getCompoundPaddingEnd", "(", ")", "{", "if", "(", "Build", ".", "VERSION", ".", "SDK_INT", ">=", "Build", ".", "VERSION_CODES", ".", "JELLY_BEAN_MR1", ")", "return", "mInputView", ".", "getCompoundPaddingEnd", "(", ")", ";", "return", "mInputView", ".", "getCompoundPaddingRight", "(", ")", ";", "}" ]
Returns the end padding of the view, plus space for the end Drawable if any.
[ "Returns", "the", "end", "padding", "of", "the", "view", "plus", "space", "for", "the", "end", "Drawable", "if", "any", "." ]
1bbcac2686a0023ef7720d3fe455bb116d115af8
https://github.com/rey5137/material/blob/1bbcac2686a0023ef7720d3fe455bb116d115af8/material/src/main/java/com/rey/material/widget/EditText.java#L1540-L1546
23,193
rey5137/material
material/src/main/java/com/rey/material/widget/EditText.java
EditText.getCompoundPaddingStart
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1) public int getCompoundPaddingStart (){ if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) return mInputView.getCompoundPaddingStart(); return mInputView.getCompoundPaddingLeft(); }
java
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1) public int getCompoundPaddingStart (){ if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) return mInputView.getCompoundPaddingStart(); return mInputView.getCompoundPaddingLeft(); }
[ "@", "TargetApi", "(", "Build", ".", "VERSION_CODES", ".", "JELLY_BEAN_MR1", ")", "public", "int", "getCompoundPaddingStart", "(", ")", "{", "if", "(", "Build", ".", "VERSION", ".", "SDK_INT", ">=", "Build", ".", "VERSION_CODES", ".", "JELLY_BEAN_MR1", ")", "return", "mInputView", ".", "getCompoundPaddingStart", "(", ")", ";", "return", "mInputView", ".", "getCompoundPaddingLeft", "(", ")", ";", "}" ]
Returns the start padding of the view, plus space for the start Drawable if any.
[ "Returns", "the", "start", "padding", "of", "the", "view", "plus", "space", "for", "the", "start", "Drawable", "if", "any", "." ]
1bbcac2686a0023ef7720d3fe455bb116d115af8
https://github.com/rey5137/material/blob/1bbcac2686a0023ef7720d3fe455bb116d115af8/material/src/main/java/com/rey/material/widget/EditText.java#L1568-L1574
23,194
rey5137/material
material/src/main/java/com/rey/material/widget/EditText.java
EditText.getIncludeFontPadding
@TargetApi(Build.VERSION_CODES.JELLY_BEAN) public boolean getIncludeFontPadding (){ return Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN && mInputView.getIncludeFontPadding(); }
java
@TargetApi(Build.VERSION_CODES.JELLY_BEAN) public boolean getIncludeFontPadding (){ return Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN && mInputView.getIncludeFontPadding(); }
[ "@", "TargetApi", "(", "Build", ".", "VERSION_CODES", ".", "JELLY_BEAN", ")", "public", "boolean", "getIncludeFontPadding", "(", ")", "{", "return", "Build", ".", "VERSION", ".", "SDK_INT", ">=", "Build", ".", "VERSION_CODES", ".", "JELLY_BEAN", "&&", "mInputView", ".", "getIncludeFontPadding", "(", ")", ";", "}" ]
Gets whether the TextView includes extra top and bottom padding to make room for accents that go above the normal ascent and descent. @see #setIncludeFontPadding(boolean) @attr ref android.R.styleable#TextView_includeFontPadding
[ "Gets", "whether", "the", "TextView", "includes", "extra", "top", "and", "bottom", "padding", "to", "make", "room", "for", "accents", "that", "go", "above", "the", "normal", "ascent", "and", "descent", "." ]
1bbcac2686a0023ef7720d3fe455bb116d115af8
https://github.com/rey5137/material/blob/1bbcac2686a0023ef7720d3fe455bb116d115af8/material/src/main/java/com/rey/material/widget/EditText.java#L1777-L1780
23,195
rey5137/material
material/src/main/java/com/rey/material/widget/EditText.java
EditText.getLineSpacingExtra
@TargetApi(Build.VERSION_CODES.JELLY_BEAN) public float getLineSpacingExtra (){ if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) return mInputView.getLineSpacingExtra(); return 0f; }
java
@TargetApi(Build.VERSION_CODES.JELLY_BEAN) public float getLineSpacingExtra (){ if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) return mInputView.getLineSpacingExtra(); return 0f; }
[ "@", "TargetApi", "(", "Build", ".", "VERSION_CODES", ".", "JELLY_BEAN", ")", "public", "float", "getLineSpacingExtra", "(", ")", "{", "if", "(", "Build", ".", "VERSION", ".", "SDK_INT", ">=", "Build", ".", "VERSION_CODES", ".", "JELLY_BEAN", ")", "return", "mInputView", ".", "getLineSpacingExtra", "(", ")", ";", "return", "0f", ";", "}" ]
Gets the line spacing extra space @return the extra space that is added to the height of each lines of this TextView. @see #setLineSpacing(float, float) @see #getLineSpacingMultiplier() @attr ref android.R.styleable#TextView_lineSpacingExtra
[ "Gets", "the", "line", "spacing", "extra", "space" ]
1bbcac2686a0023ef7720d3fe455bb116d115af8
https://github.com/rey5137/material/blob/1bbcac2686a0023ef7720d3fe455bb116d115af8/material/src/main/java/com/rey/material/widget/EditText.java#L1882-L1887
23,196
rey5137/material
material/src/main/java/com/rey/material/widget/EditText.java
EditText.getLineSpacingMultiplier
@TargetApi(Build.VERSION_CODES.JELLY_BEAN) public float getLineSpacingMultiplier (){ if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) return mInputView.getLineSpacingMultiplier(); return 0f; }
java
@TargetApi(Build.VERSION_CODES.JELLY_BEAN) public float getLineSpacingMultiplier (){ if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) return mInputView.getLineSpacingMultiplier(); return 0f; }
[ "@", "TargetApi", "(", "Build", ".", "VERSION_CODES", ".", "JELLY_BEAN", ")", "public", "float", "getLineSpacingMultiplier", "(", ")", "{", "if", "(", "Build", ".", "VERSION", ".", "SDK_INT", ">=", "Build", ".", "VERSION_CODES", ".", "JELLY_BEAN", ")", "return", "mInputView", ".", "getLineSpacingMultiplier", "(", ")", ";", "return", "0f", ";", "}" ]
Gets the line spacing multiplier @return the value by which each line's height is multiplied to get its actual height. @see #setLineSpacing(float, float) @see #getLineSpacingExtra() @attr ref android.R.styleable#TextView_lineSpacingMultiplier
[ "Gets", "the", "line", "spacing", "multiplier" ]
1bbcac2686a0023ef7720d3fe455bb116d115af8
https://github.com/rey5137/material/blob/1bbcac2686a0023ef7720d3fe455bb116d115af8/material/src/main/java/com/rey/material/widget/EditText.java#L1899-L1904
23,197
rey5137/material
material/src/main/java/com/rey/material/widget/EditText.java
EditText.getMarqueeRepeatLimit
@TargetApi(Build.VERSION_CODES.JELLY_BEAN) public int getMarqueeRepeatLimit (){ if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) return mInputView.getMarqueeRepeatLimit(); return -1; }
java
@TargetApi(Build.VERSION_CODES.JELLY_BEAN) public int getMarqueeRepeatLimit (){ if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) return mInputView.getMarqueeRepeatLimit(); return -1; }
[ "@", "TargetApi", "(", "Build", ".", "VERSION_CODES", ".", "JELLY_BEAN", ")", "public", "int", "getMarqueeRepeatLimit", "(", ")", "{", "if", "(", "Build", ".", "VERSION", ".", "SDK_INT", ">=", "Build", ".", "VERSION_CODES", ".", "JELLY_BEAN", ")", "return", "mInputView", ".", "getMarqueeRepeatLimit", "(", ")", ";", "return", "-", "1", ";", "}" ]
Gets the number of times the marquee animation is repeated. Only meaningful if the TextView has marquee enabled. @return the number of times the marquee animation is repeated. -1 if the animation repeats indefinitely @see #setMarqueeRepeatLimit(int) @attr ref android.R.styleable#TextView_marqueeRepeatLimit
[ "Gets", "the", "number", "of", "times", "the", "marquee", "animation", "is", "repeated", ".", "Only", "meaningful", "if", "the", "TextView", "has", "marquee", "enabled", "." ]
1bbcac2686a0023ef7720d3fe455bb116d115af8
https://github.com/rey5137/material/blob/1bbcac2686a0023ef7720d3fe455bb116d115af8/material/src/main/java/com/rey/material/widget/EditText.java#L1942-L1948
23,198
rey5137/material
material/src/main/java/com/rey/material/widget/EditText.java
EditText.getShadowRadius
@TargetApi(Build.VERSION_CODES.JELLY_BEAN) public float getShadowRadius (){ if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) return mInputView.getShadowRadius(); return 0; }
java
@TargetApi(Build.VERSION_CODES.JELLY_BEAN) public float getShadowRadius (){ if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) return mInputView.getShadowRadius(); return 0; }
[ "@", "TargetApi", "(", "Build", ".", "VERSION_CODES", ".", "JELLY_BEAN", ")", "public", "float", "getShadowRadius", "(", ")", "{", "if", "(", "Build", ".", "VERSION", ".", "SDK_INT", ">=", "Build", ".", "VERSION_CODES", ".", "JELLY_BEAN", ")", "return", "mInputView", ".", "getShadowRadius", "(", ")", ";", "return", "0", ";", "}" ]
Gets the radius of the shadow layer. @return the radius of the shadow layer. If 0, the shadow layer is not visible @see #setShadowLayer(float, float, float, int) @attr ref android.R.styleable#TextView_shadowRadius
[ "Gets", "the", "radius", "of", "the", "shadow", "layer", "." ]
1bbcac2686a0023ef7720d3fe455bb116d115af8
https://github.com/rey5137/material/blob/1bbcac2686a0023ef7720d3fe455bb116d115af8/material/src/main/java/com/rey/material/widget/EditText.java#L2224-L2230
23,199
rey5137/material
material/src/main/java/com/rey/material/widget/EditText.java
EditText.getShowSoftInputOnFocus
@TargetApi(Build.VERSION_CODES.LOLLIPOP) public final boolean getShowSoftInputOnFocus (){ if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) return mInputView.getShowSoftInputOnFocus(); return true; }
java
@TargetApi(Build.VERSION_CODES.LOLLIPOP) public final boolean getShowSoftInputOnFocus (){ if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) return mInputView.getShowSoftInputOnFocus(); return true; }
[ "@", "TargetApi", "(", "Build", ".", "VERSION_CODES", ".", "LOLLIPOP", ")", "public", "final", "boolean", "getShowSoftInputOnFocus", "(", ")", "{", "if", "(", "Build", ".", "VERSION", ".", "SDK_INT", ">=", "Build", ".", "VERSION_CODES", ".", "LOLLIPOP", ")", "return", "mInputView", ".", "getShowSoftInputOnFocus", "(", ")", ";", "return", "true", ";", "}" ]
Returns whether the soft input method will be made visible when this TextView gets focused. The default is true.
[ "Returns", "whether", "the", "soft", "input", "method", "will", "be", "made", "visible", "when", "this", "TextView", "gets", "focused", ".", "The", "default", "is", "true", "." ]
1bbcac2686a0023ef7720d3fe455bb116d115af8
https://github.com/rey5137/material/blob/1bbcac2686a0023ef7720d3fe455bb116d115af8/material/src/main/java/com/rey/material/widget/EditText.java#L2236-L2241