This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BitmapDescriptor markerIcon = vectorToBitmap(R.drawable.vectordrawableicon, | |
ContextCompat.getColor(getApplicationContext(), | |
R.color.marker)); | |
mMap.addMarker(new MarkerOptions() | |
.icon(markerIcon) | |
.position(LatLng()) | |
); | |
private BitmapDescriptor vectorToBitmap(@DrawableRes int id, @ColorInt int color) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface ReverseProxyValidator { | |
void validate(RecordedRequest request, Response response); | |
} | |
class ReverseProxyDispatcher extends Dispatcher { | |
private final OkHttpClient client; | |
private final HttpUrl serverUrl; | |
private final ReverseProxyValidator validator; | |
public ReverseProxyDispatcher(HttpUrl url, ReverseProxyValidator validator) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.os.Handler; | |
import android.os.SystemClock; | |
import android.view.animation.BounceInterpolator; | |
import android.view.animation.Interpolator; | |
import com.google.android.gms.maps.GoogleMap; | |
import com.google.android.gms.maps.model.Marker; | |
/** | |
* Performs a bounce animation on a {@link Marker} when it is clicked. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Produce a formatted SpannableString object from a given String | |
* input, with all lowercase characters converted to smallcap | |
* characters. Uses only standard A-Z characters, so works with | |
* any font. | |
* | |
* @param input The input string, e.g. "Small Caps" | |
* @return A formatted SpannableString, e.g. "Sᴍᴀʟʟ Cᴀᴘs" | |
*/ | |
public static SpannableString getSmallCapsString(String input) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Copyright 2014 Prateek Srivastava | |
* | |
* Licensed under the Apache License, Version 2.0 (the "License"); | |
* you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* | |
* Unless required by applicable law or agreed to in writing, software |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.text.SpannableStringBuilder; | |
import java.util.ArrayDeque; | |
import java.util.Deque; | |
import static android.text.Spanned.SPAN_INCLUSIVE_EXCLUSIVE; | |
/** A {@link SpannableStringBuilder} wrapper whose API doesn't make me want to stab my eyes out. */ | |
public class Truss { | |
private final SpannableStringBuilder builder; | |
private final Deque<Span> stack; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.time.*; | |
import java.time.format.DateTimeFormatter; | |
import java.time.format.FormatStyle; | |
import java.time.temporal.ChronoUnit; | |
import java.time.temporal.TemporalAdjusters; | |
import java.util.*; | |
import static java.time.temporal.TemporalAdjusters.*; | |
public class Java8DateTimeExamples { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.yourcompany.util; | |
import android.content.Context; | |
import android.support.v4.content.AsyncTaskLoader; | |
import android.util.Log; | |
import com.yourcompany.util.GenericAsyncTaskLoader.ServiceData; | |
/** | |
* A generic Loader that delegates its actual loading operation to a | |
* CustomLoaderCallbacks<T> instance passed through the constructor. |
NewerOlder