1818
1919import android .content .Context ;
2020import android .database .sqlite .SQLiteDatabase ;
21+ import android .os .Handler ;
22+ import android .os .Looper ;
23+
2124import com .contentful .java .cda .CDAClient ;
2225import java .util .HashMap ;
2326import java .util .LinkedHashMap ;
2629import java .util .concurrent .Executor ;
2730import java .util .concurrent .ExecutorService ;
2831import java .util .concurrent .Executors ;
29- import retrofit .android .MainThreadExecutor ;
3032import rx .Observable ;
3133import rx .subjects .PublishSubject ;
3234import rx .subjects .SerializedSubject ;
@@ -44,7 +46,12 @@ public class Vault {
4446 static final ExecutorService EXECUTOR_SYNC = Executors .newSingleThreadExecutor (
4547 new VaultThreadFactory ());
4648
47- static final Executor EXECUTOR_CALLBACK = new MainThreadExecutor ();
49+ static final Executor EXECUTOR_CALLBACK = new Executor () {
50+ Handler handler = new Handler (Looper .getMainLooper ());
51+ @ Override public void execute (Runnable command ) {
52+ handler .post (command );
53+ }
54+ };
4855
4956 static final Map <String , CallbackBundle > CALLBACKS = new HashMap <>();
5057
@@ -166,7 +173,9 @@ private static SpaceHelper createSpaceHelper(Class<?> space) {
166173 return (SpaceHelper ) clazz .newInstance ();
167174 } catch (ClassNotFoundException e ) {
168175 throw new RuntimeException ("Cannot find generated class for space: " + space .getName (), e );
169- } catch (IllegalAccessException | InstantiationException e ) {
176+ } catch (IllegalAccessException e ) {
177+ throw new RuntimeException (e );
178+ } catch (InstantiationException e ) {
170179 throw new RuntimeException (e );
171180 }
172181 }
0 commit comments