diff --git a/promisenet/src/main/java/promise/promisenet/extras/JsonAdapter.java b/promisenet/src/main/java/promise/promisenet/extras/JsonAdapter.java index 032f265..360e475 100644 --- a/promisenet/src/main/java/promise/promisenet/extras/JsonAdapter.java +++ b/promisenet/src/main/java/promise/promisenet/extras/JsonAdapter.java @@ -21,6 +21,7 @@ import java.lang.reflect.Type; import java.util.Map; +import promise.promisenet.utils.Converter; import promise.util.DoubleConverter; @@ -39,7 +40,7 @@ public DoubleConverter> converter() { @Override public Map serialize(T t) { try { - return promise.util.Converter.toMap(new JSONObject(new Gson().toJson(t))); + return Converter.toMap(new JSONObject(new Gson().toJson(t))); } catch (JSONException e) { e.printStackTrace(); } diff --git a/promisenet/src/main/java/promise/promisenet/extras/MapHttpResponse.java b/promisenet/src/main/java/promise/promisenet/extras/MapHttpResponse.java index f0c6a41..de9ce14 100644 --- a/promisenet/src/main/java/promise/promisenet/extras/MapHttpResponse.java +++ b/promisenet/src/main/java/promise/promisenet/extras/MapHttpResponse.java @@ -20,6 +20,8 @@ import java.util.Map; +import promise.promisenet.utils.Converter; + /** * Created on 2/14/18 by yoctopus. */ diff --git a/promisenet/src/main/java/promise/promisenet/net/CommonConverters.java b/promisenet/src/main/java/promise/promisenet/net/CommonConverters.java index b27593f..f45c75e 100644 --- a/promisenet/src/main/java/promise/promisenet/net/CommonConverters.java +++ b/promisenet/src/main/java/promise/promisenet/net/CommonConverters.java @@ -20,7 +20,7 @@ import okhttp3.RequestBody; import okhttp3.ResponseBody; -import promise.data.net.http.Streaming; +import promise.promisenet.http.Streaming; final class CommonConverters extends Converter.Factory { @Override diff --git a/promisenet/src/main/java/promise/promisenet/net/ExecutorCallAdapterFactory.java b/promisenet/src/main/java/promise/promisenet/net/ExecutorCallAdapterFactory.java index 171e459..908894c 100644 --- a/promisenet/src/main/java/promise/promisenet/net/ExecutorCallAdapterFactory.java +++ b/promisenet/src/main/java/promise/promisenet/net/ExecutorCallAdapterFactory.java @@ -21,7 +21,8 @@ import okhttp3.Request; -import static promise.data.net.net.Utils.checkNotNull; +import static promise.promisenet.net.Utils.checkNotNull; + final class ExecutorCallAdapterFactory extends CallAdapter.Factory { final Executor callbackExecutor; diff --git a/promisenet/src/main/java/promise/promisenet/net/FastParserEngine.java b/promisenet/src/main/java/promise/promisenet/net/FastParserEngine.java index bd24041..35a02c0 100644 --- a/promisenet/src/main/java/promise/promisenet/net/FastParserEngine.java +++ b/promisenet/src/main/java/promise/promisenet/net/FastParserEngine.java @@ -51,7 +51,7 @@ import promise.promisenet.http.Url; import static java.util.Collections.unmodifiableList; -import static promise.data.net.net.Utils.checkNotNull; +import static promise.promisenet.net.Utils.checkNotNull; /** * FastParserEngine adapts a Java interface to HTTP calls by using annotations on the declared methods to diff --git a/promisenet/src/main/java/promise/promisenet/net/HttpException.java b/promisenet/src/main/java/promise/promisenet/net/HttpException.java index 6933778..9a27420 100644 --- a/promisenet/src/main/java/promise/promisenet/net/HttpException.java +++ b/promisenet/src/main/java/promise/promisenet/net/HttpException.java @@ -14,7 +14,8 @@ */ package promise.promisenet.net; -import static promise.data.net.net.Utils.checkNotNull; + +import static promise.promisenet.net.Utils.checkNotNull; /** Exception for an unexpected, non-2xx HTTP response. */ public class HttpException extends RuntimeException { diff --git a/promisenet/src/main/java/promise/promisenet/net/OkHttpCall.java b/promisenet/src/main/java/promise/promisenet/net/OkHttpCall.java index 9082320..ff11697 100644 --- a/promisenet/src/main/java/promise/promisenet/net/OkHttpCall.java +++ b/promisenet/src/main/java/promise/promisenet/net/OkHttpCall.java @@ -27,8 +27,9 @@ import okio.ForwardingSource; import okio.Okio; -import static promise.data.net.net.Utils.checkNotNull; -import static promise.data.net.net.Utils.throwIfFatal; +import static promise.promisenet.net.Utils.checkNotNull; +import static promise.promisenet.net.Utils.throwIfFatal; + /*import javax.annotation.concurrent.GuardedBy;*/ diff --git a/promisenet/src/main/java/promise/promisenet/net/ParameterHandler.java b/promisenet/src/main/java/promise/promisenet/net/ParameterHandler.java index ccb231f..3dd0f0c 100644 --- a/promisenet/src/main/java/promise/promisenet/net/ParameterHandler.java +++ b/promisenet/src/main/java/promise/promisenet/net/ParameterHandler.java @@ -25,7 +25,8 @@ import okhttp3.MultipartBody; import okhttp3.RequestBody; -import static promise.data.net.net.Utils.checkNotNull; +import static promise.promisenet.net.Utils.checkNotNull; + abstract class ParameterHandler { abstract void apply(RequestBuilder builder, @Nullable T value) throws IOException; diff --git a/promisenet/src/main/java/promise/promisenet/net/Response.java b/promisenet/src/main/java/promise/promisenet/net/Response.java index 2f437b0..96e1874 100644 --- a/promisenet/src/main/java/promise/promisenet/net/Response.java +++ b/promisenet/src/main/java/promise/promisenet/net/Response.java @@ -21,7 +21,8 @@ import okhttp3.Request; import okhttp3.ResponseBody; -import static promise.data.net.net.Utils.checkNotNull; +import static promise.promisenet.net.Utils.checkNotNull; + /** An HTTP response. */ public final class Response { diff --git a/promisenet/src/main/java/promise/promisenet/net/ServiceMethod.java b/promisenet/src/main/java/promise/promisenet/net/ServiceMethod.java index 990671f..150d17d 100644 --- a/promisenet/src/main/java/promise/promisenet/net/ServiceMethod.java +++ b/promisenet/src/main/java/promise/promisenet/net/ServiceMethod.java @@ -35,28 +35,28 @@ import okhttp3.MultipartBody; import okhttp3.RequestBody; import okhttp3.ResponseBody; -import promise.data.net.http.Body; -import promise.data.net.http.DELETE; -import promise.data.net.http.Field; -import promise.data.net.http.FieldMap; -import promise.data.net.http.FormUrlEncoded; -import promise.data.net.http.GET; -import promise.data.net.http.HEAD; -import promise.data.net.http.HTTP; -import promise.data.net.http.Header; -import promise.data.net.http.HeaderMap; -import promise.data.net.http.Multipart; -import promise.data.net.http.OPTIONS; -import promise.data.net.http.PATCH; -import promise.data.net.http.POST; -import promise.data.net.http.PUT; -import promise.data.net.http.Part; -import promise.data.net.http.PartMap; -import promise.data.net.http.Path; -import promise.data.net.http.Query; -import promise.data.net.http.QueryMap; -import promise.data.net.http.QueryName; -import promise.data.net.http.Url; +import promise.promisenet.http.Body; +import promise.promisenet.http.DELETE; +import promise.promisenet.http.Field; +import promise.promisenet.http.FieldMap; +import promise.promisenet.http.FormUrlEncoded; +import promise.promisenet.http.GET; +import promise.promisenet.http.HEAD; +import promise.promisenet.http.HTTP; +import promise.promisenet.http.Header; +import promise.promisenet.http.HeaderMap; +import promise.promisenet.http.Multipart; +import promise.promisenet.http.OPTIONS; +import promise.promisenet.http.PATCH; +import promise.promisenet.http.POST; +import promise.promisenet.http.PUT; +import promise.promisenet.http.Part; +import promise.promisenet.http.PartMap; +import promise.promisenet.http.Path; +import promise.promisenet.http.Query; +import promise.promisenet.http.QueryMap; +import promise.promisenet.http.QueryName; +import promise.promisenet.http.Url; /** Adapts an invocation of an interface method into an HTTP call. */ final class ServiceMethod { @@ -261,8 +261,8 @@ private void parseMethodAnnotation(Annotation annotation) { } else if (annotation instanceof HTTP) { HTTP http = (HTTP) annotation; parseHttpMethodAndPath(http.method(), http.path(), http.hasBody()); - } else if (annotation instanceof promise.data.net.http.Headers) { - String[] headersToParse = ((promise.data.net.http.Headers) annotation).value(); + } else if (annotation instanceof promise.promisenet.http.Headers) { + String[] headersToParse = ((promise.promisenet.http.Headers) annotation).value(); if (headersToParse.length == 0) { throw methodError("@Headers annotation is empty."); } diff --git a/promisenet/src/main/java/promise/promisenet/view/NetworkErrorActivity.java b/promisenet/src/main/java/promise/promisenet/view/NetworkErrorActivity.java index 77e9a58..0fdbd36 100644 --- a/promisenet/src/main/java/promise/promisenet/view/NetworkErrorActivity.java +++ b/promisenet/src/main/java/promise/promisenet/view/NetworkErrorActivity.java @@ -26,6 +26,7 @@ import androidx.appcompat.app.AppCompatActivity; import promise.promisenet.R; +import promise.promisenet.utils.NetworkUtil; public class NetworkErrorActivity extends AppCompatActivity { diff --git a/promisenet/src/main/res/drawable/server_error.png b/promisenet/src/main/res/drawable/server_error.png new file mode 100644 index 0000000..7ee316b Binary files /dev/null and b/promisenet/src/main/res/drawable/server_error.png differ diff --git a/promiseui/build.gradle b/promiseui/build.gradle index dfb75b5..b664df0 100644 --- a/promiseui/build.gradle +++ b/promiseui/build.gradle @@ -57,10 +57,15 @@ dependencies { implementation 'com.tbruyelle.rxpermissions2:rxpermissions:0.9.3@aar' implementation "com.android.support:exifinterface:$project.ext.supportLibVersion" implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$project.ext.kotlin_version" - compileOnly "com.android.support:recyclerview-v7:$project.ext.supportLibVersion" - compileOnly 'androidx.appcompat:appcompat:1.0.2' - compileOnly 'io.reactivex.rxjava2:rxjava:2.2.7' - compileOnly project(path: ':promisecommons') + implementation "com.android.support:recyclerview-v7:$project.ext.supportLibVersion" + implementation 'androidx.appcompat:appcompat:1.0.2' + implementation 'io.reactivex.rxjava2:rxjava:2.2.7' + implementation project(path: ':promisecommons') + implementation 'eu.davidea:flexible-adapter:5.1.0' + implementation 'eu.davidea:flexible-adapter-ui:1.0.0' + implementation 'eu.davidea:flexible-adapter-livedata:1.0.0-b3' + // From 1.0.0-b3, library is compiled with data binding v2 + implementation 'eu.davidea:flexible-adapter-databinding:1.0.0' testImplementation 'junit:junit:4.12' androidTestImplementation 'androidx.test:runner:1.2.0' androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' diff --git a/promiseui/src/main/AndroidManifest.xml b/promiseui/src/main/AndroidManifest.xml index 8bfee3b..135dd1b 100644 --- a/promiseui/src/main/AndroidManifest.xml +++ b/promiseui/src/main/AndroidManifest.xml @@ -1,2 +1,5 @@ + package="promise.promiseui" > + + + diff --git a/promiseui/src/main/java/promise/promiseui/adapter/Holder.java b/promiseui/src/main/java/promise/promiseui/adapter/Holder.java index 539a5a7..55c6cc5 100644 --- a/promiseui/src/main/java/promise/promiseui/adapter/Holder.java +++ b/promiseui/src/main/java/promise/promiseui/adapter/Holder.java @@ -27,7 +27,7 @@ import eu.davidea.flexibleadapter.items.IFilterable; import eu.davidea.flexibleadapter.items.IFlexible; import eu.davidea.viewholders.FlexibleViewHolder; -import promise.model.Searchable; +import promise.promiseui.model.Searchable; public class Holder extends AbstractFlexibleItem.MyHolder> implements IFilterable { diff --git a/promiseui/src/main/java/promise/promiseui/adapter/SingleAdapter.java b/promiseui/src/main/java/promise/promiseui/adapter/SingleAdapter.java index 1d416a3..c81efe6 100644 --- a/promiseui/src/main/java/promise/promiseui/adapter/SingleAdapter.java +++ b/promiseui/src/main/java/promise/promiseui/adapter/SingleAdapter.java @@ -27,10 +27,10 @@ import eu.davidea.flexibleadapter.FlexibleAdapter; import promise.model.List; -import promise.model.Searchable; import promise.model.function.MapFunction; +import promise.promiseui.AdapterDivider; +import promise.promiseui.model.Searchable; import promise.util.Conditions; -import promise.view.AdapterDivider; public class SingleAdapter { diff --git a/promiseui/src/main/java/promise/promiseui/anim/ActivityAnimator.java b/promiseui/src/main/java/promise/promiseui/anim/ActivityAnimator.java index 5351358..50dd2ff 100644 --- a/promiseui/src/main/java/promise/promiseui/anim/ActivityAnimator.java +++ b/promiseui/src/main/java/promise/promiseui/anim/ActivityAnimator.java @@ -17,9 +17,6 @@ import android.app.Activity; -import promise.cac.anim.Anim; -import promise.cac.anim.AnimDuration; -import promise.cac.anim.Animator; /** * Created by octopus on 10/19/16. diff --git a/promiseui/src/main/java/promise/promiseui/anim/DrawerAnimator.java b/promiseui/src/main/java/promise/promiseui/anim/DrawerAnimator.java index 4183ccb..16172dc 100644 --- a/promiseui/src/main/java/promise/promiseui/anim/DrawerAnimator.java +++ b/promiseui/src/main/java/promise/promiseui/anim/DrawerAnimator.java @@ -20,9 +20,6 @@ import androidx.core.view.GravityCompat; import androidx.drawerlayout.widget.DrawerLayout; -import promise.cac.anim.Anim; -import promise.cac.anim.AnimDuration; -import promise.cac.anim.Animator; /** * Created by octopus on 10/1/16. diff --git a/promiseui/src/main/java/promise/promiseui/anim/ListAnimator.java b/promiseui/src/main/java/promise/promiseui/anim/ListAnimator.java index 4db5a9b..52113b6 100644 --- a/promiseui/src/main/java/promise/promiseui/anim/ListAnimator.java +++ b/promiseui/src/main/java/promise/promiseui/anim/ListAnimator.java @@ -17,9 +17,6 @@ import android.view.View; -import promise.cac.anim.Anim; -import promise.cac.anim.AnimDuration; -import promise.cac.anim.Animator; /** * Created by octopus on 9/30/16. diff --git a/promiseui/src/main/java/promise/promiseui/anim/ListDownToTopAnimator.java b/promiseui/src/main/java/promise/promiseui/anim/ListDownToTopAnimator.java index 1986adb..f0396af 100644 --- a/promiseui/src/main/java/promise/promiseui/anim/ListDownToTopAnimator.java +++ b/promiseui/src/main/java/promise/promiseui/anim/ListDownToTopAnimator.java @@ -17,8 +17,6 @@ import android.view.View; -import promise.cac.anim.Anim; -import promise.cac.anim.AnimDuration; /** * Created by octopus on 10/1/16. diff --git a/promiseui/src/main/java/promise/promiseui/anim/RecordClickAnimator.java b/promiseui/src/main/java/promise/promiseui/anim/RecordClickAnimator.java index ec7780d..711aa9f 100644 --- a/promiseui/src/main/java/promise/promiseui/anim/RecordClickAnimator.java +++ b/promiseui/src/main/java/promise/promiseui/anim/RecordClickAnimator.java @@ -17,9 +17,6 @@ import android.view.View; -import promise.cac.anim.Anim; -import promise.cac.anim.AnimDuration; -import promise.cac.anim.Animator; /** * Created by octopus on 10/1/16. diff --git a/promiseui/src/main/java/promise/promiseui/loading/LoadingListener.java b/promiseui/src/main/java/promise/promiseui/loading/LoadingListener.java index 4f07a5d..2d1bd22 100644 --- a/promiseui/src/main/java/promise/promiseui/loading/LoadingListener.java +++ b/promiseui/src/main/java/promise/promiseui/loading/LoadingListener.java @@ -5,7 +5,8 @@ import java.util.List; -import promise.model.Viewable; +import promise.promiseui.model.Viewable; + public interface LoadingListener { diff --git a/promiseui/src/main/java/promise/promiseui/loading/LoadingViewable.java b/promiseui/src/main/java/promise/promiseui/loading/LoadingViewable.java index f437c15..3d8b42f 100644 --- a/promiseui/src/main/java/promise/promiseui/loading/LoadingViewable.java +++ b/promiseui/src/main/java/promise/promiseui/loading/LoadingViewable.java @@ -4,8 +4,8 @@ import android.view.View; import android.widget.ProgressBar; -import promise.R; -import promise.model.Viewable; +import promise.promiseui.R; +import promise.promiseui.model.Viewable; public class LoadingViewable implements Viewable { protected ProgressBar progressBarLoading; diff --git a/promiseui/src/main/java/promise/promiseui/loading/ProgressLayout.java b/promiseui/src/main/java/promise/promiseui/loading/ProgressLayout.java index f04092c..4eebe90 100644 --- a/promiseui/src/main/java/promise/promiseui/loading/ProgressLayout.java +++ b/promiseui/src/main/java/promise/promiseui/loading/ProgressLayout.java @@ -19,8 +19,8 @@ import java.util.Collections; import java.util.List; -import promise.R; -import promise.model.Viewable; +import promise.promiseui.R; +import promise.promiseui.model.Viewable; public class ProgressLayout extends FrameLayout implements LoadingListener { diff --git a/promiseui/src/main/java/promise/promiseui/notif/Notification.java b/promiseui/src/main/java/promise/promiseui/notif/Notification.java index 2058cdb..1a37ae9 100644 --- a/promiseui/src/main/java/promise/promiseui/notif/Notification.java +++ b/promiseui/src/main/java/promise/promiseui/notif/Notification.java @@ -28,6 +28,7 @@ import androidx.annotation.DrawableRes; import promise.data.log.LogUtil; +import promise.promiseui.utils.ApiHelper; public class Notification { private String TAG = LogUtil.makeTag(Notification.class); diff --git a/promiseui/src/main/res/layout/loading_viewable.xml b/promiseui/src/main/res/layout/loading_viewable.xml new file mode 100644 index 0000000..127b2cc --- /dev/null +++ b/promiseui/src/main/res/layout/loading_viewable.xml @@ -0,0 +1,6 @@ + + \ No newline at end of file diff --git a/promiseui/src/main/res/layout/view_empty.xml b/promiseui/src/main/res/layout/view_empty.xml new file mode 100644 index 0000000..efd4323 --- /dev/null +++ b/promiseui/src/main/res/layout/view_empty.xml @@ -0,0 +1,40 @@ + + + + + + + + + + \ No newline at end of file diff --git a/promiseui/src/main/res/layout/view_error.xml b/promiseui/src/main/res/layout/view_error.xml new file mode 100644 index 0000000..d24e17d --- /dev/null +++ b/promiseui/src/main/res/layout/view_error.xml @@ -0,0 +1,47 @@ + + + + + + + + + +