1.AbstractMvpActivity.java 改为继承BaseActivity.java AbstractMvpFragment.java继承BaseFragment.java 2.设置页UI修改

This commit is contained in:
huangjian
2021-03-25 17:53:50 +08:00
committed by zu
parent 54d23d0028
commit b33dbb3238
41 changed files with 216 additions and 3215 deletions

View File

@@ -117,7 +117,7 @@
# Presenter 相关
-keep class com.yizhuan.erban.base.** { *; }
-keep public class * extends com.yizhuan.erban.base.BaseMvpPresenter
-keep public class * extends com.yizhuan.xchat_android_library.base.AbstractMvpPresenter
-keep public class * extends com.yizhuan.xchat_android_library.base.factory.AbstractMvpPresenter
# 云信自定义 ViewHolder 配置
-dontwarn com.yizhuan.erban.ui.im.recent.holder.**

View File

@@ -118,7 +118,7 @@ public class VoiceMatchActivity extends BaseActivity implements View.OnClickList
VmSoundManager.get().onCreate();
AudioPlayerHelper.get().onCreate();
SvgaCacheManager.get().onCreate();
initTitleBar("声音瓶子", true);
initWhiteTitleBar("声音瓶子");
initView();
UserInfo userInfo = UserModel.get().getCacheLoginUserInfo();
@@ -360,8 +360,8 @@ public class VoiceMatchActivity extends BaseActivity implements View.OnClickList
}
@Override
public void initTitleBar(String title, boolean whiteModel) {
super.initTitleBar(title, whiteModel);
public void initWhiteTitleBar(String title) {
super.initWhiteTitleBar(title);
titleBar.addAction(new TitleBar.ImageAction(R.drawable.ic_voice_match_filter_gender) {
@Override
public void performAction(View view) {

View File

@@ -944,11 +944,6 @@ public class AVRoomActivity extends BaseMvpActivity<IAvRoomView, AvRoomPresenter
finish();
}
@Override
protected int setBgColor() {
return R.color.black;
}
@Override
protected boolean needSteepStateBar() {
return true;

View File

@@ -1,6 +1,5 @@
package com.yizhuan.erban.avroom.presenter;
import com.yizhuan.erban.avroom.adapter.RoomRankHalfHourListAdapter;
import com.yizhuan.erban.avroom.fragment.IRoomRankHalfHourView;
import com.yizhuan.xchat_android_core.manager.AvRoomDataManager;
import com.yizhuan.xchat_android_core.room.bean.RoomInfo;
@@ -8,7 +7,7 @@ import com.yizhuan.xchat_android_core.room.bean.RoomRankHalfHourDataInfo;
import com.yizhuan.xchat_android_core.room.bean.RoomRankHalfHourRankInfo;
import com.yizhuan.xchat_android_core.room.bean.RoomRankMultiItem;
import com.yizhuan.xchat_android_core.room.model.RoomRankModel;
import com.yizhuan.xchat_android_library.base.AbstractMvpPresenter;
import com.yizhuan.xchat_android_library.base.factory.AbstractMvpPresenter;
import com.yizhuan.xchat_android_library.utils.SingleToastUtil;
import java.util.ArrayList;

View File

@@ -1,14 +1,16 @@
package com.yizhuan.xchat_android_library.base;
package com.yizhuan.erban.base;
import android.os.Bundle;
import androidx.annotation.Nullable;
import android.util.Log;
import androidx.annotation.Nullable;
import com.yizhuan.xchat_android_library.base.factory.AbstractMvpPresenter;
import com.yizhuan.xchat_android_library.base.factory.BaseMvpProxy;
import com.yizhuan.xchat_android_library.base.IMvpBaseView;
import com.yizhuan.xchat_android_library.base.factory.PresenterMvpFactory;
import com.yizhuan.xchat_android_library.base.factory.PresenterMvpFactoryImpl;
import com.yizhuan.xchat_android_library.base.factory.PresenterProxyInterface;
import com.trello.rxlifecycle3.components.support.RxAppCompatActivity;
/**
* <p> 1. 子类的Presenter必须继承自AbstractMvpPresenter
@@ -18,7 +20,7 @@ import com.trello.rxlifecycle3.components.support.RxAppCompatActivity;
* @author jiahui
* @date 2017/12/7
*/
public abstract class AbstractMvpActivity<V extends IMvpBaseView, P extends AbstractMvpPresenter<V>> extends RxAppCompatActivity
public abstract class AbstractMvpActivity<V extends IMvpBaseView, P extends AbstractMvpPresenter<V>> extends BaseActivity
implements PresenterProxyInterface<V, P> {
public static final boolean DEBUG = false;
protected boolean afterOnSavedInstanceState = false;

View File

@@ -1,14 +1,15 @@
package com.yizhuan.xchat_android_library.base;
package com.yizhuan.erban.base;
import android.os.Bundle;
import androidx.annotation.Nullable;
import android.util.Log;
import com.yizhuan.xchat_android_library.base.factory.AbstractMvpPresenter;
import com.yizhuan.xchat_android_library.base.factory.BaseMvpProxy;
import com.yizhuan.xchat_android_library.base.IMvpBaseView;
import com.yizhuan.xchat_android_library.base.factory.PresenterMvpFactory;
import com.yizhuan.xchat_android_library.base.factory.PresenterMvpFactoryImpl;
import com.yizhuan.xchat_android_library.base.factory.PresenterProxyInterface;
import com.trello.rxlifecycle3.components.support.RxFragment;
/**
* <p> 1. 子类的Presenter必须继承自AbstractMvpPresenter
@@ -18,7 +19,7 @@ import com.trello.rxlifecycle3.components.support.RxFragment;
* @author jiahui
* @date 2017/12/8
*/
public class AbstractMvpFragment<V extends IMvpBaseView, P extends AbstractMvpPresenter<V>> extends RxFragment
public abstract class AbstractMvpFragment<V extends IMvpBaseView, P extends AbstractMvpPresenter<V>> extends BaseFragment
implements PresenterProxyInterface<V, P> {
protected final String TAG = getClass().getSimpleName();
private static final String TAG_LOG = "Super-mvp";

View File

@@ -1,6 +1,8 @@
package com.yizhuan.erban.base;
import android.annotation.SuppressLint;
import android.app.ActivityManager;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.graphics.Color;
@@ -8,46 +10,35 @@ import android.graphics.Typeface;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.text.Html;
import android.text.Spannable;
import android.text.SpannableString;
import android.text.Spanned;
import android.text.TextUtils;
import android.text.style.ForegroundColorSpan;
import android.text.style.StyleSpan;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.view.inputmethod.InputMethodManager;
import android.widget.Toast;
import androidx.annotation.ColorInt;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.coorchice.library.SuperTextView;
import com.google.gson.Gson;
import com.netease.nim.uikit.common.util.log.LogUtil;
import com.netease.nimlib.sdk.NIMSDK;
import com.netease.nimlib.sdk.Observer;
import com.netease.nimlib.sdk.chatroom.model.ChatRoomMessage;
import com.netease.nimlib.sdk.msg.model.BroadcastMessage;
import com.orhanobut.logger.Logger;
import com.readystatesoftware.systembartint.SystemBarTintManager;
import com.tbruyelle.rxpermissions2.RxPermissions;
import com.trello.rxlifecycle3.android.ActivityEvent;
import com.trello.rxlifecycle3.components.support.RxAppCompatActivity;
import com.yizhuan.erban.avroom.widget.MessageView;
import com.yizhuan.xchat_android_core.gift.bean.LuckyBagNoticeInfo;
import com.yizhuan.xchat_android_core.im.custom.bean.RoomBoxPrizeAttachment;
import com.yizhuan.xchat_android_core.redpackage.RedPackageNotifyInfo;
import com.yizhuan.erban.MiddleActivity;
import com.yizhuan.erban.NimMiddleActivity;
import com.yizhuan.erban.R;
@@ -65,6 +56,7 @@ import com.yizhuan.erban.common.widget.dialog.DialogManager;
import com.yizhuan.erban.common.widget.dialog.DialogUiHelper;
import com.yizhuan.erban.common.widget.dialog.LoginPopupDialog;
import com.yizhuan.erban.reciever.ConnectiveChangedReceiver;
import com.yizhuan.erban.ui.im.avtivity.NimP2PMessageActivity;
import com.yizhuan.erban.ui.login.AddUserInfoActivity;
import com.yizhuan.erban.ui.login.ErbanQQMemberBindAndLoginActivity;
import com.yizhuan.erban.ui.login.ForgetPswActivity;
@@ -83,10 +75,15 @@ import com.yizhuan.xchat_android_core.manager.AvRoomDataManager;
import com.yizhuan.xchat_android_core.manager.IMNetEaseManager;
import com.yizhuan.xchat_android_core.manager.RoomEvent;
import com.yizhuan.xchat_android_core.mentoring_relationship.event.GrabApprenticesEvent;
import com.yizhuan.xchat_android_core.newbie.NewbieHelloInfo;
import com.yizhuan.xchat_android_core.newbie.event.NewbieHelloDialogEvent;
import com.yizhuan.xchat_android_core.noble.NobleInfo;
import com.yizhuan.xchat_android_core.noble.NobleProtocol;
import com.yizhuan.xchat_android_core.redpackage.RedPackageNotifyInfo;
import com.yizhuan.xchat_android_core.room.bean.RoomInfo;
import com.yizhuan.xchat_android_core.room.model.AvRoomModel;
import com.yizhuan.xchat_android_core.statistic.StatisticManager;
import com.yizhuan.xchat_android_core.utils.net.RxHelper;
import com.yizhuan.xchat_android_library.rxbus.RxBus;
import com.yizhuan.xchat_android_library.utils.ImeUtil;
import com.yizhuan.xchat_android_library.utils.NetworkUtils;
@@ -96,17 +93,18 @@ import com.yizhuan.xchat_android_library.utils.codec.DESUtils;
import com.yizhuan.xchat_android_library.utils.config.BasicConfig;
import com.yizhuan.xchat_android_library.utils.log.MLog;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
import java.lang.ref.WeakReference;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.TimeUnit;
import io.reactivex.Observable;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.CompositeDisposable;
import io.reactivex.disposables.Disposable;
import static com.yizhuan.xchat_android_core.Constants.DEBUG_MAX_UID;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MESS_HEAD_NOBLE;
@@ -114,6 +112,7 @@ import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUS
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MESS_SUB_RENEWNOBLE;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_RED_PACKAGE;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_RED_PACKAGE_RECEIVE_ALL_DIAMOND;
import static com.yizhuan.xchat_android_library.utils.UIUtils.getActivityByContext;
/**
@@ -123,10 +122,6 @@ public abstract class BaseActivity extends RxAppCompatActivity
implements IDataStatus, ConnectiveChangedReceiver.ConnectiveChangedListener,
DialogManagerInterface {
private static final Object TAG = "BaseActivity";
private Handler mHandler = new Handler();
//底部登录弹窗
private LoginPopupDialog mLoginDialog;
private DialogManager mDialogManager;
protected TitleBar mTitleBar;
protected DefaultToolBar mToolBar;
@@ -139,15 +134,22 @@ public abstract class BaseActivity extends RxAppCompatActivity
super.onCreate(savedInstanceState);
context = this;
mCompositeDisposable = new CompositeDisposable();
if (setBgColor() > 0) {
getWindow().setBackgroundDrawableResource(setBgColor());
}
if (needSteepStateBar()) {
setStatusBar();
}
registerNimBroadcastMessage(true);
mCompositeDisposable.add(IMNetEaseManager.get().getChatRoomEventObservable()
.subscribe(roomEvent -> {
if (roomEvent == null) return;
onReceiveChatRoomEvent(roomEvent);
}));
registerNimBroadcastMessage(true);
}
protected void onReceiveChatRoomEvent(RoomEvent roomEvent) {
}
/**
* 注册云信全服广播接收器
@@ -173,16 +175,11 @@ public abstract class BaseActivity extends RxAppCompatActivity
}
public void initToolBar(CharSequence title) {
mToolBar = (DefaultToolBar) findViewById(R.id.toolbar);
mToolBar = findViewById(R.id.toolbar);
if (mToolBar != null) {
mToolBar.setCenterTitle(title);
mToolBar.setNavigationIcon(R.drawable.arrow_left);
mToolBar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
onLeftClickListener();
}
});
mToolBar.setNavigationOnClickListener(v -> onLeftClickListener());
}
}
@@ -206,36 +203,37 @@ public abstract class BaseActivity extends RxAppCompatActivity
if (mTitleBar != null) {
mTitleBar.setTitle(title);
mTitleBar.setImmersive(false);
mTitleBar.setTitleColor(getResources().getColor(R.color.white));
mTitleBar.setLeftImageResource(R.drawable.arrow_left_white);
mTitleBar.setTitleColor(getResources().getColor(R.color.back_font));
mTitleBar.setLeftImageResource(R.drawable.arrow_left);
mTitleBar.setCommonBackgroundColor(getResources().getColor(R.color.transparent));
mTitleBar.setLeftClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
onLeftClickListener();
}
});
mTitleBar.setLeftClickListener(v -> onLeftClickListener());
}
}
public void initTitleBar(String title, boolean whiteModel) {
public void initWhiteTitleBar(String title) {
mTitleBar = findViewById(R.id.title_bar);
if (mTitleBar != null) {
mTitleBar.setTitle(title);
mTitleBar.setImmersive(false);
mTitleBar.setTitleColor(getResources().getColor(
whiteModel ? R.color.white : R.color.back_font));
mTitleBar.setLeftImageResource(
whiteModel ? R.drawable.arrow_left_white : R.drawable.arrow_left);
mTitleBar.setCommonBackgroundColor(getResources().getColor(
whiteModel ? R.color.transparent : R.color.transparent)
);
mTitleBar.setLeftClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
onLeftClickListener();
}
});
mTitleBar.setTitleColor(getResources().getColor(R.color.white));
mTitleBar.setLeftImageResource(R.drawable.arrow_left_white);
mTitleBar.setCommonBackgroundColor(getResources().getColor(R.color.transparent));
mTitleBar.setLeftClickListener(v -> onLeftClickListener());
}
}
public void initTitleBar(String title, TitleBar.Action action) {
mTitleBar = findViewById(R.id.title_bar);
if (mTitleBar != null) {
mTitleBar.setTitle(title);
mTitleBar.setImmersive(false);
mTitleBar.setTitleColor(getResources().getColor(R.color.back_font));
mTitleBar.setLeftImageResource(R.drawable.arrow_left);
mTitleBar.setLeftClickListener(v -> onLeftClickListener());
// action
if (action != null) {
mTitleBar.addAction(action);
}
}
}
@@ -247,13 +245,6 @@ public abstract class BaseActivity extends RxAppCompatActivity
return false;
}
public boolean blackStatusBar() {
return true;
}
protected int setBgColor() {
return 0;
}
/**
* 设置沉浸式状态栏
@@ -360,6 +351,7 @@ public abstract class BaseActivity extends RxAppCompatActivity
XChatApplication.getRefWatcher(this).watch(this);
}
}
@Override
public DialogManager getDialogManager() {
if (mDialogManager == null) {
@@ -580,15 +572,6 @@ public abstract class BaseActivity extends RxAppCompatActivity
return UIUtils.checkActivityValid(this);
}
/**
* 弹出登录框
*
* @return
*/
public void showLoginDialog() {
ImeUtil.hideIME(this);
mLoginDialog.show();
}
/**
* --------------------------------------------------
@@ -635,6 +618,11 @@ public abstract class BaseActivity extends RxAppCompatActivity
showLoading(view, 0, 0);
}
public void showReload(@ColorInt int bgColor) {
showReload(0, bgColor);
}
@Override
public void showReload() {
showReload(0, 0);
@@ -882,30 +870,7 @@ public abstract class BaseActivity extends RxAppCompatActivity
}
private void configStatusBar() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
Window window = getWindow();
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
window.setStatusBarColor(getResources().getColor(R.color.white));
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
Window window = getWindow();
window.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS, WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
// create our manager instance after the content view is set
SystemBarTintManager tintManager = new SystemBarTintManager(this);
// enable status bar tint
tintManager.setStatusBarTintEnabled(true);
// enable navigation bar tint
tintManager.setNavigationBarTintEnabled(true);
tintManager.setTintResource(R.color.white);
}
}
private RxPermissions rxPermissions = new RxPermissions(this);
private final RxPermissions rxPermissions = new RxPermissions(this);
@SuppressLint("CheckResult")
public void checkPermission(PermissionActivity.CheckPermListener listener, int resString, String... mPerms) {
@@ -1009,7 +974,7 @@ public abstract class BaseActivity extends RxAppCompatActivity
private OpenNobleGlobalNoticeDialog mNoticeDialog;
private static class BroadcastObserver implements Observer<BroadcastMessage> {
private WeakReference<BaseActivity> mReference;
private final WeakReference<BaseActivity> mReference;
BroadcastObserver(BaseActivity baseMvpActivity) {
mReference = new WeakReference<>(baseMvpActivity);
@@ -1127,8 +1092,55 @@ public abstract class BaseActivity extends RxAppCompatActivity
});
}
public static void start(Context context, Class clazz) {
context.startActivity(new Intent(context, clazz));
@Subscribe(threadMode = ThreadMode.MAIN)
public void onReceiveHello(NewbieHelloDialogEvent event) {
ActivityManager am = (ActivityManager) getSystemService(ACTIVITY_SERVICE);
if (am == null) return;
ComponentName cn = am.getRunningTasks(1).get(0).topActivity;
if (cn == null) return;
if (cn.getShortClassName().equals(getActivityByContext(context).getLocalClassName())) {
showHelloDialog(event.getHelloInfo());
}
}
/**
* 打招呼
*
* @param helloInfo
*/
private void showHelloDialog(final NewbieHelloInfo helloInfo) {
String message = helloInfo.getMessage();
int gender = helloInfo.getGender();
String nick = helloInfo.getNick();
String avatar = helloInfo.getAvatar();
getDialogManager().showNewbieHelloDialog(avatar, gender, nick, message, "去找TA", "忽略", true, new DialogManager.OkCancelDialogListener() {
@SuppressLint("CheckResult")
@Override
public void onOk() {
if (helloInfo.getInRoomUid() == 0) {
NimP2PMessageActivity.start(context, helloInfo.getUid());
return;
}
AvRoomModel.get()
.getUserRoom(Long.parseLong(helloInfo.getUid()))
.compose(RxHelper.singleMainResult())
.compose(RxHelper.handleSchAndExce())
.compose(bindToLifecycle())
.subscribe((roomInfo, throwable) -> {
if (throwable == null) {
if (roomInfo != null && roomInfo.getUid() > 0 && roomInfo.getUid() == helloInfo.getInRoomUid()) {
AVRoomActivity.startForFromType(context, helloInfo.getInRoomUid(),
AVRoomActivity.FROM_TYPE_USER, nick, helloInfo.getUid());
} else {
SingleToastUtil.showToast("来聊聊天嘛~");
}
} else {
SingleToastUtil.showToast("来聊聊天嘛~");
}
});
}
}, context);
}
}

View File

@@ -377,7 +377,7 @@ public abstract class BaseFragment extends RxFragment implements KeyEvent.Callba
return;
}
View status = view.findViewById(R.id.status_layout);
if (status == null || status.getId() <= 0) {
if (status == null || view.getId() == View.NO_ID) {
return;
}
Fragment fragment;
@@ -404,7 +404,7 @@ public abstract class BaseFragment extends RxFragment implements KeyEvent.Callba
return;
}
View status = view.findViewById(R.id.status_layout);
if (status == null || status.getId() <= 0) {
if (status == null || view.getId() == View.NO_ID) {
MLog.error(this, "xuwakao, had not set layout id ");
return;
}
@@ -428,7 +428,7 @@ public abstract class BaseFragment extends RxFragment implements KeyEvent.Callba
return;
}
View status = view.findViewById(R.id.status_layout);
if (status == null || status.getId() <= 0) {
if (status == null || view.getId() == View.NO_ID) {
MLog.error(this, "xuwakao, had not set layout id ");
return;
}
@@ -448,7 +448,7 @@ public abstract class BaseFragment extends RxFragment implements KeyEvent.Callba
return;
}
View view = getView().findViewById(R.id.status_layout);
if (view == null || view.getId() <= 0) {
if (view == null || view.getId() == View.NO_ID) {
MLog.error(this, "xuwakao, had not set layout id ");
return;
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,644 +1,16 @@
package com.yizhuan.erban.base;
import android.annotation.SuppressLint;
import android.app.Service;
import android.content.Context;
import android.content.Intent;
import android.media.AudioManager;
import android.os.Bundle;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Toast;
import com.tbruyelle.rxpermissions2.RxPermissions;
import com.yizhuan.erban.R;
import com.yizhuan.erban.application.XChatApplication;
import com.yizhuan.erban.common.AbsStatusFragment;
import com.yizhuan.erban.common.LoadingFragment;
import com.yizhuan.erban.common.NetworkErrorFragment;
import com.yizhuan.erban.common.NoDataFragment;
import com.yizhuan.erban.common.ReloadFragment;
import com.yizhuan.erban.common.widget.StatusLayout;
import com.yizhuan.erban.common.widget.dialog.DialogManager;
import androidx.fragment.app.FragmentManager;
import com.yizhuan.erban.reciever.ConnectiveChangedReceiver;
import com.yizhuan.xchat_android_library.base.AbstractMvpFragment;
import com.yizhuan.xchat_android_library.base.AbstractMvpPresenter;
import com.yizhuan.xchat_android_library.base.IMvpBaseView;
import com.yizhuan.xchat_android_library.utils.NetworkUtils;
import com.yizhuan.xchat_android_library.utils.SingleToastUtil;
import com.yizhuan.xchat_android_library.utils.UIUtils;
import com.yizhuan.xchat_android_library.utils.config.BasicConfig;
import com.yizhuan.xchat_android_library.utils.log.MLog;
import java.lang.ref.SoftReference;
import java.util.List;
import java.util.Stack;
import io.reactivex.Observable;
import io.reactivex.disposables.CompositeDisposable;
import com.yizhuan.xchat_android_library.base.factory.AbstractMvpPresenter;
/**
* @author alvin hwang
*/
public abstract class BaseMvpFragment<V extends IMvpBaseView, P extends AbstractMvpPresenter<V>> extends AbstractMvpFragment<V, P> implements KeyEvent.Callback, IDataStatus,
ConnectiveChangedReceiver.ConnectiveChangedListener, FragmentManager.OnBackStackChangedListener, IAcitivityBase {
//是否已经已完成(网络、数据库)请求数据
protected boolean requested = false;
//保留对最初的视图的软引用
private SoftReference<View> mViewReference;
protected View mView;
protected Context mContext;
protected CompositeDisposable mCompositeDisposable;
protected RxPermissions rxPermissions;
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mCompositeDisposable = new CompositeDisposable();
mContext = getContext();
onInitArguments(getArguments());
}
public void onNewIntent(Intent intent) {
}
protected void onInitArguments(Bundle bundle) {
}
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
int rootLayoutId = getRootLayoutId();
mView = inflater.inflate(rootLayoutId, container, false);
return mView;
}
public void showLoginDialog() {
getBaseActivity().showLoginDialog();
}
@Override
public void onAttach(Context context) {
super.onAttach(context);
rxPermissions = new RxPermissions(this);
}
@Override
public void onDetach() {
super.onDetach();
}
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
onFindViews();
onSetListener();
}
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
restoreState(savedInstanceState);
initiate();
}
protected void restoreState(@Nullable Bundle savedInstanceState) {
}
@Override
public void onStart() {
super.onStart();
getFragmentManager().addOnBackStackChangedListener(this);
}
@Override
public void onStop() {
super.onStop();
getFragmentManager().removeOnBackStackChangedListener(this);
}
@Override
public void onDestroy() {
if (mCompositeDisposable != null) {
mCompositeDisposable.dispose();
mCompositeDisposable = null;
}
super.onDestroy();
if (BasicConfig.INSTANCE.isDebuggable()) {
XChatApplication.getRefWatcher(getActivity()).watch(this);
}
}
public abstract int getRootLayoutId();
@Override
public void onBackStackChanged() {
}
@Override
public void onHiddenChanged(boolean hidden) {
super.onHiddenChanged(hidden);
}
/**
* 网络连接变化
*/
/**
* wifi 转 2G/3G/4G
*/
public void wifiChange2MobileData() {
}
/**
* 有网络变为无网络
*/
public void change2NoConnection() {
if (isTopActive()) {
MLog.debug(this, "change2NoConnection");
}
}
/**
* 连上wifi
*/
public void connectiveWifi() {
if (isTopActive()) {
MLog.debug(this, "connectiveWifi");
}
}
/**
* 连上移动数据网络
*/
public void connectiveMobileData() {
if (isTopActive()) {
MLog.debug(this, "connectiveMobileData");
}
}
/**
* 移动数据网络 改为连上wifi
*/
public void mobileDataChange2Wifi() {
if (isTopActive()) {
MLog.debug(this, "mobileDataChange2Wifi");
}
}
public Stack<Integer> activityForResult = new Stack<Integer>();
/**
* 为解决嵌套Fragment 收不到onActivityResult消息问题 Fragment需要调用onFragment
*
* @param requestCode
* @param resultCode
* @param data
*/
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
while (!activityForResult.isEmpty()) {
Integer index = activityForResult.pop();
FragmentManager manager = getChildFragmentManager();
if (manager == null) { //说明为activity是manager
manager = getFragmentManager();
}
if (manager != null) {
@SuppressLint("RestrictedApi")
List<Fragment> list = manager.getFragments();
if (list != null && list.size() > index) {
list.get(index).onActivityResult(requestCode, resultCode, data);
}
} else {
MLog.error(this, "嵌套fragment出现问题");
}
}
super.onActivityResult(requestCode, resultCode, data);
}
@Override
public void startActivityForResult(Intent intent, int requestCode) {
Fragment fragment = getFragmentInParent();
if (fragment == null) {
super.startActivityForResult(intent, requestCode);
} else {
fragment.startActivityForResult(intent, requestCode);
}
}
protected Fragment getFragmentInParent() {
FragmentManager manager;
Fragment parentFragment = this.getParentFragment();
if (parentFragment != null) {
manager = parentFragment.getChildFragmentManager();
} else {
manager = this.getFragmentManager();
}
@SuppressLint("RestrictedApi")
List<Fragment> list = manager.getFragments();
if (list != null) {
int index = list.indexOf(this);
if (parentFragment != null && parentFragment instanceof BaseMvpFragment) {
((BaseMvpFragment) parentFragment).activityForResult.push(index);
}
}
return parentFragment;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
return super.onOptionsItemSelected(item);
}
/**
* 权限回调
*/
@SuppressLint("CheckResult")
public Observable<Boolean> checkPermission(String... mPerms) {
return rxPermissions.request(mPerms);
}
/**
* --------------------------------------------------
* -------------------------数据状态相关-----------------
* --------------------------------------------------
*/
protected static final String STATUS_TAG = "STATUS_TAG";
@Override
public View.OnClickListener getLoadListener() {
return new View.OnClickListener() {
@Override
public void onClick(View v) {
onReloadData();
}
};
}
/**
* 重新加载页面数据:通常应用于无网络切换到有网络情况,重新刷新页面
*/
public void onReloadData() {
}
@Override
public View.OnClickListener getLoadMoreListener() {
return null;
}
@Override
public View.OnClickListener getNoMobileLiveDataListener() {
return null;
}
@Override
public void showLoading() {
showLoading(0, 0);
}
@Override
public void showLoading(View view) {
showLoading(view, 0, 0);
}
@Override
public void showReload() {
showReload(0, 0);
}
@Override
public void showNoData() {
showNoData(0, "");
}
@Override
public void showNoData(CharSequence charSequence) {
showNoData(0, charSequence);
}
@Override
public void showNoLogin() {
}
@Override
public void showLoading(int drawable, int tips) {
showLoading(getView(), drawable, tips);
}
@Override
public void showLoading(View view, int drawable, int tips) {
showLoading(view, drawable, tips, 0);
}
protected void showLoading(View view, int drawable, int tips, int paddingBottom) {
if (!checkActivityValid()) {
return;
}
if (view == null) {
return;
}
View status = view.findViewById(R.id.status_layout);
if (status == null || status.getId() <= 0) {
return;
}
Fragment fragment;
if (paddingBottom == 0) {
fragment = LoadingFragment.newInstance(drawable, tips);
} else {
fragment = LoadingFragment.newInstance(drawable, tips, paddingBottom);
}
getChildFragmentManager().beginTransaction().replace(status.getId(), fragment, STATUS_TAG).commitAllowingStateLoss();
}
@Override
public void showReload(int drawable, int tips) {
showReload(getView(), drawable, tips);
}
@Override
public void showReload(View view, int drawable, int tips) {
if (!checkActivityValid())
return;
if (view == null) {
MLog.error(this, "xuwakao, showReload view is NULL");
return;
}
View status = view.findViewById(R.id.status_layout);
if (status == null || status.getId() <= 0) {
MLog.error(this, "xuwakao, had not set layout id ");
return;
}
ReloadFragment fragment = ReloadFragment.newInstance(drawable, tips);
fragment.setListener(getLoadListener());
getChildFragmentManager().beginTransaction().replace(status.getId(), fragment, STATUS_TAG).commitAllowingStateLoss();
}
@Override
public void showNoData(int drawable, CharSequence charSequence) {
showNoData(getView(), drawable, charSequence);
}
@Override
public void showNoData(View view, int drawable, CharSequence charSequence) {
if (!checkActivityValid())
return;
if (view == null) {
MLog.error(this, "xuwakao, showNoData view is NULL");
return;
}
View status = view.findViewById(R.id.status_layout);
if (status == null || status.getId() <= 0) {
MLog.error(this, "xuwakao, had not set layout id ");
return;
}
NoDataFragment fragment = NoDataFragment.newInstance(drawable, charSequence);
fragment.setListener(getLoadListener());
getChildFragmentManager().beginTransaction().replace(status.getId(), fragment, STATUS_TAG).commitAllowingStateLoss();
}
@Override
public void showNetworkErr() {
if (!checkActivityValid()) {
return;
}
if (getView() == null) {
MLog.error(this, "xuwakao, showNetworkErr view is NULL");
return;
}
View view = getView().findViewById(R.id.status_layout);
if (view == null || view.getId() <= 0) {
MLog.error(this, "xuwakao, had not set layout id ");
return;
}
NetworkErrorFragment fragment = new NetworkErrorFragment();
fragment.setListener(getLoadListener());
getChildFragmentManager().beginTransaction().replace(view.getId(), fragment, STATUS_TAG).commitAllowingStateLoss();
}
@Override
public void hideStatus() {
Fragment fragment = getChildFragmentManager().findFragmentByTag(STATUS_TAG);
if (fragment != null) {
getChildFragmentManager().beginTransaction().remove(fragment).commitAllowingStateLoss();
} else {
MLog.warn(this, "xuwakao, status fragment is NULL");
}
}
@Override
public void showPageError(int tips) {
showPageError(getView(), tips);
}
@Override
public void showPageError(View view, int tips) {
if (!checkActivityValid())
return;
if (view == null) {
MLog.error(this, "xuwakao, showReload view is NULL");
return;
}
View more = view.findViewById(R.id.loading_more);
if (more == null) {
MLog.error(this, "xuwakao, showReload more is NULL");
return;
}
StatusLayout statusLayout = (StatusLayout) more.getParent();
statusLayout.showErrorPage(tips, getLoadMoreListener());
}
@Override
public void showPageLoading() {
if (!checkActivityValid())
return;
if (getView() == null) {
MLog.error(this, "xuwakao, showReload view is NULL");
return;
}
View more = getView().findViewById(R.id.loading_more);
if (more == null) {
MLog.error(this, "xuwakao, showReload more is NULL");
return;
}
StatusLayout statusLayout = (StatusLayout) more.getParent();
statusLayout.showLoadMore();
}
protected boolean checkActivityValid() {
return UIUtils.checkActivityValid(getActivity());
}
//====================================================================================//
//==============================请求过滤条件筛选的返回================================//
//====================================================================================//
public boolean isTopActive() {//FIXME 到我的音乐后RecommendFragment仍然是isTopActive()
boolean isVisible = this.isResumed() && this.isVisible() && getUserVisibleHint();
if (!isVisible) {
return false;
}
FragmentManager manager = this.getChildFragmentManager();
if (manager == null) {
return true;
}
int count = manager.getFragments() == null ? 0 : manager.getFragments().size();
if (count > 0) {
for (int i = 0; i < count; i++) {
Fragment fragment = manager.getFragments().get(i);
if (fragment == null) {
return true;
}
if (fragment instanceof AbsStatusFragment) {
return true;
}
if (fragment.isVisible()) {
return false;
}
}
}
return true;
}
/**
* 当前网络是否可用
*
* @return
*/
public boolean isNetworkAvailable() {
return NetworkUtils.isNetworkStrictlyAvailable(getActivity());
}
/**
* 通用消息提示
*
* @param resId
*/
public void toast(int resId) {
toast(resId, Toast.LENGTH_SHORT);
}
/**
* 通用消息提示
*
* @param tip
*/
public void toast(String tip) {
toast(tip, Toast.LENGTH_SHORT);
}
/**
* 通用消息提示
*
* @param resId
* @param length
*/
public void toast(int resId, int length) {
SingleToastUtil.showToast(BasicConfig.INSTANCE.getAppContext(), resId);
}
/**
* 通用消息提示
*
* @param tip
* @param length
*/
public void toast(String tip, int length) {
SingleToastUtil.showToast(BasicConfig.INSTANCE.getAppContext(), tip, length);
}
public boolean checkNetToast() {
boolean flag = isNetworkAvailable();
if (!flag)
toast(R.string.str_network_not_capable);
return flag;
}
protected DialogManager getDialogManager() {
if (getActivity() instanceof BaseActivity) {
return ((BaseActivity) getActivity()).getDialogManager();
}
return getBaseActivity().getDialogManager();
}
public BaseMvpActivity getBaseActivity() {
return (BaseMvpActivity) getActivity();
}
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_MENU) {
showOptionsMenu();
}
if (keyCode == KeyEvent.KEYCODE_VOLUME_DOWN) {
AudioManager audio = (AudioManager) (getContext().getSystemService(Service.AUDIO_SERVICE));
audio.adjustStreamVolume(
AudioManager.STREAM_VOICE_CALL,
AudioManager.ADJUST_LOWER,
AudioManager.FLAG_PLAY_SOUND | AudioManager.FLAG_SHOW_UI);
return true;
} else if (keyCode == KeyEvent.KEYCODE_VOLUME_UP) {
AudioManager audio = (AudioManager) (getContext().getSystemService(Service.AUDIO_SERVICE));
audio.adjustStreamVolume(
AudioManager.STREAM_VOICE_CALL,
AudioManager.ADJUST_RAISE,
AudioManager.FLAG_PLAY_SOUND | AudioManager.FLAG_SHOW_UI);
return true;
}
return false;
}
protected void showOptionsMenu() {
}
@Override
public boolean onKeyLongPress(int keyCode, KeyEvent event) {
return false;
}
@Override
public boolean onKeyUp(int keyCode, KeyEvent event) {
return false;
}
@Override
public boolean onKeyMultiple(int keyCode, int count, KeyEvent event) {
return false;
}
}

