This commit is contained in:
2025-10-20 10:16:44 +08:00
commit 437a623f81
3089 changed files with 1418412 additions and 0 deletions

1
modulenews/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
/build

45
modulenews/build.gradle Normal file
View File

@@ -0,0 +1,45 @@
plugins {
alias(libs.plugins.android.library)
}
android {
namespace 'com.example.modulenews'
compileSdk 35
defaultConfig {
minSdk 24
targetSdk 35
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}
dataBinding {
enabled = true
}
}
dependencies {
implementation libs.appcompat
implementation libs.material
implementation libs.activity
implementation libs.constraintlayout
testImplementation libs.junit
androidTestImplementation libs.ext.junit
androidTestImplementation libs.espresso.core
implementation project(':moduleUtil')
api project(':tuiconversation')
api project(':tuichat')
}

21
modulenews/proguard-rules.pro vendored Normal file
View File

@@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile

View File

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.QxLive">
</application>
</manifest>

View File

@@ -0,0 +1,39 @@
package com.example.modulenews.adapter;
import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity;
import androidx.fragment.app.FragmentManager;
import androidx.lifecycle.Lifecycle;
import androidx.viewpager2.adapter.FragmentStateAdapter;
import java.util.List;
public class FragmentAdapter extends FragmentStateAdapter {
private static final String TAG = FragmentAdapter.class.getSimpleName();
private List<Fragment> fragmentList;
public FragmentAdapter(@NonNull FragmentActivity fragmentActivity) {
super(fragmentActivity);
}
public FragmentAdapter(@NonNull Fragment fragment) {
super(fragment);
}
public FragmentAdapter(@NonNull FragmentManager fragmentManager, @NonNull Lifecycle lifecycle) {
super(fragmentManager, lifecycle);
}
public void setFragmentList(List<Fragment> fragmentList) {
this.fragmentList = fragmentList;
}
@NonNull
@Override
public Fragment createFragment(int position) {
if (fragmentList == null || fragmentList.size() <= position) {
return new Fragment();
}
return fragmentList.get(position);
}
@Override
public int getItemCount() {
return fragmentList == null ? 0 : fragmentList.size();
}
}

View File

@@ -0,0 +1,20 @@
package com.example.modulenews.contacts;
import android.app.Activity;
import com.xscm.moduleutil.activity.IPresenter;
import com.xscm.moduleutil.activity.IView;
import com.xscm.moduleutil.bean.NewsDataBean;
public class NewsContacts {
public interface View extends IView<Activity> {
void getOfficialNoticeList(NewsDataBean newsDataBeans);
}
public interface IHomePre extends IPresenter {
void getOfficialNotice();
}
}

View File

