Skip to content

Instantly share code, notes, and snippets.

public static final boolean IS_BUILD_VERSION_LM = Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP;
private static final int REQUEST_ENABLE_BLE = 1;
private static final int RESULT_OK = -1;
private static final int PERMISSION_GRANTED = PackageManager.PERMISSION_GRANTED;
private static final String PERMISSION_COARSE = Manifest.permission.ACCESS_COARSE_LOCATION;
private static final String PERMISSION_FINE = Manifest.permission.ACCESS_FINE_LOCATION;
private static WeakReference<Activity> reference;
public class RxBLE2 {
private final BluetoothAdapter bluetoothAdapter;
private final BluetoothLeScanner scanner;
private Subscriber<? super BleDevice> subscriber;
private final ScanCallback callback = new ScanCallback() {
@Override
public void onScanResult(int callbackType, ScanResult result) {
super.onScanResult(callbackType, result);
public class RxSnackBar {
private static int NONE = 0;
private final static String DEF_MESSAGE = "RxSnackBar";
private final static String DEF_ACTION = "ACTION";
private static Snackbar snackbar;
private final View rootView;
private final int messageID;
apply plugin: 'com.android.application'
apply plugin: 'com.jakewharton.hugo'
apply plugin: 'me.tatarka.retrolambda'
apply plugin: 'com.neenbedankt.android-apt'
android {
compileSdkVersion 24
buildToolsVersion "24.0.0"
compileOptions {
encoding = 'UTF-8'
@NeedPainkiller
NeedPainkiller / dependencies.gradle
Last active June 30, 2017 08:09
Android Gradle Dependency
ext {
V_GRADLE = "2.3.3"
// https://developer.android.com/studio/releases/gradle-plugin.html
V_APT = "1.8"
BasicDependencies = [
APT : "com.neenbedankt.gradle.plugins:android-apt:$V_APT",
Gradle : "com.android.tools.build:gradle:$V_GRADLE",
FileTree: fileTree(dir: 'libs', include: ['*.jar']),
]
@author 개발자
@exception 메소드에서의 예외 확인
@param 메소드의 매개변수
@return 메소드의 반환값
@see 다른 주제에 관한 링크 지정
@serial 직렬화 필드
@since 릴리즈 기록
@throws 메소드에서의 예외
@version 클래스의 버전
import static android.Manifest.permission.*;
...
...
...
private AndroidPermission androidPermission;
androidPermission.requestPermission(CAMERA,INTERNET,
ACCESS_FINE_LOCATION, ACCESS_COARSE_LOCATION)
.subscribe(deniedPermissions -> {
for (String deniedPermission : deniedPermissions) {
Log.d("Permission Denial",deniedPermission);
public class PermissionActivity extends AppCompatActivity {
@InjectExtra PermissionContent content;
@Nullable @InjectExtra String tag = "TAG";
@Override protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Dart.inject(this);
Bundle bundle = getIntent().getExtras();
private void startPermissionActivity(Context context, PermissionContent content) {
Intent intent = Henson.with(context)
.gotoPermissionActivity()
.content(content).build();
context.startActivity(intent);
}
public class Henson {
private Henson() {
}
public static WithContextSetState with(Context context) {
return new com.orca.kam.rxpermission.Henson.WithContextSetState(context);
}
public static class WithContextSetState {
private Context context;