View File

@@ -3,9 +3,8 @@ package com.yizhuan.erban.base;
import android.os.Bundle;
import androidx.annotation.Nullable;
import com.yizhuan.xchat_android_library.base.AbstractMvpPresenter;
import com.yizhuan.xchat_android_library.base.IMvpBaseView;
import com.yizhuan.xchat_android_library.base.factory.AbstractMvpPresenter;
/**

View File

@@ -2,7 +2,6 @@ package com.yizhuan.erban.base;
import android.annotation.SuppressLint;
import android.content.Intent;
import androidx.databinding.DataBindingUtil;
import android.net.Uri;
import android.os.Bundle;
import androidx.annotation.CallSuper;
@@ -22,8 +21,8 @@ import com.yizhuan.erban.R;
import com.yizhuan.erban.common.permission.PermissionActivity;
import com.yizhuan.erban.ui.widget.ButtonItem;
import com.yizhuan.xchat_android_core.file.FileModel;
import com.yizhuan.xchat_android_library.base.AbstractMvpPresenter;
import com.yizhuan.xchat_android_library.base.IMvpBaseView;
import com.yizhuan.xchat_android_library.base.factory.AbstractMvpPresenter;
import com.yizhuan.xchat_android_library.utils.file.JXFileUtils;
import com.jph.takephoto.permission.PermissionManager.TPermissionType;

View File

@@ -1,121 +0,0 @@
package com.yizhuan.erban.base;
import android.content.Context;
import androidx.recyclerview.widget.RecyclerView;
import android.view.View;
import com.yizhuan.erban.ui.utils.ArrayUtils;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
public abstract class BaseYAdapter<T> extends RecyclerView.Adapter<BaseYAdapter.BaseViewHolder> {
public Context mContext;
public ArrayList<T> mListData;
//子项点击事件
public BaseYAdapter(Context context) {
this.mContext = context;
mListData = new ArrayList<T>();
}
public ArrayList<T> getListData() {
return mListData;
}
/**
* 删除列表<E58897>?<3F><>数据并刷<E5B9B6>?
*/
public void deleteAll() {
mListData.clear();
}
/**
* 获取指定未知的数<E79A84>?
*/
public T getItem(int position) {
if (null == mListData) {
return null;
} else {
return mListData.get(position);
}
}
/**
* 删除某项数据
*/
public void deleteItemOf(int position) {
mListData.remove(position);
notifyItemRemoved(position);
}
public void deleteItem(T t){
mListData.remove(t);
notifyDataSetChanged();
}
/**
* 添加数据并刷新
*/
public void addItem(Collection<? extends T> t) {
if (null == t) {
return;
}
if (t instanceof ArrayList) {
mListData.addAll(t);
} else {
mListData.add((T) t);
}
notifyDataSetChanged();
}
public void add(T t) {
mListData.add(t);
notifyDataSetChanged();
}
public void add(int position,T t) {
mListData.add(position,t);
notifyDataSetChanged();
}
public void set(int position,T t) {
mListData.set(position,t);
notifyItemChanged(position);
}
public boolean replace(T newT,T t){
if(mListData.contains(t)){
int position = mListData.indexOf(t);
mListData.set(position,newT);
return true;
}else{
return false;
}
}
private List<T> deepList;
public List<T> deepCopy(){
deepList = ArrayUtils.deepCopy(mListData);
return deepList;
}
@Override
public int getItemCount() {
return (mListData == null) ? 0 : mListData.size();
}
public static class BaseViewHolder extends RecyclerView.ViewHolder {
public BaseViewHolder(View arg0) {
super(arg0);
}
}
}

