Commit fe10f7fb authored by mengcuiguang2's avatar mengcuiguang2

代码优化

parent 0edc09f2
...@@ -14,8 +14,8 @@ android { ...@@ -14,8 +14,8 @@ android {
applicationId "com.mints.goodmoney" applicationId "com.mints.goodmoney"
minSdkVersion rootProject.ext.androidMinSdkVersion minSdkVersion rootProject.ext.androidMinSdkVersion
targetSdkVersion rootProject.ext.androidTargetSdkVersion targetSdkVersion rootProject.ext.androidTargetSdkVersion
versionCode 26 versionCode 38
versionName "1.2.5" versionName "1.3.8"
flavorDimensions "default" flavorDimensions "default"
// dex突破65535的限制 // dex突破65535的限制
...@@ -224,9 +224,9 @@ dependencies { ...@@ -224,9 +224,9 @@ dependencies {
// 应用管理中心分包 // 应用管理中心分包
implementation(name: 'humesdk-1.0.0', ext: 'aar') implementation(name: 'humesdk-1.0.0', ext: 'aar')
// umeng // umeng
implementation 'com.umeng.umsdk:common:9.3.8' // (必选) // implementation 'com.umeng.umsdk:common:9.3.8' // (必选)
implementation 'com.umeng.umsdk:asms:1.2.2' // asms包依赖(必选) // implementation 'com.umeng.umsdk:asms:1.2.2' // asms包依赖(必选)
implementation 'com.umeng.umsdk:crash:0.0.4' // native crash包依赖(必选) // implementation 'com.umeng.umsdk:crash:0.0.4' // native crash包依赖(必选)
// TalkingDada(已集成) // TalkingDada(已集成)
// 一览视频 // 一览视频
implementation("com.yilan.sdk:ui:3.3.1.2") { implementation("com.yilan.sdk:ui:3.3.1.2") {
......
...@@ -35,8 +35,6 @@ import com.orhanobut.logger.FormatStrategy; ...@@ -35,8 +35,6 @@ import com.orhanobut.logger.FormatStrategy;
import com.orhanobut.logger.Logger; import com.orhanobut.logger.Logger;
import com.orhanobut.logger.PrettyFormatStrategy; import com.orhanobut.logger.PrettyFormatStrategy;
import com.tendcloud.tenddata.TCAgent; import com.tendcloud.tenddata.TCAgent;
import com.umeng.analytics.MobclickAgent;
import com.umeng.commonsdk.UMConfigure;
import com.ximalaya.ting.android.opensdk.constants.ConstantsOpenSdk; import com.ximalaya.ting.android.opensdk.constants.ConstantsOpenSdk;
import com.ximalaya.ting.android.opensdk.datatrasfer.CommonRequest; import com.ximalaya.ting.android.opensdk.datatrasfer.CommonRequest;
import com.ximalaya.ting.android.opensdk.player.service.XmPlayerConfig; import com.ximalaya.ting.android.opensdk.player.service.XmPlayerConfig;
...@@ -114,7 +112,7 @@ public class MintsApplication extends MultiDexApplication { ...@@ -114,7 +112,7 @@ public class MintsApplication extends MultiDexApplication {
private void thirdConfig() { private void thirdConfig() {
// 友盟SDK预初始化函数 // 友盟SDK预初始化函数
// preInit预初始化函数耗时极少,不会影响App首次冷启动用户体验 // preInit预初始化函数耗时极少,不会影响App首次冷启动用户体验
UMConfigure.preInit(this,CommonUtils.getAppMetaData(MintsApplication.getContext(), "UMENG_KEY"), CommonUtils.getAppMetaData(MintsApplication.getContext(), "CHANNEL_NAME")); // UMConfigure.preInit(this,CommonUtils.getAppMetaData(MintsApplication.getContext(), "UMENG_KEY"), CommonUtils.getAppMetaData(MintsApplication.getContext(), "CHANNEL_NAME"));
// 初始化toast // 初始化toast
initToast(); initToast();
...@@ -238,17 +236,17 @@ public class MintsApplication extends MultiDexApplication { ...@@ -238,17 +236,17 @@ public class MintsApplication extends MultiDexApplication {
* 友盟初始化 * 友盟初始化
*/ */
public void initUm(Context context) { public void initUm(Context context) {
try { // try {
/* // /*
* 参数4:设备类型,必须参数,传参数为UMConfigure.DEVICE_TYPE_PHONE则表示手机;传参数为UMConfigure.DEVICE_TYPE_BOX则表示盒子;默认为手机。 // * 参数4:设备类型,必须参数,传参数为UMConfigure.DEVICE_TYPE_PHONE则表示手机;传参数为UMConfigure.DEVICE_TYPE_BOX则表示盒子;默认为手机。
* 参数5:Push推送业务的secret,需要集成Push功能时必须传入Push的secret,否则传空。 // * 参数5:Push推送业务的secret,需要集成Push功能时必须传入Push的secret,否则传空。
*/ // */
UMConfigure.init(MintsApplication.getContext(), CommonUtils.getAppMetaData(MintsApplication.getContext(), "UMENG_KEY"), CommonUtils.getAppMetaData(MintsApplication.getContext(), "CHANNEL_NAME"), UMConfigure.DEVICE_TYPE_PHONE, ""); // UMConfigure.init(MintsApplication.getContext(), CommonUtils.getAppMetaData(MintsApplication.getContext(), "UMENG_KEY"), CommonUtils.getAppMetaData(MintsApplication.getContext(), "CHANNEL_NAME"), UMConfigure.DEVICE_TYPE_PHONE, "");
UMConfigure.setLogEnabled(BuildConfig.DEBUG); // UMConfigure.setLogEnabled(BuildConfig.DEBUG);
MobclickAgent.setPageCollectionMode(MobclickAgent.PageMode.LEGACY_MANUAL); // MobclickAgent.setPageCollectionMode(MobclickAgent.PageMode.LEGACY_MANUAL);
} catch (Exception e) { // } catch (Exception e) {
e.printStackTrace(); // e.printStackTrace();
} // }
} }
/** /**
......
...@@ -30,7 +30,6 @@ import com.mints.goodmoney.utils.* ...@@ -30,7 +30,6 @@ import com.mints.goodmoney.utils.*
import com.mints.goodmoney.utils.AppUtil.getAppName import com.mints.goodmoney.utils.AppUtil.getAppName
import com.mints.goodmoney.utils.rxutil.CommonRxTask import com.mints.goodmoney.utils.rxutil.CommonRxTask
import com.mints.goodmoney.utils.rxutil.RxjavaUtil import com.mints.goodmoney.utils.rxutil.RxjavaUtil
import com.umeng.analytics.MobclickAgent
import kotlinx.android.synthetic.main.activity_award.* import kotlinx.android.synthetic.main.activity_award.*
import java.math.BigDecimal import java.math.BigDecimal
import java.util.* import java.util.*
...@@ -333,11 +332,11 @@ class AwardActivity : BaseActivity(), AwardView, View.OnClickListener { ...@@ -333,11 +332,11 @@ class AwardActivity : BaseActivity(), AwardView, View.OnClickListener {
*/ */
private fun pushUmengEvent() { private fun pushUmengEvent() {
if (!TextUtils.isEmpty(carrierType) && curCoin > 0) { if (!TextUtils.isEmpty(carrierType) && curCoin > 0) {
// 埋点上送事件 // // 埋点上送事件
val map = mutableMapOf<String, String>() // val map = mutableMapOf<String, String>()
map["userId"] = UserManager.getInstance().userID // map["userId"] = UserManager.getInstance().userID
map["coin"] = "" + curCoin // map["coin"] = "" + curCoin
MobclickAgent.onEvent(this, carrierType, map) // MobclickAgent.onEvent(this, carrierType, map)
} }
} }
...@@ -360,17 +359,12 @@ class AwardActivity : BaseActivity(), AwardView, View.OnClickListener { ...@@ -360,17 +359,12 @@ class AwardActivity : BaseActivity(), AwardView, View.OnClickListener {
override fun onResume() { override fun onResume() {
super.onResume() super.onResume()
MobclickAgent.onPageStart(this::class.java.simpleName)
MobclickAgent.onResume(this)
awardPresenter.getCoinMsg() awardPresenter.getCoinMsg()
} }
override fun onPause() { override fun onPause() {
super.onPause() super.onPause()
MobclickAgent.onPageEnd(this::class.java.simpleName)
MobclickAgent.onPause(this)
} }
override fun onDestroy() { override fun onDestroy() {
...@@ -414,88 +408,7 @@ class AwardActivity : BaseActivity(), AwardView, View.OnClickListener { ...@@ -414,88 +408,7 @@ class AwardActivity : BaseActivity(), AwardView, View.OnClickListener {
} }
override fun onClick(v: View) { override fun onClick(v: View) {
when (v.id) { finish()
R.id.ivAwardBack -> {
finish()
}
R.id.tvAwardHigh -> {
when (superTaskStatus) {
// 播放激励视频,注册安装监听
0 -> {
// 是否开启应用使用情况权限
if (AppUtil.isOpenUsageStats()) {
registerBroad()
awardVideo()
} else {
AppTryPlayManager.openAppUsageStats(this)
}
}
// 下载完成,点击去试玩
1 -> {
if (mCurrentPkg == null) {
showToast("任务异常,请重试~")
awardPresenter.setHighTaskType("0")
} else {
if (AppUtil.checkPackInfo(mContext, mCurrentPkg!!)) {
AppTryPlayManager.toTryPlay(mCurrentPkg!!)
} else {
showToast("未找到当前APP、可能被卸载,请重试~")
}
}
}
// 试玩时间不足,继续试玩
2 -> {
if (mCurrentPkg == null) {
showToast("任务异常,请重试~")
awardPresenter.setHighTaskType("0")
} else {
if (AppUtil.checkPackInfo(mContext, mCurrentPkg!!)) {
AppTryPlayManager.toTryPlay(mCurrentPkg!!)
} else {
showToast("未找到当前APP、可能被卸载,请重试~")
}
}
}
// 试玩完成,领取奖励
3 -> {
val vo = HashMap<String, Any>()
vo["carrierType"] = Constant.CARRIER_HIGH_ACTIVITY
awardPresenter.reportAddCoinMsg(vo)
readyGoThenKill(DrawcashActivity::class.java)
}
}
}
R.id.tvAwardNext -> {
// 普通视频奖励 走公共下载监听
AppConfig.isSuperTask = false
superTaskStatus = 4
when (carrierType) {
// 只有看视频才能领金币
Constant.CARRIER_OFFLINE_DOUBLE, Constant.CARRIER_SIGNIN_HOMEPAGE_CARD,
Constant.CARRIER_CHALLENGE_TURN, Constant.CARRIER_CHALLENGE_CARD,
Constant.CARRIER_WALK_BUBBLE, Constant.CARRIER_EATMEAL_SUBSIDY,
Constant.CARRIER_WALK, Constant.CARRIER_HOMEWATER -> {
awardVideo()
}
Constant.CARRIER_BLESSINGBAG_DOUBLE, Constant.CARRIER_CHALLENGE_SHAREFRIEND_DOUBLE,
Constant.CARRIER_HOMEVEDIO_DOUBLE, Constant.CARRIER_SMALLHOMEVEDIO_DOUBLE,
Constant.CARRIER_RUISHINEWS_DOUBLE -> {
// 翻倍载体上送友盟
pushUmengEvent()
awardVideo()
}
Constant.CARRIER_NEW_VISITOR -> {
readyGoThenKill(WxLoginActivity::class.java)
}
else -> {
finish()
}
}
}
}
} }
/** /**
......
...@@ -322,10 +322,10 @@ class MainActivity : BaseActivity(), MainView, View.OnClickListener { ...@@ -322,10 +322,10 @@ class MainActivity : BaseActivity(), MainView, View.OnClickListener {
} }
fun showShortVedioLayout() { fun showShortVedioLayout() {
if (AppConfig.showAdFlag) { // if (AppConfig.showAdFlag) {
tab_rl_two.visibility = View.VISIBLE // tab_rl_two.visibility = View.VISIBLE
} else { // } else {
tab_rl_two.visibility = View.GONE // tab_rl_two.visibility = View.GONE
} // }
} }
} }
\ No newline at end of file
...@@ -155,9 +155,8 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener { ...@@ -155,9 +155,8 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener {
private fun uploadDeviceInfo() { private fun uploadDeviceInfo() {
// if (!ps.getBoolean(Constant.FIRST_DEVICE_FLAG, false)) { // if (!ps.getBoolean(Constant.FIRST_DEVICE_FLAG, false)) {
homePresenter.comSaveTerminalInfo(ps) homePresenter.comSaveTerminalInfo(ps)
baseApplication.initUm(context)
baseApplication.TalkingDataConfig() baseApplication.TalkingDataConfig()
ReaderManager.init() // ReaderManager.init()
// } // }
} }
......
...@@ -75,20 +75,14 @@ class MoneyFragment : BaseFragment(), XTabLayout.OnTabSelectedListener { ...@@ -75,20 +75,14 @@ class MoneyFragment : BaseFragment(), XTabLayout.OnTabSelectedListener {
currentFragment = mainFragment currentFragment = mainFragment
} }
xtFragmentMoney.setxTabDisplayNum(5) xtFragmentMoney.setxTabDisplayNum(3)
val newTab1 = xtFragmentMoney.newTab() val newTab1 = xtFragmentMoney.newTab()
newTab1.text = "视频" newTab1.text = "视频"
val newTab3 = xtFragmentMoney.newTab()
newTab3.text = "书城"
val newTab4 = xtFragmentMoney.newTab()
newTab4.text = "听书"
val newTab5 = xtFragmentMoney.newTab() val newTab5 = xtFragmentMoney.newTab()
newTab5.text = "游戏" newTab5.text = "游戏"
val newTab6 = xtFragmentMoney.newTab() val newTab6 = xtFragmentMoney.newTab()
newTab6.text = "来电秀" newTab6.text = "来电秀"
xtFragmentMoney.addTab(newTab1) xtFragmentMoney.addTab(newTab1)
xtFragmentMoney.addTab(newTab3)
xtFragmentMoney.addTab(newTab4)
xtFragmentMoney.addTab(newTab5) xtFragmentMoney.addTab(newTab5)
xtFragmentMoney.addTab(newTab6) xtFragmentMoney.addTab(newTab6)
xtFragmentMoney.addOnTabSelectedListener(this) xtFragmentMoney.addOnTabSelectedListener(this)
...@@ -181,24 +175,12 @@ class MoneyFragment : BaseFragment(), XTabLayout.OnTabSelectedListener { ...@@ -181,24 +175,12 @@ class MoneyFragment : BaseFragment(), XTabLayout.OnTabSelectedListener {
} }
1 -> { 1 -> {
if (bookStoreFragment == null) {
bookStoreFragment = ReaderFragment()
}
addOrShowFragment(childFragmentManager, bookStoreFragment!!, FRAGMENT_TAG_BOOKSTORE)
}
2 -> {
if (xmlyGameFragment == null) {
xmlyGameFragment = XmlyFragment()
}
addOrShowFragment(childFragmentManager, xmlyGameFragment!!, FRAGMENT_TAG_XMLY)
}
3 -> {
if (liebaoGameFragment == null) { if (liebaoGameFragment == null) {
liebaoGameFragment = LiebaoGameFragment() liebaoGameFragment = LiebaoGameFragment()
} }
addOrShowFragment(childFragmentManager, liebaoGameFragment!!, FRAGMENT_TAG_GAME) addOrShowFragment(childFragmentManager, liebaoGameFragment!!, FRAGMENT_TAG_GAME)
} }
4 -> { 2 -> {
if (kuYinyueFragment == null) { if (kuYinyueFragment == null) {
kuYinyueFragment = KuYinYueFragment() kuYinyueFragment = KuYinYueFragment()
} }
......
...@@ -25,7 +25,6 @@ import com.mints.library.net.netstatus.NetUtils; ...@@ -25,7 +25,6 @@ import com.mints.library.net.netstatus.NetUtils;
import com.mints.library.utils.CommonUtils; import com.mints.library.utils.CommonUtils;
import com.readystatesoftware.systembartint.SystemBarTintManager; import com.readystatesoftware.systembartint.SystemBarTintManager;
import com.tendcloud.tenddata.TCAgent; import com.tendcloud.tenddata.TCAgent;
import com.umeng.analytics.MobclickAgent;
/** /**
* 描述:BaseAppCompatActivity * 描述:BaseAppCompatActivity
...@@ -164,8 +163,6 @@ public abstract class BaseAppCompatActivity extends TransitionActivity { ...@@ -164,8 +163,6 @@ public abstract class BaseAppCompatActivity extends TransitionActivity {
// talkingData页面留存 // talkingData页面留存
TCAgent.onPageStart(this, getClass().getSimpleName()); TCAgent.onPageStart(this, getClass().getSimpleName());
// 友盟
MobclickAgent.onResume(this);
} }
@Override @Override
...@@ -175,8 +172,6 @@ public abstract class BaseAppCompatActivity extends TransitionActivity { ...@@ -175,8 +172,6 @@ public abstract class BaseAppCompatActivity extends TransitionActivity {
// talkingData页面留存 // talkingData页面留存
TCAgent.onPageEnd(this, getClass().getSimpleName()); TCAgent.onPageEnd(this, getClass().getSimpleName());
// 友盟
MobclickAgent.onPause(this);
} }
@Override @Override
......
...@@ -55,6 +55,7 @@ ...@@ -55,6 +55,7 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="1.0" android:layout_weight="1.0"
android:gravity="center" android:gravity="center"
android:visibility="gone"
android:orientation="vertical"> android:orientation="vertical">
<ImageView <ImageView
...@@ -100,6 +101,7 @@ ...@@ -100,6 +101,7 @@
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
android:visibility="gone"
android:id="@+id/tab_rl_four" android:id="@+id/tab_rl_four"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="match_parent" android:layout_height="match_parent"
......
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