修改公会名逻辑修改
This commit is contained in:
@@ -35,8 +35,12 @@ public class HallNameSettingActivity extends BaseMvpActivity<IHallNameView, Hall
|
||||
*/
|
||||
private final static int MAX_HALL_NAME_LIMIT = 15;
|
||||
|
||||
public static void start(Context context) {
|
||||
private long hallId;
|
||||
|
||||
public static void start(Context context,String hallName,long hallId) {
|
||||
Intent intent = new Intent(context, HallNameSettingActivity.class);
|
||||
intent.putExtra("hallName",hallName);
|
||||
intent.putExtra("hallId",hallId);
|
||||
context.startActivity(intent);
|
||||
}
|
||||
|
||||
@@ -49,8 +53,8 @@ public class HallNameSettingActivity extends BaseMvpActivity<IHallNameView, Hall
|
||||
initWhiteTitleBar("设置房间名");
|
||||
|
||||
setRightOption();
|
||||
|
||||
String hallName = HallDataManager.get().getHallName();
|
||||
hallId = getIntent().getLongExtra("hallId",0);
|
||||
String hallName = getIntent().getStringExtra("hallName");
|
||||
if (!TextUtils.isEmpty(hallName)) {
|
||||
etHallName.setTextAutoCursor(hallName);
|
||||
}
|
||||
@@ -86,13 +90,12 @@ public class HallNameSettingActivity extends BaseMvpActivity<IHallNameView, Hall
|
||||
return;
|
||||
}
|
||||
|
||||
getMvpPresenter().updateHallName(hallName);
|
||||
getMvpPresenter().updateHallName(hallName,hallId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateHallNameSuccess(String newHallName) {
|
||||
SingleToastUtil.showToastShort("保存成功");
|
||||
HallDataManager.get().updateHallName(newHallName);
|
||||
finish();
|
||||
}
|
||||
|
||||
|
@@ -108,22 +108,18 @@ public class ModuleClanActivity extends BaseActivity implements View.OnClickList
|
||||
}
|
||||
EventBus.getDefault().register(this);
|
||||
binding.nsvHall.setNestedScrollingEnabled(false);
|
||||
initClanAndHall();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
initClanAndHall();
|
||||
}
|
||||
|
||||
@SuppressLint({"CheckResult", "SetTextI18n"})
|
||||
private void initClanAndHall() {
|
||||
//没有家族才更新顶部公会名,有的话重新加载公会列表
|
||||
HallDataManager.get().registerName(this, hallName -> {
|
||||
if (TextUtils.isEmpty(hallName)) return;
|
||||
if (clanInfo == null || clanInfo.getId() == 0) {
|
||||
binding.tvTitle.setText(hallName);
|
||||
} else {
|
||||
loadHallList();
|
||||
}
|
||||
});
|
||||
|
||||
HallModel.get().getUserHallAndClan(otherUid)
|
||||
.compose(bindToLifecycle())
|
||||
.subscribe(clanAndHallInfo -> {
|
||||
@@ -263,12 +259,6 @@ public class ModuleClanActivity extends BaseActivity implements View.OnClickList
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
onReloadDate();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean needSteepStateBar() {
|
||||
return true;
|
||||
|
@@ -8,6 +8,7 @@ import android.text.SpannableString;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
|
||||
import com.netease.nim.uikit.StatusBarUtil;
|
||||
@@ -67,6 +68,9 @@ public class ModuleHallActivity extends BaseMvpActivity<IModuleHallView, ModuleH
|
||||
private long ownerUid;
|
||||
private long otherUid;
|
||||
|
||||
@Nullable
|
||||
private HallInfo hallInfo;
|
||||
|
||||
private ActivityModuleHallBinding binding;
|
||||
|
||||
public static void start(Context context, long hallId, long ownerUid, long otherUid) {
|
||||
@@ -127,24 +131,24 @@ public class ModuleHallActivity extends BaseMvpActivity<IModuleHallView, ModuleH
|
||||
setTvCount(0);
|
||||
EventBus.getDefault().register(this);
|
||||
binding.nsvHall.setNestedScrollingEnabled(false);
|
||||
initClanAndHall();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
initClanAndHall();
|
||||
loadMembers(true);
|
||||
}
|
||||
|
||||
@SuppressLint({"CheckResult", "SetTextI18n"})
|
||||
private void initClanAndHall() {
|
||||
//没有家族才更新顶部公会名,有的话重新加载公会列表
|
||||
HallDataManager.get().registerName(this, hallName -> {
|
||||
if (TextUtils.isEmpty(hallName)) return;
|
||||
binding.tvTitle.setText(hallName);
|
||||
});
|
||||
|
||||
HallModel.get().getUserHallAndClan(ownerUid)
|
||||
.compose(bindToLifecycle())
|
||||
.subscribe(clanAndHallInfo -> {
|
||||
HallInfo hallInfo = clanAndHallInfo.getHall();
|
||||
setSettingOption((HallDataManager.get().isManager() && isSelfHall) || clanAndHallInfo.isManageHall());
|
||||
if (hallInfo != null && hallInfo.getHallId() != 0) {
|
||||
this.hallInfo = hallInfo;
|
||||
binding.clHall.setVisibility(View.VISIBLE);
|
||||
binding.clHall.setOnClickListener(v -> UserInfoActivity.Companion.start(context, hallInfo.getOwnerUid()));
|
||||
binding.tvHallId.setText("房间ID:" + hallInfo.getOwnerErbanNo());
|
||||
@@ -191,12 +195,6 @@ public class ModuleHallActivity extends BaseMvpActivity<IModuleHallView, ModuleH
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onReloadDate() {
|
||||
super.onReloadDate();
|
||||
loadMembers(true);
|
||||
}
|
||||
|
||||
private long mTargetUid;
|
||||
|
||||
private void showRemoveDialog(long targetUid, int targetRoleType, String targetNick) {
|
||||
@@ -355,7 +353,11 @@ public class ModuleHallActivity extends BaseMvpActivity<IModuleHallView, ModuleH
|
||||
finish();
|
||||
break;
|
||||
case R.id.iv_setting:
|
||||
HallNameSettingActivity.start(ModuleHallActivity.this);
|
||||
if (hallInfo != null) {
|
||||
HallNameSettingActivity.start(ModuleHallActivity.this, hallInfo.getHallName(), hallId);
|
||||
} else {
|
||||
toast("加载数据中,请稍后...");
|
||||
}
|
||||
break;
|
||||
case R.id.tv_exit:
|
||||
showExitDialog();
|
||||
@@ -404,9 +406,12 @@ public class ModuleHallActivity extends BaseMvpActivity<IModuleHallView, ModuleH
|
||||
break;
|
||||
|
||||
case AuthInfo.AUTH_HALL_NAME_SET:
|
||||
HallNameSettingActivity.start(ModuleHallActivity.this);
|
||||
if (hallInfo != null) {
|
||||
HallNameSettingActivity.start(ModuleHallActivity.this, hallInfo.getHallName(), hallId);
|
||||
} else {
|
||||
toast("加载数据中,请稍后...");
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
Logger.e("本版本不能识别的权限");
|
||||
break;
|
||||
@@ -428,12 +433,6 @@ public class ModuleHallActivity extends BaseMvpActivity<IModuleHallView, ModuleH
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
onReloadDate();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean needSteepStateBar() {
|
||||
return true;
|
||||
|
@@ -9,8 +9,8 @@ import io.reactivex.disposables.Disposable;
|
||||
|
||||
public class HallNamePresenter extends BaseMvpPresenter<IHallNameView> {
|
||||
|
||||
public void updateHallName(String hallName) {
|
||||
HallNameModel.get().updateHallName(hallName)
|
||||
public void updateHallName(String hallName,long hallId) {
|
||||
HallNameModel.get().updateHallName(hallName,hallId)
|
||||
.compose(bindToLifecycle())
|
||||
.subscribe(new SingleObserver<String>() {
|
||||
@Override
|
||||
|
@@ -27,8 +27,8 @@ public class HallNameModel extends BaseModel implements IHallNameModel {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Single<String> updateHallName(String hallName) {
|
||||
return api.updateHallName(AuthModel.get().getCurrentUid(), hallName)
|
||||
public Single<String> updateHallName(String hallName,long hallId) {
|
||||
return api.updateHallName(AuthModel.get().getCurrentUid(), hallName,hallId)
|
||||
.compose(RxHelper.handleSchAndExce())
|
||||
.flatMap(response -> {
|
||||
if (response.isSuccess()) {
|
||||
@@ -49,7 +49,9 @@ public class HallNameModel extends BaseModel implements IHallNameModel {
|
||||
* 厅主id
|
||||
*/
|
||||
@POST("/hall/updateHallName")
|
||||
Single<ServiceResult> updateHallName(@Query("uid") long uid, @Query("hallName") String hallName);
|
||||
Single<ServiceResult> updateHallName(@Query("uid") long uid,
|
||||
@Query("hallName") String hallName,
|
||||
@Query("hallId") long hallId);
|
||||
|
||||
}
|
||||
}
|
||||
|
@@ -5,5 +5,5 @@ import com.yizhuan.xchat_android_core.base.IModel;
|
||||
import io.reactivex.Single;
|
||||
|
||||
public interface IHallNameModel extends IModel {
|
||||
Single<String> updateHallName(String hallName);
|
||||
Single<String> updateHallName(String hallName,long hallId);
|
||||
}
|
||||
|
Reference in New Issue
Block a user