View File

@@ -1,163 +0,0 @@
package com.yizhuan.erban.base;
import android.content.Context;
import androidx.annotation.Nullable;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
import androidx.recyclerview.widget.RecyclerView;
import android.util.AttributeSet;
import android.view.View;
/**
* <p> 具有加载更多的recycler view </p>
* Created by Administrator on 2017/11/13.
*/
public class LRecyclerView extends RecyclerView {
private boolean mIsLoading = false;
private int initPreItem = 0; //预加载个数
private SwipeRefreshLayout mSwipeRefreshLayout;
public LRecyclerView(Context context) {
this(context, null);
}
public LRecyclerView(Context context, @Nullable AttributeSet attrs) {
this(context, attrs, 0);
}
public LRecyclerView(Context context, @Nullable AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
addOnScrollListener(mOnScrollListener);
}
/**
* 绑定刷新控件
*
* @param swipeRefreshLayout
*/
public void bindSwipeRefreshLayout(SwipeRefreshLayout swipeRefreshLayout) {
this.mSwipeRefreshLayout = swipeRefreshLayout;
}
public void finishLoading() {
mIsLoading = false;
}
public boolean isLoading() {
return mIsLoading;
}
/**
* 设置预加载的item个数
*
* @param initPreItem
*/
public void setInitPreItem(int initPreItem) {
this.initPreItem = initPreItem;
}
private OnScrollListener mOnScrollListener = new OnScrollListener() {
@Override
public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
super.onScrollStateChanged(recyclerView, newState);
checkSwipeRefreshNull();
/* Log.i("liao", "newState=" + newState);
//第一种方式 有个bug当最后一个item刚显示出来的时候停止滑动这个时候也会触发滑动到底部的操作
LayoutManager layoutManager = getLayoutManager();
int itemCount = layoutManager.getItemCount();
int lastVisibleItemPosition = 0;
if (layoutManager instanceof LinearLayoutManager) {
LinearLayoutManager linearLayoutManager = (LinearLayoutManager) layoutManager;
lastVisibleItemPosition = linearLayoutManager.findLastVisibleItemPosition();
} else if (layoutManager instanceof StaggeredGridLayoutManager) {
StaggeredGridLayoutManager staggeredGridLayoutManager = (StaggeredGridLayoutManager) layoutManager;
//得到这个数组后再取到数组中position值最大的那个就是最后显示的position值了
int[] lastPositions = new int[((StaggeredGridLayoutManager) layoutManager).getSpanCount()];
staggeredGridLayoutManager.findLastVisibleItemPositions(lastPositions);
lastVisibleItemPosition = findMax(lastPositions);
}
if (!mIsLoading && ((lastVisibleItemPosition + 1) >= itemCount) && newState == SCROLL_STATE_IDLE) {
Log.i("liao", "加载.....lastVisibleItemPosition=" + lastVisibleItemPosition + ",itemCount=" + itemCount);
mIsLoading = true;
post(new Runnable() {
@Override
public void run() {
if (mOnLoadingListener != null) {
mOnLoadingListener.onLoading();
}
}
});
}*/
//第二种方式
//得到当前显示的最后一个item的view
View lastChildView = recyclerView.getLayoutManager().getChildAt(recyclerView.getLayoutManager().getChildCount() - 1);
//得到lastChildView的bottom坐标值
int lastChildBottom = lastChildView.getBottom();
//得到Recycler view的底部坐标减去底部padding值也就是显示内容最底部的坐标
int recyclerBottom = recyclerView.getBottom() - recyclerView.getPaddingBottom();
//通过这个lastChildView得到这个view当前的position值
int lastPosition = recyclerView.getLayoutManager().getPosition(lastChildView);
//判断lastChildView的bottom值跟recyclerBottom
//判断lastPosition是不是最后一个position
//如果两个条件都满足则说明是真正的滑动到了底部
if (!mIsLoading
&& lastChildBottom == recyclerBottom
&& (lastPosition == recyclerView.getLayoutManager().getItemCount() - 1 - initPreItem)
&& newState == SCROLL_STATE_IDLE
&& !mSwipeRefreshLayout.isRefreshing()) {
mIsLoading = true;
post(new Runnable() {
@Override
public void run() {
if (mOnLoadingListener != null) {
mOnLoadingListener.onLoading();
}
}
});
}
mSwipeRefreshLayout.setEnabled(!mIsLoading);
}
@Override
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
super.onScrolled(recyclerView, dx, dy);
//处理刷新冲突问题
// int topRowVerticalPosition =
// (recyclerView == null || recyclerView.getChildCount() == 0) ? 0 : recyclerView.getChildAt(0).getTop();
// checkSwipeRefreshNull();
// mSwipeRefreshLayout.setEnabled(topRowVerticalPosition >= 0 );
}
};
private void checkSwipeRefreshNull() {
if (mSwipeRefreshLayout == null)
throw new IllegalArgumentException("必须调用bindSwipeRefreshLayout(SwipeRefreshLayout)绑定SwipeRefreshLayout解决冲突");
}
//找到数组中的最大值
private int findMax(int[] lastPositions) {
int max = lastPositions[0];
for (int value : lastPositions) {
if (value > max) {
max = value;
}
}
return max;
}
private OnLoadingListener mOnLoadingListener;
public void setOnLoadingListener(OnLoadingListener onLoadingListener) {
mOnLoadingListener = onLoadingListener;
}
public interface OnLoadingListener {
void onLoading();
}
}