@@ -0,0 +1,135 @@
package com.example.modulenews.fragment;
import android.content.Intent;
import android.view.View;
import androidx.fragment.app.Fragment;
import com.example.modulenews.R;
import com.example.modulenews.contacts.NewsContacts;
import com.example.modulenews.databinding.FragmentNewsBinding;
import com.example.modulenews.presenter.NewsPresenter;
import com.xscm.moduleutil.activity.news.OfficialNoticeActivity;
import com.xscm.moduleutil.adapter.MyFragmentPagerAdapter;
import com.xscm.moduleutil.base.BaseMvpFragment;
import com.xscm.moduleutil.bean.NewsDataBean;
import com.tencent.imsdk.v2.V2TIMConversation;
import com.tencent.qcloud.tuicore.TUIConstants;
import com.tencent.qcloud.tuikit.tuichat.classicui.page.TUIC2CChatActivity;
import com.tencent.qcloud.tuikit.tuiconversation.classicui.page.TUIConversationFragment;
import java.util.ArrayList;
import java.util.List;
/**
*@author qx
*@data 2025/5/26
*@description: 音域
*/
public class NewsFragment extends BaseMvpFragment<NewsPresenter, FragmentNewsBinding> implements NewsContacts.View {
public static NewsFragment newInstance () {
return new NewsFragment();
}
@Override
protected void initData () {
}
@Override
public void onResume() {
super.onResume();
MvpPre.getOfficialNotice();
}
@Override
protected void initView () {
List<Fragment> fragments = new ArrayList<>();
// 添加 tuiconversation 组件提供的经典版会话界面
fragments.add(new TUIConversationFragment());
// 添加 tuicontact 组件提供的经典版联系人界面
// fragments.add(new TUIContactFragment());
// FragmentAdapter fragmentAdapter = new FragmentAdapter(this);
// fragmentAdapter.setFragmentList(fragments);
// mBinding.viewPager.setOffscreenPageLimit(2);
mBinding.viewPager.setAdapter(new MyFragmentPagerAdapter(fragments, getChildFragmentManager()));
mBinding.viewPager.setCurrentItem(0, false);
mBinding.ivRoom2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent=new Intent(getActivity(), TUIC2CChatActivity.class);
intent.putExtra(TUIConstants.TUIChat.CHAT_ID, "10010");
intent.putExtra(TUIConstants.TUIChat.CHAT_TYPE, V2TIMConversation.V2TIM_C2C);
startActivity(intent);
}
});
mBinding.rlSystem.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent=new Intent(getActivity(), OfficialNoticeActivity.class);
intent.putExtra("type", "1");
startActivity(intent);
}
});
mBinding.rlOfficial.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent=new Intent(getActivity(), OfficialNoticeActivity.class);
intent.putExtra("type", "2");
startActivity(intent);
}
});
}
@Override
protected void initListener () {
super.initListener();
}
@Override
protected int getLayoutId () {
return R.layout.fragment_news;
}
@Override
protected NewsPresenter bindPresenter () {
return new NewsPresenter(this, getContext());
}
@Override
public void getOfficialNoticeList(NewsDataBean newsDataBeans) {
if (newsDataBeans.getAnnouncement_last_message()!=null){
mBinding.tvNr.setText(newsDataBeans.getAnnouncement_last_message().getContent()!=null?newsDataBeans.getAnnouncement_last_message().getContent():"");
}else {
mBinding.tvNr.setText("");
}
if (newsDataBeans.getSystem_last_message()!=null){
mBinding.tvXtNr.setText(newsDataBeans.getSystem_last_message().getContent()!=null?newsDataBeans.getSystem_last_message().getContent():"");
}else {
mBinding.tvXtNr.setText("");
}
if (newsDataBeans.getSystem_no_read_count()>0) {
mBinding.tvXtCount.setText(newsDataBeans.getSystem_no_read_count()+"");
}else {
mBinding.tvXtCount.setVisibility(View.GONE);
}
if (newsDataBeans.getAnnouncement_read_count()>0) {
mBinding.tvOfficialCount.setText(newsDataBeans.getAnnouncement_read_count()+"");
}else {
mBinding.tvOfficialCount.setVisibility(View.GONE);
}
}
}

View File

@@ -0,0 +1,31 @@
package com.example.modulenews.presenter;
import android.content.Context;
import com.example.modulenews.contacts.NewsContacts;
import com.xscm.moduleutil.bean.NewsDataBean;
import com.xscm.moduleutil.http.BaseObserver;
import com.xscm.moduleutil.presenter.BasePresenter;
import io.reactivex.disposables.Disposable;
public class NewsPresenter extends BasePresenter<NewsContacts.View> implements NewsContacts.IHomePre {
public NewsPresenter(NewsContacts.View view, Context context) {
super(view, context);
}
@Override
public void getOfficialNotice() {
api.getOfficialNotice( new BaseObserver<NewsDataBean>() {
@Override
public void onSubscribe(Disposable d) {
addDisposable(d);
}
@Override
public void onNext(NewsDataBean newsDataBeans) {
MvpRef.get().getOfficialNoticeList(newsDataBeans);
}
});
}
}

View File

