최종 업데이트 : 2014-07-14 15:44:18
Intent.ACTION_BATTERY_CHANGED 를 Broadcast receiver에 등록해 변경사항이 있을때마다, 정보를 수신할 수 있음
아니면, dumpsys 를 통해 바로 확인할 수 있음
| import com.android.volley.AuthFailureError; | |
| import com.android.volley.NetworkResponse; | |
| import com.android.volley.Request; | |
| import com.android.volley.Response; | |
| import com.android.volley.VolleyLog; | |
| import org.apache.http.HttpEntity; | |
| import org.apache.http.entity.mime.MultipartEntityBuilder; | |
| import org.apache.http.entity.mime.content.FileBody; |
| package com.blogspot.ksoichiro.linktest; | |
| import android.text.Layout; | |
| import android.text.Spannable; | |
| import android.text.SpannableString; | |
| import android.text.Spanned; | |
| import android.text.TextUtils; | |
| import android.text.method.LinkMovementMethod; | |
| import android.text.style.ClickableSpan; | |
| import android.text.style.URLSpan; |
| public class CircularProgressDrawable extends Drawable | |
| implements Animatable { | |
| private static final Interpolator ANGLE_INTERPOLATOR = new LinearInterpolator(); | |
| private static final Interpolator SWEEP_INTERPOLATOR = new DecelerateInterpolator(); | |
| private static final int ANGLE_ANIMATOR_DURATION = 2000; | |
| private static final int SWEEP_ANIMATOR_DURATION = 600; | |
| private static final int MIN_SWEEP_ANGLE = 30; | |
| private final RectF fBounds = new RectF(); |
최종 업데이트 : 2014-07-14 15:44:18
Intent.ACTION_BATTERY_CHANGED 를 Broadcast receiver에 등록해 변경사항이 있을때마다, 정보를 수신할 수 있음
아니면, dumpsys 를 통해 바로 확인할 수 있음
| public class AccountAuthenticator extends AbstractAccountAuthenticator { | |
| private final Context context; | |
| @Inject @ClientId String clientId; | |
| @Inject @ClientSecret String clientSecret; | |
| @Inject ApiService apiService; | |
| public AccountAuthenticator(Context context) { | |
| super(context); |
| /* | |
| * Copyright (C) 2014 The Android Open Source Project | |
| * | |
| * 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 |
| /* | |
| * The MIT License (MIT) | |
| * | |
| * Copyright (c) 2014 Matthieu Harlé | |
| * | |
| * Permission is hereby granted, free of charge, to any person obtaining a copy | |
| * of this software and associated documentation files (the "Software"), to deal | |
| * in the Software without restriction, including without limitation the rights | |
| * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
| * copies of the Software, and to permit persons to whom the Software is |
| /* | |
| * Copyright (C) 2014 skyfish.jy@gmail.com | |
| * | |
| * 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 guide is a first draft (that will end up in the official docs) on writing resilient code for production with the Couchbase Java SDK. At the end, the reader will be able to write code that withstands bugs, latency issues or anything else that can make their application fail.
Note that lots of concepts can be applied for both synchronous and asynchronous access. When necessary, both patterns are discussed separately. Also, the focus is on database interaction, but if you are using RxJava as part of your stack you can apply most of the principles there as well (and should!).
When working with Observables, it is important to understand the difference between cold and hot. Cold Observables will start to emit events once a Observer subscribes, and will do it "fresh" for each Observer. Hot Observables instead are starting to emit data as soon as it becomes available, and will return the same (or parts of the same)
| package rxjava.issue; | |
| import java.util.Queue; | |
| import java.util.concurrent.*; | |
| import java.util.concurrent.atomic.AtomicInteger; | |
| import rx.*; | |
| import rx.Observable.Operator; | |
| import rx.Scheduler.Worker; | |
| import rx.functions.Action0; |