View File

@@ -1,578 +0,0 @@
package com.yizhuan.erban.base;
import android.annotation.SuppressLint;
import android.annotation.TargetApi;
import android.app.ActionBar.LayoutParams;
import android.app.Activity;
import android.content.Context;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.util.DisplayMetrics;
import android.util.TypedValue;
import android.view.Gravity;
import android.view.View;
import android.view.ViewConfiguration;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import java.lang.reflect.Method;
@SuppressWarnings({ "unchecked", "rawtypes", "ResourceType"})
public class SystemStatusManager {
static {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
try {
Class c = Class.forName("android.os.SystemProperties");
Method m = c.getDeclaredMethod("get", String.class);
m.setAccessible(true);
sNavBarOverride = (String) m.invoke(null,
"qemu.hw.mainkeys");
} catch (Throwable e) {
sNavBarOverride = null;
}
}
}
/**
* The default system bar tint color value.
*/
public static final int DEFAULT_TINT_COLOR = 0x99000000;
private static String sNavBarOverride;
private final SystemBarConfig mConfig;
private boolean mStatusBarAvailable;
private boolean mNavBarAvailable;
private boolean mStatusBarTintEnabled;
private boolean mNavBarTintEnabled;
private View mStatusBarTintView;
private View mNavBarTintView;
/**
* Constructor. Call this in the host activity onCreate method after its
* content view has been set. You should always create new instances when
* the host activity is recreated.
*
* @param activity
* The host activity.
*/
@TargetApi(19)
public SystemStatusManager(Activity activity) {
Window win = activity.getWindow();
ViewGroup decorViewGroup = (ViewGroup) win.getDecorView();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
// check theme attrs
int[] attrs = { android.R.attr.windowTranslucentStatus,
android.R.attr.windowTranslucentNavigation };
TypedArray a = activity.obtainStyledAttributes(attrs);
try {
mStatusBarAvailable = a.getBoolean(0, false);
mNavBarAvailable = a.getBoolean(1, false);
} finally {
a.recycle();
}
// check window flags
WindowManager.LayoutParams winParams = win.getAttributes();
int bits = WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS;
if ((winParams.flags & bits) != 0) {
mStatusBarAvailable = true;
}
bits = WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION;
if ((winParams.flags & bits) != 0) {
mNavBarAvailable = true;
}
}
mConfig = new SystemBarConfig(activity, mStatusBarAvailable,
mNavBarAvailable);
// device might not have virtual navigation keys
if (!mConfig.hasNavigtionBar()) {
mNavBarAvailable = false;
}
if (mStatusBarAvailable) {
setupStatusBarView(activity, decorViewGroup);
}
if (mNavBarAvailable) {
setupNavBarView(activity, decorViewGroup);
}
}
/**
* Enable tinting of the system status bar.
*
* If the platform is running Jelly Bean or earlier, or translucent system
* UI modes have not been enabled in either the theme or via window flags,
* then this method does nothing.
*
* @param enabled
* True to enable tinting, false to disable it (default).
*/
public void setStatusBarTintEnabled(boolean enabled) {
mStatusBarTintEnabled = enabled;
if (mStatusBarAvailable) {
mStatusBarTintView
.setVisibility(enabled ? View.VISIBLE : View.GONE);
}
}
/**
* Enable tinting of the system navigation bar.
*
* If the platform does not have soft navigation keys, is running Jelly Bean
* or earlier, or translucent system UI modes have not been enabled in
* either the theme or via window flags, then this method does nothing.
*
* @param enabled
* True to enable tinting, false to disable it (default).
*/
public void setNavigationBarTintEnabled(boolean enabled) {
mNavBarTintEnabled = enabled;
if (mNavBarAvailable) {
mNavBarTintView.setVisibility(enabled ? View.VISIBLE : View.GONE);
}
}
/**
* Apply the specified color tint to all system UI bars.
*
* @param color
* The color of the background tint.
*/
public void setTintColor(int color) {
setStatusBarTintColor(color);
setNavigationBarTintColor(color);
}
/**
* Apply the specified drawable or color resource to all system UI bars.
*
* @param res
* The identifier of the resource.
*/
public void setTintResource(int res) {
setStatusBarTintResource(res);
setNavigationBarTintResource(res);
}
/**
* Apply the specified drawable to all system UI bars.
*
* @param drawable
* The drawable to use as the background, or null to remove it.
*/
public void setTintDrawable(Drawable drawable) {
setStatusBarTintDrawable(drawable);
setNavigationBarTintDrawable(drawable);
}
/**
* Apply the specified alpha to all system UI bars.
*
* @param alpha
* The alpha to use
*/
public void setTintAlpha(float alpha) {
setStatusBarAlpha(alpha);
setNavigationBarAlpha(alpha);
}
/**
* Apply the specified color tint to the system status bar.
*
* @param color
* The color of the background tint.
*/
public void setStatusBarTintColor(int color) {
if (mStatusBarAvailable) {
mStatusBarTintView.setBackgroundColor(color);
}
}
/**
* Apply the specified drawable or color resource to the system status bar.
*
* @param res
* The identifier of the resource.
*/
public void setStatusBarTintResource(int res) {
if (mStatusBarAvailable) {
mStatusBarTintView.setBackgroundResource(res);
}
}
/**
* Apply the specified drawable to the system status bar.
*
* @param drawable
* The drawable to use as the background, or null to remove it.
*/
@SuppressWarnings("deprecation")
public void setStatusBarTintDrawable(Drawable drawable) {
if (mStatusBarAvailable) {
mStatusBarTintView.setBackgroundDrawable(drawable);
}
}
/**
* Apply the specified alpha to the system status bar.
*
* @param alpha
* The alpha to use
*/
@TargetApi(11)
public void setStatusBarAlpha(float alpha) {
if (mStatusBarAvailable
&& Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
mStatusBarTintView.setAlpha(alpha);
}
}
/**
* Apply the specified color tint to the system navigation bar.
*
* @param color
* The color of the background tint.
*/
public void setNavigationBarTintColor(int color) {
if (mNavBarAvailable) {
mNavBarTintView.setBackgroundColor(color);
}
}
/**
* Apply the specified drawable or color resource to the system navigation
* bar.
*
* @param res
* The identifier of the resource.
*/
public void setNavigationBarTintResource(int res) {
if (mNavBarAvailable) {
mNavBarTintView.setBackgroundResource(res);
}
}
/**
* Apply the specified drawable to the system navigation bar.
*
* @param drawable
* The drawable to use as the background, or null to remove it.
*/
@SuppressWarnings("deprecation")
public void setNavigationBarTintDrawable(Drawable drawable) {
if (mNavBarAvailable) {
mNavBarTintView.setBackgroundDrawable(drawable);
}
}
/**
* Apply the specified alpha to the system navigation bar.
*
* @param alpha
* The alpha to use
*/
@TargetApi(11)
public void setNavigationBarAlpha(float alpha) {
if (mNavBarAvailable
&& Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
mNavBarTintView.setAlpha(alpha);
}
}
/**
* Get the system bar configuration.
*
* @return The system bar configuration for the current device
* configuration.
*/
public SystemBarConfig getConfig() {
return mConfig;
}
/**
* Is tinting enabled for the system status bar?
*
* @return True if enabled, False otherwise.
*/
public boolean isStatusBarTintEnabled() {
return mStatusBarTintEnabled;
}
/**
* Is tinting enabled for the system navigation bar?
*
* @return True if enabled, False otherwise.
*/
public boolean isNavBarTintEnabled() {
return mNavBarTintEnabled;
}
private void setupStatusBarView(Context context, ViewGroup decorViewGroup) {
mStatusBarTintView = new View(context);
LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT,
mConfig.getStatusBarHeight());
params.gravity = Gravity.TOP;
if (mNavBarAvailable && !mConfig.isNavigationAtBottom()) {
params.rightMargin = mConfig.getNavigationBarWidth();
}
mStatusBarTintView.setLayoutParams(params);
mStatusBarTintView.setBackgroundColor(DEFAULT_TINT_COLOR);
mStatusBarTintView.setVisibility(View.GONE);
decorViewGroup.addView(mStatusBarTintView);
}
private void setupNavBarView(Context context, ViewGroup decorViewGroup) {
mNavBarTintView = new View(context);
LayoutParams params;
if (mConfig.isNavigationAtBottom()) {
params = new LayoutParams(LayoutParams.MATCH_PARENT,
mConfig.getNavigationBarHeight());
params.gravity = Gravity.BOTTOM;
} else {
params = new LayoutParams(mConfig.getNavigationBarWidth(),
LayoutParams.MATCH_PARENT);
params.gravity = Gravity.RIGHT;
}
mNavBarTintView.setLayoutParams(params);
mNavBarTintView.setBackgroundColor(DEFAULT_TINT_COLOR);
mNavBarTintView.setVisibility(View.GONE);
decorViewGroup.addView(mNavBarTintView);
}
/**
* Class which describes system bar sizing and other characteristics for the
* current device configuration.
*
*/
public static class SystemBarConfig {
private static final String STATUS_BAR_HEIGHT_RES_NAME = "status_bar_height";
private static final String NAV_BAR_HEIGHT_RES_NAME = "navigation_bar_height";
private static final String NAV_BAR_HEIGHT_LANDSCAPE_RES_NAME = "navigation_bar_height_landscape";
private static final String NAV_BAR_WIDTH_RES_NAME = "navigation_bar_width";
private static final String SHOW_NAV_BAR_RES_NAME = "config_showNavigationBar";
private final boolean mTranslucentStatusBar;
private final boolean mTranslucentNavBar;
private final int mStatusBarHeight;
private final int mActionBarHeight;
private final boolean mHasNavigationBar;
private final int mNavigationBarHeight;
private final int mNavigationBarWidth;
private final boolean mInPortrait;
private final float mSmallestWidthDp;
private SystemBarConfig(Activity activity,
boolean translucentStatusBar, boolean traslucentNavBar) {
Resources res = activity.getResources();
mInPortrait = (res.getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT);
mSmallestWidthDp = getSmallestWidthDp(activity);
mStatusBarHeight = getInternalDimensionSize(res,
STATUS_BAR_HEIGHT_RES_NAME);
mActionBarHeight = getActionBarHeight(activity);
mNavigationBarHeight = getNavigationBarHeight(activity);
mNavigationBarWidth = getNavigationBarWidth(activity);
mHasNavigationBar = (mNavigationBarHeight > 0);
mTranslucentStatusBar = translucentStatusBar;
mTranslucentNavBar = traslucentNavBar;
}
@TargetApi(14)
private int getActionBarHeight(Context context) {
int result = 0;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
TypedValue tv = new TypedValue();
context.getTheme().resolveAttribute(
android.R.attr.actionBarSize, tv, true);
result = TypedValue.complexToDimensionPixelSize(tv.data,
context.getResources().getDisplayMetrics());
}
return result;
}
@TargetApi(14)
private int getNavigationBarHeight(Context context) {
Resources res = context.getResources();
int result = 0;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
if (hasNavBar(context)) {
String key;
if (mInPortrait) {
key = NAV_BAR_HEIGHT_RES_NAME;
} else {
key = NAV_BAR_HEIGHT_LANDSCAPE_RES_NAME;
}
return getInternalDimensionSize(res, key);
}
}
return result;
}
@TargetApi(14)
private int getNavigationBarWidth(Context context) {
Resources res = context.getResources();
int result = 0;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
if (hasNavBar(context)) {
return getInternalDimensionSize(res, NAV_BAR_WIDTH_RES_NAME);
}
}
return result;
}
@TargetApi(14)
private boolean hasNavBar(Context context) {
Resources res = context.getResources();
int resourceId = res.getIdentifier(SHOW_NAV_BAR_RES_NAME, "bool",
"android");
if (resourceId != 0) {
boolean hasNav = res.getBoolean(resourceId);
// check override flag (see static block)
if ("1".equals(sNavBarOverride)) {
hasNav = false;
} else if ("0".equals(sNavBarOverride)) {
hasNav = true;
}
return hasNav;
} else { // fallback
return !ViewConfiguration.get(context).hasPermanentMenuKey();
}
}
private int getInternalDimensionSize(Resources res, String key) {
int result = 0;
int resourceId = res.getIdentifier(key, "dimen", "android");
if (resourceId > 0) {
result = res.getDimensionPixelSize(resourceId);
}
return result;
}
@SuppressLint("NewApi")
private float getSmallestWidthDp(Activity activity) {
DisplayMetrics metrics = new DisplayMetrics();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
activity.getWindowManager().getDefaultDisplay()
.getRealMetrics(metrics);
} else {
activity.getWindowManager().getDefaultDisplay()
.getMetrics(metrics);
}
float widthDp = metrics.widthPixels / metrics.density;
float heightDp = metrics.heightPixels / metrics.density;
return Math.min(widthDp, heightDp);
}
/**
* Should a navigation bar appear at the bottom of the screen in the
* current device configuration? A navigation bar may appear on the
* right side of the screen in certain configurations.
*
* @return True if navigation should appear at the bottom of the screen,
* False otherwise.
*/
public boolean isNavigationAtBottom() {
return (mSmallestWidthDp >= 600 || mInPortrait);
}
/**
* Get the height of the system status bar.
*
* @return The height of the status bar (in pixels).
*/
public int getStatusBarHeight() {
return mStatusBarHeight;
}
/**
* Get the height of the action bar.
*
* @return The height of the action bar (in pixels).
*/
public int getActionBarHeight() {
return mActionBarHeight;
}
/**
* Does this device have a system navigation bar?
*
* @return True if this device uses soft key navigation, False
* otherwise.
*/
public boolean hasNavigtionBar() {
return mHasNavigationBar;
}
/**
* Get the height of the system navigation bar.
*
* @return The height of the navigation bar (in pixels). If the device
* does not have soft navigation keys, this will always return
* 0.
*/
public int getNavigationBarHeight() {
return mNavigationBarHeight;
}
/**
* Get the width of the system navigation bar when it is placed
* vertically on the screen.
*
* @return The width of the navigation bar (in pixels). If the device
* does not have soft navigation keys, this will always return
* 0.
*/
public int getNavigationBarWidth() {
return mNavigationBarWidth;
}
/**
* Get the layout inset for any system UI that appears at the top of the
* screen.
*
* @param withActionBar
* True to include the height of the action bar, False
* otherwise.
* @return The layout inset (in pixels).
*/
public int getPixelInsetTop(boolean withActionBar) {
return (mTranslucentStatusBar ? mStatusBarHeight : 0)
+ (withActionBar ? mActionBarHeight : 0);
}
/**
* Get the layout inset for any system UI that appears at the bottom of
* the screen.
*
* @return The layout inset (in pixels).
*/
public int getPixelInsetBottom() {
if (mTranslucentNavBar && isNavigationAtBottom()) {
return mNavigationBarHeight;
} else {
return 0;
}
}
/**
* Get the layout inset for any system UI that appears at the right of
* the screen.
*
* @return The layout inset (in pixels).
*/
public int getPixelInsetRight() {
if (mTranslucentNavBar && !isNavigationAtBottom()) {
return mNavigationBarWidth;
} else {
return 0;
}
}
}
}

