com.gianlu.commonutils.lifecycle.LifecycleAwareHandler Java Examples

The following examples show how to use com.gianlu.commonutils.lifecycle.LifecycleAwareHandler. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SearchApi.java    From Aria2App with GNU General Public License v3.0 5 votes vote down vote up
private SearchApi() {
    client = new OkHttpClient.Builder().connectTimeout(TIMEOUT, TimeUnit.SECONDS)
            .writeTimeout(TIMEOUT, TimeUnit.SECONDS)
            .readTimeout(TIMEOUT, TimeUnit.SECONDS)
            .build();
    executorService = Executors.newSingleThreadExecutor();
    handler = new LifecycleAwareHandler(new Handler(Looper.getMainLooper()));
}
 
Example #2
Source File: RegisteredPyx.java    From PretendYoureXyzzyAndroid with GNU General Public License v3.0 5 votes vote down vote up
RegisteredPyx(Server server, LifecycleAwareHandler handler, OkHttpClient client, FirstLoadAndConfig firstLoad, User user) {
    super(server, handler, client, firstLoad);
    this.user = user;
    this.pollingThread = new PollingThread();
    this.pollingThread.start();

    Prefs.putString(PK.LAST_JSESSIONID, user.sessionId);
    AnalyticsApplication.setCrashlyticsString("server", server.url.toString());
}
 
Example #3
Source File: ZoneVisionAPI.java    From DNSHero with GNU General Public License v3.0 4 votes vote down vote up
private ZoneVisionAPI() {
    executorService = Executors.newSingleThreadExecutor();
    client = new OkHttpClient();
    handler = new LifecycleAwareHandler(new Handler(Looper.getMainLooper()));
}
 
Example #4
Source File: GeoIP.java    From Aria2App with GNU General Public License v3.0 4 votes vote down vote up
private GeoIP() {
    handler = new LifecycleAwareHandler(new Handler(Looper.getMainLooper()));
    client = new OkHttpClient();
    executorService = Executors.newCachedThreadPool();
    cache = new LruCache<>(50);
}
 
Example #5
Source File: TrackersListFetch.java    From Aria2App with GNU General Public License v3.0 4 votes vote down vote up
private TrackersListFetch() {
    this.client = new OkHttpClient();
    this.handler = new LifecycleAwareHandler(new Handler(Looper.getMainLooper()));
}
 
Example #6
Source File: UrbanDictApi.java    From PretendYoureXyzzyAndroid with GNU General Public License v3.0 4 votes vote down vote up
private UrbanDictApi() {
    executorService = Executors.newSingleThreadExecutor();
    client = new OkHttpClient.Builder().addInterceptor(new UserAgentInterceptor()).build();
    handler = new LifecycleAwareHandler(new Handler(Looper.getMainLooper()));
}
 
Example #7
Source File: PyxDiscoveryApi.java    From PretendYoureXyzzyAndroid with GNU General Public License v3.0 4 votes vote down vote up
private PyxDiscoveryApi() {
    this.client = new OkHttpClient();
    this.handler = new LifecycleAwareHandler(new Handler(Looper.getMainLooper()));
}
 
Example #8
Source File: FirstLoadedPyx.java    From PretendYoureXyzzyAndroid with GNU General Public License v3.0 4 votes vote down vote up
FirstLoadedPyx(Server server, LifecycleAwareHandler handler, OkHttpClient client, FirstLoadAndConfig firstLoadAndConfig) {
    super(server, handler, client);
    this.firstLoadAndConfig = firstLoadAndConfig;
}
 
Example #9
Source File: Pyx.java    From PretendYoureXyzzyAndroid with GNU General Public License v3.0 4 votes vote down vote up
Pyx() throws NoServersException {
    this.handler = new LifecycleAwareHandler(new Handler(Looper.getMainLooper()));
    this.server = Server.lastServer();
    this.client = new OkHttpClient.Builder().addInterceptor(new UserAgentInterceptor()).build();
}
 
Example #10
Source File: Pyx.java    From PretendYoureXyzzyAndroid with GNU General Public License v3.0 4 votes vote down vote up
protected Pyx(Server server, LifecycleAwareHandler handler, OkHttpClient client) {
    this.server = server;
    this.handler = handler;
    this.client = client;
}