Commit 0c737d5a authored by jyx's avatar jyx

首页新增微转分享

parent 3c9214ac
......@@ -627,6 +627,8 @@
# webView处理,项目中没有使用到webView忽略即可,webview与JS交互内部类不能混淆
-keepclassmembers class com.show.you.WebVerfiedActivity$MyHandler {*;}
-keepattributes *JavascriptInterface*
-keep public class com.mints.goodmoney.ui.fragment.WzFragment.JsObject.**
# ======================= 微转分享 END ================
......
......@@ -100,4 +100,14 @@ public class AppConfig {
*/
public static boolean needReportClickAdEvent = false;
/**
* 首页是显示微转
*/
public static boolean isMainShowWz = true;
/**
* 微转金币
*/
public static int wzReadCoin = 300;
}
......@@ -63,17 +63,18 @@ object Constant {
/**
* app应用首页 0-主页 1-横屏视频 2-pan 3-friends 4-我
*/
const val FRAGMENT_CLICK_MAIN = 0
const val FRAGMENT_CLICK_CHANNEL = 1
const val FRAGMENT_CLICK_PAN = 2
const val FRAGMENT_CLICK_FRIENDS = 3
const val FRAGMENT_CLICK_MY = 4
const val FRAGMENT_TAG_MAIN = "FRAGMENT_TAG_MAIN"
const val FRAGMENT_TAG_CHANNEL = "FRAGMENT_TAG_CHANNEL"
const val FRAGMENT_TAG_PAN = "FRAGMENT_TAG_PAN"
const val FRAGMENT_TAG_FRIENDS = "FRAGMENT_TAG_FRIENDS"
const val FRAGMENT_TAG_MY = "FRAGMENT_TAG_MY"
const val FRAGMENT_CLICK_ONE = 0
const val FRAGMENT_CLICK_TWO = 1
const val FRAGMENT_CLICK_THREE = 2
const val FRAGMENT_CLICK_FOUR = 3
const val FRAGMENT_CLICK_FIVE = 4
const val FRAGMENT_TAG_ONE = "FRAGMENT_TAG_ONE"
const val FRAGMENT_TAG_TWO = "FRAGMENT_TAG_TWO"
const val FRAGMENT_TAG_THREE = "FRAGMENT_TAG_THREE"
const val FRAGMENT_TAG_FOUR = "FRAGMENT_TAG_FOUR"
const val FRAGMENT_TAG_FIVE = "FRAGMENT_TAG_FIVE"
const val FRAGMENT_TAG_RSNEWS = "FRAGMENT_TAG_RSNEWS"
// 协议地址
......
......@@ -4,7 +4,6 @@ package com.mints.goodmoney.manager;
import android.text.TextUtils;
import com.mints.goodmoney.MintsApplication;
import com.mints.goodmoney.common.AppConfig;
import com.mints.goodmoney.mvp.presenters.TrackPresenter;
/**
......@@ -98,4 +97,10 @@ public class TrackManager {
trackPresenter.getCommonHallBaseMsg();
}
}
public void firstApiWithUid() {
if (trackPresenter != null) {
trackPresenter.firstApiWithUid();
}
}
}
......@@ -106,4 +106,19 @@ public class TzTaskBean {
this.currentPkgName = currentPkgName;
}
@Override
public String toString() {
return "TzTaskBean{" +
"icon='" + icon + '\'' +
", title='" + title + '\'' +
", description='" + description + '\'' +
", app_url='" + app_url + '\'' +
", isShCpd=" + isShCpd +
", coralAd=" + coralAd +
", trackerBean=" + trackerBean +
", coin=" + coin +
", state=" + state +
", currentPkgName='" + currentPkgName + '\'' +
'}';
}
}
......@@ -7,6 +7,7 @@ public class UserTaskMsgBean implements Serializable {
private OfflineBean offline;
private UserMsgBean userMsg;
private ShareNewsBean shareNews;
private VedioRulesBean vedioRules;
private BlessingBigMsgBean blessingBigMsg;
private UserRiskAppsBean userRiskApps;
......@@ -29,10 +30,30 @@ public class UserTaskMsgBean implements Serializable {
return blessingBigMsg;
}
public ShareNewsBean getShareNews() {
return shareNews;
}
public void setShareNews(ShareNewsBean shareNews) {
this.shareNews = shareNews;
}
public void setBlessingBigMsgBean(BlessingBigMsgBean blessingBigMsg) {
this.blessingBigMsg = blessingBigMsg;
}
public class ShareNewsBean implements Serializable {
private int readCoin;
public int getReadCoin() {
return readCoin;
}
public void setReadCoin(int readCoin) {
this.readCoin = readCoin;
}
}
public class BlessingBigMsgBean implements Serializable {
private int doubleCoin;
private int surplusCount;
......
......@@ -73,8 +73,11 @@ open class MyPresenter : BasePresenter<MyView>() {
}
fun getAutoUserHallBaseMsg() {
val vo = HashMap<String, Any>()
vo["isAndroid10"] = TextUtils.isEmpty(DeviceInfo.instance.iMEI)
AppHttpManager.getInstance(loanApplication)
.call(loanService.autoUserHallBaseMsg, object : BaseSubscriber<BaseResponse<MyInfo>>() {
.call(loanService.getAutoUserHallBaseMsg(vo), object : BaseSubscriber<BaseResponse<MyInfo>>() {
override fun onCompleted() {
if (isLinkView)
......
package com.mints.goodmoney.mvp.presenters
import android.text.TextUtils
import com.google.gson.Gson
import com.google.gson.JsonObject
import com.mints.goodmoney.common.DeviceInfo
import com.mints.goodmoney.manager.AppHttpManager
import com.mints.goodmoney.manager.CpdManager
import com.mints.goodmoney.mvp.model.BaseResponse
import com.mints.goodmoney.mvp.model.CpdModelBean
import com.mints.goodmoney.mvp.views.TaskView
import com.mints.goodmoney.net.CpdService
import com.mints.goodmoney.utils.LogUtil
import com.mints.library.net.neterror.BaseSubscriber
import com.mints.library.net.neterror.Throwable
class TaskPresenter : BasePresenter<TaskView>() {
fun getShCpdTime() {
val vo = HashMap<String, Any>()
vo["isAndroid10"] = TextUtils.isEmpty(DeviceInfo.instance.iMEI)
view.showLoading("加载中...")
AppHttpManager.getInstance(loanApplication)
.call(loanService.shCpdTime,
.call(loanService.getShCpdTime(vo),
object : BaseSubscriber<BaseResponse<JsonObject>>() {
override fun onCompleted() {
}
override fun onError(e: Throwable) {
}
override fun onError(e: Throwable) {}
override fun onNext(baseResponse: BaseResponse<JsonObject>) {
if (isLinkView) return
......@@ -36,7 +39,6 @@ class TaskPresenter : BasePresenter<TaskView>() {
view.getShCpdTimeSuc(data.get("needSeconds").asInt, data.get("CPD").asInt, data.get("CPD_SYD").asInt)
}
}
else -> view.showToast(message)
}
}
})
......@@ -66,7 +68,6 @@ class TaskPresenter : BasePresenter<TaskView>() {
}
override fun onError(e: Throwable) {
LogUtil.d("" + e.code + " -> " + e.message)
view.getCpdModelFail()
}
......@@ -78,10 +79,11 @@ class TaskPresenter : BasePresenter<TaskView>() {
val data = response.data
if (data != null) {
view.getCpdModelSuc(data)
} else {
view.getCpdModelFail()
}
} else {
view.getCpdModelFail()
view.showToast(response.message)
}
}
......
package com.mints.goodmoney.mvp.presenters;
import com.google.gson.JsonObject;
import com.mints.goodmoney.common.AppConfig;
import com.mints.goodmoney.common.Constant;
import com.mints.goodmoney.manager.AppHttpManager;
......@@ -183,4 +184,40 @@ public class TrackPresenter extends BaseTrackPresenter {
}
});
}
/**
* 首页是否显示微转
*/
public void firstApiWithUid() {
HashMap<String, Object> vo = new HashMap<>();
vo.put("param", "param");
AppHttpManager.getInstance(loanApplication)
.call(loanService.firstApiWithUid(vo),
new BaseSubscriber<BaseResponse<JsonObject>>() {
@Override
public void onCompleted() {
}
@Override
public void onError(Throwable e) {
}
@Override
public void onNext(BaseResponse<JsonObject> baseResponse) {
try {
if (baseResponse.getStatus() == 200) {
JsonObject data = baseResponse.getData();
if (data != null) {
AppConfig.isMainShowWz = data.get("showCallShow").getAsBoolean();
} else {
AppConfig.isMainShowWz = false;
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
}
......@@ -397,8 +397,8 @@ public interface LoanService {
*
* @return
*/
@POST("api/getAutoUserHallBaseMsg")
Observable<BaseResponse<MyInfo>> getAutoUserHallBaseMsg();
@POST("api/114/getAutoUserHallBaseMsg")
Observable<BaseResponse<MyInfo>> getAutoUserHallBaseMsg(@Body Map<String, Object> vo);
/**
* 饭补
......@@ -533,8 +533,8 @@ public interface LoanService {
*
* @return
*/
@POST("api/getCPDBaseMsg")
Observable<BaseResponse<JsonObject>> getShCpdTime();
@POST("api/114/getCPDBaseMsg")
Observable<BaseResponse<JsonObject>> getShCpdTime(@Body Map<String, Object> vo);
/**
* 获取用户配置信息
......@@ -549,9 +549,8 @@ public interface LoanService {
*
* @return
*/
// @Headers({"domain_name: domain_musesmobi"})
@POST("api/cpd/1/detail/default")
Observable<BaseResponse<JsonObject>> getCpdDetail(@HeaderMap Map<String, String> headers, @Body Map<String, Object> vo);
@POST("api//firstApiWithUid")
Observable<BaseResponse<JsonObject>> firstApiWithUid(@Body Map<String, Object> vo);
/**
* 默认http工厂
......
......@@ -5,7 +5,6 @@ import android.media.MediaPlayer
import android.os.Bundle
import android.text.TextUtils
import android.view.View
import android.widget.VideoView
import com.downloader.Error
import com.downloader.OnDownloadListener
import com.downloader.PRDownloader
......
......@@ -18,7 +18,6 @@ import com.mints.goodmoney.manager.ZhangyueManager
import com.mints.goodmoney.mvp.views.MainView
import com.mints.goodmoney.ui.activitys.base.BaseActivity
import com.mints.goodmoney.ui.fragment.*
import com.mints.goodmoney.utils.IPUtil
import kotlinx.android.synthetic.main.activity_main.*
/**
......@@ -34,9 +33,13 @@ class MainActivity : BaseActivity(), MainView, View.OnClickListener {
// 底部标签切换的Fragment
private var moneyFragment: Fragment? = null
private var panFragment: Fragment? = null
private var friendsFragment: Fragment? = null
// private var friendsFragment: Fragment? = null
private var myFragment: Fragment? = null
private var channelFragment: Fragment? = null
private var kuYinyueFragment: Fragment? = null
private var wzFragment: Fragment? = null
private var currentFragment: Fragment? = null
override fun getContentViewLayoutID() = R.layout.activity_main
......@@ -49,6 +52,7 @@ class MainActivity : BaseActivity(), MainView, View.OnClickListener {
if (moneyFragment == null) {
moneyFragment = MoneyFragment()
}
if (!moneyFragment!!.isAdded) {
// 提交事务
supportFragmentManager.beginTransaction()
......@@ -57,14 +61,21 @@ class MainActivity : BaseActivity(), MainView, View.OnClickListener {
// 记录当前Fragment
currentFragment = moneyFragment
}
tab_iv_main.isSelected = true
tab_tv_main.isSelected = true
tab_rl_main.setOnClickListener(this)
tab_rl_pan.setOnClickListener(this)
tab_rl_channel.setOnClickListener(this)
tab_rl_friends.setOnClickListener(this)
tab_rl_my.setOnClickListener(this)
if (AppConfig.isMainShowWz) {
tab_tv_four.text = "新闻分享"
} else {
tab_tv_four.text = "来电秀"
}
tab_iv_one.isSelected = true
tab_tv_one.isSelected = true
tab_rl_one.setOnClickListener(this)
tab_rl_three.setOnClickListener(this)
tab_rl_two.setOnClickListener(this)
tab_rl_four.setOnClickListener(this)
tab_rl_five.setOnClickListener(this)
}
override fun isApplyKitKatTranslucency() = false
......@@ -111,11 +122,11 @@ class MainActivity : BaseActivity(), MainView, View.OnClickListener {
override fun onClick(view: View) {
when (view.id) {
R.id.tab_rl_main -> clickTab1Layout()
R.id.tab_rl_channel -> clickTab2Layout()
R.id.tab_rl_friends -> clickTab4Layout()
R.id.tab_rl_pan -> clickTab3Layout()
R.id.tab_rl_my -> clickTab5Layout()
R.id.tab_rl_one -> clickTab1Layout()
R.id.tab_rl_two -> clickTab2Layout()
R.id.tab_rl_four -> clickTab4Layout()
R.id.tab_rl_three -> clickTab3Layout()
R.id.tab_rl_five -> clickTab5Layout()
}
}
......@@ -123,22 +134,22 @@ class MainActivity : BaseActivity(), MainView, View.OnClickListener {
* 点击第一个tab
*/
fun clickTab1Layout() {
AppConfig.fragmentClickFlag = Constant.FRAGMENT_CLICK_MAIN
AppConfig.fragmentClickFlag = Constant.FRAGMENT_CLICK_ONE
if (moneyFragment == null) {
moneyFragment = MoneyFragment()
}
addOrShowFragment(supportFragmentManager, moneyFragment!!, Constant.FRAGMENT_TAG_MAIN)
addOrShowFragment(supportFragmentManager, moneyFragment!!, Constant.FRAGMENT_TAG_ONE)
tab_iv_main.isSelected = true
tab_tv_main.isSelected = true
tab_iv_channel.isSelected = false
tab_tv_channel.isSelected = false
// tab_iv_pan.isSelected = false
// tab_tv_pan.isSelected = false
tab_iv_friends.isSelected = false
tab_tv_friends.isSelected = false
tab_iv_my.isSelected = false
tab_tv_my.isSelected = false
tab_iv_one.isSelected = true
tab_tv_one.isSelected = true
tab_iv_two.isSelected = false
tab_tv_two.isSelected = false
// tab_iv_three.isSelected = false
// tab_tv_three.isSelected = false
tab_iv_four.isSelected = false
tab_tv_four.isSelected = false
tab_iv_five.isSelected = false
tab_tv_five.isSelected = false
}
fun selectVedio() {
......@@ -169,22 +180,22 @@ class MainActivity : BaseActivity(), MainView, View.OnClickListener {
/**
* 点击第二个tab
*/
public fun clickTab2Layout() {
AppConfig.fragmentClickFlag = Constant.FRAGMENT_CLICK_CHANNEL
fun clickTab2Layout() {
AppConfig.fragmentClickFlag = Constant.FRAGMENT_CLICK_TWO
if (channelFragment == null) {
channelFragment = HorizonChannelFragment()
}
addOrShowFragment(supportFragmentManager, channelFragment!!, Constant.FRAGMENT_TAG_CHANNEL)
tab_iv_main.isSelected = false
tab_tv_main.isSelected = false
tab_iv_channel.isSelected = true
tab_tv_channel.isSelected = true
// tab_iv_pan.isSelected = false
// tab_tv_pan.isSelected = false
tab_iv_friends.isSelected = false
tab_tv_friends.isSelected = false
tab_iv_my.isSelected = false
tab_tv_my.isSelected = false
addOrShowFragment(supportFragmentManager, channelFragment!!, Constant.FRAGMENT_TAG_TWO)
tab_iv_one.isSelected = false
tab_tv_one.isSelected = false
tab_iv_two.isSelected = true
tab_tv_two.isSelected = true
// tab_iv_three.isSelected = false
// tab_tv_three.isSelected = false
tab_iv_four.isSelected = false
tab_tv_four.isSelected = false
tab_iv_five.isSelected = false
tab_tv_five.isSelected = false
}
......@@ -192,63 +203,75 @@ class MainActivity : BaseActivity(), MainView, View.OnClickListener {
* 点击第四个tab
*/
fun clickTab4Layout() {
AppConfig.fragmentClickFlag = Constant.FRAGMENT_CLICK_FRIENDS
if (friendsFragment == null) {
friendsFragment = FriendsFragment()
}
addOrShowFragment(supportFragmentManager, friendsFragment!!, Constant.FRAGMENT_TAG_FRIENDS)
tab_iv_main.isSelected = false
tab_tv_main.isSelected = false
tab_iv_channel.isSelected = false
tab_tv_channel.isSelected = false
// tab_iv_pan.isSelected = false
// tab_tv_pan.isSelected = false
tab_iv_friends.isSelected = true
tab_tv_friends.isSelected = true
tab_iv_my.isSelected = false
tab_tv_my.isSelected = false
// 是否显示微转
if (AppConfig.isMainShowWz) {
AppConfig.fragmentClickFlag = Constant.FRAGMENT_CLICK_FOUR
if (wzFragment == null) {
wzFragment = WzFragment()
}
addOrShowFragment(supportFragmentManager, wzFragment!!, Constant.FRAGMENT_TAG_FOUR)
} else {
AppConfig.fragmentClickFlag = Constant.FRAGMENT_CLICK_FOUR
if (kuYinyueFragment == null) {
kuYinyueFragment = KuYinYueFragment()
}
addOrShowFragment(supportFragmentManager, kuYinyueFragment!!, Constant.FRAGMENT_TAG_FOUR)
}
tab_iv_one.isSelected = false
tab_tv_one.isSelected = false
tab_iv_two.isSelected = false
tab_tv_two.isSelected = false
// tab_iv_three.isSelected = false
// tab_tv_three.isSelected = false
tab_iv_four.isSelected = true
tab_tv_four.isSelected = true
tab_iv_five.isSelected = false
tab_tv_five.isSelected = false
}
/**
* 点击第三个tab
*/
private fun clickTab3Layout() {
AppConfig.fragmentClickFlag = Constant.FRAGMENT_CLICK_PAN
AppConfig.fragmentClickFlag = Constant.FRAGMENT_CLICK_THREE
if (panFragment == null) {
panFragment = PanFragment()
}
addOrShowFragment(supportFragmentManager, panFragment!!, Constant.FRAGMENT_TAG_PAN)
tab_iv_main.isSelected = false
tab_tv_main.isSelected = false
tab_iv_channel.isSelected = false
tab_tv_channel.isSelected = false
// tab_iv_pan.isSelected = true
// tab_tv_pan.isSelected = true
tab_iv_friends.isSelected = false
tab_tv_friends.isSelected = false
tab_iv_my.isSelected = false
tab_tv_my.isSelected = false
addOrShowFragment(supportFragmentManager, panFragment!!, Constant.FRAGMENT_TAG_THREE)
tab_iv_one.isSelected = false
tab_tv_one.isSelected = false
tab_iv_two.isSelected = false
tab_tv_two.isSelected = false
// tab_iv_three.isSelected = true
// tab_tv_three.isSelected = true
tab_iv_four.isSelected = false
tab_tv_four.isSelected = false
tab_iv_five.isSelected = false
tab_tv_five.isSelected = false
}
/**
* 点击第五个tab
*/
private fun clickTab5Layout() {
AppConfig.fragmentClickFlag = Constant.FRAGMENT_CLICK_MY
AppConfig.fragmentClickFlag = Constant.FRAGMENT_CLICK_FIVE
if (myFragment == null) {
myFragment = MyFragment()
}
addOrShowFragment(supportFragmentManager, myFragment!!, Constant.FRAGMENT_TAG_MY)
tab_iv_main.isSelected = false
tab_tv_main.isSelected = false
tab_iv_channel.isSelected = false
tab_tv_channel.isSelected = false
// tab_iv_pan.isSelected = false
// tab_tv_pan.isSelected = false
tab_iv_friends.isSelected = false
tab_tv_friends.isSelected = false
tab_iv_my.isSelected = true
tab_tv_my.isSelected = true
addOrShowFragment(supportFragmentManager, myFragment!!, Constant.FRAGMENT_TAG_FIVE)
tab_iv_one.isSelected = false
tab_tv_one.isSelected = false
tab_iv_two.isSelected = false
tab_tv_two.isSelected = false
// tab_iv_three.isSelected = false
// tab_tv_three.isSelected = false
tab_iv_four.isSelected = false
tab_tv_four.isSelected = false
tab_iv_five.isSelected = true
tab_tv_five.isSelected = true
}
/**
......@@ -270,11 +293,11 @@ class MainActivity : BaseActivity(), MainView, View.OnClickListener {
currentFragment = fragment
}
fun showShortVedioLayout(){
fun showShortVedioLayout() {
if (AppConfig.showAdFlag) {
tab_rl_channel.visibility = View.VISIBLE
tab_rl_two.visibility = View.VISIBLE
} else {
tab_rl_channel.visibility = View.GONE
tab_rl_two.visibility = View.GONE
}
}
}
\ No newline at end of file
......@@ -65,6 +65,7 @@ class SplashYlhActivity : BaseActivity(), SplashADListener {
return
}
TrackManager.getInstance().getCommonHallBaseMsg()
TrackManager.getInstance().firstApiWithUid()
// 校验APP签名
checkAppSign()
......
......@@ -35,7 +35,6 @@ import com.tz.sdk.coral.callback.h5.DownloadProcess
import kotlinx.android.synthetic.main.activity_task.*
import kotlinx.android.synthetic.main.header_layout.*
/**
*
* 描述:试玩任务
......@@ -150,8 +149,6 @@ class TaskActivity : BaseActivity(), TaskView,
shMax = CPD
cpdMax = CPD_SYD
isTwiceGetCpd = false
if ((shMax + cpdMax) <= 0) {
hideLoading()
showToast("今日任务已完成,请明日再试")
......@@ -159,13 +156,23 @@ class TaskActivity : BaseActivity(), TaskView,
return
}
isTwiceGetCpd = false
shLoadCountTime = 0
cpdLoadCountTime = 0
mFakeTaskList.clear()
if (shMax > 0 && (cpdMax > 0 || cpdMax == 0)) {
for (i in 0 until shMax) {
mCoralDownload?.pull()
}
} else if (cpdMax > 0) {
for (i in 0 until cpdMax) {
loadCPDData()
}
}
}
override fun getCpdModelSuc(dataBean: CpdModelBean.DataBean) {
......@@ -177,9 +184,10 @@ class TaskActivity : BaseActivity(), TaskView,
}
LogUtil.d(TAG_LOG, "CPD -> getCpdModelSuc CPD-PKG -> " + dataBean.materials[0].app_apk_name)
LogUtil.d(TAG_LOG, "CPD -> getCpdModelSuc cpdLoadCountTime -> " + cpdLoadCountTime)
// 多拉取的CPD广告
if (cpdLoadCountTime++ == cpdMax - 1) {
if (cpdLoadCountTime++ >= cpdMax - 1) {
getCpdRepeatPkg()
}
}
......@@ -189,12 +197,14 @@ class TaskActivity : BaseActivity(), TaskView,
*/
private fun getCpdRepeatPkg() {
if (isTwiceGetCpd) {
LogUtil.d("isTwiceGetCpd")
if (cpdLoadCountTime >= cpdMax) {
LogUtil.d("BBBBBB")
notifyDataAndShowAd()
}
return
}
var thatCpdLoadCountTime = cpdMax
cpdLoadCountTime = cpdMax
RxjavaUtil.executeRxTask<MutableList<TzTaskBean>>(object : CommonRxTask<MutableList<TzTaskBean>>() {
override fun doInIOThread() {
......@@ -205,19 +215,26 @@ class TaskActivity : BaseActivity(), TaskView,
if (mFakeTaskList[i].isShCpd) {
newPkgData.add(mFakeTaskList[i])
} else {
var flag = true
for (j in 0 until mFakeTaskList.size) {
if (!mFakeTaskList[j].isShCpd && !mFakeTaskList[i].isShCpd) {
if (mFakeTaskList[j].currentPkgName == mFakeTaskList[i].currentPkgName) {
// 是否已经安装此app
if (!DeviceInfo.instance.isLoadingPkg(mFakeTaskList[j].currentPkgName)) {
newPkgData.add(mFakeTaskList[j])
} else {
thatCpdLoadCountTime--
if (!mFakeTaskList[i].isShCpd && !mFakeTaskList[j].isShCpd) {
// 数据重复
if (i != j && mFakeTaskList[i].currentPkgName == mFakeTaskList[j].currentPkgName) {
flag = false
break
}
} else {
thatCpdLoadCountTime--
}
}
if (flag) {
// 是否已经安装此app
if (!DeviceInfo.instance.isLoadingPkg(mFakeTaskList[i].currentPkgName)) {
cpdLoadCountTime--
newPkgData.add(mFakeTaskList[i])
}
}
}
}
......@@ -231,17 +248,19 @@ class TaskActivity : BaseActivity(), TaskView,
mFakeTaskList.clear()
mFakeTaskList.addAll(t)
LogUtil.d("列表数据" + "-->" + mFakeTaskList.size)
LogUtil.d("列表数据" + "-->" + t.size)
LogUtil.d("thatCpdLoadCountTime" + "-->" + thatCpdLoadCountTime)
LogUtil.d("thatCpdLoadCountTime-->$cpdLoadCountTime")
// 重新获取数据
if (thatCpdLoadCountTime < cpdMax - 1) {
if (cpdLoadCountTime in 1..cpdMax) {
isTwiceGetCpd = true
for (i in thatCpdLoadCountTime until cpdMax) {
for (i in 0 until cpdLoadCountTime) {
loadCPDData()
}
cpdLoadCountTime = cpdMax - cpdLoadCountTime
return
} else {
notifyDataAndShowAd()
......@@ -252,15 +271,19 @@ class TaskActivity : BaseActivity(), TaskView,
})
}
fun notifyDataAndShowAd() {
private fun notifyDataAndShowAd() {
hideLoading()
srl_task.finishRefresh()
mTaskAdapter?.notifyDataSetChanged()
for (tzTaskBean in mFakeTaskList) {
if (!tzTaskBean.isShCpd) {
val trackerBean = tzTaskBean.trackerBean
if (trackerBean != null) {
LogUtil.d("AAAAA")
LogUtil.d(TAG_LOG, "CPD -> show")
// 上报CPD显示
......@@ -271,8 +294,10 @@ class TaskActivity : BaseActivity(), TaskView,
}
override fun getCpdModelFail() {
if (cpdLoadCountTime++ >= cpdMax - 1) {
notifyDataAndShowAd()
}
}
override fun onRefresh(refreshLayout: RefreshLayout) {
loadData()
......@@ -288,7 +313,12 @@ class TaskActivity : BaseActivity(), TaskView,
}
// 多拉取的广告
if (shLoadCountTime++ == shMax - 1) {
if (shLoadCountTime++ >= shMax - 1) {
if (cpdMax == 0) {
notifyDataAndShowAd()
return
}
for (i in 0 until cpdMax) {
loadCPDData()
}
......@@ -298,10 +328,15 @@ class TaskActivity : BaseActivity(), TaskView,
override fun onLoadFail() {
// 次数刷新完 且未拿到数据 提示
if (mFakeTaskList.size == 0) {
hideLoading()
// showToast("加载失败,请下拉刷新重试")
srl_task.finishRefresh(false)
if (shLoadCountTime++ >= shMax - 1) {
if (cpdMax == 0) {
notifyDataAndShowAd()
return
}
for (i in 0 until cpdMax) {
loadCPDData()
}
}
}
......
......@@ -161,7 +161,7 @@ class FriendsFragment : BaseFragment(), FriendsView, OnRefreshListener, View.OnC
override fun onResume() {
super.onResume()
if (AppConfig.fragmentClickFlag == Constant.FRAGMENT_CLICK_FRIENDS) {
if (AppConfig.fragmentClickFlag == Constant.FRAGMENT_CLICK_FOUR) {
if (!TextUtils.isEmpty(UserManager.getInstance().userID)) {
// 刷新分红数据
friendsPresenter.getFriendHallMsg()
......
......@@ -85,7 +85,7 @@ class HorizonChannelFragment : BaseFragment(), HorizChannelView, View.OnClickLis
override fun onResume() {
super.onResume()
if (AppConfig.fragmentClickFlag == Constant.FRAGMENT_CLICK_CHANNEL) {
if (AppConfig.fragmentClickFlag == Constant.FRAGMENT_CLICK_TWO) {
// 调用金币视频信息接口
horizChannelPresenter.getSmallHomeVedioBaseMsg()
......@@ -105,7 +105,7 @@ class HorizonChannelFragment : BaseFragment(), HorizChannelView, View.OnClickLis
override fun onPause() {
super.onPause()
if (AppConfig.fragmentClickFlag == Constant.FRAGMENT_CLICK_CHANNEL) {
if (AppConfig.fragmentClickFlag == Constant.FRAGMENT_CLICK_TWO) {
YLPlayerConfig.config().unRegisterPlayerCallback()
}
// 福袋动画停止
......
......@@ -52,7 +52,7 @@ class LiebaoGameFragment : LazyLoadBaseFragment(), GameView,
override fun onFragmentResume() {
super.onFragmentResume()
if (AppConfig.fragmentClickFlag == Constant.FRAGMENT_CLICK_MAIN) {
if (AppConfig.fragmentClickFlag == Constant.FRAGMENT_CLICK_ONE) {
gvGameLiebao.inflate(activity)
LogUtil.d("LiebaoGameFragment","onFragmentResume")
gamePresenter.getGameInfo()
......
......@@ -131,7 +131,7 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener {
override fun onResume() {
super.onResume()
if (AppConfig.fragmentClickFlag == Constant.FRAGMENT_CLICK_MAIN) {
if (AppConfig.fragmentClickFlag == Constant.FRAGMENT_CLICK_ONE) {
if (!TextUtils.isEmpty(userManager?.userID)) {
homePresenter.getHallBaseMsg()
} else {
......@@ -162,7 +162,7 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener {
override fun onPause() {
super.onPause()
if (AppConfig.fragmentClickFlag == Constant.FRAGMENT_CLICK_MAIN) {
if (AppConfig.fragmentClickFlag == Constant.FRAGMENT_CLICK_ONE) {
YLPlayerConfig.config().unRegisterPlayerCallback()
}
// 福袋动画停止
......@@ -214,6 +214,10 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener {
userMsgBean = data
if (userMsgBean?.shareNews != null) {
AppConfig.wzReadCoin = userMsgBean!!.shareNews.readCoin
}
// 保存Ip,用于穿山甲回调校验
ps.put(Constant.CSJ_VEDIO_APPIP, data.ip)
AppConfig.app_black_name = data.userRiskApps.userRiskAppName
......
......@@ -28,10 +28,10 @@ class MoneyFragment : BaseFragment(), XTabLayout.OnTabSelectedListener {
private var currentFragment: Fragment? = null
private var mainFragment: Fragment? = null
private var bookStoreFragment: Fragment? = null
private var newsFragment: Fragment? = null
// private var newsFragment: Fragment? = null
private var xmlyGameFragment: Fragment? = null
private var liebaoGameFragment: Fragment? = null
private var kuYinyueFragment: Fragment? = null
// private var kuYinyueFragment: Fragment? = null
private var curPosition = 0//当前标签选中的下标
......@@ -186,7 +186,6 @@ class MoneyFragment : BaseFragment(), XTabLayout.OnTabSelectedListener {
addOrShowFragment(childFragmentManager, xmlyGameFragment!!, FRAGMENT_TAG_XMLY)
}
}
1 -> {
if (AppConfig.showAdFlag) {
......@@ -213,18 +212,18 @@ class MoneyFragment : BaseFragment(), XTabLayout.OnTabSelectedListener {
}
addOrShowFragment(childFragmentManager, xmlyGameFragment!!, FRAGMENT_TAG_XMLY)
}
// 3 -> {
// if (liebaoGameFragment == null) {
// liebaoGameFragment = LiebaoGameFragment()
// }
// addOrShowFragment(childFragmentManager, liebaoGameFragment!!, FRAGMENT_TAG_GAME)
// }
3 -> {
if (kuYinyueFragment == null) {
kuYinyueFragment = KuYinYueFragment()
if (liebaoGameFragment == null) {
liebaoGameFragment = LiebaoGameFragment()
}
addOrShowFragment(childFragmentManager, kuYinyueFragment!!, FRAGMENT_TAG_KYL)
addOrShowFragment(childFragmentManager, liebaoGameFragment!!, FRAGMENT_TAG_GAME)
}
// 3 -> {
// if (kuYinyueFragment == null) {
// kuYinyueFragment = KuYinYueFragment()
// }
// addOrShowFragment(childFragmentManager, kuYinyueFragment!!, FRAGMENT_TAG_KYL)
// }
}
curPosition = tab.position
}
......
......@@ -128,7 +128,7 @@ class MyFragment : BaseFragment(),
override fun onResume() {
super.onResume()
if (AppConfig.fragmentClickFlag == Constant.FRAGMENT_CLICK_MY) {
if (AppConfig.fragmentClickFlag == Constant.FRAGMENT_CLICK_FIVE) {
if (!TextUtils.isEmpty(userManager.userID)) {
myPresenter.getAutoUserHallBaseMsg()
refreshHighTask()
......@@ -249,6 +249,10 @@ class MyFragment : BaseFragment(),
return
}
if (data?.shareNews != null) {
AppConfig.wzReadCoin = data!!.shareNews.readCoin
}
// 更新权重
initAdWeight(data)
AppConfig.app_black_name = data.userRiskApps.userRiskAppName
......
......@@ -47,7 +47,7 @@ class MyZhangyueFragment : LazyLoadBaseFragment(), BookView, IreaderApi.OnReadCh
override fun onFragmentResume() {
super.onFragmentResume()
if (AppConfig.fragmentClickFlag == Constant.FRAGMENT_CLICK_MAIN) {
if (AppConfig.fragmentClickFlag == Constant.FRAGMENT_CLICK_ONE) {
bookPresenter.getReadInfo()
}
}
......
......@@ -62,7 +62,7 @@ class PanFragment : BaseFragment(), PanView {
override fun onResume() {
super.onResume()
if (AppConfig.fragmentClickFlag == Constant.FRAGMENT_CLICK_PAN) {
if (AppConfig.fragmentClickFlag == Constant.FRAGMENT_CLICK_THREE) {
if (TextUtils.isEmpty(userManager?.userID)) {
// 游客登录
panPresenter.userLogin()
......
package com.mints.goodmoney.ui.fragment
import android.annotation.SuppressLint
import android.text.TextUtils
import android.webkit.*
import cn.sharesdk.framework.Platform
import cn.sharesdk.framework.PlatformActionListener
import cn.sharesdk.framework.ShareSDK
import cn.sharesdk.wechat.friends.Wechat
import cn.sharesdk.wechat.moments.WechatMoments
import com.mints.goodmoney.MintsApplication
import com.mints.goodmoney.R
import com.mints.goodmoney.common.AppConfig
import com.mints.goodmoney.common.Constant
import com.mints.goodmoney.manager.UserManager
import com.mints.goodmoney.mvp.views.BaseView
import com.mints.goodmoney.ui.fragment.base.BaseFragment
import com.mints.goodmoney.utils.ToastUtil
import kotlinx.android.synthetic.main.fragment_main_wz.*
import java.lang.StringBuilder
import java.util.HashMap
/**
* 描述:微转分享
* 作者:孟崔广
* 时间:2020/9/20 17:30
*/
@SuppressLint("SetJavaScriptEnabled")
class WzFragment : BaseFragment(), BaseView {
private val userManager by lazy { UserManager.getInstance() }
override fun getContentViewLayoutID() = R.layout.fragment_main_wz
override fun initViewsAndEvents() {
}
override fun onHiddenChanged(hidden: Boolean) {
if (hidden) { // 不在最前端界面显示
onPause()
} else { // 重新显示到最前端中
onResume()
}
super.onHiddenChanged(hidden)
}
override fun onResume() {
super.onResume()
if (AppConfig.fragmentClickFlag == Constant.FRAGMENT_CLICK_FOUR) {
if (TextUtils.isEmpty(userManager?.userID)) {
// 游客登录
} else {
loadWzUrl()
}
}
}
/**
* 加载微转url
*/
private fun loadWzUrl() {
getWzUrl()
blTurntableWebview.webChromeClient = WebChromeClient()
blTurntableWebview.webViewClient = object : WebViewClient() {}
blTurntableWebview.addJavascriptInterface(object : JsObject() {}, "mobile")
val settings = blTurntableWebview.settings
settings.javaScriptEnabled = true
}
/**
* 获取微转url
*/
private fun getWzUrl() {
val sb = StringBuilder()
sb.append("http://api.wenlv-kd.com/h5/init.html?appkey=haozhuanqian&appid=169")
.append("&userid=" + userManager.userID)
.append("&reward=" + AppConfig.wzReadCoin)
.append("&unit=" + "金币")
blTurntableWebview.loadUrl(sb.toString())
}
open class JsObject {
/**
* 分享文章
*/
@JavascriptInterface
fun shareArticle(shareImageUrl: String, shareTarget: String, shareTitle: String, shareUrl: String, shareContent: String) {
val wechatSp = Platform.ShareParams()
wechatSp.shareType = Platform.SHARE_WEBPAGE
wechatSp.imageUrl = shareImageUrl
wechatSp.title = shareTitle
wechatSp.url = shareUrl
wechatSp.text = shareContent
val wechatTarget: Platform = when (shareTarget) {
"timegroup" -> {
ShareSDK.getPlatform(Wechat.NAME)
}
"timeline" -> {
ShareSDK.getPlatform(WechatMoments.NAME)
}
else -> {
ShareSDK.getPlatform(Wechat.NAME)
}
}
if (wechatTarget.isClientValid) {
wechatTarget.platformActionListener = object : PlatformActionListener {
override fun onComplete(p0: Platform?, p1: Int, p2: HashMap<String, Any>?) {
}
override fun onError(p0: Platform?, p1: Int, p2: Throwable?) {
}
override fun onCancel(p0: Platform?, p1: Int) {
}
}
wechatTarget.share(wechatSp)
} else {
ToastUtil.show(MintsApplication.getContext(), "请先安装微信")
}
}
}
}
\ No newline at end of file
......@@ -46,7 +46,7 @@ class ZhangyueFragment : LazyLoadBaseFragment(), BookView, IreaderApi.OnReadChan
override fun onFragmentResume() {
super.onFragmentResume()
if (AppConfig.fragmentClickFlag == Constant.FRAGMENT_CLICK_MAIN) {
if (AppConfig.fragmentClickFlag == Constant.FRAGMENT_CLICK_ONE) {
bookPresenter.getReadInfo()
}
}
......
......@@ -118,7 +118,7 @@ object AppUtil {
if (StringUtilMy.stringAvalable(paramString) && checkPackInfo(paramContext, paramString) && Build.VERSION.SDK_INT >= 21) {
val usageStatsManager = paramContext.getSystemService("usagestats") as UsageStatsManager
var l = System.currentTimeMillis()
val list = usageStatsManager.queryUsageStats(4, l - 5 * 6 * 1000L, l)
val list = usageStatsManager.queryUsageStats(4, l - 2 * 6 * 1000L, l)
if (list != null && list.size > 0) for (i in list.indices) {
val str = (list[i] as UsageStats).packageName
(list[i] as UsageStats).lastTimeUsed
......
......@@ -27,7 +27,7 @@
android:orientation="horizontal">
<LinearLayout
android:id="@+id/tab_rl_main"
android:id="@+id/tab_rl_one"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1.0"
......@@ -35,13 +35,13 @@
android:orientation="vertical">
<ImageView
android:id="@+id/tab_iv_main"
android:id="@+id/tab_iv_one"
android:layout_width="25dp"
android:layout_height="25dp"
android:src="@drawable/tab_loan_btn" />
<TextView
android:id="@+id/tab_tv_main"
android:id="@+id/tab_tv_one"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/bottom_tab_main"
......@@ -50,7 +50,7 @@
</LinearLayout>
<LinearLayout
android:id="@+id/tab_rl_channel"
android:id="@+id/tab_rl_two"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1.0"
......@@ -58,13 +58,13 @@
android:orientation="vertical">
<ImageView
android:id="@+id/tab_iv_channel"
android:id="@+id/tab_iv_two"
android:layout_width="25dp"
android:layout_height="25dp"
android:src="@drawable/tab_video_btn" />
<TextView
android:id="@+id/tab_tv_channel"
android:id="@+id/tab_tv_two"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/bottom_tab_channel"
......@@ -73,7 +73,7 @@
</LinearLayout>
<LinearLayout
android:id="@+id/tab_rl_pan"
android:id="@+id/tab_rl_three"
android:layout_width="0dp"
android:layout_height="75dp"
android:layout_gravity="bottom"
......@@ -100,7 +100,7 @@
</LinearLayout>
<LinearLayout
android:id="@+id/tab_rl_friends"
android:id="@+id/tab_rl_four"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1.0"
......@@ -108,13 +108,13 @@
android:orientation="vertical">
<ImageView
android:id="@+id/tab_iv_friends"
android:id="@+id/tab_iv_four"
android:layout_width="25dp"
android:layout_height="25dp"
android:src="@drawable/tab_friends_btn" />
<TextView
android:id="@+id/tab_tv_friends"
android:id="@+id/tab_tv_four"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/bottom_tab_friends"
......@@ -123,7 +123,7 @@
</LinearLayout>
<LinearLayout
android:id="@+id/tab_rl_my"
android:id="@+id/tab_rl_five"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1.0"
......@@ -131,13 +131,13 @@
android:orientation="vertical">
<ImageView
android:id="@+id/tab_iv_my"
android:id="@+id/tab_iv_five"
android:layout_width="25dp"
android:layout_height="25dp"
android:src="@drawable/tab_my_btn" />
<TextView
android:id="@+id/tab_tv_my"
android:id="@+id/tab_tv_five"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/bottom_tab_my"
......
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<WebView
android:id="@+id/blTurntableWebview"
android:layout_width="match_parent"
android:background="@color/black"
android:layout_height="match_parent" />
</FrameLayout>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment