code stringlengths 23 201k | docstring stringlengths 17 96.2k | func_name stringlengths 0 235 | language stringclasses 1
value | repo stringlengths 8 72 | path stringlengths 11 317 | url stringlengths 57 377 | license stringclasses 7
values |
|---|---|---|---|---|---|---|---|
@Override
public void run() {
dontNotifyRequestListenersForRequestInternal(request);
} | Disable request listeners notifications for a specific request.<br/>
None of the listeners associated to this request will be called when
request will finish.<br/>
This method will ask (asynchronously) to the {@link SpiceService} to
remove listeners if requests have already been sent to the
{@link SpiceService} if the ... | run | java | stephanenicolas/robospice | robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceManager.java | https://github.com/stephanenicolas/robospice/blob/master/robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceManager.java | Apache-2.0 |
protected void dontNotifyRequestListenersForRequestInternal(final SpiceRequest<?> request) {
lockSendRequestsToService.lock();
try {
final boolean requestNotPassedToServiceYet = removeListenersOfCachedRequestToLaunch(request);
Ln.v("Removed from requests to launch list : " + req... | Internal method to remove requests. If request has not been passed to the
{@link SpiceService} yet, all listeners are unregistered locally before
being passed to the service. Otherwise, it will asynchronously ask to the
{@link SpiceService} to remove the listeners of the request being
processed.
@param request
... | dontNotifyRequestListenersForRequestInternal | java | stephanenicolas/robospice | robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceManager.java | https://github.com/stephanenicolas/robospice/blob/master/robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceManager.java | Apache-2.0 |
private boolean removeListenersOfCachedRequestToLaunch(final SpiceRequest<?> request) {
synchronized (mapRequestToLaunchToRequestListener) {
for (final CachedSpiceRequest<?> cachedSpiceRequest : mapRequestToLaunchToRequestListener.keySet()) {
if (match(cachedSpiceRequest, request)) {... | Remove all listeners of a request that has not yet been passed to the
{@link SpiceService}.
@param request
the request for which listeners must be unregistered.
@return a boolean indicating if the request could be found inside the
list of requests to be launched. If false, the request was
alr... | removeListenersOfCachedRequestToLaunch | java | stephanenicolas/robospice | robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceManager.java | https://github.com/stephanenicolas/robospice/blob/master/robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceManager.java | Apache-2.0 |
private void removeListenersOfPendingCachedRequest(final SpiceRequest<?> request) throws InterruptedException {
synchronized (mapPendingRequestToRequestListener) {
for (final CachedSpiceRequest<?> cachedSpiceRequest : mapPendingRequestToRequestListener.keySet()) {
if (match(cachedSpi... | Remove all listeners of a request that may have already been passed to
the {@link SpiceService}. If the request has already been passed to the
{@link SpiceService}, the method will bind to the service and ask it to
remove listeners.
@param request
the request for which listeners must be unregistered. | removeListenersOfPendingCachedRequest | java | stephanenicolas/robospice | robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceManager.java | https://github.com/stephanenicolas/robospice/blob/master/robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceManager.java | Apache-2.0 |
public void dontNotifyAnyRequestListeners() {
executorService.execute(new Runnable() {
@Override
public void run() {
dontNotifyAnyRequestListenersInternal();
}
});
} | Disable request listeners notifications for all requests. <br/>
Should be called in {@link Activity#onStop} | dontNotifyAnyRequestListeners | java | stephanenicolas/robospice | robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceManager.java | https://github.com/stephanenicolas/robospice/blob/master/robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceManager.java | Apache-2.0 |
@Override
public void run() {
dontNotifyAnyRequestListenersInternal();
} | Disable request listeners notifications for all requests. <br/>
Should be called in {@link Activity#onStop} | run | java | stephanenicolas/robospice | robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceManager.java | https://github.com/stephanenicolas/robospice/blob/master/robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceManager.java | Apache-2.0 |
protected void dontNotifyAnyRequestListenersInternal() {
lockSendRequestsToService.lock();
try {
if (spiceService == null) {
return;
}
synchronized (mapRequestToLaunchToRequestListener) {
if (!mapRequestToLaunchToRequestListener.isEmpty... | Remove all listeners of requests. All requests that have not been yet
passed to the service will see their of listeners cleaned. For all
requests that have been passed to the service, we ask the service to
remove their listeners. | dontNotifyAnyRequestListenersInternal | java | stephanenicolas/robospice | robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceManager.java | https://github.com/stephanenicolas/robospice/blob/master/robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceManager.java | Apache-2.0 |
private void removeListenersOfAllPendingCachedRequests() throws InterruptedException {
synchronized (mapPendingRequestToRequestListener) {
if (!mapPendingRequestToRequestListener.isEmpty()) {
for (final CachedSpiceRequest<?> cachedSpiceRequest : mapPendingRequestToRequestListener.key... | Asynchronously ask service to remove all listeners of pending requests.
@throws InterruptedException
in case service binding fails. | removeListenersOfAllPendingCachedRequests | java | stephanenicolas/robospice | robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceManager.java | https://github.com/stephanenicolas/robospice/blob/master/robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceManager.java | Apache-2.0 |
private boolean match(final CachedSpiceRequest<?> cachedSpiceRequest, final SpiceRequest<?> spiceRequest) {
if (spiceRequest instanceof CachedSpiceRequest) {
return spiceRequest == cachedSpiceRequest;
} else {
return cachedSpiceRequest.getSpiceRequest() == spiceRequest;
}... | Wether or not a given {@link CachedSpiceRequest} matches a
{@link SpiceRequest}.
@param cachedSpiceRequest
the request know by the {@link SpiceManager}.
@param spiceRequest
the request that we wish to remove notification for.
@return true if {@link CachedSpiceRequest} matches contentRequest. | match | java | stephanenicolas/robospice | robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceManager.java | https://github.com/stephanenicolas/robospice/blob/master/robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceManager.java | Apache-2.0 |
public <T> Future<T> getDataFromCache(final Class<T> clazz, final Object cacheKey) throws CacheLoadingException {
return executeCommand(new GetDataFromCacheCommand<T>(this, clazz, cacheKey));
} | Get some data previously saved in cache with key <i>requestCacheKey</i>.
This method doesn't perform any network processing, it just checks if
there are previously saved data. Don't call this method in the main
thread because you could block it. Instead, use the asynchronous version
of this method:
{@link #getFromCache... | getDataFromCache | java | stephanenicolas/robospice | robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceManager.java | https://github.com/stephanenicolas/robospice/blob/master/robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceManager.java | Apache-2.0 |
public <T> Future<T> putDataInCache(final Object cacheKey, final T data) throws CacheSavingException, CacheCreationException {
return executeCommand(new PutDataInCacheCommand<T>(this, data, cacheKey));
} | Put some new data in cache using cache key <i>requestCacheKey</i>. This
method doesn't perform any network processing, it just data in cache,
erasing any previsouly saved date in cache using the same class and key.
Don't call this method in the main thread because you could block it.
Instead, use the asynchronous versi... | putDataInCache | java | stephanenicolas/robospice | robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceManager.java | https://github.com/stephanenicolas/robospice/blob/master/robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceManager.java | Apache-2.0 |
public Future<Boolean> isDataInCache(Class<?> clazz, final Object cacheKey, long cacheExpiryDuration) throws CacheCreationException {
return executeCommand(new IsDataInCacheCommand(this, clazz, cacheKey, cacheExpiryDuration));
} | Tests whether some data is present in cache or not.
@param clazz
the class of the result to retrieve from cache.
@param cacheKey
the key used to store and retrieve the result of the request
in the cache
@param cacheExpiryDuration
duration in milliseconds after which the conte... | isDataInCache | java | stephanenicolas/robospice | robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceManager.java | https://github.com/stephanenicolas/robospice/blob/master/robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceManager.java | Apache-2.0 |
public Future<Date> getDateOfDataInCache(Class<?> clazz, final Object cacheKey) throws CacheCreationException {
return executeCommand(new GetDateOfDataInCacheCommand(this, clazz, cacheKey));
} | Returns the last date of storage of a given data into the cache.
@param clazz
the class of the result to retrieve from cache.
@param cacheKey
the key used to store and retrieve the result of the request
in the cache
@return the date at which data has been stored in cache. Null if no suc... | getDateOfDataInCache | java | stephanenicolas/robospice | robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceManager.java | https://github.com/stephanenicolas/robospice/blob/master/robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceManager.java | Apache-2.0 |
public <T> Future<?> removeDataFromCache(final Class<T> clazz, final Object cacheKey) {
if (clazz == null || cacheKey == null) {
throw new IllegalArgumentException("Both parameters must be non null.");
}
return executeCommand(new RemoveDataFromCacheCommand(this, clazz, cacheKey));
... | Remove some specific content from cache
@param clazz
the Type of data you want to remove from cache
@param cacheKey
the key of the object in cache | removeDataFromCache | java | stephanenicolas/robospice | robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceManager.java | https://github.com/stephanenicolas/robospice/blob/master/robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceManager.java | Apache-2.0 |
public <T> Future<?> removeDataFromCache(final Class<T> clazz) {
if (clazz == null) {
throw new IllegalArgumentException("Clazz must be non null.");
}
return executeCommand(new RemoveDataClassFromCacheCommand(this, clazz));
} | Remove some specific content from cache
@param clazz
the type of data you want to remove from cache. | removeDataFromCache | java | stephanenicolas/robospice | robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceManager.java | https://github.com/stephanenicolas/robospice/blob/master/robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceManager.java | Apache-2.0 |
public Future<?> removeAllDataFromCache() {
return executeCommand(new RemoveAllDataFromCacheCommand(this));
} | Remove all data from cache. This will clear all data stored by the
{@link CacheManager} of the {@link SpiceService}. | removeAllDataFromCache | java | stephanenicolas/robospice | robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceManager.java | https://github.com/stephanenicolas/robospice/blob/master/robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceManager.java | Apache-2.0 |
public void setFailOnCacheError(final boolean failOnCacheError) {
executeCommand(new SetFailOnCacheErrorCommand(this, failOnCacheError));
} | Configure the behavior in case of error during reading/writing cache. <br/>
Specify wether an error on reading/writing cache must fail the process.
@param failOnCacheError
true if an error must fail the process | setFailOnCacheError | java | stephanenicolas/robospice | robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceManager.java | https://github.com/stephanenicolas/robospice/blob/master/robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceManager.java | Apache-2.0 |
private <T> void addRequestListenerToListOfRequestListeners(final CachedSpiceRequest<T> cachedSpiceRequest, final RequestListener<T> requestListener) {
synchronized (mapRequestToLaunchToRequestListener) {
Set<RequestListener<?>> listeners = mapRequestToLaunchToRequestListener.get(cachedSpiceRequest)... | Configure the behavior in case of error during reading/writing cache. <br/>
Specify wether an error on reading/writing cache must fail the process.
@param failOnCacheError
true if an error must fail the process | addRequestListenerToListOfRequestListeners | java | stephanenicolas/robospice | robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceManager.java | https://github.com/stephanenicolas/robospice/blob/master/robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceManager.java | Apache-2.0 |
@Override
public void onServiceConnected(final ComponentName name, final IBinder service) {
lockAcquireService.lock();
try {
if (service instanceof SpiceServiceBinder) {
spiceService = ((SpiceServiceBinder) service).getSpiceService();
... | Reacts to binding/unbinding with {@link SpiceService}. | onServiceConnected | java | stephanenicolas/robospice | robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceManager.java | https://github.com/stephanenicolas/robospice/blob/master/robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceManager.java | Apache-2.0 |
@Override
public void onRequestAdded(CachedSpiceRequest<?> cachedSpiceRequest, RequestProcessingContext requestProcessingContext) {
Set<RequestListener<?>> listeners = mapRequestToLaunchToRequestListener.remove(cachedSpiceRequest);
if (listeners != null) {
mapPendingReque... | Called when a request has been processed by the {@link SpiceService}. | onRequestAdded | java | stephanenicolas/robospice | robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceManager.java | https://github.com/stephanenicolas/robospice/blob/master/robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceManager.java | Apache-2.0 |
@Override
public void onRequestAggregated(CachedSpiceRequest<?> cachedSpiceRequest, RequestProcessingContext requestProcessingContext) {
Set<RequestListener<?>> listeners = mapPendingRequestToRequestListener.get(cachedSpiceRequest);
if (listeners == null) {
listeners = Co... | Called when a request has been processed by the {@link SpiceService}. | onRequestAggregated | java | stephanenicolas/robospice | robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceManager.java | https://github.com/stephanenicolas/robospice/blob/master/robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceManager.java | Apache-2.0 |
@Override
public void onRequestNotFound(CachedSpiceRequest<?> cachedSpiceRequest, RequestProcessingContext requestProcessingContext) {
mapRequestToLaunchToRequestListener.remove(cachedSpiceRequest);
} | Called when a request has been processed by the {@link SpiceService}. | onRequestNotFound | java | stephanenicolas/robospice | robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceManager.java | https://github.com/stephanenicolas/robospice/blob/master/robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceManager.java | Apache-2.0 |
@Override
public void onRequestProcessed(final CachedSpiceRequest<?> cachedSpiceRequest, RequestProcessingContext requestProcessingContext) {
mapPendingRequestToRequestListener.remove(cachedSpiceRequest);
} | Called when a request has been processed by the {@link SpiceService}. | onRequestProcessed | java | stephanenicolas/robospice | robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceManager.java | https://github.com/stephanenicolas/robospice/blob/master/robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceManager.java | Apache-2.0 |
protected void waitForServiceToBeBound() throws InterruptedException {
Ln.d("Waiting for service to be bound.");
lockAcquireService.lock();
try {
while (spiceService == null && (!requestQueue.isEmpty() || !isStopped)) {
conditionServiceBound.await();
}
... | Wait for acquiring binding to {@link SpiceService}.
@throws InterruptedException
in case the binding is interrupted. | waitForServiceToBeBound | java | stephanenicolas/robospice | robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceManager.java | https://github.com/stephanenicolas/robospice/blob/master/robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceManager.java | Apache-2.0 |
protected void waitForServiceToBeUnbound() throws InterruptedException {
Ln.d("Waiting for service to be unbound.");
lockAcquireService.lock();
try {
while (spiceService != null) {
conditionServiceUnbound.await();
}
} finally {
lockAcq... | Wait for acquiring binding to {@link SpiceService}.
@throws InterruptedException
in case the binding is interrupted. | waitForServiceToBeUnbound | java | stephanenicolas/robospice | robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceManager.java | https://github.com/stephanenicolas/robospice/blob/master/robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceManager.java | Apache-2.0 |
protected <T> Future<T> executeCommand(SpiceManagerCommand<T> spiceManagerCommand) {
if (executorService == null || executorService.isShutdown()) {
return null;
}
return executorService.submit(spiceManagerCommand);
} | Wait for acquiring binding to {@link SpiceService}.
@throws InterruptedException
in case the binding is interrupted. | executeCommand | java | stephanenicolas/robospice | robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceManager.java | https://github.com/stephanenicolas/robospice/blob/master/robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceManager.java | Apache-2.0 |
private void checkServiceIsProperlyDeclaredInAndroidManifest(final Context context) {
final Intent intentCheck = new Intent(context, spiceServiceClass);
if (context.getPackageManager().queryIntentServices(intentCheck, 0).isEmpty()) {
shouldStop();
throw new RuntimeException("Impo... | Wait for acquiring binding to {@link SpiceService}.
@throws InterruptedException
in case the binding is interrupted. | checkServiceIsProperlyDeclaredInAndroidManifest | java | stephanenicolas/robospice | robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceManager.java | https://github.com/stephanenicolas/robospice/blob/master/robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceManager.java | Apache-2.0 |
private void dumpMap(final StringBuilder stringBuilder, final Map<CachedSpiceRequest<?>, Set<RequestListener<?>>> map) {
synchronized (map) {
stringBuilder.append(" request count= ");
stringBuilder.append(mapRequestToLaunchToRequestListener.keySet().size());
stringBuilder.ap... | Wait for acquiring binding to {@link SpiceService}.
@throws InterruptedException
in case the binding is interrupted. | dumpMap | java | stephanenicolas/robospice | robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceManager.java | https://github.com/stephanenicolas/robospice/blob/master/robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceManager.java | Apache-2.0 |
@Override
public T call() {
try {
spiceManager.waitForServiceToBeBound();
if (spiceManager.spiceService == null) {
return null;
}
spiceManager.lockSendRequestsToService.lock();
try {
... | Wait for acquiring binding to {@link SpiceService}.
@throws InterruptedException
in case the binding is interrupted. | call | java | stephanenicolas/robospice | robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceManager.java | https://github.com/stephanenicolas/robospice/blob/master/robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceManager.java | Apache-2.0 |
public boolean isSuccessFull() {
return successFull;
} | Wait for acquiring binding to {@link SpiceService}.
@throws InterruptedException
in case the binding is interrupted. | isSuccessFull | java | stephanenicolas/robospice | robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceManager.java | https://github.com/stephanenicolas/robospice/blob/master/robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceManager.java | Apache-2.0 |
public Exception getException() {
return exception;
} | Wait for acquiring binding to {@link SpiceService}.
@throws InterruptedException
in case the binding is interrupted. | getException | java | stephanenicolas/robospice | robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceManager.java | https://github.com/stephanenicolas/robospice/blob/master/robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceManager.java | Apache-2.0 |
protected RequestProcessor createRequestProcessor(CacheManager cacheManager, RequestProgressManager requestProgressManager, RequestRunner requestRunner) {
return new RequestProcessor(cacheManager, requestProgressManager, requestRunner);
} | Factory method to create an entity responsible for processing requests
send to the SpiceService. The default implementation of this method will
return a {@link RequestProcessor}. Override this method if you want to
inject a custom request processor. This feature has been implemented
following a request from Christopher... | createRequestProcessor | java | stephanenicolas/robospice | robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceService.java | https://github.com/stephanenicolas/robospice/blob/master/robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceService.java | Apache-2.0 |
protected RequestProcessorListener createRequestProcessorListener() {
return new SelfStopperRequestProcessorListener();
} | Creates a {@link RequestProcessorListener} for the
{@link RequestProcessor} used by this service. See a typical
implementation : @see {@link SelfStopperRequestProcessorListener}.
@return a new instance {@link RequestProcessorListener} for the
{@link RequestProcessor} used by this service. | createRequestProcessorListener | java | stephanenicolas/robospice | robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceService.java | https://github.com/stephanenicolas/robospice/blob/master/robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceService.java | Apache-2.0 |
protected RequestProcessor getRequestProcessor() {
return requestProcessor;
} | For testing purposes only.
@return the request processor of this spice service. | getRequestProcessor | java | stephanenicolas/robospice | robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceService.java | https://github.com/stephanenicolas/robospice/blob/master/robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceService.java | Apache-2.0 |
protected RequestListenerNotifier createRequestRequestListenerNotifier() {
return new DefaultRequestListenerNotifier();
} | Method to create a Request Progress Reporter object which is responsible
for informing the listeners of the current state of each request. You can
use this method to modify the existing behavior
@return {@link RequestListenerNotifier} | createRequestRequestListenerNotifier | java | stephanenicolas/robospice | robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceService.java | https://github.com/stephanenicolas/robospice/blob/master/robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceService.java | Apache-2.0 |
protected NetworkStateChecker getNetworkStateChecker() {
return new DefaultNetworkStateChecker();
} | Factory method to create an entity responsible to check for network
state. The default implementation of this method will return a
{@link DefaultNetworkStateChecker}. Override this method if you want to
inject a custom network state for testing or to adapt to connectivity
changes on the Android. This method is also use... | getNetworkStateChecker | java | stephanenicolas/robospice | robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceService.java | https://github.com/stephanenicolas/robospice/blob/master/robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceService.java | Apache-2.0 |
protected ExecutorService getExecutorService() {
final int coreThreadCount = getCoreThreadCount();
final int maxThreadCount = getMaximumThreadCount();
final int threadPriority = getThreadPriority();
if (coreThreadCount <= 0 || maxThreadCount <= 0) {
throw new IllegalArgumentE... | Factory method to create an {@link ExecutorService} that will be used to
execute requests. The default implementation of this method will create a
single threaded or multi-threaded {@link ExecutorService} depending on
the number of threads returned by {@link #getThreadCount()} and will
assign them the priority returned... | getExecutorService | java | stephanenicolas/robospice | robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceService.java | https://github.com/stephanenicolas/robospice/blob/master/robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceService.java | Apache-2.0 |
protected SpiceServiceListenerNotifier createSpiceServiceListenerNotifier() {
return new SpiceServiceListenerNotifier();
} | Creates the SpiceServiceListenerNotifier.
@return {@link SpiceServiceListenerNotifier} | createSpiceServiceListenerNotifier | java | stephanenicolas/robospice | robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceService.java | https://github.com/stephanenicolas/robospice/blob/master/robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceService.java | Apache-2.0 |
@SuppressWarnings("deprecation")
public Notification createDefaultNotification() {
Notification notification = null;
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
notification = new Notification.Builder(this).setSmallIcon(getApplicationInfo().icon).build();
... | This method can be overriden in order to create a foreground
SpiceService. By default, it will create a notification that can be used
to set a spiceService to foreground (depending on the versions of
Android, the behavior is different : before ICS, no notification is
shown, on ICS+, a notification is shown with app ico... | createDefaultNotification | java | stephanenicolas/robospice | robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceService.java | https://github.com/stephanenicolas/robospice/blob/master/robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceService.java | Apache-2.0 |
protected int getNotificationId() {
return DEFAULT_NOTIFICATION_ID;
} | This method can be overriden in order to create a foreground
SpiceService. By default, it will create a notification that can be used
to set a spiceService to foreground (depending on the versions of
Android, the behavior is different : before ICS, no notification is
shown, on ICS+, a notification is shown with app ico... | getNotificationId | java | stephanenicolas/robospice | robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceService.java | https://github.com/stephanenicolas/robospice/blob/master/robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceService.java | Apache-2.0 |
@Override
public void onDestroy() {
requestProcessor.shouldStop();
Ln.d("SpiceService instance destroyed.");
super.onDestroy();
} | This method can be overriden in order to create a foreground
SpiceService. By default, it will create a notification that can be used
to set a spiceService to foreground (depending on the versions of
Android, the behavior is different : before ICS, no notification is
shown, on ICS+, a notification is shown with app ico... | onDestroy | java | stephanenicolas/robospice | robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceService.java | https://github.com/stephanenicolas/robospice/blob/master/robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceService.java | Apache-2.0 |
public int getThreadCount() {
return DEFAULT_THREAD_COUNT;
} | Override this method to increase the number of threads used to process
requests. This method will have no effect if you override
{@link #getExecutorService()}.
@return the number of threads used to process requests. Defaults to
{@link #DEFAULT_THREAD_COUNT}. | getThreadCount | java | stephanenicolas/robospice | robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceService.java | https://github.com/stephanenicolas/robospice/blob/master/robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceService.java | Apache-2.0 |
public int getCoreThreadCount() {
return getThreadCount();
} | Override this method to increase the number of core threads used to
process requests. This method will have no effect if you override
{@link #getExecutorService()}.
@return the number of threads used to process requests. Defaults to
{@link #DEFAULT_THREAD_COUNT}. | getCoreThreadCount | java | stephanenicolas/robospice | robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceService.java | https://github.com/stephanenicolas/robospice/blob/master/robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceService.java | Apache-2.0 |
public int getMaximumThreadCount() {
return getThreadCount();
} | Override this method to increase the number of maximum threads used to
process requests. This method will have no effect if you override
{@link #getExecutorService()}.
@return the number of threads used to process requests. Defaults to
{@link #DEFAULT_THREAD_COUNT}. | getMaximumThreadCount | java | stephanenicolas/robospice | robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceService.java | https://github.com/stephanenicolas/robospice/blob/master/robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceService.java | Apache-2.0 |
public int getKeepAliveTime() {
return DEFAULT_THREAD_KEEP_ALIVE_TIME;
} | Override this method to set the keep alive time for core threads
{@link #getExecutorService()}.
@return the time to keep alive idle threads on {@see
TimeUnit.NANOSECONDS}. Defaults to
{@link #DEFAULT_THREAD_KEEP_ALIVE_TIME}. | getKeepAliveTime | java | stephanenicolas/robospice | robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceService.java | https://github.com/stephanenicolas/robospice/blob/master/robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceService.java | Apache-2.0 |
public boolean isCoreThreadDisposable() {
return true;
} | Override this method to disable timeout on core threads.
This is only taken into consideration for Android SDK 9+.
{@link #getExecutorService()}.
@return whether core threads are disposable or not (DEFAULT=true). | isCoreThreadDisposable | java | stephanenicolas/robospice | robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceService.java | https://github.com/stephanenicolas/robospice/blob/master/robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceService.java | Apache-2.0 |
public int getThreadPriority() {
return DEFAULT_THREAD_PRIORITY;
} | Override this method to change the priority of threads requests. This
method will have no effect if you override {@link #getExecutorService()}.
@return the number of threads used to process requests.Defaults to
{@link #DEFAULT_THREAD_PRIORITY}. | getThreadPriority | java | stephanenicolas/robospice | robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceService.java | https://github.com/stephanenicolas/robospice/blob/master/robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceService.java | Apache-2.0 |
public void addRequest(final CachedSpiceRequest<?> request, final Set<RequestListener<?>> listRequestListener) {
currentPendingRequestCount++;
requestProcessor.addRequest(request, listRequestListener);
showNotificationIfNotBoundAndHasPendingRequestsOtherwiseHideNotification();
} | Override this method to change the priority of threads requests. This
method will have no effect if you override {@link #getExecutorService()}.
@return the number of threads used to process requests.Defaults to
{@link #DEFAULT_THREAD_PRIORITY}. | addRequest | java | stephanenicolas/robospice | robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceService.java | https://github.com/stephanenicolas/robospice/blob/master/robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceService.java | Apache-2.0 |
public boolean removeDataFromCache(final Class<?> clazz, final Object cacheKey) {
return requestProcessor.removeDataFromCache(clazz, cacheKey);
} | Override this method to change the priority of threads requests. This
method will have no effect if you override {@link #getExecutorService()}.
@return the number of threads used to process requests.Defaults to
{@link #DEFAULT_THREAD_PRIORITY}. | removeDataFromCache | java | stephanenicolas/robospice | robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceService.java | https://github.com/stephanenicolas/robospice/blob/master/robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceService.java | Apache-2.0 |
public <T> List<Object> getAllCacheKeys(final Class<T> clazz) {
return cacheManager.getAllCacheKeys(clazz);
} | Override this method to change the priority of threads requests. This
method will have no effect if you override {@link #getExecutorService()}.
@return the number of threads used to process requests.Defaults to
{@link #DEFAULT_THREAD_PRIORITY}. | getAllCacheKeys | java | stephanenicolas/robospice | robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceService.java | https://github.com/stephanenicolas/robospice/blob/master/robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceService.java | Apache-2.0 |
public <T> List<T> loadAllDataFromCache(final Class<T> clazz) throws CacheLoadingException, CacheCreationException {
return cacheManager.loadAllDataFromCache(clazz);
} | Override this method to change the priority of threads requests. This
method will have no effect if you override {@link #getExecutorService()}.
@return the number of threads used to process requests.Defaults to
{@link #DEFAULT_THREAD_PRIORITY}. | loadAllDataFromCache | java | stephanenicolas/robospice | robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceService.java | https://github.com/stephanenicolas/robospice/blob/master/robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceService.java | Apache-2.0 |
public <T> T getDataFromCache(final Class<T> clazz, final Object cacheKey) throws CacheLoadingException, CacheCreationException {
return cacheManager.loadDataFromCache(clazz, cacheKey, DurationInMillis.ALWAYS_RETURNED);
} | Override this method to change the priority of threads requests. This
method will have no effect if you override {@link #getExecutorService()}.
@return the number of threads used to process requests.Defaults to
{@link #DEFAULT_THREAD_PRIORITY}. | getDataFromCache | java | stephanenicolas/robospice | robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceService.java | https://github.com/stephanenicolas/robospice/blob/master/robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceService.java | Apache-2.0 |
public <T> T putDataInCache(final Object cacheKey, T data) throws CacheSavingException, CacheCreationException {
return cacheManager.saveDataToCacheAndReturnData(data, cacheKey);
} | Override this method to change the priority of threads requests. This
method will have no effect if you override {@link #getExecutorService()}.
@return the number of threads used to process requests.Defaults to
{@link #DEFAULT_THREAD_PRIORITY}. | putDataInCache | java | stephanenicolas/robospice | robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceService.java | https://github.com/stephanenicolas/robospice/blob/master/robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceService.java | Apache-2.0 |
public boolean isDataInCache(Class<?> clazz, Object cacheKey, long cacheExpiryDuration) throws CacheCreationException {
return cacheManager.isDataInCache(clazz, cacheKey, cacheExpiryDuration);
} | Override this method to change the priority of threads requests. This
method will have no effect if you override {@link #getExecutorService()}.
@return the number of threads used to process requests.Defaults to
{@link #DEFAULT_THREAD_PRIORITY}. | isDataInCache | java | stephanenicolas/robospice | robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceService.java | https://github.com/stephanenicolas/robospice/blob/master/robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceService.java | Apache-2.0 |
public Date getDateOfDataInCache(Class<?> clazz, Object cacheKey) throws CacheLoadingException, CacheCreationException {
return cacheManager.getDateOfDataInCache(clazz, cacheKey);
} | Override this method to change the priority of threads requests. This
method will have no effect if you override {@link #getExecutorService()}.
@return the number of threads used to process requests.Defaults to
{@link #DEFAULT_THREAD_PRIORITY}. | getDateOfDataInCache | java | stephanenicolas/robospice | robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceService.java | https://github.com/stephanenicolas/robospice/blob/master/robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceService.java | Apache-2.0 |
public boolean isFailOnCacheError() {
return requestProcessor.isFailOnCacheError();
} | Override this method to change the priority of threads requests. This
method will have no effect if you override {@link #getExecutorService()}.
@return the number of threads used to process requests.Defaults to
{@link #DEFAULT_THREAD_PRIORITY}. | isFailOnCacheError | java | stephanenicolas/robospice | robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceService.java | https://github.com/stephanenicolas/robospice/blob/master/robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceService.java | Apache-2.0 |
public void dontNotifyRequestListenersForRequest(final CachedSpiceRequest<?> request, final Collection<RequestListener<?>> listRequestListener) {
requestProcessor.dontNotifyRequestListenersForRequest(request, listRequestListener);
} | Override this method to change the priority of threads requests. This
method will have no effect if you override {@link #getExecutorService()}.
@return the number of threads used to process requests.Defaults to
{@link #DEFAULT_THREAD_PRIORITY}. | dontNotifyRequestListenersForRequest | java | stephanenicolas/robospice | robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceService.java | https://github.com/stephanenicolas/robospice/blob/master/robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceService.java | Apache-2.0 |
@Override
public IBinder onBind(final Intent intent) {
isBound = true;
showNotificationIfNotBoundAndHasPendingRequestsOtherwiseHideNotification();
return mSpiceServiceBinder;
} | Override this method to change the priority of threads requests. This
method will have no effect if you override {@link #getExecutorService()}.
@return the number of threads used to process requests.Defaults to
{@link #DEFAULT_THREAD_PRIORITY}. | onBind | java | stephanenicolas/robospice | robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceService.java | https://github.com/stephanenicolas/robospice/blob/master/robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceService.java | Apache-2.0 |
@Override
public void onRebind(Intent intent) {
isBound = true;
showNotificationIfNotBoundAndHasPendingRequestsOtherwiseHideNotification();
super.onRebind(intent);
} | Override this method to change the priority of threads requests. This
method will have no effect if you override {@link #getExecutorService()}.
@return the number of threads used to process requests.Defaults to
{@link #DEFAULT_THREAD_PRIORITY}. | onRebind | java | stephanenicolas/robospice | robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceService.java | https://github.com/stephanenicolas/robospice/blob/master/robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceService.java | Apache-2.0 |
@Override
public boolean onUnbind(final Intent intent) {
isBound = false;
showNotificationIfNotBoundAndHasPendingRequestsOtherwiseHideNotification();
stopIfNotBoundAndHasNoPendingRequests();
return true;
} | Override this method to change the priority of threads requests. This
method will have no effect if you override {@link #getExecutorService()}.
@return the number of threads used to process requests.Defaults to
{@link #DEFAULT_THREAD_PRIORITY}. | onUnbind | java | stephanenicolas/robospice | robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceService.java | https://github.com/stephanenicolas/robospice/blob/master/robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceService.java | Apache-2.0 |
@Override
public void requestsInProgress() {
} | Override this method to change the priority of threads requests. This
method will have no effect if you override {@link #getExecutorService()}.
@return the number of threads used to process requests.Defaults to
{@link #DEFAULT_THREAD_PRIORITY}. | requestsInProgress | java | stephanenicolas/robospice | robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceService.java | https://github.com/stephanenicolas/robospice/blob/master/robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceService.java | Apache-2.0 |
@Override
public void allRequestComplete() {
currentPendingRequestCount = 0;
stopIfNotBoundAndHasNoPendingRequests();
} | Override this method to change the priority of threads requests. This
method will have no effect if you override {@link #getExecutorService()}.
@return the number of threads used to process requests.Defaults to
{@link #DEFAULT_THREAD_PRIORITY}. | allRequestComplete | java | stephanenicolas/robospice | robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceService.java | https://github.com/stephanenicolas/robospice/blob/master/robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceService.java | Apache-2.0 |
public SpiceService getSpiceService() {
return spiceService;
} | Override this method to change the priority of threads requests. This
method will have no effect if you override {@link #getExecutorService()}.
@return the number of threads used to process requests.Defaults to
{@link #DEFAULT_THREAD_PRIORITY}. | getSpiceService | java | stephanenicolas/robospice | robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceService.java | https://github.com/stephanenicolas/robospice/blob/master/robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceService.java | Apache-2.0 |
private void stopIfNotBoundAndHasNoPendingRequests() {
Ln.v("Pending requests : " + currentPendingRequestCount);
if (currentPendingRequestCount == 0 && !isBound) {
stopSelf();
}
} | Override this method to change the priority of threads requests. This
method will have no effect if you override {@link #getExecutorService()}.
@return the number of threads used to process requests.Defaults to
{@link #DEFAULT_THREAD_PRIORITY}. | stopIfNotBoundAndHasNoPendingRequests | java | stephanenicolas/robospice | robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceService.java | https://github.com/stephanenicolas/robospice/blob/master/robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceService.java | Apache-2.0 |
private void showNotificationIfNotBoundAndHasPendingRequestsOtherwiseHideNotification() {
// http://stackoverflow.com/a/13359680/693752
if (notification == null || isJUnit) {
return;
}
Ln.v("Pending requests : " + currentPendingRequestCount);
if (isBound || currentPen... | Override this method to change the priority of threads requests. This
method will have no effect if you override {@link #getExecutorService()}.
@return the number of threads used to process requests.Defaults to
{@link #DEFAULT_THREAD_PRIORITY}. | showNotificationIfNotBoundAndHasPendingRequestsOtherwiseHideNotification | java | stephanenicolas/robospice | robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceService.java | https://github.com/stephanenicolas/robospice/blob/master/robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceService.java | Apache-2.0 |
private void startForeground(final Notification notification) {
try {
final Method setForegroundMethod = Service.class.getMethod("startForeground", int.class, Notification.class);
setForegroundMethod.invoke(this, getNotificationId(), notification);
} catch (final SecurityExceptio... | Override this method to change the priority of threads requests. This
method will have no effect if you override {@link #getExecutorService()}.
@return the number of threads used to process requests.Defaults to
{@link #DEFAULT_THREAD_PRIORITY}. | startForeground | java | stephanenicolas/robospice | robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceService.java | https://github.com/stephanenicolas/robospice/blob/master/robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceService.java | Apache-2.0 |
public static final void setIsJunit(boolean b) {
isJUnit = b;
} | Override this method to change the priority of threads requests. This
method will have no effect if you override {@link #getExecutorService()}.
@return the number of threads used to process requests.Defaults to
{@link #DEFAULT_THREAD_PRIORITY}. | setIsJunit | java | stephanenicolas/robospice | robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceService.java | https://github.com/stephanenicolas/robospice/blob/master/robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceService.java | Apache-2.0 |
@Override
public CacheManager createCacheManager(Application application) {
// Just return an empty CacheManager
return new CacheManager() {
@Override
public <T> T saveDataToCacheAndReturnData(T data, Object cacheKey) throws CacheSavingException, CacheCreationException {
... | Concrete implementation of {@link SpiceService} with an empty CacheManager.
Using this class, requests will not be cached.
@author rciovati | createCacheManager | java | stephanenicolas/robospice | robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/UncachedSpiceService.java | https://github.com/stephanenicolas/robospice/blob/master/robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/UncachedSpiceService.java | Apache-2.0 |
@Override
public <T> T saveDataToCacheAndReturnData(T data, Object cacheKey) throws CacheSavingException, CacheCreationException {
return data;
} | Concrete implementation of {@link SpiceService} with an empty CacheManager.
Using this class, requests will not be cached.
@author rciovati | saveDataToCacheAndReturnData | java | stephanenicolas/robospice | robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/UncachedSpiceService.java | https://github.com/stephanenicolas/robospice/blob/master/robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/UncachedSpiceService.java | Apache-2.0 |
@Override
public boolean isNetworkAvailable(final Context context) {
final ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
final NetworkInfo[] allNetworkInfos = connectivityManager.getAllNetworkInfo();
for (final Network... | Consider network to be available when one network connection is up, whatever
it is. This class will also ensure that both
<tt>android.permission.ACCESS_NETWORK_STATE</tt> and
<tt>android.permission.ACCESS_NETWORK</tt> are granted.
@author sni | isNetworkAvailable | java | stephanenicolas/robospice | robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/networkstate/DefaultNetworkStateChecker.java | https://github.com/stephanenicolas/robospice/blob/master/robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/networkstate/DefaultNetworkStateChecker.java | Apache-2.0 |
@Override
public void checkPermissions(final Context context) {
checkHasPermission(context, Manifest.permission.ACCESS_NETWORK_STATE);
checkHasPermission(context, Manifest.permission.INTERNET);
} | Consider network to be available when one network connection is up, whatever
it is. This class will also ensure that both
<tt>android.permission.ACCESS_NETWORK_STATE</tt> and
<tt>android.permission.ACCESS_NETWORK</tt> are granted.
@author sni | checkPermissions | java | stephanenicolas/robospice | robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/networkstate/DefaultNetworkStateChecker.java | https://github.com/stephanenicolas/robospice/blob/master/robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/networkstate/DefaultNetworkStateChecker.java | Apache-2.0 |
private boolean checkHasPermission(final Context context, final String permissionName) {
final boolean hasPermission = context.getPackageManager().checkPermission(permissionName, context.getPackageName()) == PackageManager.PERMISSION_GRANTED;
if (!hasPermission) {
throw new SecurityException... | Consider network to be available when one network connection is up, whatever
it is. This class will also ensure that both
<tt>android.permission.ACCESS_NETWORK_STATE</tt> and
<tt>android.permission.ACCESS_NETWORK</tt> are granted.
@author sni | checkHasPermission | java | stephanenicolas/robospice | robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/networkstate/DefaultNetworkStateChecker.java | https://github.com/stephanenicolas/robospice/blob/master/robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/networkstate/DefaultNetworkStateChecker.java | Apache-2.0 |
public static Intent createIntent(final Context context, final Class<? extends SpiceNotificationService> clazz, final Class<? extends SpiceService> spiceServiceClass, final int notificationId,
final Class<?> requestResultType, final String cacheKey, final boolean foreground) {
final Intent intent = new ... | Will create notifications to display the progress of a given request. This
class is a base class to create such a service. Implementations will only
focus on creating notifications to "follow" the status of given request. All
informations about the request to track are provided to the service via an
Intent. This servic... | createIntent | java | stephanenicolas/robospice | robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/notification/SpiceNotificationService.java | https://github.com/stephanenicolas/robospice/blob/master/robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/notification/SpiceNotificationService.java | Apache-2.0 |
@Override
public IBinder onBind(final Intent intent) {
return null;
} | Will create notifications to display the progress of a given request. This
class is a base class to create such a service. Implementations will only
focus on creating notifications to "follow" the status of given request. All
informations about the request to track are provided to the service via an
Intent. This servic... | onBind | java | stephanenicolas/robospice | robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/notification/SpiceNotificationService.java | https://github.com/stephanenicolas/robospice/blob/master/robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/notification/SpiceNotificationService.java | Apache-2.0 |
@SuppressWarnings({ "unchecked", "rawtypes", "deprecation" })
@Override
public final void onStart(final Intent intent, final int startId) {
super.onStart(intent, startId);
notificationId = intent.getIntExtra(BUNDLE_KEY_NOTIFICATION_ID, DEFAULT_ROBOSPICE_NOTIFICATION_ID);
requestClass = (... | Will create notifications to display the progress of a given request. This
class is a base class to create such a service. Implementations will only
focus on creating notifications to "follow" the status of given request. All
informations about the request to track are provided to the service via an
Intent. This servic... | onStart | java | stephanenicolas/robospice | robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/notification/SpiceNotificationService.java | https://github.com/stephanenicolas/robospice/blob/master/robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/notification/SpiceNotificationService.java | Apache-2.0 |
@Override
public final void onDestroy() {
spiceManager.shouldStop();
super.onDestroy();
} | Will create notifications to display the progress of a given request. This
class is a base class to create such a service. Implementations will only
focus on creating notifications to "follow" the status of given request. All
informations about the request to track are provided to the service via an
Intent. This servic... | onDestroy | java | stephanenicolas/robospice | robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/notification/SpiceNotificationService.java | https://github.com/stephanenicolas/robospice/blob/master/robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/notification/SpiceNotificationService.java | Apache-2.0 |
public Notification onCreateForegroundNotification() {
throw new RuntimeException("If you use foreground = true, then you must override onCreateForegroundNotification().");
} | Will create notifications to display the progress of a given request. This
class is a base class to create such a service. Implementations will only
focus on creating notifications to "follow" the status of given request. All
informations about the request to track are provided to the service via an
Intent. This servic... | onCreateForegroundNotification | java | stephanenicolas/robospice | robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/notification/SpiceNotificationService.java | https://github.com/stephanenicolas/robospice/blob/master/robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/notification/SpiceNotificationService.java | Apache-2.0 |
@Override
public void onRequestFailure(final SpiceException arg0) {
final Notification notification = onCreateNotificationForRequestFailure(arg0);
notificationManager.notify(notificationId, notification);
stopSelf();
} | Will create notifications to display the progress of a given request. This
class is a base class to create such a service. Implementations will only
focus on creating notifications to "follow" the status of given request. All
informations about the request to track are provided to the service via an
Intent. This servic... | onRequestFailure | java | stephanenicolas/robospice | robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/notification/SpiceNotificationService.java | https://github.com/stephanenicolas/robospice/blob/master/robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/notification/SpiceNotificationService.java | Apache-2.0 |
@Override
public void onRequestSuccess(final T result) {
final Notification notification = onCreateNotificationForRequestSuccess();
notificationManager.notify(notificationId, notification);
stopSelf();
} | Will create notifications to display the progress of a given request. This
class is a base class to create such a service. Implementations will only
focus on creating notifications to "follow" the status of given request. All
informations about the request to track are provided to the service via an
Intent. This servic... | onRequestSuccess | java | stephanenicolas/robospice | robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/notification/SpiceNotificationService.java | https://github.com/stephanenicolas/robospice/blob/master/robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/notification/SpiceNotificationService.java | Apache-2.0 |
@Override
public void onRequestProgressUpdate(final RequestProgress progress) {
final Notification notification = onCreateNotificationForRequestProgress(progress);
notificationManager.notify(notificationId, notification);
if (progress.getStatus() == RequestStatus.COMPLETE) {... | Will create notifications to display the progress of a given request. This
class is a base class to create such a service. Implementations will only
focus on creating notifications to "follow" the status of given request. All
informations about the request to track are provided to the service via an
Intent. This servic... | onRequestProgressUpdate | java | stephanenicolas/robospice | robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/notification/SpiceNotificationService.java | https://github.com/stephanenicolas/robospice/blob/master/robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/notification/SpiceNotificationService.java | Apache-2.0 |
public static Intent createIntent(final Context context, final Class<? extends SpiceServiceListenerNotificationService> clazz, final Class<? extends SpiceService> spiceServiceClass,
final int notificationId, final boolean foreground) {
final Intent intent = new Intent(context, clazz);
intent.put... | Will display updates in the status of a given spice service itself by
displaying notifications when the service processes a request, updates its
progress, etc. This service will need to be started via an intent and will be
stopped automatically when the target spice service stops.
@author SNI | createIntent | java | stephanenicolas/robospice | robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/notification/SpiceServiceListenerNotificationService.java | https://github.com/stephanenicolas/robospice/blob/master/robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/notification/SpiceServiceListenerNotificationService.java | Apache-2.0 |
@Override
public IBinder onBind(final Intent intent) {
return null;
} | Will display updates in the status of a given spice service itself by
displaying notifications when the service processes a request, updates its
progress, etc. This service will need to be started via an intent and will be
stopped automatically when the target spice service stops.
@author SNI | onBind | java | stephanenicolas/robospice | robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/notification/SpiceServiceListenerNotificationService.java | https://github.com/stephanenicolas/robospice/blob/master/robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/notification/SpiceServiceListenerNotificationService.java | Apache-2.0 |
public Class<? extends SpiceService> getSpiceServiceClass() {
return spiceServiceClass;
} | Will display updates in the status of a given spice service itself by
displaying notifications when the service processes a request, updates its
progress, etc. This service will need to be started via an intent and will be
stopped automatically when the target spice service stops.
@author SNI | getSpiceServiceClass | java | stephanenicolas/robospice | robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/notification/SpiceServiceListenerNotificationService.java | https://github.com/stephanenicolas/robospice/blob/master/robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/notification/SpiceServiceListenerNotificationService.java | Apache-2.0 |
@SuppressWarnings({ "unchecked", "deprecation" })
@Override
public final void onStart(final Intent intent, final int startId) {
super.onStart(intent, startId);
if (intent == null) {
return;
}
notificationId = intent.getIntExtra(BUNDLE_KEY_NOTIFICATION_ID, DEFAULT_ROBO... | Will display updates in the status of a given spice service itself by
displaying notifications when the service processes a request, updates its
progress, etc. This service will need to be started via an intent and will be
stopped automatically when the target spice service stops.
@author SNI | onStart | java | stephanenicolas/robospice | robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/notification/SpiceServiceListenerNotificationService.java | https://github.com/stephanenicolas/robospice/blob/master/robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/notification/SpiceServiceListenerNotificationService.java | Apache-2.0 |
@Override
public final void onDestroy() {
spiceManager.shouldStop();
super.onDestroy();
} | Will display updates in the status of a given spice service itself by
displaying notifications when the service processes a request, updates its
progress, etc. This service will need to be started via an intent and will be
stopped automatically when the target spice service stops.
@author SNI | onDestroy | java | stephanenicolas/robospice | robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/notification/SpiceServiceListenerNotificationService.java | https://github.com/stephanenicolas/robospice/blob/master/robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/notification/SpiceServiceListenerNotificationService.java | Apache-2.0 |
public Notification onCreateForegroundNotification() {
throw new RuntimeException("If you use foreground = true, then you must override onCreateForegroundNotification().");
} | Will display updates in the status of a given spice service itself by
displaying notifications when the service processes a request, updates its
progress, etc. This service will need to be started via an intent and will be
stopped automatically when the target spice service stops.
@author SNI | onCreateForegroundNotification | java | stephanenicolas/robospice | robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/notification/SpiceServiceListenerNotificationService.java | https://github.com/stephanenicolas/robospice/blob/master/robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/notification/SpiceServiceListenerNotificationService.java | Apache-2.0 |
public int getId() {
return id;
} | Will display updates in the status of a given spice service itself by
displaying notifications when the service processes a request, updates its
progress, etc. This service will need to be started via an intent and will be
stopped automatically when the target spice service stops.
@author SNI | getId | java | stephanenicolas/robospice | robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/notification/SpiceServiceListenerNotificationService.java | https://github.com/stephanenicolas/robospice/blob/master/robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/notification/SpiceServiceListenerNotificationService.java | Apache-2.0 |
public Notification getNotification() {
return notification;
} | Will display updates in the status of a given spice service itself by
displaying notifications when the service processes a request, updates its
progress, etc. This service will need to be started via an intent and will be
stopped automatically when the target spice service stops.
@author SNI | getNotification | java | stephanenicolas/robospice | robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/notification/SpiceServiceListenerNotificationService.java | https://github.com/stephanenicolas/robospice/blob/master/robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/notification/SpiceServiceListenerNotificationService.java | Apache-2.0 |
@Override
public void onRequestSucceeded(CachedSpiceRequest<?> request, RequestProcessingContext requestProcessingContext) {
final SpiceNotification notification = onCreateNotificationForRequestSucceeded(request, requestProcessingContext);
notificationManager.notify(notification.getId(),... | Will display updates in the status of a given spice service itself by
displaying notifications when the service processes a request, updates its
progress, etc. This service will need to be started via an intent and will be
stopped automatically when the target spice service stops.
@author SNI | onRequestSucceeded | java | stephanenicolas/robospice | robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/notification/SpiceServiceListenerNotificationService.java | https://github.com/stephanenicolas/robospice/blob/master/robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/notification/SpiceServiceListenerNotificationService.java | Apache-2.0 |
@Override
public void onRequestFailed(CachedSpiceRequest<?> request, RequestProcessingContext requestProcessingContext) {
final SpiceNotification notification = onCreateNotificationForRequestFailed(request, requestProcessingContext);
notificationManager.notify(notification.getId(), notif... | Will display updates in the status of a given spice service itself by
displaying notifications when the service processes a request, updates its
progress, etc. This service will need to be started via an intent and will be
stopped automatically when the target spice service stops.
@author SNI | onRequestFailed | java | stephanenicolas/robospice | robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/notification/SpiceServiceListenerNotificationService.java | https://github.com/stephanenicolas/robospice/blob/master/robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/notification/SpiceServiceListenerNotificationService.java | Apache-2.0 |
@Override
public void onRequestCancelled(CachedSpiceRequest<?> request, RequestProcessingContext requestProcessingContext) {
final SpiceNotification notification = onCreateNotificationForRequestCancelled(request, requestProcessingContext);
notificationManager.notify(notification.getId(),... | Will display updates in the status of a given spice service itself by
displaying notifications when the service processes a request, updates its
progress, etc. This service will need to be started via an intent and will be
stopped automatically when the target spice service stops.
@author SNI | onRequestCancelled | java | stephanenicolas/robospice | robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/notification/SpiceServiceListenerNotificationService.java | https://github.com/stephanenicolas/robospice/blob/master/robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/notification/SpiceServiceListenerNotificationService.java | Apache-2.0 |
@Override
public void onRequestProgressUpdated(CachedSpiceRequest<?> request, RequestProcessingContext requestProcessingContext) {
final SpiceNotification notification = onCreateNotificationForRequestProgressUpdate(request, requestProcessingContext);
notificationManager.notify(notificati... | Will display updates in the status of a given spice service itself by
displaying notifications when the service processes a request, updates its
progress, etc. This service will need to be started via an intent and will be
stopped automatically when the target spice service stops.
@author SNI | onRequestProgressUpdated | java | stephanenicolas/robospice | robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/notification/SpiceServiceListenerNotificationService.java | https://github.com/stephanenicolas/robospice/blob/master/robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/notification/SpiceServiceListenerNotificationService.java | Apache-2.0 |
@Override
public void onRequestAdded(CachedSpiceRequest<?> request, RequestProcessingContext requestProcessingContext) {
final SpiceNotification notification = onCreateNotificationForRequestAdded(request, requestProcessingContext);
notificationManager.notify(notification.getId(), notific... | Will display updates in the status of a given spice service itself by
displaying notifications when the service processes a request, updates its
progress, etc. This service will need to be started via an intent and will be
stopped automatically when the target spice service stops.
@author SNI | onRequestAdded | java | stephanenicolas/robospice | robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/notification/SpiceServiceListenerNotificationService.java | https://github.com/stephanenicolas/robospice/blob/master/robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/notification/SpiceServiceListenerNotificationService.java | Apache-2.0 |
@Override
public void onRequestAggregated(CachedSpiceRequest<?> request, RequestProcessingContext requestProcessingContext) {
final SpiceNotification notification = onCreateNotificationForRequestAdded(request, requestProcessingContext);
notificationManager.notify(notification.getId(), no... | Will display updates in the status of a given spice service itself by
displaying notifications when the service processes a request, updates its
progress, etc. This service will need to be started via an intent and will be
stopped automatically when the target spice service stops.
@author SNI | onRequestAggregated | java | stephanenicolas/robospice | robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/notification/SpiceServiceListenerNotificationService.java | https://github.com/stephanenicolas/robospice/blob/master/robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/notification/SpiceServiceListenerNotificationService.java | Apache-2.0 |
@Override
public void onRequestNotFound(CachedSpiceRequest<?> request, RequestProcessingContext requestProcessingContext) {
final SpiceNotification notification = onCreateNotificationForRequestNotFound(request, requestProcessingContext);
notificationManager.notify(notification.getId(), n... | Will display updates in the status of a given spice service itself by
displaying notifications when the service processes a request, updates its
progress, etc. This service will need to be started via an intent and will be
stopped automatically when the target spice service stops.
@author SNI | onRequestNotFound | java | stephanenicolas/robospice | robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/notification/SpiceServiceListenerNotificationService.java | https://github.com/stephanenicolas/robospice/blob/master/robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/notification/SpiceServiceListenerNotificationService.java | Apache-2.0 |
@Override
public void onRequestProcessed(CachedSpiceRequest<?> cachedSpiceRequest, RequestProcessingContext requestProcessingContext) {
final SpiceNotification notification = onCreateNotificationForRequestProcessed(cachedSpiceRequest, requestProcessingContext);
notificationManager.notify... | Will display updates in the status of a given spice service itself by
displaying notifications when the service processes a request, updates its
progress, etc. This service will need to be started via an intent and will be
stopped automatically when the target spice service stops.
@author SNI | onRequestProcessed | java | stephanenicolas/robospice | robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/notification/SpiceServiceListenerNotificationService.java | https://github.com/stephanenicolas/robospice/blob/master/robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/notification/SpiceServiceListenerNotificationService.java | Apache-2.0 |
@Override
public void onServiceStopped() {
final SpiceNotification notification = onCreateNotificationForServiceStopped();
notificationManager.notify(notification.getId(), notification.getNotification());
stopSelf();
} | Will display updates in the status of a given spice service itself by
displaying notifications when the service processes a request, updates its
progress, etc. This service will need to be started via an intent and will be
stopped automatically when the target spice service stops.
@author SNI | onServiceStopped | java | stephanenicolas/robospice | robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/notification/SpiceServiceListenerNotificationService.java | https://github.com/stephanenicolas/robospice/blob/master/robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/notification/SpiceServiceListenerNotificationService.java | Apache-2.0 |
@Override
public Thread newThread(Runnable runnable) {
Thread thread = new Thread(runnable);
thread.setPriority(threadPriority);
return thread;
} | Creates threads with a low priority.
@author SNI | newThread | java | stephanenicolas/robospice | robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/priority/CustomizablePriorityThreadFactory.java | https://github.com/stephanenicolas/robospice/blob/master/robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/priority/CustomizablePriorityThreadFactory.java | Apache-2.0 |
@Override
public T poll() {
pauseLock.lock();
try {
while (isPaused) {
unpaused.await();
}
} catch (InterruptedException ie) {
throw new RuntimeException("Interrupted while paused.");
} finally {
pauseLock.unlock();
... | This class is used internally. It makes testing easier. The queue will not
allow to {@link #poll()} or {@link #take()} an element when paused.
@author SNI | poll | java | stephanenicolas/robospice | robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/priority/PausablePriorityBlockingQueue.java | https://github.com/stephanenicolas/robospice/blob/master/robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/priority/PausablePriorityBlockingQueue.java | Apache-2.0 |
@Override
public T poll(long timeout, TimeUnit unit) throws InterruptedException {
pauseLock.lock();
try {
while (isPaused) {
unpaused.await();
}
} catch (InterruptedException ie) {
throw new RuntimeException("Interrupted while paused.");
... | This class is used internally. It makes testing easier. The queue will not
allow to {@link #poll()} or {@link #take()} an element when paused.
@author SNI | poll | java | stephanenicolas/robospice | robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/priority/PausablePriorityBlockingQueue.java | https://github.com/stephanenicolas/robospice/blob/master/robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/priority/PausablePriorityBlockingQueue.java | Apache-2.0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.