View File

@@ -65,7 +65,7 @@ public class TitleBar extends ViewGroup implements View.OnClickListener {
setBackgroundColor(mBackgroundColor);
}
private int mBackgroundColor = getResources().getColor(R.color.white);
private int mBackgroundColor = getResources().getColor(R.color.translucent);
public TitleBar(Context context) {
super(context);

View File

@@ -1,37 +0,0 @@
package com.yizhuan.erban.base.component;
import android.content.Intent;
import android.os.Bundle;
/**
* create by lvzebiao @2019/12/24
*/
public abstract class BaseComponent implements IComponent {
@Override
public void onCreate(Bundle savedInstanceState) {
}
@Override
public void onResume() {
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
}
@Override
public void onPause() {
}
@Override
public void onDestroy() {
}
}

View File

@@ -1,21 +0,0 @@
package com.yizhuan.erban.base.component;
import android.content.Intent;
import android.os.Bundle;
/**
* create by lvzebiao @2019/12/24
*/
public interface IComponent {
void onCreate(Bundle savedInstanceState);
void onResume();
void onActivityResult(int requestCode, int resultCode, Intent data);
void onPause();
void onDestroy();
}

View File

@@ -14,7 +14,7 @@ import com.yizhuan.erban.base.BaseMvpFragment;
import com.yizhuan.xchat_android_core.Constants;
import com.yizhuan.xchat_android_core.bills.bean.BillItemEntity;
import com.yizhuan.xchat_android_core.radish.RadishModel;
import com.yizhuan.xchat_android_library.base.AbstractMvpPresenter;
import com.yizhuan.xchat_android_library.base.factory.AbstractMvpPresenter;
import com.yizhuan.xchat_android_library.base.IMvpBaseView;
import com.yizhuan.xchat_android_library.utils.TimeUtils;

View File

@@ -83,7 +83,7 @@ public class HomeMoreRoomActivity extends BaseMvpActivity<IMainFragmentView, Mai
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_home_more_room);
ButterKnife.bind(this);
initTitleBar("房间", true);
initWhiteTitleBar("房间");
initRoomTitleTab();
initRoomConcern();
}

