This file contains hidden or 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 intent = Intent(Intent.ACTION_SEND).apply { | |
type = "text/plain" | |
putExtra(Intent.EXTRA_EMAIL, "[email protected]") | |
putExtra(Intent.EXTRA_EMAIL, "[email protected]") | |
putExtra(Intent.EXTRA_SUBJECT, "Subject") | |
putExtra(Intent.EXTRA_TEXT, "I'm email body.") | |
} | |
startActivity(intent) |
This file contains hidden or 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
Intent intent = new Intent(Intent.ACTION_SEND); | |
intent.setType("text/plain"); | |
intent.putExtra(Intent.EXTRA_EMAIL, "[email protected]"); | |
intent.putExtra(Intent.EXTRA_SUBJECT, "Subject"); | |
intent.putExtra(Intent.EXTRA_TEXT, "I'm email body."); | |
startActivity(Intent.createChooser(intent, "Send Email")); |
This file contains hidden or 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
/** | |
* Calls the specified function [block] and returns its result. | |
*/ | |
@kotlin.internal.InlineOnly | |
public inline fun <R> run(block: () -> R): R = block() |
This file contains hidden or 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
PublishSubject<Integer> limit = PublishSubject.create(); | |
limit.concatMap(integer -> Observable.just(integer + 1)) // Assuming this gives network result based upon the artist id you provided | |
.doOnNext(integer -> { | |
// Based on the network result i make my conditions here | |
Timber.d("Publish: doOnNext: %d", integer); | |
if (integer < 10) { | |
// Pass the artist id to make the next call | |
limit.onNext(integer); | |
} else { |
This file contains hidden or 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
private boolean isPermsAvailable() { | |
return Build.VERSION.SDK_INT < Build.VERSION_CODES.M | |
|| ContextCompat.checkSelfPermission(this, | |
Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED | |
&& ContextCompat.checkSelfPermission(MainActivity.this, | |
Manifest.permission.CAMERA) == PackageManager.PERMISSION_GRANTED | |
&& ContextCompat.checkSelfPermission(MainActivity.this, | |
Manifest.permission.READ_PHONE_STATE) == PackageManager.PERMISSION_GRANTED | |
&& ContextCompat.checkSelfPermission(MainActivity.this, | |
Manifest.permission.SEND_SMS) == PackageManager.PERMISSION_GRANTED |
This file contains hidden or 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.content.Context; | |
import android.content.res.TypedArray; | |
import android.graphics.Bitmap; | |
import android.graphics.Canvas; | |
import android.graphics.Color; | |
import android.graphics.Paint; | |
import android.graphics.Paint.Style; | |
import android.graphics.PorterDuff; | |
import android.graphics.drawable.Drawable; | |
import android.os.Vibrator; |
This file contains hidden or 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
/** | |
* Uses a combination of a PageTransformer and swapping X & Y coordinates | |
* of touch events to create the illusion of a vertically scrolling ViewPager. | |
* | |
* Requires API 11+ | |
* | |
*/ | |
public class VerticalViewPager extends ViewPager { | |
public VerticalViewPager(Context context) { |
This file contains hidden or 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 2010 Square, Inc. | |
package com.squareup.seismic; | |
import android.hardware.Sensor; | |
import android.hardware.SensorEvent; | |
import android.hardware.SensorEventListener; | |
import android.hardware.SensorManager; | |
import java.util.ArrayList; | |
import java.util.List; |
This file contains hidden or 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 2010 Square, Inc. | |
package com.squareup.seismic; | |
import android.hardware.Sensor; | |
import android.hardware.SensorEvent; | |
import android.hardware.SensorEventListener; | |
import android.hardware.SensorManager; | |
import java.util.ArrayList; | |
import java.util.List; |
This file contains hidden or 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 2010 Square, Inc. | |
package com.squareup.seismic; | |
import android.hardware.Sensor; | |
import android.hardware.SensorEvent; | |
import android.hardware.SensorEventListener; | |
import android.hardware.SensorManager; | |
import java.util.ArrayList; | |
import java.util.List; |