diff --git a/app/src/main/java/com/mogo/launcher/MogoApplication.java b/app/src/main/java/com/mogo/launcher/MogoApplication.java index bc835850ee..5c6abc3da7 100644 --- a/app/src/main/java/com/mogo/launcher/MogoApplication.java +++ b/app/src/main/java/com/mogo/launcher/MogoApplication.java @@ -304,7 +304,8 @@ public class MogoApplication extends AbsMogoApplication { MogoModulePaths.addBaseModule(new MogoModule(MogoServicePaths.PATH_V2X_FRONT_CRASH_WARNING, "IV2XManagerProvider")); // 全局语音唤醒 MogoModulePaths.addBaseModule(new MogoModule(MogoServicePaths.PATH_GLOBAL_UNWAKE, "GlobalUnwake")); - + // 云公告发布 + MogoModulePaths.addModuleFunction(new MogoModule(MogoServicePaths.PATH_AI_NOTICE, "IMoGoNoticeProvider")); if (!DebugConfig.isLauncher()) { PersistentManager.getInstance().initManager(this); diff --git a/core/function-impl/mogo-core-function-check/src/main/java/com/mogo/eagle/core/function/check/view/CheckRecyclerFooter.java b/core/function-impl/mogo-core-function-check/src/main/java/com/mogo/eagle/core/function/check/view/CheckRecyclerFooter.java deleted file mode 100644 index f072f65a03..0000000000 --- a/core/function-impl/mogo-core-function-check/src/main/java/com/mogo/eagle/core/function/check/view/CheckRecyclerFooter.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.mogo.eagle.core.function.check.view; - -import android.content.Context; -import android.util.AttributeSet; -import android.view.LayoutInflater; -import android.view.View; - -import com.mogo.eagle.core.function.check.R; - -import java.util.jar.Attributes; - -/** - * @author liujing - * @description 描述 - * @since: 10/13/21 - */ -public class CheckRecyclerFooter extends View { - - public CheckRecyclerFooter(Context context, AttributeSet attributes) { - super(context, attributes); - LayoutInflater.from(context).inflate(R.layout.check_recycler_footer, null); - } - - @Override - protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { - super.onMeasure(widthMeasureSpec, heightMeasureSpec); - } -} diff --git a/core/function-impl/mogo-core-function-hmi/build.gradle b/core/function-impl/mogo-core-function-hmi/build.gradle index aa8fc72bc4..5fc71fcd47 100644 --- a/core/function-impl/mogo-core-function-hmi/build.gradle +++ b/core/function-impl/mogo-core-function-hmi/build.gradle @@ -48,6 +48,7 @@ dependencies { implementation rootProject.ext.dependencies.androidxconstraintlayout implementation rootProject.ext.dependencies.arouter implementation rootProject.ext.dependencies.rxandroid + implementation rootProject.ext.dependencies.androidxrecyclerview kapt rootProject.ext.dependencies.aroutercompiler diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/notice/NoticeBannerView.java b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/notice/NoticeBannerView.java new file mode 100644 index 0000000000..f76d032c57 --- /dev/null +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/notice/NoticeBannerView.java @@ -0,0 +1,67 @@ +package com.mogo.eagle.core.function.hmi.ui.notice; + +import android.content.Context; +import android.util.AttributeSet; +import android.view.LayoutInflater; +import android.widget.ImageView; +import android.widget.TextView; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.constraintlayout.widget.ConstraintLayout; + +import com.mogo.eagle.core.data.notice.NoticeInfo; +import com.mogo.eagle.core.function.hmi.R; + +/** + * @author liujing + * @description 云公告顶部弹框 + * @since: 10/26/21 + */ +public class NoticeBannerView extends ConstraintLayout { + + private ImageView styleImageView; + private ImageView iconImageView; + private TextView noticePushTitle; + private TextView noticePushContent; + private TextView noticeBannerCheck; + private NoticeTrafficDialog mNoticeTrafficDialog; + private Context mContext; + + public NoticeBannerView(@NonNull Context context) { + super(context); + mContext = context; + LayoutInflater.from(context).inflate(R.layout.notice_push_top_banner, this); + initView(); + } + + public NoticeBannerView(@NonNull Context context, @Nullable AttributeSet attrs) { + super(context, attrs); + } + + public NoticeBannerView(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) { + super(context, attrs, defStyleAttr); + } + + public NoticeBannerView(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr, int defStyleRes) { + super(context, attrs, defStyleAttr, defStyleRes); + } + + public void initView() { + styleImageView = findViewById(R.id.notice_push_style_image); + iconImageView = findViewById(R.id.notice_push_icon_video); + noticePushTitle = findViewById(R.id.notice_push_title); + noticePushContent = findViewById(R.id.notice_push_content); + noticeBannerCheck = findViewById(R.id.notice_push_banner_check); + + noticeBannerCheck.setOnClickListener(v -> { + mNoticeTrafficDialog = new NoticeTrafficDialog(mContext); + mNoticeTrafficDialog.show(); + }); + } + + //数据改变刷新UI + public void pushBeanChanged(NoticeInfo info){ + + } +} diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/notice/NoticeTrafficAdapter.java b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/notice/NoticeTrafficAdapter.java new file mode 100644 index 0000000000..2dc70cf41e --- /dev/null +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/notice/NoticeTrafficAdapter.java @@ -0,0 +1,55 @@ +package com.mogo.eagle.core.function.hmi.ui.notice; + +import android.content.Context; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.TextView; + +import androidx.annotation.NonNull; +import androidx.recyclerview.widget.RecyclerView; + +import com.mogo.eagle.core.function.hmi.R; + +/** + * @author liujing + * @description 描述 + * @since: 10/26/21 + */ +class NoticeTrafficAdapter extends RecyclerView.Adapter { + LayoutInflater mLayoutInflater; + + public NoticeTrafficAdapter(@NonNull Context context) { + mLayoutInflater = LayoutInflater.from(context); + } + + @NonNull + @Override + public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { + View v = mLayoutInflater.inflate(R.layout.notice_traffice_info_list_adapter, parent, + false); + TrafficInfoHolder holder = new TrafficInfoHolder(v); + return holder; + } + + @Override + public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) { + + } + + @Override + public int getItemCount() { + return 18; + } + + public class TrafficInfoHolder extends RecyclerView.ViewHolder { + private TextView keyText; + private TextView valueText; + + public TrafficInfoHolder(@NonNull View itemView) { + super(itemView); + keyText = itemView.findViewById(R.id.key_text_view); + valueText = itemView.findViewById(R.id.value_text_view); + } + } +} diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/notice/NoticeTrafficDialog.java b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/notice/NoticeTrafficDialog.java new file mode 100644 index 0000000000..8a14da7768 --- /dev/null +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/notice/NoticeTrafficDialog.java @@ -0,0 +1,50 @@ +package com.mogo.eagle.core.function.hmi.ui.notice; + +import android.content.Context; + +import androidx.annotation.NonNull; +import androidx.recyclerview.widget.GridLayoutManager; +import androidx.recyclerview.widget.RecyclerView; + +import com.mogo.eagle.core.function.hmi.R; +import com.mogo.module.common.dialog.BaseFloatDialog; + +import java.util.List; + +/** + * @author liujing + * @description 描述 + * @since: 10/26/21 + */ +public class NoticeTrafficDialog extends BaseFloatDialog { + private Context mContext; + private RecyclerView mRecyclerView; + + public NoticeTrafficDialog(@NonNull Context context) { + super(context); + mContext = context; + initView(); + } + + public NoticeTrafficDialog(@NonNull Context context, int themeResId) { + super(context, themeResId); + } + + public void initView() { + mRecyclerView = findViewById(R.id.traffic_info_recyclerView); + //网格布局 + GridLayoutManager layoutManager = new GridLayoutManager(mContext, 4); + mRecyclerView.setLayoutManager(layoutManager); + layoutManager.setOrientation(GridLayoutManager.VERTICAL); + //网格绘制 + try { + NoticeTrafficInfoGridItemDivider gridLayoutDivider = new NoticeTrafficInfoGridItemDivider(1, + (mContext.getResources().getColor(R.color.notice_dialog_back))); + mRecyclerView.addItemDecoration(gridLayoutDivider); + } catch (Exception e) { + e.printStackTrace(); + } + NoticeTrafficAdapter adapter = new NoticeTrafficAdapter(mContext); + mRecyclerView.setAdapter(adapter); + } +} diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/notice/NoticeTrafficInfoGridItemDivider.java b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/notice/NoticeTrafficInfoGridItemDivider.java new file mode 100644 index 0000000000..fb1e7dba89 --- /dev/null +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/notice/NoticeTrafficInfoGridItemDivider.java @@ -0,0 +1,165 @@ +package com.mogo.eagle.core.function.hmi.ui.notice; + +import android.content.Context; +import android.content.res.TypedArray; +import android.graphics.Canvas; +import android.graphics.Rect; +import android.graphics.drawable.Drawable; +import android.graphics.drawable.GradientDrawable; +import android.view.View; + +import androidx.recyclerview.widget.GridLayoutManager; +import androidx.recyclerview.widget.RecyclerView; +import androidx.recyclerview.widget.StaggeredGridLayoutManager; + +/** + * @author liujing + * @description 网格布局网格绘制类 + * @since: 9/22/21 + */ +public class NoticeTrafficInfoGridItemDivider extends RecyclerView.ItemDecoration { + private String TAG = getClass().getSimpleName(); + private static final int[] ATTRS = new int[]{android.R.attr.listDivider}; + private Drawable divider; + + public NoticeTrafficInfoGridItemDivider(Context context) { + final TypedArray a = context.obtainStyledAttributes(ATTRS); + divider = a.getDrawable(0); + a.recycle(); + } + + public NoticeTrafficInfoGridItemDivider(Drawable drawable) { + divider = drawable; + } + + public NoticeTrafficInfoGridItemDivider(int height, int color) { + GradientDrawable shapeDrawable = new GradientDrawable(); + shapeDrawable.setColor(color); + shapeDrawable.setShape(GradientDrawable.RECTANGLE); + shapeDrawable.setSize(height, height); + divider = shapeDrawable; + } + + + @Override + public void onDraw(Canvas c, RecyclerView parent, RecyclerView.State state) { + + drawHorizontal(c, parent); + drawVertical(c, parent); + + } + + private int getSpanCount(RecyclerView parent) { + // 列数 + int spanCount = -1; + RecyclerView.LayoutManager layoutManager = parent.getLayoutManager(); + if (layoutManager instanceof GridLayoutManager) { + + spanCount = ((GridLayoutManager) layoutManager).getSpanCount(); + } else if (layoutManager instanceof StaggeredGridLayoutManager) { + spanCount = ((StaggeredGridLayoutManager) layoutManager) + .getSpanCount(); + } + return spanCount; + } + + public void drawHorizontal(Canvas c, RecyclerView parent) { + int childCount = parent.getChildCount(); //获取可见item的数量 + int spanCount = getSpanCount(parent); + for (int i = 0; i < childCount; i++) { + final View child = parent.getChildAt(i); + final RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child + .getLayoutParams(); + final int left = child.getLeft() - params.leftMargin; + final int right = child.getRight() + params.rightMargin + + divider.getIntrinsicWidth(); + final int top = child.getBottom() + params.bottomMargin; + final int bottom = top + divider.getIntrinsicHeight(); + divider.setBounds(left, top, right, bottom); + divider.draw(c); + if (i < spanCount) { //画第一行顶部的分割线 + drawHorizontalForFirstRow(c, child); + } + } + } + + private void drawHorizontalForFirstRow(Canvas c, View child) { + final RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child + .getLayoutParams(); + int left = child.getLeft() - params.leftMargin - divider.getIntrinsicWidth(); + int top = child.getTop() - params.topMargin - divider.getIntrinsicHeight(); + int right = child.getRight() + params.rightMargin + divider.getIntrinsicWidth(); + int bottom = top + divider.getIntrinsicHeight(); + divider.setBounds(left, top, right, bottom); + divider.draw(c); + } + + private void drawVerticalForFirstColum(Canvas c, View child) { + final RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child + .getLayoutParams();//在父布局的 + int left = child.getLeft() - params.leftMargin - divider.getIntrinsicWidth(); + int top = child.getTop() - params.topMargin; + int right = child.getLeft() - params.leftMargin; + int bottom = top + child.getHeight() + divider.getIntrinsicHeight(); + divider.setBounds(left, top, right, bottom); + divider.draw(c); + } + + public void drawVertical(Canvas c, RecyclerView parent) { + final int childCount = parent.getChildCount(); + for (int i = 0; i < childCount; i++) { + final View child = parent.getChildAt(i); + + final RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child + .getLayoutParams(); + final int top = child.getTop() - params.topMargin; + final int bottom = child.getBottom() + params.bottomMargin; + final int left = child.getRight() + params.rightMargin; + final int right = left + divider.getIntrinsicWidth(); + divider.setBounds(left, top, right, bottom); + divider.draw(c); + if (isFirstColum(parent, i, getSpanCount(parent))) { //画第一列左边分割线 + drawVerticalForFirstColum(c, child); + } + } + } + + //是否为第一列 + private boolean isFirstColum(RecyclerView parent, int pos, int spanCount) { + RecyclerView.LayoutManager layoutManager = parent.getLayoutManager(); + if (layoutManager instanceof GridLayoutManager) { //网格布局 + if ((pos + 1) % spanCount == 1) { + return true; + } + } + return false; + } + + //是否为第一行 + private boolean isFirstRaw(int pos, int spanCount) { + if (pos < spanCount) { + return true; + } + return false; + } + + @Override + public void getItemOffsets(Rect outRect, int itemPosition, + RecyclerView parent) { + int spanCount = getSpanCount(parent); //列数 + + if (itemPosition == 0) { //第一行第一个,四边都画 + outRect.set(divider.getIntrinsicWidth(), divider.getIntrinsicHeight(), + divider.getIntrinsicWidth(), divider.getIntrinsicHeight()); + } else if (isFirstRaw(itemPosition, spanCount)) { //第一行,画上下右三边 + outRect.set(0, divider.getIntrinsicHeight(), divider.getIntrinsicWidth(), divider.getIntrinsicHeight()); + } else if (isFirstColum(parent, itemPosition, spanCount)) { //第一列,画左右下三边 + outRect.set(divider.getIntrinsicWidth(), 0, divider.getIntrinsicWidth(), divider.getIntrinsicHeight()); + } else { //其他,画右下两边 + outRect.set(0, 0, divider.getIntrinsicWidth(), divider.getIntrinsicHeight()); + } + + } + +} + diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/notice/NoticeTrafficInfoView.java b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/notice/NoticeTrafficInfoView.java new file mode 100644 index 0000000000..d4c632b9d6 --- /dev/null +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/notice/NoticeTrafficInfoView.java @@ -0,0 +1,42 @@ +package com.mogo.eagle.core.function.hmi.ui.notice; + +import android.content.Context; +import android.util.AttributeSet; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.recyclerview.widget.RecyclerView; + +import com.mogo.eagle.core.function.hmi.R; + +/** + * @author liujing + * @description 交通事故任务详情 + * @since: 10/26/21 + */ +public class NoticeTrafficInfoView extends RecyclerView { + private int maxHeight = (int) getContext().getResources().getDimension(R.dimen.notice_traffic_info_width); + private int maxWeight = (int) getContext().getResources().getDimension(R.dimen.notice_traffic_info_height); + + public NoticeTrafficInfoView(@NonNull Context context) { + super(context); + } + + public NoticeTrafficInfoView(@NonNull Context context, @Nullable AttributeSet attrs) { + super(context, attrs); + } + + public NoticeTrafficInfoView(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) { + super(context, attrs, defStyleAttr); + } + + @Override + protected void onMeasure(int widthSpec, int heightSpec) { + super.onMeasure(widthSpec, heightSpec); + int limitHeight = getMeasuredHeight(); + if (getMeasuredHeight() > maxHeight) { + limitHeight = maxHeight; + } + setMeasuredDimension(maxWeight, limitHeight); + } +} diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/drawable/notice_push_item_background.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable/notice_push_item_background.xml new file mode 100644 index 0000000000..c190bbd78e --- /dev/null +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable/notice_push_item_background.xml @@ -0,0 +1,11 @@ + + + + + + diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/notice_dialog_traffic_police.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/notice_dialog_traffic_police.xml index b3c45c3e42..9968c19c15 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/notice_dialog_traffic_police.xml +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/notice_dialog_traffic_police.xml @@ -30,7 +30,28 @@ app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintRight_toRightOf="parent" app:layout_constraintTop_toTopOf="parent" /> - + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/notice_traffice_info_list_adapter.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/notice_traffice_info_list_adapter.xml new file mode 100644 index 0000000000..fe5aeaf134 --- /dev/null +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/notice_traffice_info_list_adapter.xml @@ -0,0 +1,37 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/values-xhdpi-2560x1440/color.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/values-xhdpi-2560x1440/color.xml index 3c0fb558fb..5caff3edca 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/res/values-xhdpi-2560x1440/color.xml +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/values-xhdpi-2560x1440/color.xml @@ -2,6 +2,8 @@ #2B6EFF #1F9BFE + #5A8EFD #E63B4577 #D5D5D4 + #3B4577 \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/values-xhdpi-2560x1440/dimens.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/values-xhdpi-2560x1440/dimens.xml index 8734c2bd14..57be068902 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/res/values-xhdpi-2560x1440/dimens.xml +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/values-xhdpi-2560x1440/dimens.xml @@ -4,14 +4,30 @@ 1200px 1400px 788px + 900px + 506px 1300px 1210px + 1160px + 290px 32px + 18px + 30px + 36px + 38px 42px + 45px 50px 52px 54px 56px + 62px 150px + 180px + 220px + 580px + 588px + 1066px + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/values/color.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/values/color.xml index 3c0fb558fb..5caff3edca 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/res/values/color.xml +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/values/color.xml @@ -2,6 +2,8 @@ #2B6EFF #1F9BFE + #5A8EFD #E63B4577 #D5D5D4 + #3B4577 \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/values/dimens.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/values/dimens.xml index 8734c2bd14..57be068902 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/res/values/dimens.xml +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/values/dimens.xml @@ -4,14 +4,30 @@ 1200px 1400px 788px + 900px + 506px 1300px 1210px + 1160px + 290px 32px + 18px + 30px + 36px + 38px 42px + 45px 50px 52px 54px 56px + 62px 150px + 180px + 220px + 580px + 588px + 1066px + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-notice/build.gradle b/core/function-impl/mogo-core-function-notice/build.gradle index 9da8588b39..e8c776714b 100644 --- a/core/function-impl/mogo-core-function-notice/build.gradle +++ b/core/function-impl/mogo-core-function-notice/build.gradle @@ -48,17 +48,22 @@ dependencies { implementation rootProject.ext.dependencies.androidxconstraintlayout implementation rootProject.ext.dependencies.arouter implementation rootProject.ext.dependencies.rxandroid + implementation project(path: ':services:mogo-service-api') kapt rootProject.ext.dependencies.aroutercompiler if (Boolean.valueOf(RELEASE)) { - + api rootProject.ext.dependencies.mogocommons + api rootProject.ext.dependencies.mogoserviceapi + implementation rootProject.ext.dependencies.modulecommon } else { - - implementation project(':core:mogo-core-data') + api project(":foudations:mogo-commons") + api project(':services:mogo-service-api') implementation project(':core:mogo-core-utils') - implementation project(':core:mogo-core-function-api') + implementation project(':modules:mogo-module-common') implementation project(':core:mogo-core-function-call') + implementation project(':core:mogo-core-res') + implementation project(':core:mogo-core-data') } } diff --git a/core/function-impl/mogo-core-function-notice/src/main/java/com/mogo/eagle/core/function/notice/MoGoNoticeProvider.kt b/core/function-impl/mogo-core-function-notice/src/main/java/com/mogo/eagle/core/function/notice/MoGoNoticeProvider.kt deleted file mode 100644 index 28edb711c7..0000000000 --- a/core/function-impl/mogo-core-function-notice/src/main/java/com/mogo/eagle/core/function/notice/MoGoNoticeProvider.kt +++ /dev/null @@ -1,22 +0,0 @@ -package com.mogo.eagle.core.function.notice - -import android.content.Context -import com.mogo.eagle.core.function.api.notice.IMoGoNoticeProvider - -/** - * @author xiaoyuzhou - * @date 2021/9/18 11:44 上午 - * 处理云端下发通知、公告类的逻辑的接口 - */ -class MoGoNoticeProvider : IMoGoNoticeProvider { - private val TAG = "MoGoNoticeProvider" - - override val functionName: String - get() = TAG - - override fun onDestroy() { - - } - - override fun init(context: Context) {} -} \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-notice/src/main/java/com/mogo/eagle/core/function/notice/NoticeProvider.java b/core/function-impl/mogo-core-function-notice/src/main/java/com/mogo/eagle/core/function/notice/NoticeProvider.java new file mode 100644 index 0000000000..69af9d10d4 --- /dev/null +++ b/core/function-impl/mogo-core-function-notice/src/main/java/com/mogo/eagle/core/function/notice/NoticeProvider.java @@ -0,0 +1,54 @@ +package com.mogo.eagle.core.function.notice; + +import android.content.Context; +import android.os.Bundle; +import android.util.Log; + +import androidx.fragment.app.Fragment; + +import com.alibaba.android.arouter.facade.annotation.Route; +import com.mogo.eagle.core.data.constants.MogoServicePaths; +import com.mogo.eagle.core.function.api.notice.IMoGoNoticeProvider; +import com.mogo.eagle.core.function.notice.receiver.NoticeMessageListener; +import com.mogo.module.common.MogoApisHandler; +import com.mogo.service.cloud.socket.IMogoLifecycleListener; + +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + + +/** + * @author Jing + * @description 云公告 + * @since: 10/27/21 + */ +@Route(path = MogoServicePaths.PATH_AI_NOTICE) +public class NoticeProvider implements IMoGoNoticeProvider { + private String TAG = "AINotice"; + private Context mContext; + + @Nullable + @Override + public Fragment createCoverage(@Nullable Context context, @Nullable Bundle data) { + return null; + } + + @NotNull + @Override + public String getFunctionName() { + return null; + } + + @Override + public void onDestroy() { + NoticeSocketManager.getInstance().unRegisterSocketMessage(); + } + + @Override + public void init(Context context) { + Log.d(TAG, "init"); + mContext = context; + NoticeSocketManager.getInstance().registerSocketMessage(context); + } + +} diff --git a/core/function-impl/mogo-core-function-notice/src/main/java/com/mogo/eagle/core/function/notice/NoticeSocketManager.java b/core/function-impl/mogo-core-function-notice/src/main/java/com/mogo/eagle/core/function/notice/NoticeSocketManager.java new file mode 100644 index 0000000000..082c7505b6 --- /dev/null +++ b/core/function-impl/mogo-core-function-notice/src/main/java/com/mogo/eagle/core/function/notice/NoticeSocketManager.java @@ -0,0 +1,53 @@ +package com.mogo.eagle.core.function.notice; + +import android.content.Context; +import android.util.Log; + +import com.alibaba.android.arouter.launcher.ARouter; +import com.mogo.eagle.core.function.notice.receiver.NoticeMessageListener; +import com.mogo.module.common.MogoApisHandler; +import com.mogo.service.IMogoServiceApis; + +/** + * @author Jing + * @description 云公告注册、反注册 + * @since: 10/27/21 + */ +class NoticeSocketManager { + private String TAG = "AINotice"; + private static NoticeSocketManager mNoticeSocketManager; + private NoticeMessageListener mNoticeMessageListener; + private static IMogoServiceApis mMoGoServiceApis; + private Context mContext; + + public static synchronized NoticeSocketManager getInstance() { + synchronized (NoticeSocketManager.class) { + if (mNoticeSocketManager == null) { + mNoticeSocketManager = new NoticeSocketManager(); + } + } + return mNoticeSocketManager; + } + + public void registerSocketMessage(Context context) { + Log.d(TAG, "registerSocketMessage"); + mContext = context; + mNoticeMessageListener = new NoticeMessageListener(); + if (mMoGoServiceApis == null) { + mMoGoServiceApis = (IMogoServiceApis) ARouter.getInstance().build(com.mogo.eagle.core.data.constants. + MogoServicePaths.PATH_SERVICE_APIS).navigation(context); + } + mMoGoServiceApis. + getSocketManagerApi(context). + registerOnMessageListener(100, mNoticeMessageListener); + } + + public void unRegisterSocketMessage() { + if (mNoticeMessageListener != null) { + mMoGoServiceApis + .getSocketManagerApi(mContext). + unregisterOnMessageListener(100, mNoticeMessageListener); + } + } +} + diff --git a/core/function-impl/mogo-core-function-notice/src/main/java/com/mogo/eagle/core/function/notice/receiver/NoticeMessageListener.java b/core/function-impl/mogo-core-function-notice/src/main/java/com/mogo/eagle/core/function/notice/receiver/NoticeMessageListener.java new file mode 100644 index 0000000000..da3bc2570d --- /dev/null +++ b/core/function-impl/mogo-core-function-notice/src/main/java/com/mogo/eagle/core/function/notice/receiver/NoticeMessageListener.java @@ -0,0 +1,28 @@ +package com.mogo.eagle.core.function.notice.receiver; + +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; +import android.util.Log; + +import com.mogo.service.cloud.socket.IMogoOnMessageListener; + +/** + * @author Jing + * @description push云公告消息接收 + * @since: 10/27/21 + */ +public class NoticeMessageListener implements IMogoOnMessageListener { + private String TAG = "AINotice"; + private Context mContext; + + @Override + public Class target() { + return null; + } + + @Override + public void onMsgReceived(Object obj) { + Log.d(TAG, obj.toString()); + } +} diff --git a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/constants/MogoServicePaths.java b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/constants/MogoServicePaths.java index 97c7094d5b..c44ef7d437 100644 --- a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/constants/MogoServicePaths.java +++ b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/constants/MogoServicePaths.java @@ -361,4 +361,11 @@ public class MogoServicePaths { @Keep @Deprecated public static final String PATH_AUTO_PILOT = "/auto_pilot/api"; + + /** + * 云公告 模块 + */ + @Keep + @Deprecated + public static final String PATH_AI_NOTICE = "/ai/notice"; } diff --git a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/notice/NoticeInfo.java b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/notice/NoticeInfo.java new file mode 100644 index 0000000000..024dba8d76 --- /dev/null +++ b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/notice/NoticeInfo.java @@ -0,0 +1,67 @@ +package com.mogo.eagle.core.data.notice; + +import java.io.Serializable; + +/** + * @author liujing + * @description 交通事故任务详情数据bean + * @since: 10/26/21 + */ +public class NoticeInfo implements Serializable { + private String infoId;//事故id + private long dataCreateTime;//事故发生时间 + private long dataHandleTime;//事故处理时间 + private String operaStatus;//事故状态 + private String reason;//事故原因 + + public String getInfoId() { + return infoId; + } + + public void setInfoId(String infoId) { + this.infoId = infoId; + } + + public long getDataCreateTime() { + return dataCreateTime; + } + + public void setDataCreateTime(long dataCreateTime) { + this.dataCreateTime = dataCreateTime; + } + + public long getDataHandleTime() { + return dataHandleTime; + } + + public void setDataHandleTime(long dataHandleTime) { + this.dataHandleTime = dataHandleTime; + } + + public String getOperaStatus() { + return operaStatus; + } + + public void setOperaStatus(String operaStatus) { + this.operaStatus = operaStatus; + } + + public String getReason() { + return reason; + } + + public void setReason(String reason) { + this.reason = reason; + } + + @Override + public String toString() { + return "NoticeInfo{" + + "infoId='" + infoId + '\'' + + ", dataCreateTime=" + dataCreateTime + + ", dataHandleTime=" + dataHandleTime + + ", operaStatus='" + operaStatus + '\'' + + ", reason='" + reason + '\'' + + '}'; + } +} diff --git a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/notice/IMoGoNoticeProvider.java b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/notice/IMoGoNoticeProvider.java new file mode 100644 index 0000000000..59ec7f1081 --- /dev/null +++ b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/notice/IMoGoNoticeProvider.java @@ -0,0 +1,12 @@ +package com.mogo.eagle.core.function.api.notice; + +import com.mogo.eagle.core.function.api.base.IMoGoFunctionProvider; + +/** + * @author Jing + * @description 云公告监听者 + * @since: 10/27/21 + */ +public interface IMoGoNoticeProvider extends IMoGoFunctionProvider { + +} diff --git a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/notice/IMoGoNoticeProvider.kt b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/notice/IMoGoNoticeProvider.kt deleted file mode 100644 index 048e468b2f..0000000000 --- a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/notice/IMoGoNoticeProvider.kt +++ /dev/null @@ -1,13 +0,0 @@ -package com.mogo.eagle.core.function.api.notice - -import com.mogo.eagle.core.function.api.base.IMoGoFunctionServerProvider - -/** - * @author xiaoyuzhou - * @date 2021/9/18 11:25 上午 - * 处理云端下发通知、公告类的逻辑的接口 - */ -interface IMoGoNoticeProvider : IMoGoFunctionServerProvider { - - -} \ No newline at end of file diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/notice/CallerNoticeManager.java b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/notice/CallerNoticeManager.java index 99bdaabb35..03094b70e2 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/notice/CallerNoticeManager.java +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/notice/CallerNoticeManager.java @@ -1,9 +1,27 @@ package com.mogo.eagle.core.function.call.notice; +import com.mogo.eagle.core.function.api.notice.IMoGoNoticeProvider; +import com.mogo.eagle.core.function.call.base.CallerBase; + +import java.util.HashMap; + /** * @author xiaoyuzhou - * @date 2021/9/18 11:48 上午 - * 云端公告、通知类的 调用者管理,这里对外及其他模块提供功能的调用,用啥写啥,不要过度设计,不允许直接将Provider暴露出去 */ -public class CallerNoticeManager { +public class CallerNoticeManager extends CallerBase { + private HashMap mListeners = new HashMap<>(); + + /** + * 添加监听者 + */ + void addListener(String tag, IMoGoNoticeProvider listener) { + mListeners.put(tag, listener); + } + + /** + * 移除监听者 + */ + void removeListener(String tag) { + mListeners.remove(tag); + } } diff --git a/core/mogo-core-res/src/main/function-hmi-res/drawable/notice_banner_default.png b/core/mogo-core-res/src/main/function-hmi-res/drawable/notice_banner_default.png new file mode 100644 index 0000000000..a6aef500e9 Binary files /dev/null and b/core/mogo-core-res/src/main/function-hmi-res/drawable/notice_banner_default.png differ diff --git a/core/mogo-core-res/src/main/function-hmi-res/drawable/notice_banner_icon_video.png b/core/mogo-core-res/src/main/function-hmi-res/drawable/notice_banner_icon_video.png new file mode 100644 index 0000000000..d187488084 Binary files /dev/null and b/core/mogo-core-res/src/main/function-hmi-res/drawable/notice_banner_icon_video.png differ