心动空间 优化帮助。
This commit is contained in:
@@ -8,6 +8,7 @@ import com.xscm.modulemain.activity.user.conacts.HeartCpContact
|
|||||||
import com.xscm.modulemain.activity.user.presenter.HeartCpPresenter
|
import com.xscm.modulemain.activity.user.presenter.HeartCpPresenter
|
||||||
import com.xscm.modulemain.adapter.ItemCpHeartAdapter
|
import com.xscm.modulemain.adapter.ItemCpHeartAdapter
|
||||||
import com.xscm.modulemain.databinding.ActivityHeartCpBinding
|
import com.xscm.modulemain.databinding.ActivityHeartCpBinding
|
||||||
|
import com.xscm.modulemain.dialog.DialogWebView
|
||||||
import com.xscm.modulemain.dialog.RoomAuctionWebViewDialog
|
import com.xscm.modulemain.dialog.RoomAuctionWebViewDialog
|
||||||
import com.xscm.moduleutil.base.CommonAppContext
|
import com.xscm.moduleutil.base.CommonAppContext
|
||||||
import com.xscm.moduleutil.bean.HeartCpBean
|
import com.xscm.moduleutil.bean.HeartCpBean
|
||||||
@@ -50,14 +51,9 @@ class HeartCpActivity : BaseMvpActivity<HeartCpPresenter, ActivityHeartCpBinding
|
|||||||
finish()
|
finish()
|
||||||
}
|
}
|
||||||
mBinding.ivHelp.setOnClickListener {
|
mBinding.ivHelp.setOnClickListener {
|
||||||
val bundle = Bundle()
|
val dialog = DialogWebView(this)
|
||||||
bundle.putString(
|
dialog.show(CommonAppContext.getInstance()
|
||||||
"url",
|
.getCurrentEnvironment().serverUrl + "api/Page/page_show?id=31")
|
||||||
CommonAppContext.getInstance()
|
|
||||||
.getCurrentEnvironment().serverUrl + "api/Page/page_show?id=31"
|
|
||||||
)
|
|
||||||
val dialog = RoomAuctionWebViewDialog(this, bundle)
|
|
||||||
dialog.show()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mBinding.ivHeadLeft.setOnClickListener {
|
mBinding.ivHeadLeft.setOnClickListener {
|
||||||
|
|||||||
@@ -31,13 +31,13 @@ class ItemCpHeartAdapter(
|
|||||||
|
|
||||||
val cid = if (userId == item.from_user_id) {
|
val cid = if (userId == item.from_user_id) {
|
||||||
tv.setTextColor(context.getColor(R.color.ffff53cc))
|
tv.setTextColor(context.getColor(R.color.ffff53cc))
|
||||||
R.color.ffff53cc
|
R.color.ff4a89ff
|
||||||
} else {
|
} else {
|
||||||
tv.setTextColor(context.getColor(R.color.ff4a89ff))
|
tv.setTextColor(context.getColor(R.color.ff4a89ff))
|
||||||
R.color.ff4a89ff
|
R.color.ffff53cc
|
||||||
}
|
}
|
||||||
if (item.remark.contains(userId.toString())) {
|
if (item.remark.contains(item.to_user_info.nickname)) {
|
||||||
val builder = getContentColor(item.from_user_info.nickname, item.remark, cid)
|
val builder = getContentColor(item.to_user_info.nickname, item.remark, cid)
|
||||||
helper.setText(R.id.tv_content, builder)
|
helper.setText(R.id.tv_content, builder)
|
||||||
} else {
|
} else {
|
||||||
helper.setText(R.id.tv_content, item.remark)
|
helper.setText(R.id.tv_content, item.remark)
|
||||||
|
|||||||
@@ -0,0 +1,44 @@
|
|||||||
|
package com.xscm.modulemain.dialog
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import android.graphics.Color
|
||||||
|
import com.xscm.modulemain.R
|
||||||
|
import com.xscm.modulemain.databinding.WebviewDialogBinding
|
||||||
|
import com.xscm.moduleutil.base.CommonAppContext
|
||||||
|
import com.xscm.moduleutil.widget.dialog.BaseDialog
|
||||||
|
|
||||||
|
class DialogWebView(context: Context) : BaseDialog<WebviewDialogBinding>(context) {
|
||||||
|
|
||||||
|
|
||||||
|
override fun getLayoutId(): Int {
|
||||||
|
return R.layout.webview_dialog
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun initView() {
|
||||||
|
mBinding.webview.setBackgroundColor(Color.TRANSPARENT)
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun initData() {
|
||||||
|
mBinding.ivBack.setOnClickListener {
|
||||||
|
dismiss()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 显示网页内容的方法
|
||||||
|
* @param url 要加载的网页URL地址
|
||||||
|
*/
|
||||||
|
fun show(url:String) {
|
||||||
|
// 调用父类的show方法
|
||||||
|
super.show()
|
||||||
|
// 调用setWebView方法加载指定URL的网页
|
||||||
|
setWebView(url)
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun setWebView(url: String) {
|
||||||
|
mBinding.webview.getSettings().setJavaScriptEnabled(true)
|
||||||
|
mBinding.webview.loadUrl(url)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -28,8 +28,7 @@
|
|||||||
|
|
||||||
<FrameLayout
|
<FrameLayout
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content">
|
||||||
android:animation="@anim/up_down_animation">
|
|
||||||
|
|
||||||
<com.makeramen.roundedimageview.RoundedImageView
|
<com.makeramen.roundedimageview.RoundedImageView
|
||||||
android:id="@+id/room_cp_head1"
|
android:id="@+id/room_cp_head1"
|
||||||
@@ -75,8 +74,7 @@
|
|||||||
|
|
||||||
<FrameLayout
|
<FrameLayout
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content">
|
||||||
android:animation="@anim/up_down_animation">
|
|
||||||
|
|
||||||
<com.makeramen.roundedimageview.RoundedImageView
|
<com.makeramen.roundedimageview.RoundedImageView
|
||||||
android:id="@+id/room_cp_head2"
|
android:id="@+id/room_cp_head2"
|
||||||
|
|||||||
38
MainModule/src/main/res/layout/webview_dialog.xml
Normal file
38
MainModule/src/main/res/layout/webview_dialog.xml
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||||
|
|
||||||
|
<data></data>
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
|
||||||
|
<WebView
|
||||||
|
android:id="@+id/webview"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:layout_marginHorizontal="@dimen/dp_30"
|
||||||
|
android:background="@mipmap/icon_cp_tops_bg"
|
||||||
|
android:padding="@dimen/dp_10"
|
||||||
|
app:layout_constraintBottom_toTopOf="@id/iv_back"
|
||||||
|
app:layout_constraintDimensionRatio="3:5"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:layout_constraintVertical_chainStyle="packed" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/iv_back"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="@dimen/dp_20"
|
||||||
|
android:layout_marginBottom="@dimen/dp_20"
|
||||||
|
android:src="@mipmap/index_close_youth"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/webview" />
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
</layout>
|
||||||
BIN
MainModule/src/main/res/mipmap-hdpi/icon_cp_tops_bg.png
Normal file
BIN
MainModule/src/main/res/mipmap-hdpi/icon_cp_tops_bg.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 172 KiB |
BIN
MainModule/src/main/res/mipmap-xhdpi/icon_cp_tops_bg.png
Normal file
BIN
MainModule/src/main/res/mipmap-xhdpi/icon_cp_tops_bg.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 309 KiB |
BIN
MainModule/src/main/res/mipmap-xxhdpi/icon_cp_tops_bg.png
Normal file
BIN
MainModule/src/main/res/mipmap-xxhdpi/icon_cp_tops_bg.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 680 KiB |
@@ -1,110 +0,0 @@
|
|||||||
package com.qxcm.qxlive.presenter;
|
|
||||||
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
|
|
||||||
|
|
||||||
import com.xscm.moduleutil.activity.IPresenter;
|
|
||||||
import com.xscm.moduleutil.activity.IView;
|
|
||||||
|
|
||||||
import java.lang.ref.Reference;
|
|
||||||
import java.lang.ref.WeakReference;
|
|
||||||
|
|
||||||
import io.reactivex.disposables.CompositeDisposable;
|
|
||||||
import io.reactivex.disposables.Disposable;
|
|
||||||
|
|
||||||
public abstract class BasePresenter<V extends IView> implements IPresenter {
|
|
||||||
protected CompositeDisposable mDisposables = new CompositeDisposable();
|
|
||||||
// private RemoteDataSource api;
|
|
||||||
protected Reference<V> MvpRef;
|
|
||||||
protected Context mContext;
|
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
public BasePresenter(V view) {
|
|
||||||
attachView(view);
|
|
||||||
}
|
|
||||||
|
|
||||||
public BasePresenter(V view, Context context) {
|
|
||||||
attachView(view);
|
|
||||||
mContext = context;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void attachView(V view) {
|
|
||||||
MvpRef = new WeakReference<V>(view);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected V getView() {
|
|
||||||
if (MvpRef != null) {
|
|
||||||
return MvpRef.get();
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
// protected RemoteDataSource getApi() {
|
|
||||||
// if (api == null) {
|
|
||||||
// api = RemoteDataSource.getInstance();
|
|
||||||
// }
|
|
||||||
// return api;
|
|
||||||
// }
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 主要用于判断IView的生命周期是否结束,防止出现内存泄露状况
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public boolean isViewAttach() {
|
|
||||||
return MvpRef != null && MvpRef.get() != null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void detachView() {
|
|
||||||
cancelRequest();
|
|
||||||
if (MvpRef != null) {
|
|
||||||
MvpRef.clear();
|
|
||||||
MvpRef = null;
|
|
||||||
}
|
|
||||||
// if (api != null) {
|
|
||||||
// api = null;
|
|
||||||
// }
|
|
||||||
unBindView();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public void unBindView() {
|
|
||||||
if (MvpRef != null) {
|
|
||||||
MvpRef.clear();
|
|
||||||
}
|
|
||||||
mContext=null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 加入订阅对象
|
|
||||||
*
|
|
||||||
* @param disposable
|
|
||||||
*/
|
|
||||||
public void addDisposable(Disposable disposable) {
|
|
||||||
mDisposables.add(disposable);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 移除订阅对象
|
|
||||||
*
|
|
||||||
* @param disposable
|
|
||||||
*/
|
|
||||||
public void removeDisposable(Disposable disposable) {
|
|
||||||
mDisposables.remove(disposable);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 取消所有请求
|
|
||||||
*/
|
|
||||||
public void cancelRequest() {
|
|
||||||
if (mDisposables != null) {
|
|
||||||
mDisposables.clear(); // clear时网络请求会随即cancel
|
|
||||||
mDisposables = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user