View File

@@ -5,7 +5,7 @@ import android.annotation.SuppressLint;
import com.yizhuan.erban.pay.view.IPayView;
import com.yizhuan.xchat_android_core.pay.PayModel;
import com.yizhuan.xchat_android_core.pay.bean.WalletInfo;
import com.yizhuan.xchat_android_library.base.AbstractMvpPresenter;
import com.yizhuan.xchat_android_library.base.factory.AbstractMvpPresenter;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;

View File

@@ -26,7 +26,7 @@ public class AddUserInfoActivity extends BaseActivity {
addUserInfoFragment = new AddUserInfoFragment();
showAddUserInfo();
initTitleBar("",true);
initWhiteTitleBar("");
}
public void showAddUserInfo() {

View File

@@ -23,7 +23,6 @@ import com.yizhuan.erban.R;
import com.yizhuan.erban.base.BaseLoginAct;
import com.yizhuan.erban.ui.login.ui.CodeEditText;
import com.yizhuan.xchat_android_core.auth.AuthModel;
import com.yizhuan.xchat_android_core.auth.event.LoginEvent;
import com.yizhuan.xchat_android_core.auth.exception.BanAccountException;
import com.yizhuan.xchat_android_core.auth.exception.IsSuperAdminException;
import com.yizhuan.xchat_android_core.auth.exception.ShowPhoneCodeException;
@@ -34,14 +33,11 @@ import com.yizhuan.xchat_android_core.user.bean.UserInfo;
import com.yizhuan.xchat_android_core.user.event.NeedCompleteInfoEvent;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
import io.reactivex.Single;
import io.reactivex.SingleObserver;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.Disposable;
@@ -77,7 +73,7 @@ public class BindCodeActivity extends BaseLoginAct {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login_code);
initTitleBar("",true);
initWhiteTitleBar("");
onFindViews();
initData();
onSetListener();

View File

@@ -38,7 +38,7 @@ public class ForgetPswActivity extends BaseActivity implements View.OnClickListe
setContentView(R.layout.activity_forget_psw);
onFindViews();
onSetListener();
initTitleBar("", false);
initTitleBar("");
}
@Override

View File

@@ -40,10 +40,6 @@ public class CDKEYChargeActivity extends BaseActivity implements View.OnClickLis
charge.setOnClickListener(this);
}
@Override
protected int setBgColor() {
return R.color.white;
}
@Override
public void onClick(View v) {

View File

@@ -65,7 +65,7 @@ public class AttentionListActivity extends BaseActivity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_list_attention);
initTitleBar(getString(R.string.my_attention));
initWhiteTitleBar(getString(R.string.my_attention));
initView();
setListener();
initData();

View File

@@ -35,15 +35,15 @@ class FansListActivity : BaseActivity() {
setContentView(R.layout.activity_fans)
when (intent.getStringExtra(KEY_TYPE) ?: "") {
TYPE_ATTENTION -> {
initTitleBar(getString(R.string.my_attention))
initWhiteTitleBar(getString(R.string.my_attention))
commitF(AttentionFragment.newInstance(Constants.FAN_NO_MAIN_PAGE_TYPE))
}
TYPE_FRIEND -> {
initTitleBar(getString(R.string.friend))
initWhiteTitleBar(getString(R.string.friend))
commitF(FriendListFragment.newInstance(false, 0))
}
else -> {
initTitleBar(getString(R.string.fan))
initWhiteTitleBar(getString(R.string.fan))
commitF(FansListFragment.newInstance(Constants.FAN_NO_MAIN_PAGE_TYPE))
}
}

View File

@@ -50,26 +50,15 @@ public class SettingActivity extends BaseActivity implements View.OnClickListene
private ActivitySettingBinding settingBinding;
private WithdrawInfo withdrawInfos;
private UserInfo userInfo;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
settingBinding = DataBindingUtil.setContentView(this, R.layout.activity_setting);
settingBinding.setClick(this);
initTitleBar("设置");
initWhiteTitleBar("设置");
initView();
initData();
initListeners();
}
private void initListeners() {
}
@Override
protected void onDestroy() {
super.onDestroy();
}
@SuppressLint("CheckResult")
@@ -79,7 +68,6 @@ public class SettingActivity extends BaseActivity implements View.OnClickListene
UserModel.get().updateCurrentUserInfo()
.compose(bindToLifecycle())
.subscribe(info -> {
userInfo = info;
//刷新下界面
initView();
if (info != null && info.isBindPhone()) {
@@ -103,12 +91,10 @@ public class SettingActivity extends BaseActivity implements View.OnClickListene
private void setPhoneUI(String phone) {
settingBinding.tvPhone.setText(TextUtils.isEmpty(phone) ? "未绑定" : phone);
settingBinding.tvPhone.setTextColor(TextUtils.isEmpty(phone) ? Color.parseColor("#7154EE") : ContextCompat.getColor(this, R.color.color_999999));
}
private void setAlipayUI(String name) {
settingBinding.tvAlipay.setText(TextUtils.isEmpty(name) ? "未绑定" : name);
settingBinding.tvAlipay.setTextColor(TextUtils.isEmpty(name) ? Color.parseColor("#7154EE") : ContextCompat.getColor(this, R.color.color_999999));
}
private void initData() {
@@ -118,7 +104,6 @@ public class SettingActivity extends BaseActivity implements View.OnClickListene
@Override
public void onClick(View view) {
//super.onClick(view);
switch (view.getId()) {
case R.id.rly_content://反馈
startActivity(new Intent(getApplicationContext(), FeedbackActivity.class));
@@ -161,10 +146,6 @@ public class SettingActivity extends BaseActivity implements View.OnClickListene
startActivity(new Intent(this, BinderPhoneActivity.class));
}
break;
// case R.id.tv_bank_card:
// // 跳转到银行卡列表页面
// BankCardListActivity.start(this);
// break;
case R.id.rly_contact_us:
UIHelper.openContactUs(this);
break;
@@ -184,17 +165,6 @@ public class SettingActivity extends BaseActivity implements View.OnClickListene
case R.id.tv_black_manager:
BlackListManageActivity.start(this);
break;
// case R.id.rly_login_pwd:
// if (UserModel.get().getCacheLoginUserInfo() == null) {
// toast("无当前登录用户信息.");
// return;
// }
// if (UserModel.get().getCacheLoginUserInfo().isBindPhone()) {
// ModifyPwdActivity.start(this, ModifyPwdActivity.LOGIN_PWD);
// } else {
// startActivity(new Intent(this, BinderPhoneActivity.class));
// }
// break;
case R.id.rly_pay_pwd:
if (UserModel.get().getCacheLoginUserInfo() == null) {
toast("无当前登录用户信息.");
@@ -237,9 +207,6 @@ public class SettingActivity extends BaseActivity implements View.OnClickListene
case R.id.tv_notice_setting:
NoticeSettingActivity.start(context);
break;
// case R.id.vg_withdraw_bank_card:
// start(context, BindWithdrawBankCardActivity.class);
// break;
}
}
@@ -278,34 +245,12 @@ public class SettingActivity extends BaseActivity implements View.OnClickListene
} else {
settingBinding.rlThird.setVisibility(View.GONE);
}
// if (!cacheLoginUserInfo.isBindPasswd()) {
// settingBinding.tvModify.setText("设置");
// } else {
// settingBinding.tvModify.setText("修改");
// }
if (!cacheLoginUserInfo.isBindPaymentPwd()) {
settingBinding.tvPayModify.setText("设置");
} else {
settingBinding.tvPayModify.setText("修改");
}
//提现银行卡信息 暂时隐藏
// settingBinding.vgWithdrawBankCard.setVisibility(View.GONE);
// if (cacheLoginUserInfo.isBindBankCard()) {
// settingBinding.vgWithdrawBankCard.setVisibility(View.VISIBLE);
// String wdBankCardNum = cacheLoginUserInfo.getBankCardNum();
// if (wdBankCardNum == null) {
// wdBankCardNum = "";
// }
// String wdBankCardName = cacheLoginUserInfo.getBankCardName();
// if (wdBankCardName == null) {
// wdBankCardName = "";
// }
// settingBinding.tvWithdrawBankCard.setText(getString(R.string.text_setting_withdraw_format_bank_card_info,
// wdBankCardNum, wdBankCardName));
// }
}
public static class MissingPermissionException extends RuntimeException {
@@ -323,7 +268,6 @@ public class SettingActivity extends BaseActivity implements View.OnClickListene
protected void setStatusBar() {
super.setStatusBar();
StatusBarUtil.transparencyBar(this);
StatusBarUtil.StatusBarLightMode(this);
}
}

View File

@@ -3,8 +3,10 @@ package com.yizhuan.erban.ui.withdraw;
import android.annotation.SuppressLint;
import android.content.Intent;
import android.os.Bundle;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.text.TextUtils;
import android.text.style.ForegroundColorSpan;
import android.view.View;
@@ -322,7 +324,7 @@ public class WithdrawActivity extends BaseActivity {
zxcAccount.setText(getString(R.string.withdraw_format_bank_card_account, withdrawInfos.getBankCardNum()));
alipayName.setText(getString(R.string.withdraw_format_bank_card_name, withdrawInfos.getBankCardName()));
//用户点击修改银行卡信息
binderSucceed.setOnClickListener(v -> start(context, BindWithdrawBankCardActivity.class));
binderSucceed.setOnClickListener(v -> startActivity(new Intent(this, BindWithdrawBankCardActivity.class)));
}
}
}
@@ -494,7 +496,7 @@ public class WithdrawActivity extends BaseActivity {
.append("请先绑定银行卡",
new ForegroundColorSpan(getResources().getColor(R.color.color_FF3B30)));
getDialogManager().showOkCancelWithTitleDialog(builder.build(), "去绑定",
() -> start(context, BindWithdrawBankCardActivity.class));
() -> startActivity(new Intent(context, BindWithdrawBankCardActivity.class)));
}
@Override

View File

@@ -2,7 +2,7 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/white"/>
<solid android:color="@color/color_1c1b22"/>
<corners android:topLeftRadius="23dp"
android:bottomRightRadius="23dp"

View File

