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
dependencies { | |
// Your app's other dependencies | |
compile 'com.github.bumptech.glide:glide.3.7.0' | |
compile 'com.android.support:support-v4:23.2.1' | |
} |
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
dependencies { | |
// Your app's other dependencies | |
compile 'com.github.bumptech.glide:glide.3.7.0' | |
compile 'com.android.support:support-v4:23.2.1' | |
} |
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
Imageview imageView = (ImageView) findViewById(R.id.image_view); | |
Glide.with(this).load("https://an-awesome-image.com").into(imageView); |
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
DrawableRequestBuilder drawableRequestBuilder = Glide.with(This | |
.load(url) | |
.fitCenter() | |
.animate(android.R.anim.fade_in); | |
if (mMediaFragmentListener.getLocalVideoUri() != null) { | |
MediaMetadataRetriever retriever = new MediaMetadataRetriever(); | |
Context context = getContext(); | |
retriever.setDataSource(context, mMediaFragmentListener.getLocalVideoUri()); | |
Bitmap frame = retriever.getFrameAtTime(); |
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
val sorted: List[Message] = decryptedIndexedList | |
.sortBy { case (_, index) => index } | |
.map { case (message, _) => message } |
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
val keyGroups: Map[Long, List[(EncryptedMessage, Int)]] = | |
maybeKeyGroups.collect { case (Some(key), messageGroup) => (key, messageGroup) } |
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
val maybeKeyGroups: Map[Option[Long], List[(EncryptedMessage, Int)]] = | |
indexedList.groupBy { case (message, _) => message.key } |
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
val indexedList: List[(EncryptedMessage, Int)] = encryptedMessages.zipWithIndex |
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
class InvalidLatLongException(latitude: Double, longitude: Double) extends Exception | |
def validateLatLong(latitude: Double, longitude: Double): Either[InvalidLatLongException, (Double, Double)] = | |
if (latitude < -90 || latitude > 90 || longitude < -180 || longitude > 180) | |
Left(InvalidLatLongException(latitude, longitude)) | |
else | |
Right((latitude, longitude)) |
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
def validateLatLong(latitude: Double, longitude: Double): Option[(Double, Double)] = | |
if (latitude < -90 || latitude > 90 || longitude < -180 || longitude > 180) | |
None | |
else | |
Some((latitude, longitude)) | |
val foo = | |
validateLatLong(49, 123) match { | |
case Some((latitude, longitude)) => /* Proceed with validated data */ | |
case None => /* Handle case where no value is returned */ |
OlderNewer