[Modify]修改项目中可能违规的地方
This commit is contained in:
@@ -895,9 +895,6 @@
|
|||||||
<activity
|
<activity
|
||||||
android:name=".fansteam.FansTeamListActivity"
|
android:name=".fansteam.FansTeamListActivity"
|
||||||
android:screenOrientation="portrait" />
|
android:screenOrientation="portrait" />
|
||||||
<activity
|
|
||||||
android:name=".avroom.newuserchargegift.NewUserChargeGiftDialog"
|
|
||||||
android:theme="@style/dialogactivity" />
|
|
||||||
<activity
|
<activity
|
||||||
android:name=".shipantics.PullRadishActivity"
|
android:name=".shipantics.PullRadishActivity"
|
||||||
android:theme="@style/dialog_web_view_activity" />
|
android:theme="@style/dialog_web_view_activity" />
|
||||||
|
@@ -1,11 +1,8 @@
|
|||||||
package com.yizhuan.erban;
|
package com.yizhuan.erban;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.ComponentName;
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.net.Uri;
|
|
||||||
import android.provider.Settings;
|
|
||||||
|
|
||||||
import com.yizhuan.erban.audio.MyVoiceActivity;
|
import com.yizhuan.erban.audio.MyVoiceActivity;
|
||||||
import com.yizhuan.erban.audio.RecordingVoiceActivity;
|
import com.yizhuan.erban.audio.RecordingVoiceActivity;
|
||||||
@@ -36,29 +33,6 @@ import com.yizhuan.xchat_android_library.utils.ResUtil;
|
|||||||
* **************************************************************************
|
* **************************************************************************
|
||||||
*/
|
*/
|
||||||
public class UIHelper {
|
public class UIHelper {
|
||||||
//
|
|
||||||
// /**
|
|
||||||
// * 登录
|
|
||||||
// *
|
|
||||||
// * @param context
|
|
||||||
// */
|
|
||||||
// public static void showLoginAct(Context context) {
|
|
||||||
// Intent intent = new Intent(context, LoginActivity.class);
|
|
||||||
// intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
|
||||||
// intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
|
|
||||||
// context.startActivity(intent);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// /**
|
|
||||||
// * 显示 主界面
|
|
||||||
// */
|
|
||||||
// public static void showMyMainAct(Context context) {
|
|
||||||
// Intent intent = new Intent(context, Main2Activity.class);
|
|
||||||
// intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
|
||||||
// intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
|
|
||||||
// context.startActivity(intent);
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
public static void showUserGuideAct(Context mContext) {
|
public static void showUserGuideAct(Context mContext) {
|
||||||
mContext.startActivity(new Intent(mContext, UserGuideActivity.class));
|
mContext.startActivity(new Intent(mContext, UserGuideActivity.class));
|
||||||
@@ -74,11 +48,6 @@ public class UIHelper {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// public static void showUserAvatarUpdateAct(Context mContext) {
|
|
||||||
// mContext.startActivity(new Intent(mContext, UserAvatarUpdateActivity.class));
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
//修改用户资料
|
//修改用户资料
|
||||||
public static void showUserInfoModifyAct(Context mContext, long userId) {
|
public static void showUserInfoModifyAct(Context mContext, long userId) {
|
||||||
Intent intent = new Intent(mContext, UserInfoModifyActivity.class);
|
Intent intent = new Intent(mContext, UserInfoModifyActivity.class);
|
||||||
@@ -172,36 +141,6 @@ public class UIHelper {
|
|||||||
CommonWebViewActivity.start(context, cardUrl);
|
CommonWebViewActivity.start(context, cardUrl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 启动应用的设置
|
|
||||||
*
|
|
||||||
* @param context
|
|
||||||
*/
|
|
||||||
public static void startAppSettings(Context context) {
|
|
||||||
Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
|
|
||||||
intent.setData(Uri.parse("package:" + context.getPackageName()));
|
|
||||||
context.startActivity(intent);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void startOtherApp(Context context, String pkgName, String launcherActivityName) {
|
|
||||||
ComponentName componet = new ComponentName(pkgName, launcherActivityName);
|
|
||||||
//pkgName 就是第三方应用的包名
|
|
||||||
//launcherActivityName 就是第三方应用的进入的第一个Activity
|
|
||||||
Intent intent = new Intent();
|
|
||||||
intent.setComponent(componet);
|
|
||||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
|
||||||
context.startActivity(intent);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void startWeixinApp(Context context) {
|
|
||||||
startOtherApp(context, "com.tencent.mm", "com.tencent.mm.ui.LauncherUI");
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void startQQApp(Context context) {
|
|
||||||
startOtherApp(context, "com.tencent.mobileqq", "com.tencent.mobileqq.activity.SplashActivity");
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void openContactUs(Context context) {
|
public static void openContactUs(Context context) {
|
||||||
CommonWebViewActivity.start(context, UriProvider.IM_SERVER_URL + "/peko/modules/contact/contact.html");
|
CommonWebViewActivity.start(context, UriProvider.IM_SERVER_URL + "/peko/modules/contact/contact.html");
|
||||||
}
|
}
|
||||||
|
@@ -1,78 +0,0 @@
|
|||||||
package com.yizhuan.erban.avroom.firstcharge
|
|
||||||
|
|
||||||
import android.annotation.SuppressLint
|
|
||||||
import android.os.Bundle
|
|
||||||
import android.view.Gravity
|
|
||||||
import android.view.View
|
|
||||||
import android.view.WindowManager
|
|
||||||
import com.yizhuan.erban.R
|
|
||||||
import com.yizhuan.erban.base.BaseDialog
|
|
||||||
import com.yizhuan.erban.databinding.DialogSelectPayTypeBinding
|
|
||||||
import com.yizhuan.xchat_android_core.pay.PayModel
|
|
||||||
import com.yizhuan.xchat_android_library.annatation.ActLayoutRes
|
|
||||||
import com.yizhuan.xchat_android_library.utils.ResUtil
|
|
||||||
import com.yizhuan.xchat_android_library.utils.SingleToastUtil
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 充值方式选择弹窗
|
|
||||||
*/
|
|
||||||
@ActLayoutRes(R.layout.dialog_select_pay_type)
|
|
||||||
class SelectPayTypeDialog : BaseDialog<DialogSelectPayTypeBinding>() {
|
|
||||||
|
|
||||||
private val chargeProdId by lazy { requireArguments().getString("chargeProdId", "") }
|
|
||||||
private val descText by lazy { requireArguments().getString("descText", "") }
|
|
||||||
private var removeView: View? = null
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
|
|
||||||
@JvmStatic
|
|
||||||
fun newInstance(chargeProdId: String, descText: String): SelectPayTypeDialog {
|
|
||||||
return SelectPayTypeDialog().apply {
|
|
||||||
arguments = Bundle().apply {
|
|
||||||
putString("chargeProdId", chargeProdId)
|
|
||||||
putString("descText", descText)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private var payChannel = ""
|
|
||||||
|
|
||||||
override fun onStart() {
|
|
||||||
width = WindowManager.LayoutParams.MATCH_PARENT
|
|
||||||
gravity = Gravity.BOTTOM
|
|
||||||
super.onStart()
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressLint("CheckResult")
|
|
||||||
override fun init() {
|
|
||||||
PayModel.get().walletInfo
|
|
||||||
.compose(bindToLifecycle())
|
|
||||||
.subscribe({
|
|
||||||
//setWalletData(it)
|
|
||||||
}, {
|
|
||||||
SingleToastUtil.showToast(it.message)
|
|
||||||
it.printStackTrace()
|
|
||||||
})
|
|
||||||
binding.tvDesc.text = descText
|
|
||||||
|
|
||||||
binding.tvConfirm.setOnClickListener {
|
|
||||||
if (payChannel.isEmpty()) {
|
|
||||||
SingleToastUtil.showToast(ResUtil.getString(R.string.avroom_firstcharge_selectpaytypedialog_01))
|
|
||||||
return@setOnClickListener
|
|
||||||
}
|
|
||||||
dismissAllowingStateLoss()
|
|
||||||
}
|
|
||||||
|
|
||||||
binding.tvMore.setOnClickListener {
|
|
||||||
removeView?.let {
|
|
||||||
binding.rg.addView(it)
|
|
||||||
binding.tvMore.visibility = View.GONE
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
binding.ivClose.setOnClickListener {
|
|
||||||
dismissAllowingStateLoss()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,196 +0,0 @@
|
|||||||
package com.yizhuan.erban.avroom.newuserchargegift
|
|
||||||
|
|
||||||
import android.annotation.SuppressLint
|
|
||||||
import android.content.Context
|
|
||||||
import android.content.Intent
|
|
||||||
import android.view.Gravity
|
|
||||||
import android.view.View
|
|
||||||
import android.view.WindowManager
|
|
||||||
import androidx.core.view.isVisible
|
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
|
||||||
import com.netease.nim.uikit.common.util.sys.ScreenUtil
|
|
||||||
import com.netease.nim.uikit.common.util.sys.TimeUtil
|
|
||||||
import com.trello.rxlifecycle3.android.ActivityEvent
|
|
||||||
import com.yizhuan.erban.R
|
|
||||||
import com.yizhuan.erban.avroom.firstcharge.SelectPayTypeDialog
|
|
||||||
import com.yizhuan.erban.base.BaseViewBindingActivity
|
|
||||||
import com.yizhuan.erban.databinding.DialogNewUserChargeGiftBinding
|
|
||||||
import com.yizhuan.erban.ui.setting.ModifyPwdActivity
|
|
||||||
import com.yizhuan.erban.ui.utils.RVDelegate
|
|
||||||
import com.yizhuan.xchat_android_core.pay.PayModel
|
|
||||||
import com.yizhuan.xchat_android_core.pay.bean.FirstChargeGoods
|
|
||||||
import com.yizhuan.xchat_android_core.pay.bean.FirstChargeReward
|
|
||||||
import com.yizhuan.xchat_android_core.pay.event.NewUserChargeEvent
|
|
||||||
import com.yizhuan.xchat_android_core.statistic.StatisticManager
|
|
||||||
import com.yizhuan.xchat_android_core.statistic.protocol.StatisticsProtocol
|
|
||||||
import com.yizhuan.xchat_android_core.user.UserModel
|
|
||||||
import com.yizhuan.xchat_android_core.utils.CurrentTimeUtils
|
|
||||||
import com.yizhuan.xchat_android_core.utils.toast
|
|
||||||
import com.yizhuan.xchat_android_library.annatation.ActLayoutRes
|
|
||||||
import com.yizhuan.xchat_android_library.utils.ResUtil
|
|
||||||
import com.yizhuan.xchat_android_library.utils.SingleToastUtil
|
|
||||||
import io.reactivex.Observable
|
|
||||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
|
||||||
import org.greenrobot.eventbus.EventBus
|
|
||||||
import org.greenrobot.eventbus.Subscribe
|
|
||||||
import org.greenrobot.eventbus.ThreadMode
|
|
||||||
import java.util.concurrent.TimeUnit
|
|
||||||
|
|
||||||
@ActLayoutRes(R.layout.dialog_new_user_charge_gift)
|
|
||||||
class NewUserChargeGiftDialog : BaseViewBindingActivity<DialogNewUserChargeGiftBinding>() {
|
|
||||||
|
|
||||||
private var goodsList: List<FirstChargeGoods>? = null
|
|
||||||
private var currGoods: FirstChargeGoods? = null
|
|
||||||
private lateinit var rewardAdapter: RewardAdapter
|
|
||||||
private lateinit var rvDelegate: RVDelegate<FirstChargeReward>
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
@JvmStatic
|
|
||||||
fun start(context: Context) {
|
|
||||||
val starter = Intent(context, NewUserChargeGiftDialog::class.java)
|
|
||||||
context.startActivity(starter)
|
|
||||||
}
|
|
||||||
|
|
||||||
private const val BIND_CODE_GOLD = 200
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressLint("CheckResult")
|
|
||||||
override fun init() {
|
|
||||||
//這裏的height用MATCH_PARENT狀態欄會被頂上去,不知道什麽鬼
|
|
||||||
val height = ScreenUtil.screenHeight - ScreenUtil.getStatusBarHeight(context)
|
|
||||||
window.setLayout(WindowManager.LayoutParams.MATCH_PARENT, height)
|
|
||||||
window.setGravity(Gravity.CENTER)
|
|
||||||
EventBus.getDefault().register(this)
|
|
||||||
binding.rgPlan.setOnCheckedChangeListener { group, checkedId ->
|
|
||||||
updateCurrGoods(goodsList?.getOrNull(group.indexOfChild(group.findViewById(checkedId))))
|
|
||||||
}
|
|
||||||
|
|
||||||
binding.tvCharge.setOnClickListener {
|
|
||||||
currGoods?.let {
|
|
||||||
SelectPayTypeDialog.newInstance(it.chargeProdId, "¥${it.chargeMoney}")
|
|
||||||
.show(this)
|
|
||||||
StatisticManager.Instance()
|
|
||||||
.onEvent(
|
|
||||||
StatisticsProtocol.EVENT_NUGIFT_POP_CLICK,
|
|
||||||
ResUtil.getString(R.string.avroom_newuserchargegift_newuserchargegiftdialog_01),
|
|
||||||
mapOf("charge_money" to "${it.chargeMoney}元")
|
|
||||||
)
|
|
||||||
} ?: run {
|
|
||||||
"請選擇充值產品!".toast()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
rvDelegate = RVDelegate.Builder<FirstChargeReward>()
|
|
||||||
.setAdapter(RewardAdapter().also { rewardAdapter = it })
|
|
||||||
.setLayoutManager(LinearLayoutManager(this, RecyclerView.HORIZONTAL, false))
|
|
||||||
.setRecyclerView(binding.recyclerView)
|
|
||||||
.build()
|
|
||||||
|
|
||||||
dialogManager.showProgressDialog(this)
|
|
||||||
PayModel.get().newUserChargeInfo
|
|
||||||
.compose(bindToLifecycle())
|
|
||||||
.subscribe({
|
|
||||||
it.limitFirstChargeTaskList?.let { it1 -> initData(it1) }
|
|
||||||
initNewUserCharge(it.limitEndTime)
|
|
||||||
dialogManager.dismissDialog()
|
|
||||||
}, {
|
|
||||||
it.printStackTrace()
|
|
||||||
dialogManager.dismissDialog()
|
|
||||||
SingleToastUtil.showToast(it.message)
|
|
||||||
finish()
|
|
||||||
})
|
|
||||||
|
|
||||||
binding.viewBg.setOnClickListener {
|
|
||||||
//do nothing
|
|
||||||
}
|
|
||||||
val closeClick = View.OnClickListener {
|
|
||||||
finish()
|
|
||||||
StatisticManager.Instance()
|
|
||||||
.onEvent(StatisticsProtocol.EVENT_NUGIFT_POP_CLOSE_CLICK, "新人專享禮物彈窗關閉點擊")
|
|
||||||
}
|
|
||||||
binding.root.setOnClickListener(closeClick)
|
|
||||||
binding.ivClose.setOnClickListener(closeClick)
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressLint("SetTextI18n")
|
|
||||||
private fun initData(goodsList: List<FirstChargeGoods>) {
|
|
||||||
this.goodsList = goodsList
|
|
||||||
updateCurrGoods(goodsList.getOrNull(0))
|
|
||||||
val planViews = arrayListOf(
|
|
||||||
binding.rbPlanA,
|
|
||||||
binding.rbPlanB,
|
|
||||||
binding.rbPlanC,
|
|
||||||
binding.rbPlanD
|
|
||||||
)
|
|
||||||
var initChecked = false
|
|
||||||
planViews.forEachIndexed { index, button ->
|
|
||||||
goodsList.getOrNull(index)?.let {
|
|
||||||
if (!it.finishCharge && !initChecked) {
|
|
||||||
initChecked = true
|
|
||||||
button.isChecked = true
|
|
||||||
}
|
|
||||||
button.isVisible = true
|
|
||||||
button.text = "${it.chargeMoney}元"
|
|
||||||
} ?: run {
|
|
||||||
button.isVisible = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressLint("CheckResult", "SetTextI18n")
|
|
||||||
private fun initNewUserCharge(limitChargeEndTime: Long) {
|
|
||||||
val count = (limitChargeEndTime - CurrentTimeUtils.getCurrentTime()) / 1000 / 60 + 1
|
|
||||||
if (count <= 0) return
|
|
||||||
Observable.intervalRange(0, count, 0, 1, TimeUnit.MINUTES)
|
|
||||||
.compose(bindUntilEvent(ActivityEvent.DESTROY))
|
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
|
||||||
.doOnComplete {
|
|
||||||
finish()
|
|
||||||
}
|
|
||||||
.subscribe({
|
|
||||||
val residueTime =
|
|
||||||
limitChargeEndTime - CurrentTimeUtils.getCurrentTime()
|
|
||||||
if (residueTime <= 0) {
|
|
||||||
UserModel.get().cacheLoginUserInfo?.isShowLimitCharge = false
|
|
||||||
finish()
|
|
||||||
} else {
|
|
||||||
binding.tvTime.text =
|
|
||||||
"限時${TimeUtil.getElapseTimeForNewUserCharge(residueTime)}"
|
|
||||||
}
|
|
||||||
}, {
|
|
||||||
it.printStackTrace()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun updateCurrGoods(firstChargeGoods: FirstChargeGoods?) {
|
|
||||||
firstChargeGoods?.let {
|
|
||||||
currGoods = it
|
|
||||||
binding.tvTitle.text = it.chargeProdTitle
|
|
||||||
binding.tvCharge.isEnabled = !it.finishCharge
|
|
||||||
rewardAdapter.setNewData(it.firstChargeRewardList)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
|
||||||
super.onActivityResult(requestCode, resultCode, data)
|
|
||||||
dialogManager.dismissDialog()
|
|
||||||
if (resultCode != RESULT_OK) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if (requestCode == BIND_CODE_GOLD) {
|
|
||||||
ModifyPwdActivity.start(this, ModifyPwdActivity.FOGERT_PAY_PWD)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
|
||||||
fun onNewUserChargeEvent(event: NewUserChargeEvent?) {
|
|
||||||
finish()
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onDestroy() {
|
|
||||||
super.onDestroy()
|
|
||||||
EventBus.getDefault().unregister(this)
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@@ -1,78 +0,0 @@
|
|||||||
package com.yizhuan.erban.common.widget.dialog;
|
|
||||||
|
|
||||||
|
|
||||||
import android.app.Dialog;
|
|
||||||
import android.content.Context;
|
|
||||||
import android.view.Gravity;
|
|
||||||
import android.view.View;
|
|
||||||
import android.view.View.OnClickListener;
|
|
||||||
import android.view.ViewGroup;
|
|
||||||
import android.view.Window;
|
|
||||||
import android.view.WindowManager;
|
|
||||||
|
|
||||||
import com.yizhuan.erban.R;
|
|
||||||
|
|
||||||
|
|
||||||
public class LoginPopupDialog extends Dialog implements OnClickListener {
|
|
||||||
|
|
||||||
private ViewGroup mContentView;
|
|
||||||
private View mBtnRegister;
|
|
||||||
private View mBtnLogin;
|
|
||||||
private View mQQLogin;
|
|
||||||
private View mSinaLogin;
|
|
||||||
private View mWeChatLogin;
|
|
||||||
|
|
||||||
private OnLoginPopupDialogListener mL;
|
|
||||||
|
|
||||||
public LoginPopupDialog(Context context, final OnLoginPopupDialogListener l) {
|
|
||||||
super(context, R.style.Dialog_Fullscreen);
|
|
||||||
mL = l;
|
|
||||||
mContentView = (ViewGroup) View.inflate(getContext(), R.layout.layout_login_popup_dialog, null);
|
|
||||||
//mTvTitle = (TextView) mContentView.findViewById(R.id.tv_title);
|
|
||||||
mBtnRegister = mContentView.findViewById(R.id.btn_register);
|
|
||||||
mBtnLogin = mContentView.findViewById(R.id.btn_login);
|
|
||||||
// mQQLogin = mContentView.findViewById(R.id.qq_login);
|
|
||||||
// mSinaLogin = mContentView.findViewById(R.id.sina_login);
|
|
||||||
// mWeChatLogin = mContentView.findViewById(R.id.wechat_login);
|
|
||||||
mBtnRegister.setOnClickListener(this);
|
|
||||||
mBtnLogin.setOnClickListener(this);
|
|
||||||
// mQQLogin.setOnClickListener(this);
|
|
||||||
// mSinaLogin.setOnClickListener(this);
|
|
||||||
// mWeChatLogin.setOnClickListener(this);
|
|
||||||
|
|
||||||
setContentView(mContentView);
|
|
||||||
setCanceledOnTouchOutside(true);
|
|
||||||
|
|
||||||
Window window = getWindow();
|
|
||||||
WindowManager.LayoutParams params = window.getAttributes();
|
|
||||||
params.height = WindowManager.LayoutParams.WRAP_CONTENT;
|
|
||||||
window.setGravity( Gravity.BOTTOM );
|
|
||||||
window.setAttributes(params);
|
|
||||||
window.setWindowAnimations(R.style.DialogAnimation);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onClick(View arg0) {
|
|
||||||
if(arg0 == mBtnRegister){
|
|
||||||
mL.onClickRegister();
|
|
||||||
} else if(arg0 == mBtnLogin){
|
|
||||||
mL.onClickLogin();
|
|
||||||
} else if (arg0 == mQQLogin) {
|
|
||||||
mL.onClickQQ();
|
|
||||||
} else if (arg0 == mSinaLogin) {
|
|
||||||
mL.onClickWeibo();
|
|
||||||
} else if (arg0 == mWeChatLogin) {
|
|
||||||
mL.onClickWeChat();
|
|
||||||
}
|
|
||||||
dismiss();
|
|
||||||
}
|
|
||||||
|
|
||||||
public interface OnLoginPopupDialogListener{
|
|
||||||
void onClickRegister();
|
|
||||||
void onClickLogin();
|
|
||||||
void onClickWeibo();
|
|
||||||
void onClickQQ();
|
|
||||||
void onClickWeChat();
|
|
||||||
void dismissDialog();
|
|
||||||
}
|
|
||||||
}
|
|
Binary file not shown.
Before Width: | Height: | Size: 806 B |
Binary file not shown.
Before Width: | Height: | Size: 1.1 KiB |
@@ -1,163 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="center"
|
|
||||||
tools:background="@color/black_transparent_50">
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/iv_close"
|
|
||||||
android:layout_width="32dp"
|
|
||||||
android:layout_height="32dp"
|
|
||||||
android:layout_marginBottom="10dp"
|
|
||||||
android:src="@drawable/ic_new_user_charge_close"
|
|
||||||
app:layout_constraintBottom_toTopOf="@id/view_bg"
|
|
||||||
app:layout_constraintEnd_toEndOf="@id/view_bg" />
|
|
||||||
|
|
||||||
<View
|
|
||||||
android:id="@+id/view_bg"
|
|
||||||
android:layout_width="315dp"
|
|
||||||
android:layout_height="405dp"
|
|
||||||
android:background="@drawable/bg_new_user_charge_gift"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/tv_time"
|
|
||||||
android:layout_width="136dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginStart="21dp"
|
|
||||||
android:layout_marginTop="87dp"
|
|
||||||
android:gravity="center"
|
|
||||||
android:textColor="@color/white"
|
|
||||||
android:textSize="10sp"
|
|
||||||
app:layout_constraintStart_toStartOf="@id/view_bg"
|
|
||||||
app:layout_constraintTop_toTopOf="@id/view_bg"
|
|
||||||
tools:text="@string/layout_dialog_new_user_charge_gift_01" />
|
|
||||||
|
|
||||||
<RadioGroup
|
|
||||||
android:id="@+id/rg_plan"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="center_horizontal"
|
|
||||||
android:layout_marginStart="25dp"
|
|
||||||
android:layout_marginTop="128dp"
|
|
||||||
android:layout_marginEnd="25dp"
|
|
||||||
android:orientation="horizontal"
|
|
||||||
app:layout_constraintEnd_toEndOf="@id/view_bg"
|
|
||||||
app:layout_constraintStart_toStartOf="@id/view_bg"
|
|
||||||
app:layout_constraintTop_toTopOf="@id/view_bg">
|
|
||||||
|
|
||||||
<RadioButton
|
|
||||||
android:id="@+id/rb_plan_a"
|
|
||||||
android:layout_width="63dp"
|
|
||||||
android:layout_height="38dp"
|
|
||||||
android:background="@drawable/bg_new_user_charge_rb_plan"
|
|
||||||
android:button="@null"
|
|
||||||
android:gravity="center"
|
|
||||||
android:includeFontPadding="false"
|
|
||||||
android:textColor="@color/color_selector_white_false_999"
|
|
||||||
android:textSize="14sp"
|
|
||||||
tools:text="@string/layout_dialog_new_user_charge_gift_02" />
|
|
||||||
|
|
||||||
<RadioButton
|
|
||||||
android:id="@+id/rb_plan_b"
|
|
||||||
android:layout_width="63dp"
|
|
||||||
android:layout_height="38dp"
|
|
||||||
android:layout_marginStart="4dp"
|
|
||||||
android:background="@drawable/bg_new_user_charge_rb_plan"
|
|
||||||
android:button="@null"
|
|
||||||
android:checked="false"
|
|
||||||
android:gravity="center"
|
|
||||||
android:includeFontPadding="false"
|
|
||||||
android:textColor="@color/color_selector_white_false_999"
|
|
||||||
android:textSize="14sp"
|
|
||||||
tools:text="@string/layout_dialog_new_user_charge_gift_03" />
|
|
||||||
|
|
||||||
<RadioButton
|
|
||||||
android:id="@+id/rb_plan_c"
|
|
||||||
android:layout_width="63dp"
|
|
||||||
android:layout_height="38dp"
|
|
||||||
android:layout_marginStart="4dp"
|
|
||||||
android:background="@drawable/bg_new_user_charge_rb_plan"
|
|
||||||
android:button="@null"
|
|
||||||
android:checked="false"
|
|
||||||
android:gravity="center"
|
|
||||||
android:includeFontPadding="false"
|
|
||||||
android:textColor="@color/color_selector_white_false_999"
|
|
||||||
android:textSize="14sp"
|
|
||||||
tools:text="@string/layout_dialog_new_user_charge_gift_04" />
|
|
||||||
|
|
||||||
<RadioButton
|
|
||||||
android:id="@+id/rb_plan_d"
|
|
||||||
android:layout_width="63dp"
|
|
||||||
android:layout_height="38dp"
|
|
||||||
android:layout_marginStart="4dp"
|
|
||||||
android:background="@drawable/bg_new_user_charge_rb_plan"
|
|
||||||
android:button="@null"
|
|
||||||
android:checked="false"
|
|
||||||
android:gravity="center"
|
|
||||||
android:includeFontPadding="false"
|
|
||||||
android:textColor="@color/color_selector_white_false_999"
|
|
||||||
android:textSize="14sp"
|
|
||||||
tools:text="@string/layout_dialog_new_user_charge_gift_05" />
|
|
||||||
|
|
||||||
|
|
||||||
</RadioGroup>
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/tv_title"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="center_horizontal"
|
|
||||||
android:layout_marginTop="8dp"
|
|
||||||
android:includeFontPadding="false"
|
|
||||||
android:textColor="#FF3987"
|
|
||||||
android:textSize="16sp"
|
|
||||||
app:layout_constraintEnd_toEndOf="@id/view_bg"
|
|
||||||
app:layout_constraintStart_toStartOf="@id/view_bg"
|
|
||||||
app:layout_constraintTop_toBottomOf="@id/rg_plan"
|
|
||||||
tools:text="@string/layout_dialog_new_user_charge_gift_06" />
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/iv_tips"
|
|
||||||
android:layout_width="84dp"
|
|
||||||
android:layout_height="11dp"
|
|
||||||
android:layout_marginTop="10dp"
|
|
||||||
android:src="@drawable/bg_new_user_charge_tips"
|
|
||||||
app:layout_constraintEnd_toEndOf="@id/view_bg"
|
|
||||||
app:layout_constraintStart_toStartOf="@id/view_bg"
|
|
||||||
app:layout_constraintTop_toBottomOf="@id/tv_title" />
|
|
||||||
|
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
|
||||||
android:id="@+id/recycler_view"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="0dp"
|
|
||||||
android:layout_marginStart="18dp"
|
|
||||||
android:layout_marginTop="12dp"
|
|
||||||
android:layout_marginEnd="18dp"
|
|
||||||
android:layout_marginBottom="12dp"
|
|
||||||
android:clipToPadding="false"
|
|
||||||
app:layout_constrainedWidth="true"
|
|
||||||
app:layout_constraintBottom_toTopOf="@id/tv_charge"
|
|
||||||
app:layout_constraintEnd_toEndOf="@id/view_bg"
|
|
||||||
app:layout_constraintStart_toStartOf="@id/view_bg"
|
|
||||||
app:layout_constraintTop_toBottomOf="@id/iv_tips" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/tv_charge"
|
|
||||||
android:layout_width="244dp"
|
|
||||||
android:layout_height="44dp"
|
|
||||||
android:layout_marginBottom="28dp"
|
|
||||||
android:background="@drawable/bg_sekector_new_user_charge_charge_btn"
|
|
||||||
android:enabled="false"
|
|
||||||
app:layout_constraintBottom_toBottomOf="@id/view_bg"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent" />
|
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
||||||
|
|
@@ -1,116 +0,0 @@
|
|||||||
<layout xmlns:android="http://schemas.android.com/apk/res/android">
|
|
||||||
|
|
||||||
<data>
|
|
||||||
|
|
||||||
</data>
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:background="@drawable/shape_white_top_10dp"
|
|
||||||
android:orientation="vertical">
|
|
||||||
|
|
||||||
<FrameLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="10dp">
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/iv_close"
|
|
||||||
android:layout_width="40dp"
|
|
||||||
android:layout_height="40dp"
|
|
||||||
android:layout_marginStart="5dp"
|
|
||||||
android:scaleType="center"
|
|
||||||
android:src="@drawable/ic_pwd_close" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="center"
|
|
||||||
android:text="@string/layout_dialog_select_pay_type_01"
|
|
||||||
android:textColor="@color/color_666666"
|
|
||||||
android:textSize="16sp" />
|
|
||||||
|
|
||||||
</FrameLayout>
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/tv_desc"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="center_horizontal"
|
|
||||||
android:layout_marginTop="20dp"
|
|
||||||
android:text="¥60"
|
|
||||||
android:textColor="@color/color_333333"
|
|
||||||
android:textSize="28sp" />
|
|
||||||
|
|
||||||
|
|
||||||
<RadioGroup
|
|
||||||
android:id="@+id/rg"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="30dp"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:paddingStart="30dp"
|
|
||||||
android:paddingEnd="30dp"
|
|
||||||
android:visibility="invisible">
|
|
||||||
|
|
||||||
<RadioButton
|
|
||||||
android:id="@+id/rb_alipay"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="50dp"
|
|
||||||
android:layout_marginTop="10dp"
|
|
||||||
android:background="@color/transparent"
|
|
||||||
android:button="@null"
|
|
||||||
android:drawableStart="@drawable/ic_ali_charge"
|
|
||||||
android:drawableEnd="@drawable/selector_check_box_pic_check"
|
|
||||||
android:drawablePadding="10dp"
|
|
||||||
android:text="@string/layout_dialog_select_pay_type_02"
|
|
||||||
android:textColor="@color/color_333333"
|
|
||||||
android:textSize="15sp" />
|
|
||||||
|
|
||||||
<RadioButton
|
|
||||||
android:id="@+id/rb_wechat"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="50dp"
|
|
||||||
android:layout_marginTop="10dp"
|
|
||||||
android:background="@color/transparent"
|
|
||||||
android:button="@null"
|
|
||||||
android:drawableStart="@drawable/ic_wechat_charge"
|
|
||||||
android:drawableEnd="@drawable/selector_check_box_pic_check"
|
|
||||||
android:drawablePadding="10dp"
|
|
||||||
android:text="@string/layout_dialog_select_pay_type_03"
|
|
||||||
android:textColor="@color/color_333333"
|
|
||||||
android:textSize="15sp" />
|
|
||||||
|
|
||||||
</RadioGroup>
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/tv_more"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="50dp"
|
|
||||||
android:layout_gravity="center_horizontal"
|
|
||||||
android:layout_marginTop="10dp"
|
|
||||||
android:drawableEnd="@drawable/ic_charge_arrow"
|
|
||||||
android:drawablePadding="4dp"
|
|
||||||
android:gravity="center"
|
|
||||||
android:text="@string/layout_dialog_select_pay_type_04"
|
|
||||||
android:textColor="@color/color_666666"
|
|
||||||
android:textSize="@dimen/dp_13"
|
|
||||||
android:visibility="gone" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/tv_confirm"
|
|
||||||
android:layout_width="225dp"
|
|
||||||
android:layout_height="45dp"
|
|
||||||
android:layout_gravity="center_horizontal"
|
|
||||||
android:layout_marginStart="15dp"
|
|
||||||
android:layout_marginTop="40dp"
|
|
||||||
android:layout_marginBottom="15dp"
|
|
||||||
android:background="@drawable/selector_common_confirm"
|
|
||||||
android:gravity="center"
|
|
||||||
android:text="@string/layout_dialog_select_pay_type_05"
|
|
||||||
android:textColor="@color/white"
|
|
||||||
android:textSize="15sp" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
</layout>
|
|
@@ -1,43 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:background="@color/white"
|
|
||||||
android:baselineAligned="false"
|
|
||||||
android:orientation="vertical">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/tv_title"
|
|
||||||
style="@style/popup_dialog_text"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginBottom="15dp"
|
|
||||||
android:layout_marginTop="20dp"
|
|
||||||
android:text="@string/layout_layout_login_popup_dialog_01"
|
|
||||||
android:textColor="@color/common_color_7"
|
|
||||||
android:textSize="@dimen/long_text_tips_fnt" />
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginBottom="13dp"
|
|
||||||
android:background="@color/white"
|
|
||||||
android:baselineAligned="false"
|
|
||||||
android:gravity="center_horizontal"
|
|
||||||
android:orientation="horizontal">
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/btn_register"
|
|
||||||
style="@style/HalfInverseBtn"
|
|
||||||
android:layout_marginRight="6dp"
|
|
||||||
android:text="@string/layout_layout_login_popup_dialog_02"/>
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/btn_login"
|
|
||||||
|
|
||||||
style="@style/HalfPrimaryBtn"
|
|
||||||
android:layout_marginLeft="6dp"
|
|
||||||
android:text="@string/layout_layout_login_popup_dialog_03"/>
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
</LinearLayout>
|
|
@@ -1202,15 +1202,6 @@ public class AuthModel extends BaseModel implements IAuthModel {
|
|||||||
@Field("yiDunToken") String yiDunToken,
|
@Field("yiDunToken") String yiDunToken,
|
||||||
@Field("shuMeiDeviceId") String shuMeiDeviceId);
|
@Field("shuMeiDeviceId") String shuMeiDeviceId);
|
||||||
|
|
||||||
/**
|
|
||||||
* Peko上耳伴老用户用 QQ 登录时,判断 QQ 的 open id 是否存在
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@FormUrlEncoded
|
|
||||||
@POST("/acc/third/isExistsQqAccount")
|
|
||||||
Single<ServiceResult<String>> isExistsQqAccount(@Field("qqOpenid") String qqOpenid);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否绑定手机
|
* 是否绑定手机
|
||||||
|
@@ -1,27 +0,0 @@
|
|||||||
package com.yizhuan.xchat_android_core.auth.exception;
|
|
||||||
|
|
||||||
import com.yizhuan.xchat_android_core.bean.response.ServiceResult;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 当请求 /acc/third/isExistsQqAccount 的时候,如果对应的 openid 不存在数据库里,则
|
|
||||||
* 返回 {"code":6616,"message":ResUtil.getString(R.string.auth_exception_oldmemberexception_01)},于是抛出这个
|
|
||||||
*/
|
|
||||||
public class OldMemberException extends Exception {
|
|
||||||
|
|
||||||
private ServiceResult<String> data;
|
|
||||||
private String openid;
|
|
||||||
|
|
||||||
public OldMemberException(ServiceResult<String> data, String openid) {
|
|
||||||
super();
|
|
||||||
this.data = data;
|
|
||||||
this.openid = openid;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ServiceResult<String> getData() {
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getOpenid() {
|
|
||||||
return openid;
|
|
||||||
}
|
|
||||||
}
|
|
@@ -308,7 +308,7 @@ public class ShareModel extends BaseModel implements IShareModel {
|
|||||||
sp.setText(XChatConstants.SHARE_TEAM_TEXT);
|
sp.setText(XChatConstants.SHARE_TEAM_TEXT);
|
||||||
sp.setTitle(XChatConstants.SHARE_TEAM_TITLE + "“" + title + "”");
|
sp.setTitle(XChatConstants.SHARE_TEAM_TITLE + "“" + title + "”");
|
||||||
sp.setImageUrl(teamIcon);
|
sp.setImageUrl(teamIcon);
|
||||||
//QQ空间分享
|
|
||||||
sp.setSite(XChatConstants.SHARE_TEAM_TEXT);
|
sp.setSite(XChatConstants.SHARE_TEAM_TEXT);
|
||||||
final String siteUrl = shareLink + "?shareUid=" + String.valueOf(AuthModel.get().getCurrentUid())
|
final String siteUrl = shareLink + "?shareUid=" + String.valueOf(AuthModel.get().getCurrentUid())
|
||||||
+ "&familyId=" + familyId;
|
+ "&familyId=" + familyId;
|
||||||
|
@@ -1,88 +0,0 @@
|
|||||||
package com.yizhuan.xchat_android_core.community.download;
|
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
import androidx.annotation.Nullable;
|
|
||||||
|
|
||||||
import com.liulishuo.okdownload.DownloadSerialQueue;
|
|
||||||
import com.liulishuo.okdownload.DownloadTask;
|
|
||||||
import com.liulishuo.okdownload.core.cause.EndCause;
|
|
||||||
import com.liulishuo.okdownload.core.cause.ResumeFailedCause;
|
|
||||||
import com.liulishuo.okdownload.core.listener.DownloadListener1;
|
|
||||||
import com.liulishuo.okdownload.core.listener.assist.Listener1Assist;
|
|
||||||
import com.yizhuan.xchat_android_core.R;
|
|
||||||
import com.yizhuan.xchat_android_core.base.BaseModel;
|
|
||||||
import com.yizhuan.xchat_android_library.utils.ResUtil;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
|
|
||||||
import io.reactivex.Single;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* create by lvzebiao @2019/11/22
|
|
||||||
*/
|
|
||||||
public class DownloadModel extends BaseModel implements IDownloadModel {
|
|
||||||
|
|
||||||
|
|
||||||
private static final class Helper {
|
|
||||||
public static final DownloadModel INSTANCE = new DownloadModel();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static DownloadModel get() {
|
|
||||||
return Helper.INSTANCE;
|
|
||||||
}
|
|
||||||
|
|
||||||
private DownloadSerialQueue serialQueue;
|
|
||||||
private DownloadTask downloadTask;
|
|
||||||
|
|
||||||
private DownloadModel() {
|
|
||||||
serialQueue = new DownloadSerialQueue();
|
|
||||||
}
|
|
||||||
|
|
||||||
public Single<String> download(String url, String dir, String fileName) {
|
|
||||||
return Single.create(emitter -> {
|
|
||||||
downloadTask = new DownloadTask.Builder(url, dir, fileName)
|
|
||||||
.setMinIntervalMillisCallbackProcess(100)
|
|
||||||
.setPassIfAlreadyCompleted(false)
|
|
||||||
.setAutoCallbackToUIThread(true)
|
|
||||||
.build();
|
|
||||||
serialQueue.setListener(new DownloadListener1() {
|
|
||||||
@Override
|
|
||||||
public void taskStart(@NonNull DownloadTask task, @NonNull Listener1Assist.Listener1Model model) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void retry(@NonNull DownloadTask task, @NonNull ResumeFailedCause cause) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void connected(@NonNull DownloadTask task, int blockCount, long currentOffset, long totalLength) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void progress(@NonNull DownloadTask task, long currentOffset, long totalLength) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void taskEnd(@NonNull DownloadTask task, @NonNull EndCause cause, @Nullable Exception realCause, @NonNull Listener1Assist.Listener1Model model) {
|
|
||||||
if (cause != EndCause.COMPLETED) {
|
|
||||||
emitter.onError(new Throwable(ResUtil.getString(R.string.community_download_downloadmodel_01)));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
File file = new File(dir, fileName);
|
|
||||||
if (file.exists()) {
|
|
||||||
emitter.onSuccess("");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
emitter.onError(new Throwable(ResUtil.getString(R.string.community_download_downloadmodel_02)));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
serialQueue.enqueue(downloadTask);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
@@ -1,10 +0,0 @@
|
|||||||
package com.yizhuan.xchat_android_core.community.download;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* create by lvzebiao @2019/11/22
|
|
||||||
*/
|
|
||||||
public interface IDownloadModel {
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
@@ -11,14 +11,6 @@ import io.reactivex.Single;
|
|||||||
*/
|
*/
|
||||||
public interface IUpgradeModel {
|
public interface IUpgradeModel {
|
||||||
|
|
||||||
/**
|
|
||||||
* 下载最新版本
|
|
||||||
*
|
|
||||||
* @param downLoadListener
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
Single<String> downloadNewVersion(UpgradeModel.DownLoadListener downLoadListener);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取最新版本信息,后台会根据我们的公参获取到我们的版本号渠道号
|
* 获取最新版本信息,后台会根据我们的公参获取到我们的版本号渠道号
|
||||||
*
|
*
|
||||||
@@ -26,10 +18,6 @@ public interface IUpgradeModel {
|
|||||||
*/
|
*/
|
||||||
Single<NewestVersionInfo> checkUpgrade();
|
Single<NewestVersionInfo> checkUpgrade();
|
||||||
|
|
||||||
boolean isDownloading();
|
|
||||||
|
|
||||||
void stopDownload();
|
|
||||||
|
|
||||||
void setHasShowDialog(boolean flag);
|
void setHasShowDialog(boolean flag);
|
||||||
|
|
||||||
boolean isHasShowDialog();
|
boolean isHasShowDialog();
|
||||||
|
@@ -1,22 +1,5 @@
|
|||||||
package com.yizhuan.xchat_android_core.upgrade.model;
|
package com.yizhuan.xchat_android_core.upgrade.model;
|
||||||
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.net.Uri;
|
|
||||||
import android.os.Build;
|
|
||||||
import android.os.Environment;
|
|
||||||
import android.text.TextUtils;
|
|
||||||
import android.util.Log;
|
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
import androidx.annotation.Nullable;
|
|
||||||
import androidx.core.content.FileProvider;
|
|
||||||
|
|
||||||
import com.liulishuo.okdownload.DownloadSerialQueue;
|
|
||||||
import com.liulishuo.okdownload.DownloadTask;
|
|
||||||
import com.liulishuo.okdownload.core.cause.EndCause;
|
|
||||||
import com.liulishuo.okdownload.core.cause.ResumeFailedCause;
|
|
||||||
import com.liulishuo.okdownload.core.listener.DownloadListener1;
|
|
||||||
import com.liulishuo.okdownload.core.listener.assist.Listener1Assist;
|
|
||||||
import com.yizhuan.xchat_android_core.R;
|
import com.yizhuan.xchat_android_core.R;
|
||||||
import com.yizhuan.xchat_android_core.base.BaseModel;
|
import com.yizhuan.xchat_android_core.base.BaseModel;
|
||||||
import com.yizhuan.xchat_android_core.bean.response.ServiceResult;
|
import com.yizhuan.xchat_android_core.bean.response.ServiceResult;
|
||||||
@@ -24,12 +7,6 @@ import com.yizhuan.xchat_android_core.upgrade.bean.NewestVersionInfo;
|
|||||||
import com.yizhuan.xchat_android_core.utils.net.RxHelper;
|
import com.yizhuan.xchat_android_core.utils.net.RxHelper;
|
||||||
import com.yizhuan.xchat_android_library.net.rxnet.RxNet;
|
import com.yizhuan.xchat_android_library.net.rxnet.RxNet;
|
||||||
import com.yizhuan.xchat_android_library.utils.ResUtil;
|
import com.yizhuan.xchat_android_library.utils.ResUtil;
|
||||||
import com.yizhuan.xchat_android_library.utils.codec.MD5Utils;
|
|
||||||
import com.yizhuan.xchat_android_library.utils.config.BasicConfig;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.Objects;
|
|
||||||
|
|
||||||
import io.reactivex.Single;
|
import io.reactivex.Single;
|
||||||
import io.reactivex.SingleSource;
|
import io.reactivex.SingleSource;
|
||||||
@@ -45,13 +22,6 @@ public class UpgradeModel extends BaseModel implements IUpgradeModel {
|
|||||||
|
|
||||||
private static final String TAG = "UpgradeModel";
|
private static final String TAG = "UpgradeModel";
|
||||||
|
|
||||||
private NewestVersionInfo newestVersionInfo;
|
|
||||||
private DownloadSerialQueue serialQueue;
|
|
||||||
private DownloadTask downloadTask;
|
|
||||||
|
|
||||||
private DownLoadListener downLoadListener;
|
|
||||||
private boolean isDownloading = false;
|
|
||||||
|
|
||||||
private final Api api;
|
private final Api api;
|
||||||
private static IUpgradeModel model;
|
private static IUpgradeModel model;
|
||||||
|
|
||||||
@@ -74,133 +44,8 @@ public class UpgradeModel extends BaseModel implements IUpgradeModel {
|
|||||||
|
|
||||||
private UpgradeModel() {
|
private UpgradeModel() {
|
||||||
api = RxNet.create(Api.class);
|
api = RxNet.create(Api.class);
|
||||||
serialQueue = new DownloadSerialQueue(new DownloadListener1() {
|
|
||||||
@Override
|
|
||||||
public void taskStart(@NonNull DownloadTask task, @NonNull Listener1Assist.Listener1Model model) {
|
|
||||||
Log.e(TAG, "taskStart() called with: task = [" + task + "], model = [" + model + "]");
|
|
||||||
if (task.getId() != downloadTask.getId()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (downLoadListener == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
downLoadListener.onStart();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void retry(@NonNull DownloadTask task, @NonNull ResumeFailedCause cause) {
|
|
||||||
Log.e(TAG, "retry() called with: task = [" + task + "], cause = [" + cause + "]");
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void connected(@NonNull DownloadTask task, int blockCount, long currentOffset, long totalLength) {
|
|
||||||
Log.e(TAG, "connected() called with: task = [" + task + "], blockCount = [" + blockCount + "], currentOffset = [" + currentOffset + "], totalLength = [" + totalLength + "]");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void progress(@NonNull DownloadTask task, long currentOffset, long totalLength) {
|
|
||||||
Log.e(TAG, "progress() called with: task = [" + task + "], currentOffset = [" + currentOffset + "], totalLength = [" + totalLength + "]");
|
|
||||||
if (task.getId() != downloadTask.getId()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (downLoadListener == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
downLoadListener.onProgress(currentOffset, totalLength);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void taskEnd(@NonNull DownloadTask task, @NonNull EndCause cause, @Nullable Exception realCause, @NonNull Listener1Assist.Listener1Model model) {
|
|
||||||
Log.e(TAG, "taskEnd() called with: task = [" + task + "], cause = [" + cause + "], realCause = [" + realCause + "], model = [" + model + "]");
|
|
||||||
if (task.getId() != downloadTask.getId()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
downloadTask = null;
|
|
||||||
if (downLoadListener == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (cause != EndCause.COMPLETED) {
|
|
||||||
if (realCause != null) {
|
|
||||||
downLoadListener.onError(ResUtil.getString(R.string.upgrade_model_upgrademodel_01));
|
|
||||||
} else {
|
|
||||||
downLoadListener.onError(ResUtil.getString(R.string.upgrade_model_upgrademodel_02));
|
|
||||||
}
|
|
||||||
downLoadListener = null;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
String downloadFileMD5 = MD5Utils.getFileMD5String(task.getFile());
|
|
||||||
if (Objects.equals(downloadFileMD5, newestVersionInfo.getUpdateFileMd5())) {
|
|
||||||
downLoadListener.onComplete(task.getFile());
|
|
||||||
installApp(task.getFile());
|
|
||||||
} else {
|
|
||||||
downLoadListener.onError(ResUtil.getString(R.string.upgrade_model_upgrademodel_03));
|
|
||||||
}
|
|
||||||
downLoadListener = null;
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
downLoadListener.onError(e.getMessage());
|
|
||||||
downLoadListener = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 安装
|
|
||||||
*/
|
|
||||||
private void installApp(File file) {
|
|
||||||
try {
|
|
||||||
Intent install = new Intent(Intent.ACTION_VIEW);
|
|
||||||
install.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
|
||||||
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
|
||||||
install.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
|
|
||||||
Uri contentUri = FileProvider.getUriForFile(getContext(), getContext().getPackageName() + ".fileprovider", file);
|
|
||||||
install.setDataAndType(contentUri, "application/vnd.android.package-archive");
|
|
||||||
} else {
|
|
||||||
install.setDataAndType(Uri.fromFile(file), "application/vnd.android.package-archive");
|
|
||||||
}
|
|
||||||
BasicConfig.INSTANCE.getAppContext().startActivity(install);
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 下载新版本
|
|
||||||
*
|
|
||||||
* @param downLoadListener
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public Single<String> downloadNewVersion(DownLoadListener downLoadListener) {
|
|
||||||
if (null == newestVersionInfo || TextUtils.isEmpty(newestVersionInfo.getUpdateDownloadLink())) {
|
|
||||||
return Single.error(new Throwable(ResUtil.getString(R.string.upgrade_model_upgrademodel_04)));
|
|
||||||
}
|
|
||||||
if (downloadTask != null) {
|
|
||||||
return Single.error(new Throwable(ResUtil.getString(R.string.upgrade_model_upgrademodel_05)));
|
|
||||||
}
|
|
||||||
|
|
||||||
this.downLoadListener = downLoadListener;
|
|
||||||
downloadTask = new DownloadTask.Builder(newestVersionInfo.getUpdateDownloadLink(),
|
|
||||||
Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS))
|
|
||||||
.setFilenameFromResponse(true)
|
|
||||||
.setMinIntervalMillisCallbackProcess(100)
|
|
||||||
.setPassIfAlreadyCompleted(false)
|
|
||||||
.setAutoCallbackToUIThread(true)
|
|
||||||
.build();
|
|
||||||
serialQueue.enqueue(downloadTask);
|
|
||||||
|
|
||||||
return Single.just(ResUtil.getString(R.string.upgrade_model_upgrademodel_06));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取最新版本信息,后台会根据我们的公参获取到我们的版本号渠道号
|
* 获取最新版本信息,后台会根据我们的公参获取到我们的版本号渠道号
|
||||||
*
|
*
|
||||||
@@ -210,38 +55,18 @@ public class UpgradeModel extends BaseModel implements IUpgradeModel {
|
|||||||
public Single<NewestVersionInfo> checkUpgrade() {
|
public Single<NewestVersionInfo> checkUpgrade() {
|
||||||
return api.loadNewestVersion()
|
return api.loadNewestVersion()
|
||||||
.compose(RxHelper.handleSchedulers())
|
.compose(RxHelper.handleSchedulers())
|
||||||
.flatMap(new Function<ServiceResult<NewestVersionInfo>, SingleSource<NewestVersionInfo>>() {
|
.flatMap((Function<ServiceResult<NewestVersionInfo>, SingleSource<NewestVersionInfo>>) respone -> {
|
||||||
@Override
|
if (respone.isSuccess() && respone.getData() == null) {
|
||||||
public SingleSource<NewestVersionInfo> apply(ServiceResult<NewestVersionInfo> respone) throws Exception {
|
return Single.error(new Throwable(ResUtil.getString(R.string.upgrade_model_upgrademodel_07)));
|
||||||
if (respone.isSuccess() && respone.getData() == null) {
|
|
||||||
return Single.error(new Throwable(ResUtil.getString(R.string.upgrade_model_upgrademodel_07)));
|
|
||||||
}
|
|
||||||
if (respone.isSuccess() && respone.getData() != null) {
|
|
||||||
newestVersionInfo = respone.getData();
|
|
||||||
return Single.just(respone.getData());
|
|
||||||
}
|
|
||||||
return Single.error(new Throwable(respone.getMessage()));
|
|
||||||
}
|
}
|
||||||
|
if (respone.isSuccess() && respone.getData() != null) {
|
||||||
|
return Single.just(respone.getData());
|
||||||
|
}
|
||||||
|
return Single.error(new Throwable(respone.getMessage()));
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isDownloading() {
|
|
||||||
if (downloadTask == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return serialQueue.getWorkingTaskId() != 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void stopDownload() {
|
|
||||||
if (downloadTask != null) {
|
|
||||||
downloadTask.cancel();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setHasShowDialog(boolean flag) {
|
public void setHasShowDialog(boolean flag) {
|
||||||
this.hasShowDialog = flag;
|
this.hasShowDialog = flag;
|
||||||
@@ -252,17 +77,6 @@ public class UpgradeModel extends BaseModel implements IUpgradeModel {
|
|||||||
return hasShowDialog;
|
return hasShowDialog;
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface DownLoadListener {
|
|
||||||
public void onStart();
|
|
||||||
|
|
||||||
public void onComplete(File file);
|
|
||||||
|
|
||||||
public void onProgress(long currentOffset, long totalLength);
|
|
||||||
|
|
||||||
public void onError(String reason);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private interface Api {
|
private interface Api {
|
||||||
/**
|
/**
|
||||||
* 获取最新版本信息
|
* 获取最新版本信息
|
||||||
|
Reference in New Issue
Block a user