@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto">
xmlns:tools="http://schemas.android.com/tools">
<data>
@@ -13,14 +12,14 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="@color/white">
android:background="@color/color_1c1b22"
android:orientation="vertical">
<com.yizhuan.erban.base.TitleBar
android:id="@+id/title_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_23"/>
android:layout_marginTop="@dimen/dp_23" />
<ScrollView
android:layout_width="match_parent"
@@ -29,14 +28,12 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white"
android:orientation="vertical">
<RelativeLayout
android:id="@+id/rl_third"
android:layout_width="match_parent"
android:layout_height="50dp"
android:background="@color/white"
android:clickable="true"
android:focusable="true"
android:onClick="@{click}">
@@ -48,7 +45,7 @@
android:layout_centerVertical="true"
android:layout_marginStart="@dimen/dp_15"
android:text="@string/text_setting_third"
android:textColor="@color/text_color_primary"
android:textColor="@color/white"
android:textSize="@dimen/dp_14" />
<TextView
@@ -59,7 +56,7 @@
android:layout_marginEnd="@dimen/dp_14"
android:layout_toStartOf="@+id/account_right"
android:text="@string/text_setting_wx"
android:textColor="@color/color_999999"
android:textColor="@color/color_c6c6e9"
android:textSize="12sp" />
<ImageView
@@ -71,20 +68,21 @@
android:layout_marginEnd="@dimen/dp_15"
android:src="@drawable/setting_right" />
<View
android:layout_width="match_parent"
android:layout_height="1px"
android:layout_alignParentBottom="true"
android:layout_marginStart="@dimen/dp_15"
android:layout_marginEnd="15dp"
android:background="@color/color_353548" />
</RelativeLayout>
<View
android:layout_width="match_parent"
android:layout_height="1px"
android:layout_marginStart="@dimen/dp_15"
android:layout_marginEnd="15dp"
android:background="@color/color_F5F5F5" />
<RelativeLayout
android:id="@+id/rly_binder"
android:layout_width="match_parent"
android:layout_height="50dp"
android:background="@color/white"
android:clickable="true"
android:focusable="true"
android:onClick="@{click}">
@@ -95,7 +93,7 @@
android:layout_centerVertical="true"
android:layout_marginStart="@dimen/dp_15"
android:text="@string/text_setting_bind_phone"
android:textColor="@color/color_333333"
android:textColor="@color/white"
android:textSize="14sp" />
<ImageView
@@ -114,7 +112,7 @@
android:layout_centerVertical="true"
android:layout_marginEnd="@dimen/dp_14"
android:layout_toStartOf="@id/binder_right"
android:textColor="@color/color_999999"
android:textColor="@color/color_c6c6e9"
android:textSize="12sp"
tools:text="123456" />
</RelativeLayout>
@@ -124,13 +122,12 @@
android:layout_height="1px"
android:layout_marginStart="@dimen/dp_15"
android:layout_marginEnd="15dp"
android:background="@color/color_F5F5F5" />
android:background="@color/color_353548" />
<RelativeLayout
android:id="@+id/rly_alipay_binder"
android:layout_width="match_parent"
android:layout_height="50dp"
android:background="@color/white"
android:clickable="true"
android:focusable="true"
android:onClick="@{click}">
@@ -142,7 +139,7 @@
android:layout_centerVertical="true"
android:layout_marginStart="@dimen/dp_15"
android:text="@string/text_setting_bind_alipay_account"
android:textColor="@color/color_333333"
android:textColor="@color/white"
android:textSize="14sp" />
<ImageView
@@ -163,138 +160,21 @@
android:layout_toStartOf="@id/iv_alipay_right"
android:layout_toEndOf="@id/label_alipay_binder"
android:gravity="end"
android:textColor="@color/text_color_primary"
android:textColor="@color/color_c6c6e9"
android:textSize="12sp"
tools:text="未绑定" />
</RelativeLayout>
<View
android:layout_width="match_parent"
android:layout_height="1px"
android:layout_marginStart="@dimen/dp_15"
android:layout_marginEnd="15dp"
android:background="@color/color_F5F5F5" />
<!-- <android.support.constraint.ConstraintLayout-->
<!-- android:id="@+id/vg_withdraw_bank_card"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:orientation="vertical"-->
<!-- android:onClick="@{click}"-->
<!-- android:visibility="gone"-->
<!-- tools:visibility="visible">-->
<!-- <TextView-->
<!-- android:id="@+id/label_bank_card_binder"-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="@dimen/dp_height_setting_bind_info_item"-->
<!-- android:layout_centerVertical="true"-->
<!-- android:layout_marginStart="@dimen/dp_15"-->
<!-- android:gravity="center_vertical"-->
<!-- android:text="@string/text_setting_bind_bank_card_account"-->
<!-- android:textColor="@color/color_333333"-->
<!-- android:textSize="14sp"-->
<!-- app:layout_constraintStart_toStartOf="parent"-->
<!-- app:layout_constraintTop_toTopOf="parent" />-->
<!-- <TextView-->
<!-- android:id="@+id/tv_withdraw_bank_card"-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_centerVertical="true"-->
<!-- android:layout_marginEnd="@dimen/dp_15"-->
<!-- android:drawableEnd="@drawable/setting_right"-->
<!-- android:drawablePadding="@dimen/dp_14"-->
<!-- android:gravity="end"-->
<!-- android:textColor="@color/color_999999"-->
<!-- android:textSize="12sp"-->
<!-- app:layout_constraintBottom_toBottomOf="@id/label_bank_card_binder"-->
<!-- app:layout_constraintEnd_toEndOf="parent"-->
<!-- app:layout_constraintTop_toTopOf="@id/label_bank_card_binder"-->
<!-- tools:text="1234*******1234" />-->
<!-- <View-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="1px"-->
<!-- android:layout_marginStart="@dimen/dp_15"-->
<!-- android:layout_marginEnd="15dp"-->
<!-- android:background="@color/color_F5F5F5"-->
<!-- app:layout_constraintEnd_toEndOf="parent"-->
<!-- app:layout_constraintStart_toStartOf="parent"-->
<!-- app:layout_constraintTop_toBottomOf="@id/label_bank_card_binder" />-->
<!-- </android.support.constraint.ConstraintLayout>-->
<!-- <TextView-->
<!-- android:id="@+id/tv_bank_card"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="50dp"-->
<!-- android:drawableEnd="@drawable/setting_right"-->
<!-- android:gravity="center_vertical"-->
<!-- android:onClick="@{click}"-->
<!-- android:paddingLeft="@dimen/dp_15"-->
<!-- android:paddingRight="@dimen/dp_15"-->
<!-- android:text="@string/setting_text_bank_card"-->
<!-- android:textColor="@color/color_333333"-->
<!-- android:textSize="14sp" />-->
<View
android:layout_width="match_parent"
android:layout_height="10dp"
android:background="@color/color_F5F5F5" />
<!-- <RelativeLayout-->
<!-- android:id="@+id/rly_login_pwd"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="50dp"-->
<!-- android:background="@color/white"-->
<!-- android:clickable="true"-->
<!-- android:focusable="true"-->
<!-- android:onClick="@{click}">-->
<!-- <TextView-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_centerVertical="true"-->
<!-- android:layout_marginStart="@dimen/dp_15"-->
<!-- android:text="@string/text_setting_login_password"-->
<!-- android:textColor="@color/color_333333"-->
<!-- android:textSize="14sp" />-->
<!-- <ImageView-->
<!-- android:id="@+id/iv_login_arrow"-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_alignParentEnd="true"-->
<!-- android:layout_centerVertical="true"-->
<!-- android:layout_marginEnd="@dimen/dp_15"-->
<!-- android:src="@drawable/setting_right" />-->
<!-- <TextView-->
<!-- android:id="@+id/tv_modify"-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_toStartOf="@id/iv_login_arrow"-->
<!-- android:layout_centerVertical="true"-->
<!-- android:layout_marginEnd="@dimen/dp_14"-->
<!-- android:text="@string/text_modify"-->
<!-- android:textColor="@color/color_999999"-->
<!-- android:textSize="12sp" />-->
<!-- </RelativeLayout>-->
<View
android:layout_width="match_parent"
android:layout_height="1px"
android:layout_marginStart="@dimen/dp_15"
android:layout_marginEnd="15dp"
android:background="@color/color_F5F5F5" />
android:background="@color/color_353548" />
<RelativeLayout
android:id="@+id/rly_pay_pwd"
android:layout_width="match_parent"
android:layout_height="50dp"
android:background="@color/white"
android:clickable="true"
android:focusable="true"
android:onClick="@{click}">
@@ -305,7 +185,7 @@
android:layout_centerVertical="true"
android:layout_marginStart="@dimen/dp_15"
android:text="@string/text_setting_pay_password"
android:textColor="@color/color_333333"
android:textColor="@color/white"
android:textSize="14sp" />
<ImageView
@@ -321,11 +201,11 @@
android:id="@+id/tv_pay_modify"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toStartOf="@id/iv_pay_pwd_arrow"
android:layout_centerVertical="true"
android:layout_marginEnd="@dimen/dp_14"
android:layout_toStartOf="@id/iv_pay_pwd_arrow"
android:text="@string/text_modify"
android:textColor="@color/color_999999"
android:textColor="@color/color_c6c6e9"
android:textSize="12sp" />
</RelativeLayout>
@@ -334,7 +214,7 @@
android:layout_height="1px"
android:layout_marginStart="@dimen/dp_15"
android:layout_marginEnd="15dp"
android:background="@color/color_F5F5F5" />
android:background="@color/color_353548" />
<TextView
android:id="@+id/tv_privacy_setting"
@@ -346,16 +226,16 @@
android:paddingStart="@dimen/dp_15"
android:paddingEnd="@dimen/dp_15"
android:text="@string/privacy_setting"
android:visibility="gone"
android:textColor="@color/color_333333"
android:textSize="@dimen/sp_14" />
android:textColor="@color/white"
android:textSize="@dimen/sp_14"
android:visibility="gone" />
<View
android:layout_width="match_parent"
android:layout_height="1px"
android:layout_marginStart="@dimen/dp_15"
android:layout_marginEnd="15dp"
android:background="@color/color_F5F5F5" />
android:background="@color/color_353548" />
<TextView
android:id="@+id/tv_notice_setting"
@@ -367,7 +247,7 @@
android:paddingStart="@dimen/dp_15"
android:paddingEnd="@dimen/dp_15"
android:text="@string/notice_setting"
android:textColor="@color/color_333333"
android:textColor="@color/white"
android:textSize="@dimen/sp_14" />
<View
@@ -375,7 +255,7 @@
android:layout_height="1px"
android:layout_marginStart="@dimen/dp_15"
android:layout_marginEnd="15dp"
android:background="@color/color_F5F5F5" />
android:background="@color/color_353548" />
<TextView
android:id="@+id/tv_black_manager"
@@ -387,19 +267,18 @@
android:paddingLeft="@dimen/dp_15"
android:paddingRight="@dimen/dp_15"
android:text="@string/text_setting_black_management"
android:textColor="@color/color_333333"
android:textColor="@color/white"
android:textSize="14sp" />
<View
android:layout_width="match_parent"
android:layout_height="10dp"
android:background="@color/color_F5F5F5" />
android:background="@color/color_353548" />
<RelativeLayout
android:id="@+id/rly_help"
android:layout_width="match_parent"
android:layout_height="50dp"
android:background="@color/white"
android:clickable="true"
android:focusable="true"
android:onClick="@{click}">
@@ -410,7 +289,7 @@
android:layout_centerVertical="true"
android:layout_marginStart="@dimen/dp_15"
android:text="@string/text_setting_help"
android:textColor="@color/color_333333"
android:textColor="@color/white"
android:textSize="14sp" />
<ImageView
@@ -427,13 +306,12 @@
android:layout_height="1px"
android:layout_marginStart="@dimen/dp_15"
android:layout_marginEnd="15dp"
android:background="@color/color_F5F5F5" />
android:background="@color/color_353548" />
<RelativeLayout
android:id="@+id/rly_content"
android:layout_width="match_parent"
android:layout_height="50dp"
android:background="@color/white"
android:clickable="true"
android:focusable="true"
android:onClick="@{click}">
@@ -444,7 +322,7 @@
android:layout_centerVertical="true"
android:layout_marginStart="@dimen/dp_15"
android:text="@string/text_setting_feedback"
android:textColor="@color/color_333333"
android:textColor="@color/white"
android:textSize="14sp" />
<ImageView
@@ -463,40 +341,39 @@
android:layout_height="1px"
android:layout_marginStart="@dimen/dp_15"
android:layout_marginEnd="15dp"
android:background="@color/color_F5F5F5" />
android:background="@color/color_353548" />
<!-- 1.3.1 版本隐藏社区规范和联系官方 -->
<TextView
android:id="@+id/tv_community_norms"
android:layout_width="match_parent"
android:layout_height="50dp"
android:visibility="gone"
android:drawableEnd="@drawable/setting_right"
android:gravity="center_vertical"
android:onClick="@{click}"
android:paddingLeft="@dimen/dp_15"
android:paddingRight="@dimen/dp_15"
android:text="@string/text_setting_community_norms"
android:textColor="@color/color_333333"
android:textSize="14sp" />
android:textColor="@color/white"
android:textSize="14sp"
android:visibility="gone" />
<View
android:layout_width="match_parent"
android:layout_height="1px"
android:visibility="gone"
android:layout_marginStart="@dimen/dp_15"
android:layout_marginEnd="15dp"
android:background="@color/color_F5F5F5" />
android:background="@color/color_353548"
android:visibility="gone" />
<RelativeLayout
android:id="@+id/rly_contact_us"
android:layout_width="match_parent"
android:layout_height="50dp"
android:background="@color/white"
android:clickable="true"
android:visibility="gone"
android:focusable="true"
android:onClick="@{click}">
android:onClick="@{click}"
android:visibility="gone">
<TextView
android:layout_width="wrap_content"
@@ -504,7 +381,7 @@
android:layout_centerVertical="true"
android:layout_marginStart="@dimen/dp_15"
android:text="@string/text_setting_contact_us"
android:textColor="@color/color_333333"
android:textColor="@color/white"
android:textSize="14sp" />
<ImageView
@@ -517,19 +394,18 @@
</RelativeLayout>
<View
android:visibility="gone"
android:layout_width="match_parent"
android:layout_height="1px"
android:layout_marginStart="@dimen/dp_15"
android:layout_marginEnd="15dp"
android:background="@color/color_F5F5F5" />
android:background="@color/color_353548"
android:visibility="gone" />
<!-- 1.3.1 版本隐藏社区规范和联系官方 -->
<RelativeLayout
android:id="@+id/rly_clear_cache"
android:layout_width="match_parent"
android:layout_height="50dp"
android:background="@color/white"
android:clickable="true"
android:focusable="true"
android:onClick="@{click}">
@@ -540,7 +416,7 @@
android:layout_centerVertical="true"
android:layout_marginStart="@dimen/dp_15"
android:text="@string/text_setting_clear_cache"
android:textColor="@color/color_333333"
android:textColor="@color/white"
android:textSize="14sp" />
<ImageView
@@ -559,13 +435,12 @@
android:layout_height="1px"
android:layout_marginStart="@dimen/dp_15"
android:layout_marginEnd="15dp"
android:background="@color/color_F5F5F5" />
android:background="@color/color_353548" />
<RelativeLayout
android:id="@+id/rly_update"
android:layout_width="match_parent"
android:layout_height="50dp"
android:background="@color/white"
android:clickable="true"
android:focusable="true"
android:onClick="@{click}">
@@ -576,7 +451,7 @@
android:layout_centerVertical="true"
android:layout_marginStart="@dimen/dp_15"
android:text="@string/text_setting_about"
android:textColor="@color/color_333333"
android:textColor="@color/white"
android:textSize="14sp" />
<ImageView
@@ -595,13 +470,12 @@
android:layout_height="1px"
android:layout_marginStart="@dimen/dp_15"
android:layout_marginEnd="15dp"
android:background="@color/color_F5F5F5" />
android:background="@color/color_353548" />
<RelativeLayout
android:id="@+id/rly_check"
android:layout_width="match_parent"
android:layout_height="50dp"
android:background="@color/white"
android:clickable="true"
android:focusable="true"
android:onClick="@{click}">
@@ -612,7 +486,7 @@
android:layout_centerVertical="true"
android:layout_marginStart="@dimen/dp_15"
android:text="@string/text_setting_check_for_update"
android:textColor="@color/color_333333"
android:textColor="@color/white"
android:textSize="14sp" />
<TextView
@@ -634,13 +508,12 @@
android:layout_height="1px"
android:layout_marginStart="@dimen/dp_15"
android:layout_marginEnd="15dp"
android:background="@color/color_F5F5F5" />
android:background="@color/color_353548" />
<RelativeLayout
android:id="@+id/rly_lab"
android:layout_width="match_parent"
android:layout_height="50dp"
android:background="@color/white"
android:clickable="true"
android:focusable="true"
android:onClick="@{click}">
@@ -651,7 +524,7 @@
android:layout_centerVertical="true"
android:layout_marginStart="@dimen/dp_15"
android:text="@string/text_setting_lab"
android:textColor="@color/color_333333"
android:textColor="@color/white"
android:textSize="14sp" />
<ImageView
@@ -668,7 +541,7 @@
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/color_F5F5F5">
android:background="@color/color_353548">
<TextView
android:id="@+id/btn_login_out"
@@ -683,7 +556,7 @@
android:gravity="center"
android:onClick="@{click}"
android:text="@string/text_setting_logout"
android:textColor="@color/appColor"
android:textColor="@color/white"
android:textSize="14sp" />
</FrameLayout>
</LinearLayout>