@@ -0,0 +1,170 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path
android:fillColor="#3DDC84"
android:pathData="M0,0h108v108h-108z" />
<path
android:fillColor="#00000000"
android:pathData="M9,0L9,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,0L19,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M29,0L29,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M39,0L39,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M49,0L49,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M59,0L59,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M69,0L69,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M79,0L79,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M89,0L89,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M99,0L99,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,9L108,9"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,19L108,19"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,29L108,29"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,39L108,39"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,49L108,49"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,59L108,59"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,69L108,69"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,79L108,79"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,89L108,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,99L108,99"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,29L89,29"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,39L89,39"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,49L89,49"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,59L89,59"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,69L89,69"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,79L89,79"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M29,19L29,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M39,19L39,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M49,19L49,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M59,19L59,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M69,19L69,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M79,19L79,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
</vector>

View File

@@ -0,0 +1,30 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path android:pathData="M31,63.928c0,0 6.4,-11 12.1,-13.1c7.2,-2.6 26,-1.4 26,-1.4l38.1,38.1L107,108.928l-32,-1L31,63.928z">
<aapt:attr name="android:fillColor">
<gradient
android:endX="85.84757"
android:endY="92.4963"
android:startX="42.9492"
android:startY="49.59793"
android:type="linear">
<item
android:color="#44000000"
android:offset="0.0" />
<item
android:color="#00000000"
android:offset="1.0" />
</gradient>
</aapt:attr>
</path>
<path
android:fillColor="#FFFFFF"
android:fillType="nonZero"
android:pathData="M65.3,45.828l3.8,-6.6c0.2,-0.4 0.1,-0.9 -0.3,-1.1c-0.4,-0.2 -0.9,-0.1 -1.1,0.3l-3.9,6.7c-6.3,-2.8 -13.4,-2.8 -19.7,0l-3.9,-6.7c-0.2,-0.4 -0.7,-0.5 -1.1,-0.3C38.8,38.328 38.7,38.828 38.9,39.228l3.8,6.6C36.2,49.428 31.7,56.028 31,63.928h46C76.3,56.028 71.8,49.428 65.3,45.828zM43.4,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2c-0.3,-0.7 -0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C45.3,56.528 44.5,57.328 43.4,57.328L43.4,57.328zM64.6,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2s-0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C66.5,56.528 65.6,57.328 64.6,57.328L64.6,57.328z"
android:strokeWidth="1"
android:strokeColor="#00000000" />
</vector>

View File