View File

@@ -227,9 +227,7 @@ public class DynamicDetailActivity extends BaseActivity implements IEmoticonSele
ButterKnife.bind(this);
dynamicId = getIntent().getLongExtra(EXTRA_DYNAMIC_ID, 0L);
worldId = getIntent().getLongExtra(EXTRA_WORLD_ID, 0L);
initTitleBar("详情");
mTitleBar.setLeftImageResource(R.drawable.arrow_left_white);
mTitleBar.setTitleColor(Color.WHITE);
initWhiteTitleBar("详情");
initRecyclerView();
initView();
loadComment(true, true);

View File

@@ -1,96 +0,0 @@
package com.yizhuan.erban.public_chat_hall.msg;
import android.content.Context;
import android.os.Handler;
import androidx.recyclerview.widget.RecyclerView;
import android.text.TextUtils;
import android.text.style.ImageSpan;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.netease.nim.uikit.business.session.emoji.MoonUtil;
import com.netease.nim.uikit.business.session.helper.TeamNotificationHelper;
import com.netease.nim.uikit.common.ui.imageview.HeadImageView;
import com.netease.nimlib.sdk.msg.model.IMMessage;
import com.yizhuan.erban.R;
/**
* 新消息提醒模块
* Created by hzxuwen on 2015/6/17.
*/
public class IncomingMsgPrompt {
// 底部新消息提示条
private View newMessageTipLayout;
private TextView newMessageTipTextView;
private HeadImageView newMessageTipHeadImageView;
private Context context;
private View view;
private RecyclerView messageListView;
private BaseFetchLoadAdapter adapter;
private Handler uiHandler;
public IncomingMsgPrompt(Context context, View view, RecyclerView messageListView, BaseFetchLoadAdapter adapter,
Handler uiHandler) {
this.context = context;
this.view = view;
this.messageListView = messageListView;
this.adapter = adapter;
this.uiHandler = uiHandler;
}
// 显示底部新信息提示条
public void show(IMMessage newMessage) {
if (newMessageTipLayout == null) {
init();
}
if (!TextUtils.isEmpty(newMessage.getFromAccount())) {
newMessageTipHeadImageView.loadBuddyAvatar(newMessage.getFromAccount());
} else {
newMessageTipHeadImageView.resetImageView();
}
MoonUtil.identifyFaceExpression(context, newMessageTipTextView, TeamNotificationHelper.getMsgShowText(newMessage),
ImageSpan.ALIGN_BOTTOM);
newMessageTipLayout.setVisibility(View.VISIBLE);
uiHandler.removeCallbacks(showNewMessageTipLayoutRunnable);
uiHandler.postDelayed(showNewMessageTipLayoutRunnable, 5 * 1000);
}
public void onBackPressed() {
removeHandlerCallback();
}
// 初始化底部新信息提示条
private void init() {
ViewGroup containerView = (ViewGroup) view.findViewById(R.id.message_activity_list_view_container);
View.inflate(context, R.layout.nim_new_message_tip_layout, containerView);
newMessageTipLayout = containerView.findViewById(R.id.new_message_tip_layout);
newMessageTipLayout.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
messageListView.scrollToPosition(adapter.getBottomDataPosition());
newMessageTipLayout.setVisibility(View.GONE);
}
});
newMessageTipTextView = (TextView) newMessageTipLayout.findViewById(R.id.new_message_tip_text_view);
newMessageTipHeadImageView = (HeadImageView) newMessageTipLayout.findViewById(R.id.new_message_tip_head_image_view);
}
private Runnable showNewMessageTipLayoutRunnable = new Runnable() {
@Override
public void run() {
newMessageTipLayout.setVisibility(View.GONE);
}
};
private void removeHandlerCallback() {
if (showNewMessageTipLayoutRunnable != null) {
uiHandler.removeCallbacks(showNewMessageTipLayoutRunnable);
}
}
}

View File

@@ -1,4 +1,4 @@
package com.yizhuan.xchat_android_library.base;
package com.yizhuan.xchat_android_library.base.factory;
import android.os.Bundle;
import androidx.annotation.NonNull;
@@ -9,6 +9,9 @@ import com.trello.rxlifecycle3.LifecycleProvider;
import com.trello.rxlifecycle3.LifecycleTransformer;
import com.trello.rxlifecycle3.OutsideLifecycleException;
import com.trello.rxlifecycle3.RxLifecycle;
import com.yizhuan.xchat_android_library.BuildConfig;
import com.yizhuan.xchat_android_library.base.IMvpBaseView;
import com.yizhuan.xchat_android_library.base.PresenterEvent;
import io.reactivex.Observable;
import io.reactivex.functions.Function;
@@ -135,7 +138,7 @@ public abstract class AbstractMvpPresenter<V extends IMvpBaseView> implements Li
};
private void logInfo(String msg) {
if (AbstractMvpActivity.DEBUG)
if (BuildConfig.DEBUG)
Log.e(TAG, msg);
}

View File

@@ -3,8 +3,7 @@ package com.yizhuan.xchat_android_library.base.factory;
import android.os.Bundle;
import android.util.Log;
import com.yizhuan.xchat_android_library.base.AbstractMvpActivity;
import com.yizhuan.xchat_android_library.base.AbstractMvpPresenter;
import com.yizhuan.xchat_android_library.BuildConfig;
import com.yizhuan.xchat_android_library.base.IMvpBaseView;
@@ -138,7 +137,7 @@ public class BaseMvpProxy<V extends IMvpBaseView, P extends AbstractMvpPresenter
}
private void logInfo(String msg) {
if (AbstractMvpActivity.DEBUG)
if (BuildConfig.DEBUG)
Log.e(TAG, msg);
}
}

View File

@@ -1,6 +1,5 @@
package com.yizhuan.xchat_android_library.base.factory;
import com.yizhuan.xchat_android_library.base.AbstractMvpPresenter;
import java.lang.annotation.Inherited;
import java.lang.annotation.Retention;

View File

@@ -1,7 +1,6 @@
package com.yizhuan.xchat_android_library.base.factory;
import com.yizhuan.xchat_android_library.base.AbstractMvpPresenter;
import com.yizhuan.xchat_android_library.base.IMvpBaseView;
/**

View File

@@ -1,7 +1,6 @@
package com.yizhuan.xchat_android_library.base.factory;
import com.yizhuan.xchat_android_library.base.AbstractMvpPresenter;
import com.yizhuan.xchat_android_library.base.IMvpBaseView;
/**

View File

@@ -1,7 +1,6 @@
package com.yizhuan.xchat_android_library.base.factory;
import com.yizhuan.xchat_android_library.base.AbstractMvpPresenter;
import com.yizhuan.xchat_android_library.base.IMvpBaseView;
/**

View File

@@ -1,6 +1,7 @@
package com.netease.nim.uikit.business.session.module.list;
import androidx.recyclerview.widget.RecyclerView;
import android.view.View;
import com.netease.nim.uikit.R;
@@ -12,6 +13,7 @@ import com.netease.nim.uikit.common.ui.recyclerview.holder.BaseViewHolder;
import com.netease.nim.uikit.impl.NimUIKitImpl;
import com.netease.nimlib.sdk.msg.constant.SessionTypeEnum;
import com.netease.nimlib.sdk.msg.model.IMMessage;
import com.yizhuan.xchat_android_library.utils.LogUtil;
import java.util.HashMap;
import java.util.HashSet;
@@ -53,7 +55,9 @@ public class MsgAdapter extends BaseMultiItemFetchLoadAdapter<IMMessage, BaseVie
@Override
protected int getViewType(IMMessage message) {
try {
return holder2ViewType.get(MsgViewHolderFactory.getViewHolderByType(message));
Class<? extends MsgViewHolderBase> clazz = (MsgViewHolderFactory.getViewHolderByType(message));
LogUtil.print("MsgViewHolder=" + clazz.getSimpleName() + " --- MessageType=" + message.getMsgType().name());
return holder2ViewType.get(clazz);
} catch (Exception e) {
return 0;
}

View File

@@ -40,7 +40,7 @@ public class MsgViewHolderText extends MsgViewHolderBase {
MoonUtil.identifyFaceExpression(NimUIKit.getContext(), bodyTextView, getDisplayText(), ImageSpan.ALIGN_BOTTOM);
bodyTextView.setMovementMethod(LinkMovementMethod.getInstance());
bodyTextView.setOnLongClickListener(longClickListener);
bodyTextView.setLinkTextColor(Color.parseColor("#522f0c"));
bodyTextView.setLinkTextColor(Color.parseColor("#C6C6E9"));
}
protected String getDisplayText() {