@@ -0,0 +1,164 @@
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
tools:context=".fragment.NewsFragment">
<data>
</data>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_45"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_15"
android:text="@string/news"
android:textColor="@color/color_black"
android:textSize="@dimen/sp_25"
android:textStyle="normal" />
<ImageView
android:id="@+id/iv_room2"
android:layout_width="@dimen/dp_24"
android:layout_height="@dimen/dp_24"
android:layout_alignParentEnd="true"
android:layout_centerInParent="true"
android:layout_marginRight="@dimen/dp_11"
android:src="@mipmap/notifi"
android:visibility="gone" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/rl_official"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_62"
android:layout_marginStart="@dimen/dp_16"
android:layout_marginTop="@dimen/dp_12"
android:layout_marginEnd="@dimen/dp_16">
<ImageView
android:id="@+id/im_gg"
android:layout_width="@dimen/dp_50"
android:layout_height="@dimen/dp_50"
android:src="@mipmap/gg" />
<TextView
android:id="@+id/tv_gfgg"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/dp_10"
android:layout_toEndOf="@+id/im_gg"
android:text="官方公告"
android:textColor="@color/color_FF333333"
android:textSize="@dimen/sp_16" />
<TextView
android:id="@+id/tv_nr"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/tv_gfgg"
android:layout_marginStart="@dimen/dp_10"
android:layout_marginTop="5dp"
android:layout_toEndOf="@+id/im_gg"
android:ellipsize="end"
android:singleLine="true"
tools:text="Chat with your friends"
android:textColor="@color/color_FF666666"
android:textSize="@dimen/sp_12" />
<com.tencent.qcloud.tuikit.timcommon.component.UnreadCountTextView
android:id="@+id/tv_official_count"
android:layout_width="@dimen/dp_15"
android:layout_height="@dimen/dp_15"
android:layout_alignParentEnd="true"
android:layout_centerInParent="true"
android:gravity="center"
tools:text="1"
android:textColor="@color/white" />
</RelativeLayout>
<View
android:id="@+id/view_line"
android:layout_width="match_parent"
android:layout_height="@dimen/conversation_list_divide_line_height"
android:layout_alignParentBottom="true"
android:layout_marginTop="12dp"
android:background="@color/conversation_divide_line_color"
android:visibility="gone"/>
<RelativeLayout
android:id="@+id/rl_system"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_62"
android:layout_marginStart="@dimen/dp_16"
android:layout_marginTop="@dimen/dp_12"
android:layout_marginEnd="@dimen/dp_16"
android:layout_marginBottom="@dimen/dp_12">
<ImageView
android:id="@+id/im_xt"
android:layout_width="@dimen/dp_50"
android:layout_height="@dimen/dp_50"
android:src="@mipmap/xt" />
<TextView
android:id="@+id/tv_xtx"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/dp_10"
android:layout_toEndOf="@+id/im_xt"
android:text="系统消息"
android:textColor="@color/color_FF333333"
android:textSize="@dimen/sp_16" />
<TextView
android:id="@+id/tv_xt_nr"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/tv_xtx"
android:layout_marginStart="@dimen/dp_10"
android:layout_marginTop="5dp"
android:layout_toEndOf="@+id/im_xt"
android:ellipsize="end"
android:singleLine="true"
tools:text="Chat with your friends"
android:textColor="@color/color_FF666666"
android:textSize="@dimen/sp_12" />
<com.tencent.qcloud.tuikit.timcommon.component.UnreadCountTextView
android:id="@+id/tv_xt_count"
android:layout_width="@dimen/dp_15"
android:layout_height="@dimen/dp_15"
android:layout_alignParentEnd="true"
android:layout_centerInParent="true"
android:gravity="center"
tools:text="1"
android:textColor="@color/white" />
</RelativeLayout>
<com.xscm.moduleutil.widget.ScrollViewPager
android:id="@+id/view_pager"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<View
android:layout_width="match_parent"
android:layout_height="@dimen/dp_60"
android:background="@color/color_transparent" />
</LinearLayout>
</layout>

View File

@@ -0,0 +1,16 @@
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="Theme.QxLive" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
<!-- Primary brand color. -->
<item name="colorPrimary">@color/purple_200</item>
<item name="colorPrimaryVariant">@color/purple_700</item>
<item name="colorOnPrimary">@color/black</item>
<!-- Secondary brand color. -->
<item name="colorSecondary">@color/teal_200</item>
<item name="colorSecondaryVariant">@color/teal_200</item>
<item name="colorOnSecondary">@color/black</item>
<!-- Status bar color. -->
<item name="android:statusBarColor">?attr/colorPrimaryVariant</item>
<!-- Customize your theme here. -->
</style>
</resources>

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="purple_200">#FFBB86FC</color>
<color name="purple_500">#FF6200EE</color>
<color name="purple_700">#FF3700B3</color>
<color name="teal_200">#FF03DAC5</color>
<color name="teal_700">#FF018786</color>
<color name="black">#FF000000</color>
<color name="white">#FFFFFFFF</color>
</resources>

View File

@@ -0,0 +1 @@
<resources></resources>

View File

@@ -0,0 +1,16 @@
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="Theme.QxLive" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
<!-- Primary brand color. -->
<item name="colorPrimary">@color/purple_500</item>
<item name="colorPrimaryVariant">@color/purple_700</item>
<item name="colorOnPrimary">@color/white</item>
<!-- Secondary brand color. -->
<item name="colorSecondary">@color/teal_200</item>
<item name="colorSecondaryVariant">@color/teal_700</item>
<item name="colorOnSecondary">@color/black</item>
<!-- Status bar color. -->
<item name="android:statusBarColor">?attr/colorPrimaryVariant</item>
<!-- Customize your theme here. -->
</style>
</resources>