Commit 38df2f03 authored by mengcuiguang's avatar mengcuiguang

代码优化

parents d92cbc98 f40fa2a3
......@@ -9,8 +9,8 @@ android {
applicationId "com.mints.goodmoney"
minSdkVersion rootProject.ext.androidMinSdkVersion
targetSdkVersion rootProject.ext.androidTargetSdkVersion
versionCode 6
versionName "1.0.5"
versionCode 7
versionName "1.0.6"
flavorDimensions "default"
// dex突破65535的限制
......@@ -180,7 +180,7 @@ dependencies {
// 三方接入
// leakcanary
debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.4'
// debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.4'
// 极光推送
implementation 'cn.jiguang.sdk:jpush:3.6.6'
implementation 'cn.jiguang.sdk:jcore:2.3.8'
......@@ -192,6 +192,8 @@ dependencies {
implementation(name: 'GDTSDK.unionNoPlugin.4.294.1164', ext: 'aar')
// shareSdk
implementation project(':shareSdkLib')
// 应用管理中心分包
implementation(name: 'humesdk-1.0.0', ext: 'aar')
// umeng
implementation 'com.umeng.umsdk:common:9.1.0' // (必选)
implementation 'com.umeng.umsdk:asms:1.1.3' // asms包依赖(必选)
......@@ -202,6 +204,7 @@ dependencies {
implementation("com.yilan.sdk:ui:3.0.0.3") {
exclude group: 'com.yilan.sdk', module: 'toutiao'
exclude group: 'com.yilan.sdk', module: 'gdt'
exclude group: 'com.yilan.sdk', module: 'ks'
}
implementation('com.aliyun.ams:alicloud-android-httpdns:1.2.3@aar') {
transitive true
......@@ -234,7 +237,21 @@ dependencies {
implementation(name: 'bxmsdk-release-3.0.0-csj3300', ext: 'aar')
// 闪电盒子
implementation(name: 'wannuosili_ad_2.0.0', ext: 'aar')
// 瑞狮新闻
implementation 'com.tencent.mm.opensdk:wechat-sdk-android-without-mta:+'
implementation(name: 'xrsdk-release_tbs', ext: 'aar')
// 枫岚
implementation(name: 'mh-adsdk', ext: 'aar')
implementation(name: 'mh-adsdk-ext', ext: 'aar')
implementation(name: 'ks_3.3.5.3', ext: 'aar')
// 聚乐云
implementation(name: 'okgo-2.1', ext: 'aar')
implementation(name: 'scenemodule-2.1', ext: 'aar')
implementation(name: 'scenead-2.1', ext: 'aar')
implementation 'com.just.agentweb:agentweb:4.1.2'
// implementation 'com.squareup.okio:okio:1.13.0'
// implementation 'com.squareup.retrofit2:converter-gson:2.3.0'
// testImplementation 'junit:junit:4.13'
// androidTestImplementation 'androidx.test.ext:junit:1.1.2'
......
......@@ -489,4 +489,35 @@
# ===================== 闪电盒子 START ================
-keep class com.wannuosili.sdk.** {*;}
-dontwarn com.wannuosili.sdk.**
# ======================= 闪电盒子 END ================
\ No newline at end of file
# ======================= 闪电盒子 END ================
# ===================== 瑞狮新闻 START ================
-keep class com.tencent.** {*;}
-keep class com.qq.e.** {public protected *;}
-keep class com.xr.xrsdk.** { *;}
# ======================= 瑞狮新闻 END ================
# ===================== 聚乐云 START ================
-keep class com.lzy.okgo.** {*;}
-keep class com.fly.scenemodule.** {*;}
#agentweb
-keep class com.just.agentweb.** {
*;
}
-dontwarn com.just.agentweb.**
# # Okio
# -dontwarn com.squareup.**
# -dontwarn okio.**
# -keep class okio.* { *; }
# -keep public class org.codehaus.* { *; }
# -keep public class java.nio.* { *; }
# ======================= 聚乐云 END ================
\ No newline at end of file
......@@ -45,6 +45,10 @@
android:usesCleartextTraffic="true"
tools:ignore="GoogleAppIndexingWarning">
<uses-library
android:name="org.apache.http.legacy"
android:required="false" />
<!-- 适配小米(xiaomi)刘海屏 -->
<meta-data
android:name="android.max_aspect"
......@@ -140,7 +144,9 @@
<activity
android:name=".ui.activitys.AboutusActivity"
android:screenOrientation="portrait" />
<activity android:name=".ui.activitys.GuideActivity" />
<activity
android:name=".ui.activitys.GuideActivity"
android:screenOrientation="portrait" />
<activity
android:name=".ui.activitys.LiebaoGameActivity"
android:screenOrientation="portrait" />
......@@ -179,7 +185,10 @@
android:screenOrientation="portrait" />
<activity
android:name=".ui.activitys.AccountMergeActivity"
android:screenOrientation="portrait"/>
android:screenOrientation="portrait" />
<activity
android:name=".ui.activitys.WrapperActivity"
android:screenOrientation="portrait" />
<service
android:name=".service.UpdateService"
......@@ -319,6 +328,7 @@
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/wn_file_paths" />
</provider>
</application>
</manifest>
\ No newline at end of file
......@@ -50,7 +50,7 @@ class InitAppService : IntentService("InitializeService") {
if (ACTION_INIT == action) {
initApplication()
isInit = false
isInit = true
}
}
}
......@@ -74,9 +74,6 @@ class InitAppService : IntentService("InitializeService") {
// 极光推送
initJpush()
// 掌阅书城
// ZhangyueManager.onCreateIreader(this.application)
// 变现猫
initBxm(this.application)
}
......
......@@ -14,7 +14,9 @@ import androidx.multidex.MultiDexApplication;
import com.bun.miitmdid.core.JLibrary;
import com.mints.goodmoney.common.Constant;
import com.mints.goodmoney.manager.LiebaoManager;
import com.mints.goodmoney.manager.MhManager;
import com.mints.goodmoney.manager.MiitHelper;
import com.mints.goodmoney.manager.RsNewsManager;
import com.mints.goodmoney.manager.TtCsjAdManager;
import com.mints.goodmoney.manager.WnManager;
import com.mints.goodmoney.manager.YlVideoManager;
......@@ -37,7 +39,7 @@ public class MintsApplication extends MultiDexApplication {
private static MintsApplication mContext;
public static String OAID = "";
private static LocalBroadcastManager mLocalBroadcatManager;
private static LocalBroadcastManager mLocalBroadcastManager;
private Scheduler defaultSubscribeScheduler;
private LoanService loanService;
......@@ -49,12 +51,10 @@ public class MintsApplication extends MultiDexApplication {
@Override
public void onCreate() {
super.onCreate();
mContext = this;
// 判断应用是否在前台
ForegroundOrBackground.init(this);
// 9.0之后不可多进程使用一个目录下的WebView,写在SDK初始化之前
androidPWebView();
// 三方配置
thirdConfig();
}
......@@ -81,6 +81,9 @@ public class MintsApplication extends MultiDexApplication {
super.attachBaseContext(base);
MultiDex.install(base);
// 9.0之后不可多进程使用一个目录下的WebView,写在SDK初始化之前
androidPWebView();
// 移动安全联盟
try {
JLibrary.InitEntry(base);
......@@ -115,11 +118,17 @@ public class MintsApplication extends MultiDexApplication {
// 闪电盒子
WnManager.INSTANCE.initWn(this);
// 枫岚广告
MhManager.INSTANCE.initWn(this);
// 一览视频
YlVideoManager.INSTANCE.init(this);
// 猎豹游戏初始化
LiebaoManager.getInstance().initCmGameSdk();
// 瑞狮新闻
RsNewsManager.INSTANCE.init(this);
}
private MiitHelper.AppIdsUpdater appIdsUpdater = ids -> OAID = ids;
......@@ -153,10 +162,10 @@ public class MintsApplication extends MultiDexApplication {
* 获得LocalBroadcastManager对象
*/
public static LocalBroadcastManager getLocalBroadcastManager() {
if (mLocalBroadcatManager == null) {
mLocalBroadcatManager = LocalBroadcastManager.getInstance(mContext);
if (mLocalBroadcastManager == null) {
mLocalBroadcastManager = LocalBroadcastManager.getInstance(mContext);
}
return mLocalBroadcatManager;
return mLocalBroadcastManager;
}
public LoanService getLoanService() {
......
package com.mints.goodmoney.ad.video
import android.app.Activity
import com.maplehaze.adsdk.video.RewardVideoAd
import com.mints.goodmoney.common.Constant
import com.mints.goodmoney.manager.MhManager
import com.mints.goodmoney.manager.TrackManager
import com.mints.goodmoney.mvp.presenters.MhVedioAdPresenter
import com.mints.goodmoney.mvp.views.VedioAdManagerView
import com.mints.goodmoney.utils.LogUtil
/**
* 枫岚广告视频
*/
class MhVedioAdManager private constructor(activity: Activity) :
BaseVideoAd(activity), VedioAdManagerView {
private val TAG = MhVedioAdManager::class.java.simpleName
private var mhVdedioAdPresenter: MhVedioAdPresenter? = null
private var mhVedioAdListener: MhVedioAdListener? = null
private var mRewardVideoAd: RewardVideoAd? = null
private var isClickScreen: Boolean = true
override var activity: Activity? = null
companion object {
private var _inst: MhVedioAdManager? = null
fun getInstance(activity: Activity): MhVedioAdManager? {
return if (_inst != null) {
_inst
} else {
_inst = MhVedioAdManager(activity)
_inst
}
}
}
init {
init(activity)
}
private fun init(activity: Activity) {
this.activity = activity
mhVdedioAdPresenter = MhVedioAdPresenter()
mhVdedioAdPresenter?.attachView(this)
}
override fun loadAd(activity: Activity, curCoin: Int, carrierType: String, extraId: String?) {
this.activity = activity
isClickScreen = true
var postId: String = when (carrierType) {
Constant.CARRIER_VERSUS_VIDEO -> MhManager.POS_ID
Constant.CARRIER_HOMEWATER -> MhManager.POS_ID
Constant.CARRIER_CHALLENGE_TURN, Constant.CARRIER_DRAWCASH -> MhManager.POS_ID
Constant.CARRIER_CHALLENGE_CARD -> MhManager.POS_ID
else -> MhManager.POS_ID
}
val orientation = RewardVideoAd.VERTICAL
mRewardVideoAd = RewardVideoAd(activity, MhManager.APP_ID, postId, orientation, object : RewardVideoAd.RewardVideoListener {
override fun onADCached() {
LogUtil.d(TAG, "onADCached")
mRewardVideoAd?.showAd(activity)
}
override fun onADShow() {
LogUtil.d(TAG, "onADShow")
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_FL, Constant.EVENT_TYPE_ZERO, "", "")
}
override fun onReward() {
LogUtil.d(TAG, "onReward")
}
override fun onADClick() {
LogUtil.d(TAG, "onADClick")
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_FL, Constant.EVENT_TYPE_TWO, "", "")
if (isClickScreen) {
// 防止重复
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_FL, Constant.EVENT_TYPE_FOUR, "", "")
isClickScreen = false
}
if (mhVedioAdListener != null) {
mhVedioAdListener?.mhVedioAdDownload()
}
}
override fun onVideoComplete() {
LogUtil.d(TAG, "onVideoComplete")
}
override fun onADClose() {
LogUtil.d(TAG, "onADClose")
mhVdedioAdPresenter?.reportAddCoinMsg(activity, getAdMapVO(carrierType, Constant.AD_SOURCE_FL, extraId, curCoin))
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_FL, Constant.EVENT_TYPE_THREE, "", "")
if (mhVedioAdListener != null) {
mhVedioAdListener?.mhVedioAdSuccess()
}
}
override fun onADError(p0: Int) {
LogUtil.d(TAG, "onADError->$p0")
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_FL, Constant.EVENT_TYPE_ONE, (p0).toString(), "")
if (mhVedioAdListener != null) {
mhVedioAdListener?.mhVedioAdFail()
}
}
})
mRewardVideoAd?.loadAd()
}
fun setMhVedioAdListener(mhVedioAdListener: MhVedioAdListener?) {
this.mhVedioAdListener = mhVedioAdListener
}
interface MhVedioAdListener {
fun mhVedioAdSuccess()
fun mhVedioAdFail()
fun mhVedioAdDownload()
}
override fun onDestory() {
mhVdedioAdPresenter?.let {
it.dispose()
it.detachView()
}
mRewardVideoAd = null
activity = null
}
}
\ No newline at end of file
......@@ -8,6 +8,7 @@ import com.mints.goodmoney.common.Constant;
import com.mints.goodmoney.mvp.model.VedioAdingBean;
import com.mints.goodmoney.mvp.model.WeightBean;
import com.mints.goodmoney.utils.LogUtil;
import com.mints.goodmoney.utils.ToastUtil;
import java.util.ArrayList;
import java.util.Random;
......@@ -26,22 +27,22 @@ public class VedioAdingManager {
private WnVedioAdManager wnVedioAdManager;
private CsjVedioAdManager csjVedioAdManager;
private YlhVedioAdManager ylhVedioAdManager;
private MhVedioAdManager mhVedioAdManager;
private int wnWeight;
private int ylhWeight;
private int csjVedioWeight;
private int flVedioWeight;
private ArrayList<WeightBean> weightList;
private Activity activity;
private boolean isVedioAdDownload = false;// 是否点击广告下载 true-点击
public static VedioAdingManager getInstance(Activity activity) {
if (_inst != null) {
return _inst;
} else {
if (_inst == null) {
_inst = new VedioAdingManager(activity);
return _inst;
}
return _inst;
}
private VedioAdingManager(Activity activity) {
......@@ -58,9 +59,20 @@ public class VedioAdingManager {
csjVedioAdManager = CsjVedioAdManager.getInstance(activity);
ylhVedioAdManager = YlhVedioAdManager.getInstance(activity);
wnVedioAdManager = WnVedioAdManager.Companion.getInstance(activity);
mhVedioAdManager = MhVedioAdManager.Companion.getInstance(activity);
weightList = new ArrayList<>();
}
/**
* 初始化广告权重
*/
public void initAdWeight(int csjVedioWeight, int ylhWeight, int wnWeight, int flVedioWeight) {
this.csjVedioWeight = csjVedioWeight;
this.ylhWeight = ylhWeight;
this.wnWeight = wnWeight;
this.flVedioWeight = flVedioWeight;
}
/**
* 初始化广告权重
*/
......@@ -78,7 +90,40 @@ public class VedioAdingManager {
public void loadAding(Activity activity, VedioAdingBean bean) {
this.activity = activity;
isVedioAdDownload = false;
loadAdVedio(getVedioAdType(), bean);
if (AppConfig.flVideoFlag) {
// 先展示枫岚视频
firstLoadFlVideo(bean);
} else {
// 权重自有逻辑
loadAdVedio(getVedioAdType(), bean);
}
}
/**
* 根据载体优先加载枫岚
*
* @param bean
*/
private void firstLoadFlVideo(VedioAdingBean bean) {
String adType;
switch (bean.getCarrierType()) {
case Constant.CARRIER_VERSUS_VIDEO:
case Constant.CARRIER_HOMEWATER:
case Constant.CARRIER_WALK:
case Constant.CARRIER_WALK_BUBBLE:
case Constant.CARRIER_SIGNIN_HOMEPAGE_CARD:
case Constant.CARRIER_OFFLINE_DOUBLE:
case Constant.CARRIER_EATMEAL_SUBSIDY:
adType = Constant.FL_VEDIO_AD;
// ToastUtil.showLong(activity, "载体优先类型:" + Constant.FL_VEDIO_AD);
break;
default:
adType = getVedioAdType();
break;
}
loadAdVedio(adType, bean);
}
/**
......@@ -94,8 +139,6 @@ public class VedioAdingManager {
/**
* 根据广告优先级获取下一个
* <p>
* 穿山甲激励> 优量汇>闪电盒子> 珊瑚>创神>mintegral>全屏>多盟>东方网
*/
private String getNextAdType() {
String nextAdType = "";
......@@ -104,7 +147,7 @@ public class VedioAdingManager {
} else if (AppConfig.ylhAdCount > 0) {
nextAdType = Constant.YLH_VEDIO_AD;
} else {
nextAdType = Constant.SDHZ_VEDIO_AD;
nextAdType = Constant.FL_VEDIO_AD;
}
return nextAdType;
}
......@@ -130,14 +173,7 @@ public class VedioAdingManager {
weightList.clear();
}
int weight = 0;
// 若没有视频完成数,不加入权重计算范围内
// 穿山甲激励> 优量汇
if (AppConfig.wnVedioAdCount > 0) {
weightList.add(new WeightBean(wnWeight, Constant.SDHZ_VEDIO_AD));
weight = weight + wnWeight;
LogUtil.d(TAG, "权重值:sdhzWeight:" + wnWeight);
}
if (AppConfig.csjVedioAdCount > 0) {
weightList.add(new WeightBean(csjVedioWeight, Constant.CSJ_VEDIO_AD));
weight = weight + csjVedioWeight;
......@@ -148,6 +184,17 @@ public class VedioAdingManager {
weight = weight + ylhWeight;
LogUtil.d(TAG, "权重值:ylhWeight:" + ylhWeight);
}
if (AppConfig.flVedioAdCount > 0) {
weightList.add(new WeightBean(flVedioWeight, Constant.FL_VEDIO_AD));
weight = weight + flVedioWeight;
LogUtil.d(TAG, "权重值:flVedioWeight:" + flVedioWeight);
}
if (AppConfig.wnVedioAdCount > 0) {
weightList.add(new WeightBean(wnWeight, Constant.SDHZ_VEDIO_AD));
weight = weight + wnWeight;
LogUtil.d(TAG, "权重值:sdhzWeight:" + wnWeight);
}
// 权重随机
if (weightList != null && weightList.size() > 0 && weight > 0) {
LogUtil.d(TAG, "1、权重总值:" + weight);
......@@ -155,7 +202,7 @@ public class VedioAdingManager {
int randomWeight = r.nextInt(weight) + 1;
LogUtil.d(TAG, "2、权重随机值:" + randomWeight);
// ToastUtil.showLong(activity,"权重随机值:" + randomWeight);
// ToastUtil.showLong(activity, "权重随机值:" + randomWeight);
for (WeightBean weightBean : weightList) {
randomWeight -= weightBean.getWeight();
......@@ -186,8 +233,9 @@ public class VedioAdingManager {
int csjVedioAdCount = AppConfig.csjVedioAdCount;
int ylhAdCount = AppConfig.ylhAdCount;
int wnAdCount = AppConfig.wnVedioAdCount;
int flVedioAdCount = AppConfig.flVedioAdCount;
if (ylhAdCount <= 0 && csjVedioAdCount <= 0 && wnAdCount <= 0) {
if (ylhAdCount <= 0 && csjVedioAdCount <= 0 && wnAdCount <= 0 && flVedioAdCount <= 0) {
// showToast("今日视频已看完,请明天再来吧");
return true;
}
......@@ -208,12 +256,16 @@ public class VedioAdingManager {
ylhVedioAdManager.onDestory();
ylhVedioAdManager = null;
}
if (wnVedioAdManager != null) {
wnVedioAdManager.setWnVedioAdListener(null);
wnVedioAdManager.onDestory();
wnVedioAdManager = null;
}
if (mhVedioAdManager != null) {
mhVedioAdManager.setMhVedioAdListener(null);
mhVedioAdManager.onDestory();
mhVedioAdManager = null;
}
activity = null;
}
......@@ -342,8 +394,41 @@ public class VedioAdingManager {
isVedioAdDownload = true;
}
});
wnVedioAdManager.loadAd(activity, bean.getCurCoin(), bean.getCarrierType(), bean.getExtraId());
} else if (TextUtils.equals(vedioAdType, Constant.FL_VEDIO_AD)) {
// 枫岚广告激励视频
if (mhVedioAdManager == null) {
if (activity == null) {
if (vedioAdingListener != null) {
vedioAdingListener.vedioAdingListenerError(Constant.FL_VEDIO_AD);
}
return;
}
mhVedioAdManager = MhVedioAdManager.Companion.getInstance(activity);
}
mhVedioAdManager.setMhVedioAdListener(new MhVedioAdManager.MhVedioAdListener() {
@Override
public void mhVedioAdSuccess() {
AppConfig.flVedioAdCount--;
if (vedioAdingListener != null) {
vedioAdingListener.vedioAdingListenerSuccess(Constant.FL_VEDIO_AD);
}
}
@Override
public void mhVedioAdFail() {
if (vedioAdingListener != null) {
vedioAdingListener.vedioAdingListenerFail(Constant.FL_VEDIO_AD);
}
}
@Override
public void mhVedioAdDownload() {
isVedioAdDownload = true;
}
});
mhVedioAdManager.loadAd(activity, bean.getCurCoin(), bean.getCarrierType(), bean.getExtraId());
}
} catch (Exception e) {
e.printStackTrace();
......
......@@ -13,6 +13,26 @@ public class AppConfig {
*/
public static boolean app_updateing = false;
/**
* 黑名单
*/
public static String app_black = "";
/**
* 黑名单校验
*/
public static boolean app_black_flag = false;
/**
* 趣步赚成功标记
*/
public static boolean scene_flag = false;
/**
* 先展示枫岚视频
*/
public static boolean flVideoFlag = false;
/**
* app应用首页 0-主页 1-大转盘 2-邀请好友 3-我
*/
......@@ -31,5 +51,9 @@ public class AppConfig {
* wnVedio 剩余广告播放数
*/
public static int wnVedioAdCount = 5;
/**
* flVedio 剩余广告播放数
*/
public static int flVedioAdCount = 5;
}
package com.mints.goodmoney.common
import android.os.Environment
import com.mints.goodmoney.BuildConfig
import com.mints.goodmoney.MintsApplication
import com.mints.goodmoney.manager.UserManager
import com.mints.library.utils.CommonUtils
object Constant {
......@@ -77,6 +74,7 @@ object Constant {
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_TAG_RSNEWS = "FRAGMENT_TAG_RSNEWS"
// 协议地址
var REGISTER_URL = BuildConfig.MainIp + "gm/register.html"//服务协议
......@@ -109,6 +107,11 @@ object Constant {
const val CARRIER_NEW_VISITOR = "CARRIER_NEW_VISITOR" //游客首次登录
const val CARRIER_GAME_ONLINE = "GAME_ONLINE" //跳转猎豹
const val CARRIER_ZHANGYUE = "ZHANGYUE" //阅读书城
const val CARRIER_RUISHINEWS = "RuiShiNews" //瑞狮新闻
const val CARRIER_RUISHINEWS_DOUBLE = "RuiShiNews_DOUBLE" //瑞狮新闻翻倍
const val CARRIER_RUISHINEWS_CHALLANGE = "RuiShiNews_CHALLANGE" //瑞狮新闻每日挑战
const val CARRIER_RUISHINEWS_SHARE = "RuiShiNews_SHARE" //瑞狮新闻分享
const val CARRIER_RUISHINEWS_SHARE_DOUBLE = "RuiShiNews_SHARE_DOUBLE" //瑞狮新闻分享翻倍
const val CARRIER_CHALLENGE_SHAREFRIEND_DOUBLE = "CHALLENGE_SHAREFRIEND_DOUBLE" //邀请好友翻倍
const val CARRIER_HOMEVEDIO = "HOMEVEDIO" //首页红包
const val CARRIER_HOMEVEDIO_DOUBLE = "HOMEVEDIO_DOUBLE" //首页红包翻倍
......@@ -116,6 +119,10 @@ object Constant {
const val CARRIER_SMALLHOMEVEDIO_DOUBLE = "SMALLHOMEVEDIO_DOUBLE" //首页红包翻倍
const val CARRIER_MORNING_CLOCK = "MORNING_CLOCK" //早上打卡
const val CARRIER_DRAWCASH = "DRAWCASH" //提现
const val CARRIER_BLACK = "BLACK" //黑名单
const val CARRIER_HOMEVEDIO_CHALLENGE = "HOMEVEDIO_CHALLENGE" //首页视频挑战
const val CARRIER_MINIVEDIO_CHALLENGE = "MINIVEDIO_CHALLENGE" //短视频挑战
const val CARRIER_ZHANGYUE_CHALLENGE = "ZHANGYUE_CHALLENGE" //看小说挑战
const val CHALLENGE_SHAREFRIEND = "CHALLENGE_SHAREFRIEND" //邀请好友
......@@ -123,6 +130,7 @@ object Constant {
const val AD_SOURCE_CSJ = "CSJ"
const val AD_SOURCE_YLH = "YLH"
const val AD_SOURCE_SDHZ = "SDHZ" //闪电盒子
const val AD_SOURCE_FL = "FL" //枫岚
// 调用事件 0 成功 1失败 2点击 3-有效展示 4-去重
const val EVENT_TYPE_ZERO = "0"
......@@ -141,6 +149,7 @@ object Constant {
const val CSJ_VEDIO_AD = "CSJ_VEDIO_AD"
const val YLH_VEDIO_AD = "YLH_VEDIO_AD"
const val SDHZ_VEDIO_AD = "SDHZ_VEDIO_AD"
const val FL_VEDIO_AD = "Fl_VEDIO_AD"
// 游戏类型
......@@ -158,6 +167,11 @@ object Constant {
const val HOT_ACTIVITY_EAT = "eat"
const val HOT_ACTIVITY_MORNINGCLOCK = "morningclock"
const val HOT_ACTIVITY_H5 = "h5"
const val HOT_ACTIVITY_SCRAPPAGE = "scrapPage"
const val HOT_ACTIVITY_DATI = "dati"
const val HOT_ACTIVITY_CAICY = "ccy"
const val HOT_ACTIVITY_BOOK = "readBook"
const val HOT_ACTIVITY_NEWS = "TO_RUISHI"
// 打开激活
const val FIRST_DEVICE_FLAG = "first_device_flag"
......@@ -165,7 +179,8 @@ object Constant {
// share
const val SHARE_TITLE = "发现一个二傻子平台,人傻钱多,速来~一起薅死他~~"
var SHARE_CONTENT = "邀请码【${UserManager.getInstance().codeID}】,共享新模式,快来加入跟我一起赚钱吧"
// var SHARE_URL: String = BuildConfig.MainIp + "share/shareFriend.html?ruid=" + UserManager.getInstance().getUserID() + "&channel=" + CommonUtils.getAppMetaData(MintsApplication.getContext(), "CHANNEL_NAME")
// var SHARE_URL: String = BuildConfig.MainIp + "share/shareFriend.html?ruid=" + UserManager.getInstance().getUserID() + "&channel=" + CommonUtils.getAppMetaData(MintsApplication.getContext(), "CHANNEL_NAME")
var SHARE_URL: String = BuildConfig.MainIp + "wxShare/toShare?shareId=" + UserManager.getInstance().getUserID()
// 首页视频时长 单位-秒
......@@ -178,7 +193,14 @@ object Constant {
const val FIRST_VISITOR_FLAG = "first_visitor_flag"
// 账号合并
const val MERGE_MOBILE="merge_mobile"
const val MERGE_WXOPENID="merge_wxopenid"
const val MERGE_KEY="merge_key"
}
\ No newline at end of file
const val MERGE_MOBILE = "merge_mobile"
const val MERGE_WXOPENID = "merge_wxopenid"
const val MERGE_KEY = "merge_key"
// wrapper type 0-新闻 1-小说
const val WRAPPER_TYPE = "wrapper_type"
const val WRAPPER_TYPE_NEWS = 0
const val WRAPPER_TYPE_BOOK = 1
}
......@@ -10,11 +10,15 @@ import android.net.Proxy
import android.net.wifi.WifiInfo
import android.net.wifi.WifiManager
import android.os.Build
import android.os.SystemClock
import android.provider.Settings
import android.telephony.TelephonyManager
import android.text.TextUtils
import com.mints.goodmoney.MintsApplication
import com.mints.goodmoney.R
import com.mints.goodmoney.utils.SimUtils
import com.mints.goodmoney.utils.StorageQueryUtil
import com.mints.goodmoney.utils.SystemUtils
import com.mints.library.utils.json.JsonUtil
import java.io.*
import java.net.NetworkInterface
......@@ -40,6 +44,89 @@ class DeviceInfo private constructor() {
return proxyUrl
}
/**
* android4.2以上
* 系统从启动到现在的时间
* 单位:ms
*
*/
val elapsedRealtime = SystemClock.elapsedRealtime()
/**
*
*/
val newModel: String
get() {
return brand + " " + mobileModel +
" " + totalMemory + "+" + totalStorage +
" " + operator
}
/**
* 运营商名称
*
*/
val operator: String
get() {
val sb = StringBuilder("")
try {
var needSingleSim = false
// 卡1
val simStateBySlotIdx1 = SimUtils.getSimStateBySlotIdx(MintsApplication.getContext(), 0)
// 卡2
val simStateBySlotIdx2 = SimUtils.getSimStateBySlotIdx(MintsApplication.getContext(), 1)
if (simStateBySlotIdx1) {
val providersName1 = SimUtils.getSimOperatorName2(MintsApplication.getContext(), 0)
if (TextUtils.equals(providersName1, "unknown")) {
needSingleSim = true
sb.append(SimUtils.getSimOperatorNameBySingle(MintsApplication.getContext()) + " ")
} else {
sb.append("$providersName1 ")
}
} else {
sb.append("未插卡 ")
}
if (simStateBySlotIdx2) {
val providersName2 = SimUtils.getSimOperatorName2(MintsApplication.getContext(), 1)
if (TextUtils.equals(providersName2, "unknown") && !needSingleSim) {
sb.append(SimUtils.getSimOperatorNameBySingle(MintsApplication.getContext()) + " ")
} else {
sb.append("$providersName2 ")
}
} else {
sb.append("未插卡 ")
}
} catch (e: Exception) {
}
return sb.toString()
}
/**
* 手机内存大小
*
*/
val totalMemory: String
get() {
return SystemUtils.getTotalMemory()
}
/**
* 手机存储大小
*
*/
val totalStorage: String
get() {
return StorageQueryUtil.getTotalStorageSize(MintsApplication.getContext())
}
/**
* get device's IMSI
*
......@@ -133,6 +220,62 @@ class DeviceInfo private constructor() {
return versionName
}
/**
* 获取CPU核数
*
* @return
*/
val cupCount: Int
get() {
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.GINGERBREAD_MR1) {
// Gingerbread doesn't support giving a single application access to both cores, but a
// handful of devices (Atrix 4G and Droid X2 for example) were released with a dual-core
// chipset and Gingerbread; that can let an app in the background run without impacting
// the foreground application. But for our purposes, it makes them single core.
return 1
}
val cores: Int
cores = try {
File("/sys/devices/system/cpu/").listFiles(CPU_FILTER).size
} catch (e: SecurityException) {
0
} catch (e: java.lang.NullPointerException) {
0
}
return cores
}
/**
* 获取CPU型号
*
* @return
*/
val cupInfo: String
get() {
val cpuInfo = arrayOf("", "") //0:型号 1:频率
try {
val str1 = "/proc/cpuinfo"
var str2 = ""
var arrayOfString: Array<String>
val fr = FileReader(str1)
if (fr != null) {
val localBufferedReader = BufferedReader(fr, 8192)
str2 = localBufferedReader.readLine()
arrayOfString = str2.split("\\s+".toRegex()).toTypedArray()
for (i in 2 until arrayOfString.size) {
cpuInfo[0] = cpuInfo[0] + arrayOfString[i] + " "
}
str2 = localBufferedReader.readLine()
arrayOfString = str2.split("\\s+".toRegex()).toTypedArray()
cpuInfo[1] += arrayOfString[2]
localBufferedReader.close()
}
} catch (e: IOException) {
cpuInfo[0] = "unknow"
}
return cpuInfo[0]
}
/**
* 获取versionCode
*
......@@ -405,6 +548,37 @@ class DeviceInfo private constructor() {
return ""
}
/**
* 获取APP列表信息
*/
fun getAppInfoList(): MutableList<String>? {
try {
val appList: MutableList<String> = ArrayList()
val mainintent = Intent(Intent.ACTION_MAIN, null)
mainintent.addCategory(Intent.CATEGORY_LAUNCHER)
val packageinfo =
mContext!!.packageManager.getInstalledPackages(0)
var pinfo: PackageInfo? = null
val count = packageinfo.size
for (i in 0 until count) {
pinfo = packageinfo[i]
val appInfo = pinfo.applicationInfo
if (appInfo.flags and ApplicationInfo.FLAG_SYSTEM > 0) {
//系统程序 忽略
} else {
//非系统程序
appList.add(appInfo.loadLabel(mContext!!.packageManager) as String)
appList.add(pinfo.packageName)
}
}
return appList
} catch (e: Exception) {
e.printStackTrace()
}
return null
}
/**
* Android ID
......@@ -635,6 +809,8 @@ class DeviceInfo private constructor() {
return "02:00:00:00:00:00"
}
companion object {
private var _inst: DeviceInfo? = null
val instance: DeviceInfo
......
package com.mints.goodmoney.manager
import android.app.Application
import com.maplehaze.adsdk.MaplehazeSDK
/**
* 描述:枫岚激励视频
* 作者:孟崔广
*/
object MhManager {
const val APP_ID = "10200"
const val POS_ID = "56834"
/**
* 初始化
*/
fun initWn(application: Application) {
MaplehazeSDK.init(application)
}
}
\ No newline at end of file
package com.mints.goodmoney.manager
import android.app.Application
import com.tencent.smtt.sdk.QbSdk
import com.xr.xrsdk.XRNewsManager
/**
* 描述:瑞狮新闻
* 作者:孟崔广
*/
object RsNewsManager {
private const val APP_ID = "19e575538d2947ad9323e6c2a70d9a7f"
/**
* 初始化
*/
fun init(application: Application) {
QbSdk.initX5Environment(application, null)
XRNewsManager.getInstance().init(application, APP_ID, UserManager.getInstance().userID)
}
}
\ No newline at end of file
package com.mints.goodmoney.manager
import android.app.Activity
import android.text.TextUtils
import com.fly.scenemodule.SceneUtil
import com.fly.scenemodule.model.GDTInfo
import com.fly.scenemodule.model.TTInfo
import com.mints.goodmoney.MintsApplication
import com.mints.goodmoney.common.AppConfig
/**
* 描述:聚乐云SDK
*/
object SceneManager {
const val SCENE_CHANNEL_Id = "10004"
/**
* 初始化
*/
fun initScene() {
val userId = UserManager.getInstance().userID
// 初始化聚乐云
SceneUtil.initSdk(SCENE_CHANNEL_Id, userId, MintsApplication.OAID)
//穿山甲-------
val ttInfo = TTInfo()
ttInfo.csJ_Appid = TtCsjAdManager.TT_AD_APPID
ttInfo.csJ_VideoId = TtCsjAdManager.TT_AD_VEDIO_JULEYUN
ttInfo.csJ_BannerId = TtCsjAdManager.TT_AD_BANNER_JULEYUN
ttInfo.csJ_InteractionId = TtCsjAdManager.TT_AD_INSERT_LOADING_ID_JULEYUN
SceneUtil.initCSJConfig(ttInfo)
//广点通-------
val gdtInfo = GDTInfo()
gdtInfo.gdT_Appid = YlhAdManager.YLH_AD_APPID
gdtInfo.gdT_VideoId = YlhAdManager.YLH_AD_VEDIO_JULEYUN_POSTID
gdtInfo.gdT_ExpressId = YlhAdManager.YLH_AD_NATIVEEXPRESS_JULEYUN
gdtInfo.GDT_InteractionId = YlhAdManager.YLH_AD_INTERSTITIALAD_JULEYUN
SceneUtil.initGDTConfig(gdtInfo)
}
/**
* 账号同步
*/
fun signIn(activity: Activity) {
if (!TextUtils.isEmpty(UserManager.getInstance().userID)) {
SceneUtil.signIn(activity, SCENE_CHANNEL_Id, UserManager.getInstance().userID, MintsApplication.OAID)
AppConfig.scene_flag = true
}
}
}
\ No newline at end of file
......@@ -18,6 +18,7 @@ public class TtCsjAdManager {
/*banner*/
public static final String TT_AD_BANNER_MY = "945666251";// 个人中心
public static final String TT_AD_BANNER_JULEYUN = "945675532";// 聚乐云
/*激励视频*/
public static final String TT_AD_VEDIO_MAIN_DEV = "945561938";// 开发使用
......@@ -27,6 +28,7 @@ public class TtCsjAdManager {
public static final String TT_AD_VEDIO_TURNABLE = "945666260";// 大转盘
public static final String TT_AD_VEDIO_MOREDIALOG = "945666260";// 签到、气泡、离线弹框
public static final String TT_AD_VEDIO_GAME = "945562067";// 猎豹
public static final String TT_AD_VEDIO_JULEYUN = "945675529";// 聚乐云
/*信息流*/
public static final String TT_AD_NATIVEEXPRESS_AWARD = "945666318";//信息流弹窗
......@@ -41,6 +43,7 @@ public class TtCsjAdManager {
/*插屏广告*/
public static final String TT_AD_INSERT_LOADING_ID_LIEBAO = "945608874";//猎豹游戏加载时
public static final String TT_AD_INSERT_LOADING_ID_JULEYUN = "945675533";//聚乐云
private static boolean sInit;
......
......@@ -24,10 +24,17 @@ object YlhAdManager {
const val YLH_AD_VEDIO_TURNABLE_POSTID = "8081841664335704" //大转盘
const val YLH_AD_VEDIO_MOREDIALOG_POSTID = "8081841664335704" //签到、气泡、离线弹框
const val YLH_AD_VEDIO_GAME_POSTID = "4021234882122091" //猎豹游戏
const val YLH_AD_VEDIO_JULEYUN_POSTID = "1011746770898338" //聚乐云
/*信息流*/
const val YLH_AD_NATIVEEXPRESS_JULEYUN = "8041941770890627" //聚乐云
/* 插屏 */
const val YLH_AD_INTERSTITIALAD_LIEBAO = "5031044115480084" //猎豹
const val YLH_AD_INTERSTITIALAD_LIEBAO = "1021648750986824" //猎豹
const val YLH_AD_INTERSTITIALAD_JULEYUN = "4051047730890430" //聚乐云
/**
* 广告初始化
......
......@@ -60,6 +60,7 @@ public class DrawcashBean implements Serializable {
private int SDHZ_VEDIO;
private int CSJ_VEDIO;
private int YLH_VEDIO;
private int FL_VEDIO;
public int getSDHZ_VEDIO() {
return SDHZ_VEDIO;
......@@ -72,6 +73,10 @@ public class DrawcashBean implements Serializable {
public int getYLH_VEDIO() {
return YLH_VEDIO;
}
public int getFL_VEDIO() {
return FL_VEDIO;
}
}
public class CashOutMoneyArrBean implements Serializable {
......
......@@ -10,6 +10,7 @@ public class UserTaskMsgBean implements Serializable {
private VedioRulesBean vedioRules;
private String ip;
private String userRiskApp;
public OfflineBean getOfflineBean() {
return offline;
......@@ -26,4 +27,8 @@ public class UserTaskMsgBean implements Serializable {
public String getIp() {
return ip;
}
public String getUserRiskApp() {
return userRiskApp;
}
}
......@@ -7,8 +7,10 @@ public class VedioRulesBean implements Serializable {
private CsjVedioBean CSJ_VEDIO;
private YlhVedioBean YLH_VEDIO;
private SdhzVedioBean SDHZ_VEDIO;
private FLVedioBean FL_VEDIO;
private boolean flVideoFlag;
public class CsjVedioBean implements Serializable{
public class CsjVedioBean implements Serializable {
private int surplus;//剩余可看视频数
private int rate;//权重
......@@ -21,7 +23,7 @@ public class VedioRulesBean implements Serializable {
}
}
public class YlhVedioBean implements Serializable{
public class YlhVedioBean implements Serializable {
private int surplus;
private int rate;
......@@ -34,7 +36,7 @@ public class VedioRulesBean implements Serializable {
}
}
public class SdhzVedioBean implements Serializable{
public class SdhzVedioBean implements Serializable {
private int surplus;
private int rate;
......@@ -47,6 +49,23 @@ public class VedioRulesBean implements Serializable {
}
}
public class FLVedioBean implements Serializable {
private int surplus;
private int rate;
public int getSurplus() {
return surplus;
}
public int getRate() {
return rate;
}
}
public FLVedioBean getFL_VEDIO() {
return FL_VEDIO;
}
public CsjVedioBean getCSJ_VEDIO() {
return CSJ_VEDIO;
}
......@@ -58,4 +77,8 @@ public class VedioRulesBean implements Serializable {
public SdhzVedioBean getSDHZ_VEDIO() {
return SDHZ_VEDIO;
}
public boolean isFlVideoFlag() {
return flVideoFlag;
}
}
......@@ -29,6 +29,7 @@ class AccountMergePresenter : BasePresenter<AccountMergeView>() {
}
override fun onNext(baseResponse: BaseResponse<AccountMsgBean>) {
if (isLinkView) return
val code = baseResponse.status
val message = baseResponse.message
when (code) {
......@@ -61,6 +62,7 @@ class AccountMergePresenter : BasePresenter<AccountMergeView>() {
}
override fun onNext(baseResponse: BaseResponse<UserBean>) {
if (isLinkView) return
val code = baseResponse.status
val message = baseResponse.message
when (code) {
......
package com.mints.goodmoney.mvp.presenters;
import android.text.TextUtils;
import com.google.gson.JsonObject;
import com.mints.goodmoney.MintsApplication;
import com.mints.goodmoney.common.DeviceInfo;
import com.mints.goodmoney.manager.AppHttpManager;
import com.mints.goodmoney.manager.ShumeiManager;
import com.mints.goodmoney.mvp.model.BaseResponse;
import com.mints.goodmoney.mvp.model.UserTaskMsgBean;
import com.mints.goodmoney.mvp.model.UserBean;
import com.mints.goodmoney.mvp.views.AwardView;
import com.mints.goodmoney.utils.DeviceUuidFactory;
import com.mints.goodmoney.utils.rxutil.CommonRxTask;
import com.mints.goodmoney.utils.rxutil.RxjavaUtil;
import com.mints.library.net.neterror.BaseSubscriber;
import com.mints.library.net.neterror.Throwable;
......@@ -40,7 +48,7 @@ public class AwardPresenter extends BasePresenter<AwardView> {
switch (code) {
case 200://成功
JsonObject data = baseResponse.getData();
if(data!=null){
if (data != null) {
view.getUserTaskMsgSuc(data.get("coin").getAsInt());
}
break;
......@@ -52,6 +60,71 @@ public class AwardPresenter extends BasePresenter<AwardView> {
});
}
public void saveTerminalInfo() {
DeviceInfo deviceInfo = DeviceInfo.Companion.getInstance();
RxjavaUtil.executeRxTask(new CommonRxTask<String>("") {
@Override
public void doInIOThread() {
setT(deviceInfo.getAppInfoMap());
}
@Override
public void doInUIThread() {
HashMap<String, Object> vo = new HashMap<>();
String macAddress = deviceInfo.getMacAddress();
if (!TextUtils.isEmpty(macAddress)) {
String mac = macAddress.replace(":", "");
vo.put("mac", mac);
vo.put("mac1", macAddress);
}
vo.put("imei", deviceInfo.getIMEI());
vo.put("androidid", deviceInfo.getAndroidId(null));
vo.put("os", "android");
vo.put("shumeiId", ShumeiManager.getInstance().getShumeiDeviceId());
vo.put("model", deviceInfo.getNewModel());
vo.put("uuid", new DeviceUuidFactory().getDeviceUuid());
vo.put("osversion", deviceInfo.getOSVersion());
vo.put("appversion", deviceInfo.getVersionName());
vo.put("appPkgList", getT());
if (!TextUtils.isEmpty(MintsApplication.OAID)) {
vo.put("oaid", MintsApplication.OAID);
}
AppHttpManager.getInstance(loanApplication)
.call(loanService.saveTerminalInfo(vo),
new BaseSubscriber<BaseResponse<UserBean>>() {
@Override
public void onCompleted() {
if (isLinkView()) return;
view.hideLoading();
}
@Override
public void onError(Throwable e) {
if (isLinkView()) return;
view.hideLoading();
}
@Override
public void onNext(BaseResponse<UserBean> baseResponse) {
if (isLinkView()) return;
int code = baseResponse.getStatus();
String message = baseResponse.getMessage();
switch (code) {
case 200://成功
break;
default:
view.showToast(message);
break;
}
}
});
}
});
}
public void reportAddCoinMsg(HashMap<String, Object> vo) {
AppHttpManager.getInstance(loanApplication)
.call(loanService.reportAddCoinMsg(vo),
......
......@@ -23,6 +23,7 @@ class BookPresenter : BasePresenter<BookView>() {
}
override fun onNext(baseResponse: BaseResponse<JsonObject>) {
if (isLinkView) return
val code = baseResponse.getStatus()
val data = baseResponse.data
when (code) {
......@@ -49,6 +50,7 @@ class BookPresenter : BasePresenter<BookView>() {
}
override fun onNext(baseResponse: BaseResponse<JsonObject>) {
if (isLinkView) return
val code = baseResponse.getStatus()
val data = baseResponse.data
when (code) {
......
package com.mints.goodmoney.mvp.presenters;
import android.app.Activity;
import com.mints.goodmoney.MintsApplication;
import com.mints.goodmoney.mvp.model.BaseResponse;
import com.mints.goodmoney.mvp.views.VedioAdManagerView;
import com.mints.goodmoney.net.LoanService;
import com.mints.library.net.neterror.BaseSubscriber;
import com.mints.library.net.neterror.Throwable;
import java.util.HashMap;
import rx.Subscription;
import rx.android.schedulers.AndroidSchedulers;
public class CsjFullVedioAdPresenter extends BasePresenter<VedioAdManagerView>{
private MintsApplication loanApplication;
private LoanService loanService;
private Subscription subscription;
/**
* 检验立言任务是否重复
*/
public void reportAddCoinMsg(Activity activity, HashMap<String, Object> vo) {
if (activity == null)
return;
loanApplication = (MintsApplication) activity.getApplication();
loanService = loanApplication.getLoanService();
subscription = loanService.reportAddCoinMsg(vo)
.observeOn(AndroidSchedulers.mainThread())
.subscribeOn(loanApplication.defaultSubscribeScheduler())
.subscribe(new BaseSubscriber<BaseResponse<Object>>() {
@Override
public void onCompleted() {
}
@Override
public void onError(Throwable e) {
// view.checkLYContextSuc(false);
}
@Override
public void onNext(BaseResponse<Object> baseResponse) {
// int code = baseResponse.getStatus();
// String message = baseResponse.getMessage();
// switch (code) {
// case 200://成功
// view.checkLYContextSuc(true);
// break;
// case 611://重复
// view.checkLYContextSuc(false);
// break;
// default:
// break;
// }
}
});
}
public void dispose() {
loanService = null;
loanApplication = null;
if (subscription != null && !subscription.isUnsubscribed()) {
subscription.unsubscribe();
}
}
}
package com.mints.goodmoney.mvp.presenters;
import android.app.Activity;
import com.mints.goodmoney.MintsApplication;
import com.mints.goodmoney.mvp.model.BaseResponse;
import com.mints.goodmoney.mvp.views.VedioAdManagerView;
import com.mints.goodmoney.net.LoanService;
import com.mints.library.net.neterror.BaseSubscriber;
import com.mints.library.net.neterror.Throwable;
import java.util.HashMap;
import rx.Subscription;
import rx.android.schedulers.AndroidSchedulers;
public class CsjVedioAdPresenter extends BasePresenter<VedioAdManagerView>{
private MintsApplication loanApplication;
private LoanService loanService;
private Subscription subscription;
public void dispose() {
loanService = null;
loanApplication = null;
if (subscription != null && !subscription.isUnsubscribed()) {
subscription.unsubscribe();
}
}
}
package com.mints.goodmoney.mvp.presenters;
import android.text.TextUtils;
import android.view.animation.AccelerateDecelerateInterpolator;
import com.daimajia.androidanimations.library.Techniques;
import com.daimajia.androidanimations.library.YoYo;
import com.mints.goodmoney.MintsApplication;
import com.mints.goodmoney.common.DeviceInfo;
import com.mints.goodmoney.manager.AppHttpManager;
......@@ -12,6 +15,8 @@ import com.mints.goodmoney.mvp.model.DrawcashBean;
import com.mints.goodmoney.mvp.model.UserBean;
import com.mints.goodmoney.mvp.views.DrawcashView;
import com.mints.goodmoney.utils.DeviceUuidFactory;
import com.mints.goodmoney.utils.rxutil.CommonRxTask;
import com.mints.goodmoney.utils.rxutil.RxjavaUtil;
import com.mints.library.net.neterror.BaseSubscriber;
import com.mints.library.net.neterror.Throwable;
......@@ -64,7 +69,7 @@ public class DrawcashPresenter extends BasePresenter<DrawcashView> {
/**
* 修改用户信息
*/
public void editUserMsg(String wxOpenid,String wxInfo) {
public void editUserMsg(String wxOpenid, String wxInfo) {
HashMap<String, Object> vo = new HashMap<>();
vo.put("type", "OPENID");
vo.put("value", wxInfo);
......@@ -102,7 +107,7 @@ public class DrawcashPresenter extends BasePresenter<DrawcashView> {
view.editUserMsgSuc();
}
break;
case 612 :
case 612:
view.mergeAccount(UserManager.getInstance().getMobile(), wxOpenid, baseResponse.getData().getToKeepAnAccount());
break;
default:
......@@ -119,67 +124,74 @@ public class DrawcashPresenter extends BasePresenter<DrawcashView> {
public void saveTerminalInfo(double curCash) {
view.showLoading("加载中...");
HashMap<String, Object> vo = new HashMap<>();
DeviceInfo deviceInfo = DeviceInfo.Companion.getInstance();
String macAddress = deviceInfo.getMacAddress();
if (!TextUtils.isEmpty(macAddress)) {
String mac = macAddress.replace(":", "");
vo.put("mac", mac);
vo.put("mac1", macAddress);
}
vo.put("imei", deviceInfo.getIMEI());
vo.put("androidid", deviceInfo.getAndroidId(null));
vo.put("os", "android");
vo.put("shumeiId", ShumeiManager.getInstance().getShumeiDeviceId());
vo.put("model", deviceInfo.getBrand() + " " + deviceInfo.getMobileModel());
vo.put("uuid", new DeviceUuidFactory().getDeviceUuid());
vo.put("osversion", deviceInfo.getOSVersion());
vo.put("appversion", deviceInfo.getVersionName());
vo.put("appPkgList", deviceInfo.getAppInfoMap());
if (!TextUtils.isEmpty(MintsApplication.OAID)) {
vo.put("oaid", MintsApplication.OAID);
}
AppHttpManager.getInstance(loanApplication)
.call(loanService.saveTerminalInfo(vo),
new BaseSubscriber<BaseResponse<UserBean>>() {
@Override
public void onCompleted() {
if (isLinkView()) return;
}
@Override
public void onError(Throwable e) {
if (isLinkView()) return;
view.hideLoading();
}
@Override
public void onNext(BaseResponse<UserBean> baseResponse) {
if (isLinkView()) return;
RxjavaUtil.executeRxTask(new CommonRxTask<String>("") {
@Override
public void doInIOThread() {
setT(deviceInfo.getAppInfoMap());
}
@Override
public void doInUIThread() {
HashMap<String, Object> vo = new HashMap<>();
String macAddress = deviceInfo.getMacAddress();
if (!TextUtils.isEmpty(macAddress)) {
String mac = macAddress.replace(":", "");
vo.put("mac", mac);
vo.put("mac1", macAddress);
}
vo.put("imei", deviceInfo.getIMEI());
vo.put("androidid", deviceInfo.getAndroidId(null));
vo.put("os", "android");
vo.put("shumeiId", ShumeiManager.getInstance().getShumeiDeviceId());
vo.put("model", deviceInfo.getNewModel());
vo.put("uuid", new DeviceUuidFactory().getDeviceUuid());
vo.put("osversion", deviceInfo.getOSVersion());
vo.put("appversion", deviceInfo.getVersionName());
vo.put("appPkgList", getT());
if (!TextUtils.isEmpty(MintsApplication.OAID)) {
vo.put("oaid", MintsApplication.OAID);
}
AppHttpManager.getInstance(loanApplication)
.call(loanService.saveTerminalInfo(vo),
new BaseSubscriber<BaseResponse<UserBean>>() {
@Override
public void onCompleted() {
if (isLinkView()) return;
}
@Override
public void onError(Throwable e) {
if (isLinkView()) return;
int code = baseResponse.getStatus();
String message = baseResponse.getMessage();
switch (code) {
case 200://成功
addCashoutReq(curCash);
break;
default:
view.showToast(message);
view.hideLoading();
break;
}
}
});
}
@Override
public void onNext(BaseResponse<UserBean> baseResponse) {
if (isLinkView()) return;
int code = baseResponse.getStatus();
String message = baseResponse.getMessage();
switch (code) {
case 200://成功
addCashoutReq(curCash);
break;
default:
view.showToast(message);
view.hideLoading();
break;
}
}
});
}
});
}
/**
* 金币/积分兑换
*/
public void addCashoutReq(double cash) {
HashMap<String, Object> vo = new HashMap<>();
vo.put("cash", cash);
vo.put("payChannel", "WEIXIN");
......
......@@ -27,7 +27,6 @@ class FriendsActivityPresenter : BasePresenter<FriendsActivityView>() {
override fun onNext(baseResponse: BaseResponse<FriendHallMsgBean>) {
if (isLinkView) return
view.hideLoading()
when (baseResponse.status) {
200 -> {
......@@ -59,7 +58,6 @@ class FriendsActivityPresenter : BasePresenter<FriendsActivityView>() {
override fun onNext(baseResponse: BaseResponse<FriendHallMsgBean>) {
if (isLinkView) return
view.hideLoading()
when (baseResponse.status) {
200 -> {
......
......@@ -5,6 +5,7 @@ import com.mints.goodmoney.MintsApplication
import com.mints.goodmoney.common.Constant
import com.mints.goodmoney.common.DeviceInfo
import com.mints.goodmoney.manager.AppHttpManager
import com.mints.goodmoney.manager.SceneManager
import com.mints.goodmoney.manager.ShumeiManager
import com.mints.goodmoney.manager.UserManager
import com.mints.goodmoney.mvp.model.BaseResponse
......@@ -34,7 +35,7 @@ class HomePresenter : BasePresenter<HomeView>() {
vo["imei"] = deviceInfo.iMEI
vo["oaid"] = MintsApplication.OAID
vo["os"] = "android"
vo["model"] = deviceInfo.brand + " " + deviceInfo.mobileModel
vo["model"] = deviceInfo.newModel
vo["uuid"] = DeviceUuidFactory().deviceUuid
vo["osversion"] = deviceInfo.oSVersion
vo["appversion"] = deviceInfo.versionName
......@@ -133,6 +134,8 @@ class HomePresenter : BasePresenter<HomeView>() {
}
override fun onNext(baseResponse: BaseResponse<UserBean>) {
if (isLinkView) return
val code = baseResponse.getStatus()
val message = baseResponse.getMessage()
val data: UserBean? = baseResponse.getData()
......@@ -165,7 +168,7 @@ class HomePresenter : BasePresenter<HomeView>() {
vo["oaid"] = MintsApplication.OAID
}
vo["os"] = "android"
vo["model"] = deviceInfo.brand + " " + deviceInfo.mobileModel
vo["model"] = deviceInfo.newModel
vo["uuid"] = DeviceUuidFactory().deviceUuid
vo["osversion"] = deviceInfo.oSVersion
vo["appversion"] = deviceInfo.versionName
......
package com.mints.goodmoney.mvp.presenters
import android.content.pm.ApplicationInfo
import android.text.TextUtils
import com.mints.goodmoney.MintsApplication
import com.mints.goodmoney.common.Constant
......@@ -12,8 +13,11 @@ import com.mints.goodmoney.mvp.model.BaseResponse
import com.mints.goodmoney.mvp.model.UserBean
import com.mints.goodmoney.mvp.views.LoginView
import com.mints.goodmoney.utils.DeviceUuidFactory
import com.mints.goodmoney.utils.rxutil.CommonRxTask
import com.mints.goodmoney.utils.rxutil.RxjavaUtil
import com.mints.library.net.neterror.BaseSubscriber
import com.mints.library.net.neterror.Throwable
import com.mints.library.utils.json.JsonUtil
import net.grandcentrix.tray.AppPreferences
import java.util.*
......@@ -225,46 +229,56 @@ class LoginPresenter : BasePresenter<LoginView>() {
* @param context
*/
fun saveTerminalInfo(userId: Long) {
val vo = HashMap<String, Any>()
val deviceInfo: DeviceInfo = DeviceInfo.instance
val macAddress: String = deviceInfo.getMacAddress()
val mac = macAddress.replace(":", "")
vo["mac"] = mac
vo["mac1"] = macAddress
vo["androidid"] = deviceInfo.getAndroidId(null)
vo["imei"] = deviceInfo.iMEI
if (!TextUtils.isEmpty(MintsApplication.OAID)) {
vo["oaid"] = MintsApplication.OAID
}
vo["os"] = "android"
vo["model"] = deviceInfo.brand + " " + deviceInfo.mobileModel
vo["uuid"] = DeviceUuidFactory().deviceUuid
vo["osversion"] = deviceInfo.oSVersion
vo["appversion"] = deviceInfo.versionName
vo["shumeiId"] = ShumeiManager.getInstance().getShumeiDeviceId()
vo["appPkgList"] = deviceInfo.getAppInfoMap()
RxjavaUtil.executeRxTask<String>(object : CommonRxTask<String?>("") {
override fun doInIOThread() {
t = deviceInfo.getAppInfoMap()
}
AppHttpManager.getInstance(loanApplication)
.call(loanService.saveTerminalInfo(vo),
object : BaseSubscriber<BaseResponse<Any>>() {
override fun onCompleted() {
if (isLinkView) return
}
override fun doInUIThread() {
val vo = HashMap<String, Any>()
val macAddress: String = deviceInfo.getMacAddress()
val mac = macAddress.replace(":", "")
vo["mac"] = mac
vo["mac1"] = macAddress
vo["androidid"] = deviceInfo.getAndroidId(null)
vo["imei"] = deviceInfo.iMEI
if (!TextUtils.isEmpty(MintsApplication.OAID)) {
vo["oaid"] = MintsApplication.OAID
}
vo["os"] = "android"
vo["model"] = deviceInfo.newModel
vo["uuid"] = DeviceUuidFactory().deviceUuid
vo["osversion"] = deviceInfo.oSVersion
vo["appversion"] = deviceInfo.versionName
vo["shumeiId"] = ShumeiManager.getInstance().getShumeiDeviceId()
vo["appPkgList"] = t.toString()
override fun onError(e: Throwable) {
if (isLinkView) return
}
AppHttpManager.getInstance(loanApplication)
.call(loanService.saveTerminalInfo(vo),
object : BaseSubscriber<BaseResponse<Any>>() {
override fun onCompleted() {
if (isLinkView) return
}
override fun onNext(baseResponse: BaseResponse<Any>) {
if (isLinkView) return
override fun onError(e: Throwable) {
if (isLinkView) return
}
val code = baseResponse.status
when (code) {
200 -> {
JpushManager.getInstance().setJpushService(userId.toString())
override fun onNext(baseResponse: BaseResponse<Any>) {
if (isLinkView) return
val code = baseResponse.status
when (code) {
200 -> {
JpushManager.getInstance().setJpushService(userId.toString())
}
}
}
}
}
})
})
}
})
}
}
\ No newline at end of file
package com.mints.goodmoney.mvp.presenters
import android.app.Activity
import com.mints.goodmoney.MintsApplication
import com.mints.goodmoney.mvp.model.BaseResponse
import com.mints.goodmoney.mvp.views.VedioAdManagerView
import com.mints.library.net.neterror.BaseSubscriber
import com.mints.library.net.neterror.Throwable
import rx.Subscription
import rx.android.schedulers.AndroidSchedulers
import java.util.*
class MhVedioAdPresenter : BasePresenter<VedioAdManagerView>() {
fun reportAddCoinMsg(activity: Activity?, vo: HashMap<String, Any>) {
if (activity == null) return
loanApplication = activity.application as MintsApplication
loanService = loanApplication.loanService
subscription = loanService.reportAddCoinMsg(vo)
.observeOn(AndroidSchedulers.mainThread())
.subscribeOn(loanApplication.defaultSubscribeScheduler())
.subscribe(object : BaseSubscriber<BaseResponse<Any>>() {
override fun onCompleted() {}
override fun onError(e: Throwable) {
}
override fun onNext(baseResponse: BaseResponse<Any>) {}
})
}
fun dispose() {
loanService = null
loanApplication = null
if (subscription != null && !subscription.isUnsubscribed()) {
subscription.unsubscribe()
}
}
}
\ No newline at end of file
......@@ -160,6 +160,7 @@ class MyPresenter : BasePresenter<MyView>() {
}
override fun onNext(baseResponse: BaseResponse<UserBean>) {
if (isLinkView) return
val code = baseResponse.status
val message = baseResponse.message
val data: UserBean? = baseResponse.data
......@@ -192,7 +193,7 @@ class MyPresenter : BasePresenter<MyView>() {
vo["oaid"] = MintsApplication.OAID
}
vo["os"] = "android"
vo["model"] = deviceInfo.brand + " " + deviceInfo.mobileModel
vo["model"] = deviceInfo.newModel
vo["uuid"] = DeviceUuidFactory().deviceUuid
vo["osversion"] = deviceInfo.oSVersion
vo["appversion"] = deviceInfo.versionName
......
......@@ -33,6 +33,7 @@ class PanPresenter : BasePresenter<PanView>() {
}
override fun onNext(baseResponse: BaseResponse<UserBean>) {
if (isLinkView) return
val code = baseResponse.getStatus()
val message = baseResponse.getMessage()
val data: UserBean? = baseResponse.getData()
......@@ -66,7 +67,7 @@ class PanPresenter : BasePresenter<PanView>() {
vo["oaid"] = MintsApplication.OAID
}
vo["os"] = "android"
vo["model"] = deviceInfo.brand + " " + deviceInfo.mobileModel
vo["model"] = deviceInfo.newModel
vo["uuid"] = DeviceUuidFactory().deviceUuid
vo["osversion"] = deviceInfo.oSVersion
vo["appversion"] = deviceInfo.versionName
......
package com.mints.goodmoney.mvp.presenters
import com.google.gson.JsonObject
import com.mints.goodmoney.manager.AppHttpManager
import com.mints.goodmoney.mvp.model.BaseResponse
import com.mints.goodmoney.mvp.views.BookView
import com.mints.goodmoney.mvp.views.RsNewsView
import com.mints.library.net.neterror.BaseSubscriber
import com.mints.library.net.neterror.Throwable
import java.util.*
class RsNewsPresenter : BasePresenter<RsNewsView>() {
fun addNewsSeconds(seconds: Int) {
val vo = HashMap<String, Any>()
vo["time"] = seconds
AppHttpManager.getInstance(loanApplication)
.call(loanService.addNewsSeconds(vo),
object : BaseSubscriber<BaseResponse<JsonObject>>() {
override fun onCompleted() {
}
override fun onError(e: Throwable) {
}
override fun onNext(baseResponse: BaseResponse<JsonObject>) {
if (isLinkView) return
val code = baseResponse.getStatus()
val data = baseResponse.data
when (code) {
200 -> {
if (data != null) {
val msg = data.getAsJsonObject("msg")
view.readSecondsSuc(msg["xinwenCoin"].asInt, msg["xinwenDoubleCoin"].asInt, msg["xinwenSupr"].asInt)
}
}
else -> view.showToast(baseResponse.getMessage())
}
}
})
}
}
\ No newline at end of file
......@@ -15,7 +15,7 @@ class WnVedioAdPresenter : BasePresenter<VedioAdManagerView>() {
fun reportAddCoinMsg(activity: Activity?, vo: HashMap<String, Any>) {
if (activity == null) return
loanApplication = activity.application as MintsApplication
loanService = loanApplication.getLoanService()
loanService = loanApplication.loanService
subscription = loanService.reportAddCoinMsg(vo)
.observeOn(AndroidSchedulers.mainThread())
.subscribeOn(loanApplication.defaultSubscribeScheduler())
......
package com.mints.goodmoney.mvp.views
interface RsNewsView : BaseView {
fun readSecondsSuc(coin:Int,video:Int,supr:Int)
}
......@@ -301,13 +301,21 @@ public interface LoanService {
Observable<BaseResponse<MainVedioMsgBean>> getSmallHomeVedioBaseMsg();
/**
* 阅读时长
* 小说阅读时长
*
* @return
*/
@POST("api/addReadSeconds")
Observable<BaseResponse<JsonObject>> addReadSeconds(@Body Map<String, Object> vo);
/**
* 新闻阅读时长
*
* @return
*/
@POST("api/getXinwenMsg")
Observable<BaseResponse<JsonObject>> addNewsSeconds(@Body Map<String, Object> vo);
/**
* 阅读信息
*
......
......@@ -2,6 +2,7 @@ package com.mints.goodmoney.net;
import android.text.TextUtils;
import com.bytedance.hume.readapk.HumeSDK;
import com.google.gson.Gson;
import com.mints.goodmoney.BuildConfig;
import com.mints.goodmoney.MintsApplication;
......@@ -44,6 +45,15 @@ public class OkHttpInterceptor implements Interceptor {
long time = System.currentTimeMillis();
String channel = CommonUtils.getAppMetaData(MintsApplication.getContext(), "CHANNEL_NAME");
// try {
// // 穿山甲分包渠道 暂不开启
// String ttChannel = HumeSDK.getChannel(MintsApplication.getContext());
// if (!TextUtils.isEmpty(ttChannel)) {
// channel = ttChannel;
// }
// } catch (Exception e) {
// e.printStackTrace();
// }
Request request = chain.request();
request = encrypt(request, tokenID, time, channel);//加密方法
......
......@@ -3,6 +3,7 @@ package com.mints.goodmoney.ui.activitys
import android.os.Bundle
import android.view.View
import android.view.View.OnLongClickListener
import com.bytedance.hume.readapk.HumeSDK
import com.mints.goodmoney.MintsApplication
import com.mints.goodmoney.R
import com.mints.goodmoney.common.Constant
......@@ -31,7 +32,9 @@ class AboutusActivity : BaseActivity(), View.OnClickListener {
iv_left_icon.setImageResource(R.mipmap.ic_arrow_back)
ivAboutasIcon.setOnLongClickListener(OnLongClickListener {
ToastUtil.showLong(context, CommonUtils.getAppMetaData(MintsApplication.getContext(), "CHANNEL_NAME"))
ToastUtil.showLong(MintsApplication.getContext(), "自有渠道:" + CommonUtils.getAppMetaData(MintsApplication.getContext(), "CHANNEL_NAME") +
"\n 头条渠道:" + HumeSDK.getChannel(context) +
"\n 头条version:" + HumeSDK.getVersion())
true
})
......
......@@ -4,6 +4,7 @@ import android.os.Bundle
import android.view.View
import com.mints.goodmoney.R
import com.mints.goodmoney.common.Constant
import com.mints.goodmoney.manager.SceneManager
import com.mints.goodmoney.mvp.model.AccountMsgBean
import com.mints.goodmoney.mvp.presenters.AccountMergePresenter
import com.mints.goodmoney.mvp.views.AccountMergeView
......@@ -140,6 +141,8 @@ class AccountMergeActivity : BaseActivity(), View.OnClickListener, AccountMergeV
override fun toKeepAccountSuc() {
showToast("账号合并成功!")
SceneManager.signIn(this)
readyGoThenKill(MainActivity::class.java)
}
......
......@@ -6,7 +6,9 @@ import android.view.KeyEvent
import android.view.View
import com.mints.goodmoney.R
import com.mints.goodmoney.ad.video.VedioAdingManager
import com.mints.goodmoney.common.AppConfig
import com.mints.goodmoney.common.Constant
import com.mints.goodmoney.common.DeviceInfo.Companion.instance
import com.mints.goodmoney.manager.TTPreLoadExpressManager
import com.mints.goodmoney.manager.UserManager
import com.mints.goodmoney.mvp.model.VedioAdingBean
......@@ -18,12 +20,13 @@ import com.mints.goodmoney.ui.widgets.countdowntimer.OnCountDownTimerListener
import com.mints.goodmoney.utils.SoundPoolUtil
import com.mints.goodmoney.utils.SpanUtils
import com.mints.goodmoney.utils.Utils
import com.mints.goodmoney.utils.rxutil.CommonRxTask
import com.mints.goodmoney.utils.rxutil.RxjavaUtil
import com.umeng.analytics.MobclickAgent
import kotlinx.android.synthetic.main.activity_award.*
import java.math.BigDecimal
import java.util.*
/**
* 描述:奖励界面
* 作者:孟崔广
......@@ -53,8 +56,56 @@ class AwardActivity : BaseActivity(), AwardView, View.OnClickListener {
vedioAdingManager = VedioAdingManager.getInstance(this)
initExpress()
initDataView()
initListener()
initDataView()
if (!AppConfig.app_black_flag) {
// 首次进行黑名单校验
judgeAppInfo()
} else {
pushAward()
}
}
/**
* 校验是否属于黑名单
*/
private fun judgeAppInfo() {
val deviceInfo = instance
RxjavaUtil.executeRxTask<String>(object : CommonRxTask<String?>("") {
override fun doInIOThread() {
var result = "false"
val appBlack = AppConfig.app_black
if (!TextUtils.isEmpty(appBlack)) {
val appInfoList = deviceInfo.getAppInfoList()
if (appInfoList != null && appInfoList!!.size > 0) {
val appBlackList = appBlack.split(",")
for (appBlackName in appBlackList) {
if (TextUtils.equals(result, "true")) {
break
}
for (appName in appInfoList) {
if (appName.contains(appBlackName)) {
result = "true"
break
}
}
}
}
}
t = result
}
override fun doInUIThread() {
if (TextUtils.equals(t.toString(), "true")) {
// 黑名单
awardPresenter.saveTerminalInfo()
carrierType = Constant.CARRIER_BLACK
}
AppConfig.app_black_flag = true
pushAward()
}
})
}
private fun initDataView() {
......@@ -69,14 +120,21 @@ class AwardActivity : BaseActivity(), AwardView, View.OnClickListener {
// 开启3秒倒计时
startTime()
pushUmengEvent()
}
/**
* 发放奖励
*/
private fun pushAward() {
when (carrierType) {
Constant.CARRIER_GAME_ONLINE, Constant.CARRIER_EATMEAL -> {
Constant.CARRIER_HOMEVEDIO_CHALLENGE, Constant.CARRIER_MINIVEDIO_CHALLENGE,
Constant.CARRIER_GAME_ONLINE, Constant.CARRIER_EATMEAL,
Constant.CARRIER_RUISHINEWS_CHALLANGE, Constant.CARRIER_ZHANGYUE_CHALLENGE -> {
val vo = HashMap<String, Any>()
vo["carrierType"] = carrierType
awardPresenter.reportAddCoinMsg(vo)
tvAwardContent.setText(curCoin.toString() + "金币已到账")
tvAwardContent.setText("${curCoin}金币已到账")
tvAwardNext.setText("我知道了")
}
Constant.CARRIER_HOMEVEDIO -> {
......@@ -84,18 +142,29 @@ class AwardActivity : BaseActivity(), AwardView, View.OnClickListener {
vo["carrierType"] = carrierType
awardPresenter.reportAddCoinMsg(vo)
tvAwardContent.setText(curCoin.toString() + "金币已到账")
tvAwardContent.setText("${curCoin}金币已到账")
tvAwardNext.setText("看视频再领${extraId}金币")
curCoin = extraId.toInt()
carrierType = Constant.CARRIER_HOMEVEDIO_DOUBLE
}
Constant.CARRIER_RUISHINEWS -> {
val vo = HashMap<String, Any>()
vo["carrierType"] = carrierType
awardPresenter.reportAddCoinMsg(vo)
tvAwardContent.setText("${curCoin}金币已到账")
tvAwardNext.setText("看视频再领${extraId}金币")
curCoin = extraId.toInt()
carrierType = Constant.CARRIER_RUISHINEWS_DOUBLE
}
Constant.CARRIER_SMALLHOMEVEDIO -> {
val vo = HashMap<String, Any>()
vo["carrierType"] = carrierType
awardPresenter.reportAddCoinMsg(vo)
tvAwardContent.setText(curCoin.toString() + "金币已到账")
tvAwardContent.setText("${curCoin}金币已到账")
tvAwardNext.setText("看视频再领${extraId}金币")
curCoin = extraId.toInt()
......@@ -106,7 +175,7 @@ class AwardActivity : BaseActivity(), AwardView, View.OnClickListener {
vo["carrierType"] = carrierType
awardPresenter.reportAddCoinMsg(vo)
tvAwardContent.setText(curCoin.toString() + "金币已到账")
tvAwardContent.setText("${curCoin}金币已到账")
tvAwardNext.setText("看视频再领${extraId}金币")
curCoin = extraId.toInt()
......@@ -116,23 +185,24 @@ class AwardActivity : BaseActivity(), AwardView, View.OnClickListener {
tvAwardContent.setText("新人红包")
tvAwardNext.setText("我知道了")
tvAwardHint.setVisibility(View.VISIBLE)
tvAwardHint.setText(curCoin.toString() + "金币已到账")
tvAwardHint.setText("${curCoin}金币已到账")
}
Constant.CARRIER_NEW_VISITOR -> {
tvAwardContent.setText("新人红包")
tvAwardNext.setText("点击领取")
tvAwardHint.setVisibility(View.VISIBLE)
tvAwardHint.setText(curCoin.toString() + "金币已到账")
tvAwardHint.setText("${curCoin}金币已到账")
}
Constant.CARRIER_OFFLINE_DOUBLE -> {
tvAwardContent.setText("离线收益奖励" + curCoin + "金币")
tvAwardContent.setText("离线收益奖励${curCoin}金币")
tvAwardNext.setText("金币翻倍")
}
Constant.CARRIER_ZHANGYUE -> {
tvAwardContent.setText("阅读奖励" + curCoin + "金币")
tvAwardContent.setText("阅读奖励${curCoin}金币")
tvAwardNext.setText("领取金币")
}
Constant.CARRIER_SIGNIN_HOMEPAGE_AWARD -> {
tvAwardContent.setText("签到奖励" + curCoin + "金币")
tvAwardContent.setText("签到奖励${curCoin}金币")
tvAwardNext.setText("看视频最高可得3倍金币奖励")
carrierType = Constant.CARRIER_SIGNIN_HOMEPAGE_CARD
......@@ -143,7 +213,7 @@ class AwardActivity : BaseActivity(), AwardView, View.OnClickListener {
}
Constant.CARRIER_GAME -> {
if (curCoin > 0) {
tvAwardContent.setText("游戏奖励" + curCoin + "金币")
tvAwardContent.setText("游戏奖励${curCoin}金币")
} else {
tvAwardContent.setText("很遗憾,游戏试玩不足3秒")
}
......@@ -154,17 +224,15 @@ class AwardActivity : BaseActivity(), AwardView, View.OnClickListener {
tvAwardNext.visibility = View.GONE
tvAwardHint.visibility = View.GONE
}
Constant.CARRIER_VERSUS_VIDEO -> {
tvAwardContent.setText(curCoin.toString() + "金币已到账")
}
Constant.CARRIER_CHALLENGE_TURN, Constant.CARRIER_CHALLENGE_CARD,
Constant.CARRIER_WALK_BUBBLE, Constant.CARRIER_EATMEAL_SUBSIDY,
Constant.CARRIER_WALK, Constant.CARRIER_HOMEWATER -> {
tvAwardContent.setText("+" + curCoin + "金币")
tvAwardContent.setText("+${curCoin}金币")
tvAwardNext.setText("看视频领取")
}
else -> {
tvAwardContent.setText(curCoin.toString() + "金币已到账")
tvAwardContent.setText("${curCoin}金币已到账")
tvAwardNext.setText("领取金币")
}
}
}
......@@ -225,6 +293,8 @@ class AwardActivity : BaseActivity(), AwardView, View.OnClickListener {
e.printStackTrace()
}
SoundPoolUtil.getInstance().onDestory()
TTPreLoadExpressManager.getInstance().onDestroy()
flAwardAd?.removeAllViews()
vedioAdingManager.setVedioAdingListener(null)
......@@ -250,7 +320,8 @@ class AwardActivity : BaseActivity(), AwardView, View.OnClickListener {
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 -> {
Constant.CARRIER_WALK, Constant.CARRIER_HOMEWATER,
Constant.CARRIER_RUISHINEWS_DOUBLE -> {
awardVedio()
}
Constant.CARRIER_CHALLENGE_SHAREFRIEND_DOUBLE, Constant.CARRIER_HOMEVEDIO_DOUBLE,
......
......@@ -269,12 +269,14 @@ class DrawcashActivity : BaseActivity(),
* 设置视频权重
*/
private fun initAdWeight(data: DrawcashBean.VedioRules) {
vedioAdingManager?.initAdWeight(data.csJ_VEDIO, data.ylH_VEDIO, data.sdhZ_VEDIO)
LogUtil.d(TAG, "提现权重值:csjWeight:${data.csJ_VEDIO} ylhWeight:${data.ylH_VEDIO} sdhzWeight:${data.sdhZ_VEDIO}")
vedioAdingManager?.initAdWeight(data.csJ_VEDIO, data.ylH_VEDIO, data.sdhZ_VEDIO, data.fL_VEDIO)
// vedioAdingManager?.initAdWeight(data.csJ_VEDIO, data.ylH_VEDIO, data.sdhZ_VEDIO)
LogUtil.d(TAG, "提现权重值:csjWeight:${data.csJ_VEDIO} ylhWeight:${data.ylH_VEDIO} sdhzWeight:${data.sdhZ_VEDIO} flWeight:${data.fL_VEDIO}")
// 广告视频数
AppConfig.csjVedioAdCount = 10
AppConfig.ylhAdCount = 10
AppConfig.wnVedioAdCount = 10
AppConfig.flVedioAdCount = 10
}
/**
......
......@@ -3,10 +3,8 @@ package com.mints.goodmoney.ui.activitys
import android.os.Bundle
import android.view.KeyEvent
import android.view.View
import android.view.View.OnLongClickListener
import android.view.ViewGroup
import android.webkit.WebChromeClient
import com.github.lzyzsd.jsbridge.BridgeHandler
import com.github.lzyzsd.jsbridge.CallBackFunction
import com.github.lzyzsd.jsbridge.DefaultHandler
import com.mints.goodmoney.BuildConfig
......@@ -83,22 +81,20 @@ class EraseActivity : BaseActivity(), View.OnClickListener{
private fun loadTurnUrl() {
getTurnUrl()
blEarseWebview.setDefaultHandler(DefaultHandler())
blEarseWebview.setWebChromeClient(WebChromeClient())
blEarseWebview.setOnLongClickListener(OnLongClickListener { true })
blEarseWebview.registerHandler("getEraseResult", BridgeHandler { data, function ->
if(!isFinishing){
blEarseWebview.webChromeClient = WebChromeClient()
blEarseWebview.setOnLongClickListener { true }
blEarseWebview.registerHandler("getEraseResult") { data, _ ->
if (!isFinishing) {
val turntableBean: TurntableBean = JsonUtil.parseJson(data, TurntableBean::class.java)
if (turntableBean != null) {
val bundle = Bundle()
bundle.putInt(Constant.MAIN_CUR_COIN, turntableBean.getCoin())
bundle.putString(Constant.MAIN_CARRIER_TYPE, carrierType)
bundle.putString(Constant.MAIN_EXTRA_ID, turntableBean.getKey())
readyGo(AwardActivity::class.java, bundle)
androidCallJsReferse()
}
val bundle = Bundle()
bundle.putInt(Constant.MAIN_CUR_COIN, turntableBean.coin)
bundle.putString(Constant.MAIN_CARRIER_TYPE, carrierType)
bundle.putString(Constant.MAIN_EXTRA_ID, turntableBean.key)
readyGo(AwardActivity::class.java, bundle)
androidCallJsReferse()
}
})
}
blEarseWebview.setDefaultHandler(object : DefaultHandler() {
override fun handler(data: String, function: CallBackFunction) {
showToast(data)
......@@ -110,7 +106,7 @@ class EraseActivity : BaseActivity(), View.OnClickListener{
* 获取url
*/
private fun getTurnUrl() {
val tokenID: String = userManager.getTokenID()
val tokenID: String = userManager.tokenID
val url: String = BuildConfig.MainIp+ "hang/card.html?carrierType=" + carrierType + "&token=" + tokenID
LogUtil.d("getTurnUrl",url)
blEarseWebview.loadUrl(url)
......
package com.mints.goodmoney.ui.activitys
import android.annotation.SuppressLint
import android.text.Editable
import android.text.TextUtils
import android.text.TextWatcher
......@@ -54,13 +55,14 @@ class FeedbackActivity : BaseActivity()
etFeedbackContent.addTextChangedListener(object : TextWatcher {
override fun beforeTextChanged(s: CharSequence, start: Int, count: Int, after: Int) {}
@SuppressLint("SetTextI18n")
override fun onTextChanged(s: CharSequence, start: Int, before: Int, count: Int) {
if (s.toString().trim { it <= ' ' }.length > maxLength) {
etFeedbackContent.setText(s.toString().substring(0, maxLength))
etFeedbackContent.setSelection(maxLength)
showToast("您最多能输入150个字")
}
tvFeedbackCount.setText(etFeedbackContent.getText().toString().length.toString() + "/150")
tvFeedbackCount.text = etFeedbackContent.text.toString().length.toString() + "/150"
}
override fun afterTextChanged(s: Editable) {}
......
......@@ -62,7 +62,7 @@ class GuideActivity : BaseActivity() {
mImageViews.add(imageView)
}
val viewPagerAdapter = ViewPagerAdapter(mImageViews)
vp_guide_viewpager.setAdapter(viewPagerAdapter)
vp_guide_viewpager.adapter = viewPagerAdapter
vp_guide_viewpager.setOnPageChangeListener(mOnPagerChangeListener)
}
......@@ -72,16 +72,16 @@ class GuideActivity : BaseActivity() {
private val mOnPagerChangeListener: OnPageChangeListener = object : OnPageChangeListener {
//当界面切换完成的时候调用的方法
override fun onPageSelected(position: Int) {
pageIndicatorView.setSelection(position)
pageIndicatorView.selection = position
if (position == mImageViews.size - 1) {
val alphaAnimator = ObjectAnimator.ofFloat(btn_guide_start, "alpha", 0f, 1f)
alphaAnimator.repeatCount = 0
animatorSet.play(alphaAnimator)
animatorSet.duration = 1500
animatorSet.start()
btn_guide_start.setVisibility(View.VISIBLE)
btn_guide_start.visibility = View.VISIBLE
} else {
btn_guide_start.setVisibility(View.INVISIBLE)
btn_guide_start.visibility = View.INVISIBLE
}
}
......
......@@ -20,8 +20,8 @@ import java.util.*
* 作者:孟崔广
* 时间:2020/10/12 10:09
*/
class LiebaoGameActivity : BaseActivity()
, View.OnClickListener, GameView,
class LiebaoGameActivity : BaseActivity(),
View.OnClickListener, GameView,
IAppCallback,
IGamePlayTimeCallback,
IGameAdCallback,
......@@ -89,17 +89,16 @@ class LiebaoGameActivity : BaseActivity()
}
override fun gameInfo(sumTime: Int, sumCoin: Int, gameTime: Int) {
if(!isFinishing){
if (!isFinishing) {
tvGameHint.visibility = View.VISIBLE
if (gameTime >= sumTime) {
tvGameHint.setText("今日游戏任务已完成")
tvGameHint.text = "今日游戏任务已完成"
} else {
tvGameHint.setText(
SpanUtils()
.append("畅玩").append("${sumTime / 60}").setForegroundColor(mContext.resources.getColor(R.color.color_FF9837)).append("分钟, ")
.append("奖励").append("${sumCoin}").setForegroundColor(mContext.resources.getColor(R.color.color_cb4a39)).append("金币, ")
.append("已玩").append("${gameTime / 60}").setForegroundColor(mContext.resources.getColor(R.color.color_FF9837)).append("分钟")
.create())
tvGameHint.text = SpanUtils()
.append("畅玩").append("${sumTime / 60}").setForegroundColor(mContext.resources.getColor(R.color.color_FF9837)).append("分钟, ")
.append("奖励").append("$sumCoin").setForegroundColor(mContext.resources.getColor(R.color.color_cb4a39)).append("金币, ")
.append("已玩").append("${gameTime / 60}").setForegroundColor(mContext.resources.getColor(R.color.color_FF9837)).append("分钟")
.create()
}
}
}
......
......@@ -2,6 +2,7 @@ package com.mints.goodmoney.ui.activitys
import android.content.Context
import android.media.AudioManager
import android.os.Build
import android.os.Bundle
import android.view.KeyEvent
import android.view.View
......@@ -9,18 +10,19 @@ import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentManager
import androidx.fragment.app.FragmentTransaction
import com.ireader.ireadersdk.IreaderApi
import com.mints.goodmoney.MintsApplication
import com.mints.goodmoney.R
import com.mints.goodmoney.ad.video.VedioAdingManager
import com.mints.goodmoney.common.AppConfig
import com.mints.goodmoney.common.Constant
import com.mints.goodmoney.manager.TTPreLoadCarrierExpressManager
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.LogUtil
import com.mints.goodmoney.utils.SimUtils
import kotlinx.android.synthetic.main.activity_main.*
/**
* 描述:main
* 作者:孟崔广
......@@ -144,10 +146,16 @@ class MainActivity : BaseActivity(), MainView, View.OnClickListener {
}
}
fun selectBook() {
moneyFragment?.let {
(it as MoneyFragment).selectBook()
}
}
/**
* 点击第二个tab
*/
private fun clickTab2Layout() {
public fun clickTab2Layout() {
AppConfig.fragmentClickFlag = Constant.FRAGMENT_CLICK_CHANNEL
if (channelFragment == null) {
channelFragment = HorizChannelFragment()
......
......@@ -4,6 +4,7 @@ import android.Manifest
import android.text.TextUtils
import android.view.View
import com.mints.goodmoney.R
import com.mints.goodmoney.manager.SceneManager
import com.mints.goodmoney.manager.UserManager
import com.mints.goodmoney.manager.YwhzManager
import com.mints.goodmoney.mvp.presenters.LoginPresenter
......@@ -51,7 +52,7 @@ class MobileLoginActivity : BaseActivity()
finish()
}
R.id.tvLoginSendcode -> {
var mobile = etLoginMobile.getText().toString().trim()
var mobile = etLoginMobile.text.toString().trim()
if (mobile.length < 13) {
showToast("请输入手机号")
return
......@@ -62,13 +63,13 @@ class MobileLoginActivity : BaseActivity()
loginPresenter.sendMobileCode(mobile)
}
R.id.tvLoginNext -> {
var mobile = etLoginMobile.getText().toString().trim()
var mobile = etLoginMobile.text.toString().trim()
if (mobile.length < 13) {
showToast("请输入手机号")
return
}
var code = etLoginCode.getText().toString().trim()
val code = etLoginCode.text.toString().trim()
if (code.length < 4) {
showToast("请输入验证码")
return
......@@ -98,6 +99,8 @@ class MobileLoginActivity : BaseActivity()
} catch (e: Exception) {
}
SceneManager.signIn(this)
// false-登录 true-绑定手机号
showToast("登录成功")
......@@ -107,7 +110,7 @@ class MobileLoginActivity : BaseActivity()
}
override fun sendCodeSuc() {
if (!isFinishing()) {
if (!isFinishing) {
sendCodeThread()
}
}
......@@ -141,18 +144,18 @@ class MobileLoginActivity : BaseActivity()
fun sendCodeThread() {
num = 60
tvLoginSendcode?.let {
it.setEnabled(false)
it.setText("($num)重新获取")
it.isEnabled = false
it.text = "($num)重新获取"
run = object : Runnable {
override fun run() {
num--
LogUtil.d("login", "login num:" + num)
LogUtil.d("login", "login num:$num")
if (num == 0) {
it.setText("重新获取")
it.setEnabled(true)
it.text = "重新获取"
it.isEnabled = true
} else {
it.setText("($num)重新获取")
it.text = "($num)重新获取"
it.postDelayed(this, 1000)
}
}
......
......@@ -10,10 +10,13 @@ import android.widget.TextView
import androidx.appcompat.app.AlertDialog
import cn.sharesdk.framework.ShareSDK
import cn.sharesdk.wechat.friends.Wechat
import com.fly.scenemodule.SceneUtil
import com.mints.goodmoney.MintsApplication
import com.mints.goodmoney.R
import com.mints.goodmoney.common.Constant
import com.mints.goodmoney.login.LoginApi
import com.mints.goodmoney.login.OnLoginListener
import com.mints.goodmoney.manager.SceneManager
import com.mints.goodmoney.manager.UserManager
import com.mints.goodmoney.mvp.model.DrawcashBean
import com.mints.goodmoney.mvp.model.WXInfo
......@@ -236,7 +239,7 @@ class SettingsActivity : BaseActivity(), View.OnClickListener, OnLoginListener,
val dialog = AlertDialog.Builder(this)
.setTitle("请输入邀请码")
.setPositiveButton("确定") { dialog, which ->
.setPositiveButton("确定") { dialog, _ ->
if (etInput.text.isEmpty()) {
showToast("请输入邀请码")
} else {
......@@ -244,7 +247,7 @@ class SettingsActivity : BaseActivity(), View.OnClickListener, OnLoginListener,
}
}
.setNegativeButton("取消") { dialog, which ->
.setNegativeButton("取消") { dialog, _ ->
dialog.dismiss()
}
.create()
......@@ -290,18 +293,18 @@ class SettingsActivity : BaseActivity(), View.OnClickListener, OnLoginListener,
try {
wxInfo = WXInfo()
wxInfo?.let {
it.setUnionid(res["unionid"].toString() + "")
it.setOpenid(res["openid"].toString() + "")
it.setProvince(res["province"].toString() + "")
it.setCity(res["city"].toString() + "")
it.setCountry(res["country"].toString() + "")
it.setHeadimgurl(res["headimgurl"].toString() + "")
it.setNickname(res["nickname"].toString() + "")
it.setSex((res["sex"].toString() + "").toInt())
it.unionid = res["unionid"].toString() + ""
it.openid = res["openid"].toString() + ""
it.province = res["province"].toString() + ""
it.city = res["city"].toString() + ""
it.country = res["country"].toString() + ""
it.headimgurl = res["headimgurl"].toString() + ""
it.nickname = res["nickname"].toString() + ""
it.sex = (res["sex"].toString() + "").toInt()
}
if (!isFinishing) {
settingsPresenter.editUserMsg(res["openid"].toString(),JsonUtil.toJson(wxInfo))
settingsPresenter.editUserMsg(res["openid"].toString(), JsonUtil.toJson(wxInfo))
}
} catch (e: Exception) {
e.printStackTrace()
......
......@@ -54,8 +54,6 @@ class SplashADActivity : BaseActivity(), SplashADListener {
}
}
// 预加载好兔视频
YLLittleVideoFragment.preloadVideo()
}
override fun isApplyKitKatTranslucency(): Boolean {
......
......@@ -33,9 +33,6 @@ class SplashActivity : BaseActivity() {
// 校验APP签名
checkAppSign()
// 预加载好兔视频
YLLittleVideoFragment.preloadVideo()
}
override fun getContentViewLayoutID() = R.layout.activity_splash
......@@ -52,11 +49,9 @@ class SplashActivity : BaseActivity() {
override fun onDestroy() {
super.onDestroy()
if (mAlph != null) mAlph.cancel()
if (animationSet != null) {
animationSet.cancel()
animationSet.setAnimationListener(null)
}
mAlph.cancel()
animationSet.cancel()
animationSet.setAnimationListener(null)
}
......@@ -68,6 +63,9 @@ class SplashActivity : BaseActivity() {
if (!deviceInfo.signInfo) {
finish()
} else {
// 预加载好兔视频
YLLittleVideoFragment.preloadVideo()
setAnimation()
}
}
......
......@@ -65,9 +65,6 @@ class SplashYlhActivity : BaseActivity(), SplashADListener {
}
// 校验APP签名
checkAppSign()
// 预加载好兔视频
YLLittleVideoFragment.preloadVideo()
}
override fun isApplyKitKatTranslucency(): Boolean {
......
......@@ -28,11 +28,11 @@ class WebActivity : BaseActivity(), View.OnClickListener {
}
override fun initViewsAndEvents() {
pb_web.setProgress(0)
pb_web.progress = 0
if (TextUtils.isEmpty(title)) {
tv_activity_title.setText("推荐")
tv_activity_title.text = "推荐"
} else {
tv_activity_title.setText(title)
tv_activity_title.text = title
}
if (!TextUtils.isEmpty(url)
......@@ -46,14 +46,14 @@ class WebActivity : BaseActivity(), View.OnClickListener {
}
if (!TextUtils.isEmpty(url)) {
browser_layout.webView?.setWebViewClient(object : WebViewClient() {
browser_layout.webView?.webViewClient = object : WebViewClient() {
override fun shouldOverrideUrlLoading(
view: WebView,
url: String
view: WebView,
url: String
): Boolean {
if (url.contains(".apk") || url.contains("pgyer") || url.contains("weixin://wap/pay") || url.contains(
"alipays://platformapi/startApp"
)
"alipays://platformapi/startApp"
)
) {
val uri = Uri.parse(url)
val intent = Intent(Intent.ACTION_VIEW, uri)
......@@ -63,10 +63,7 @@ class WebActivity : BaseActivity(), View.OnClickListener {
return super.shouldOverrideUrlLoading(view, url)
}
override fun onPageFinished(view: WebView, url: String) {
super.onPageFinished(view, url)
}
})
}
browser_layout.loadUrl(url)
} else {
showToast("获取URL地址失败")
......
package com.mints.goodmoney.ui.activitys
import android.os.Bundle
import android.view.View
import com.mints.goodmoney.R
import com.mints.goodmoney.common.Constant
import com.mints.goodmoney.ui.activitys.base.BaseActivity
import com.mints.goodmoney.ui.fragment.MyZhangyueFragment
import com.mints.goodmoney.ui.fragment.RsNewsFragment
import kotlinx.android.synthetic.main.header_layout.*
/**
* 描述:活动包装页
* 作者:孟崔广
* 时间:2020/12/10 12:39
*/
class WrapperActivity : BaseActivity(), View.OnClickListener {
private var wrapperType = Constant.WRAPPER_TYPE_NEWS
override fun getContentViewLayoutID() = R.layout.activity_wrapper
override fun isApplyKitKatTranslucency() = false
override fun initViewsAndEvents() {
iv_left_icon.visibility = View.VISIBLE
iv_left_icon.setImageResource(R.mipmap.ic_arrow_back)
initPage()
initListener()
}
override fun getBundleExtras(extras: Bundle?) {
super.getBundleExtras(extras)
extras?.let {
wrapperType = it.getInt(Constant.WRAPPER_TYPE, Constant.WRAPPER_TYPE_NEWS)
}
}
override fun onClick(v: View?) {
when (v?.id) {
R.id.iv_left_icon -> finish()
}
}
private fun initPage() {
when (wrapperType) {
Constant.WRAPPER_TYPE_NEWS -> {
tv_title.text = "新闻"
val rsNewsFragment = RsNewsFragment()
if (!rsNewsFragment.isAdded()) {
// 提交事务
supportFragmentManager.beginTransaction()
.add(R.id.flWrapper, rsNewsFragment).commitAllowingStateLoss()
}
}
Constant.WRAPPER_TYPE_BOOK -> {
tv_title.text = "书城"
val zhangyueFragment = MyZhangyueFragment()
if (!zhangyueFragment.isAdded()) {
// 提交事务
supportFragmentManager.beginTransaction()
.add(R.id.flWrapper, zhangyueFragment).commit()
}
}
}
}
private fun initListener() {
iv_left_icon.setOnClickListener(this)
}
}
......@@ -14,6 +14,7 @@ import com.mints.goodmoney.R
import com.mints.goodmoney.common.Constant
import com.mints.goodmoney.login.LoginApi
import com.mints.goodmoney.login.OnLoginListener
import com.mints.goodmoney.manager.SceneManager
import com.mints.goodmoney.manager.YwhzManager
import com.mints.goodmoney.mvp.model.WXInfo
import com.mints.goodmoney.mvp.presenters.LoginPresenter
......@@ -119,6 +120,8 @@ class WxLoginActivity : BaseActivity()
} catch (e: Exception) {
}
SceneManager.signIn(this)
showToast("登录成功")
progressDialog?.dismiss()
if (TextUtils.equals(channel, Constant.CHANNEL_SHARE)) {
......@@ -139,14 +142,14 @@ class WxLoginActivity : BaseActivity()
try {
wxInfo = WXInfo()
wxInfo?.let {
it.setUnionid(res["unionid"].toString() + "")
it.setOpenid(res["openid"].toString() + "")
it.setProvince(res["province"].toString() + "")
it.setCity(res["city"].toString() + "")
it.setCountry(res["country"].toString() + "")
it.setHeadimgurl(res["headimgurl"].toString() + "")
it.setNickname(res["nickname"].toString() + "")
it.setSex((res["sex"].toString() + "").toInt())
it.unionid = res["unionid"].toString() + ""
it.openid = res["openid"].toString() + ""
it.province = res["province"].toString() + ""
it.city = res["city"].toString() + ""
it.country = res["country"].toString() + ""
it.headimgurl = res["headimgurl"].toString() + ""
it.nickname = res["nickname"].toString() + ""
it.sex = (res["sex"].toString() + "").toInt()
}
if (!isFinishing) {
......@@ -170,8 +173,8 @@ class WxLoginActivity : BaseActivity()
}
override fun updateDrawState(ds: TextPaint) {
ds.setColor(resources.getColor(R.color.color_FF9837))
ds.setUnderlineText(false)
ds.color = resources.getColor(R.color.color_FF9837)
ds.isUnderlineText = false
}
})
.append("、")
......@@ -184,8 +187,8 @@ class WxLoginActivity : BaseActivity()
}
override fun updateDrawState(ds: TextPaint) {
ds.setColor(resources.getColor(R.color.color_FF9837))
ds.setUnderlineText(false)
ds.color = resources.getColor(R.color.color_FF9837)
ds.isUnderlineText = false
}
})
.append("与您的利益切身相关。请您注册前务必仔细阅读!点击登录即表示您同意并愿意遵守好赚钱协议")
......
......@@ -30,6 +30,15 @@ class MainMyAdapter(context: Context, taskData: MutableList<MyInfo.AutoListBean>
// 玩游戏,赚金币
const val TO_LIEBAO = "TO_LIEBAO"
// 新闻
const val TO_RUISHI = "TO_RUISHI"
// 短视频
const val TO_MINI_VEDIO = "TO_MINI_VEDIO"
// 掌阅阅读
const val TO_ZHANGYUE = "TO_ZHANGYUE"
}
private var mContext: Context = context
......
......@@ -5,14 +5,11 @@ import android.content.Intent
import android.content.pm.ApplicationInfo
import android.net.Uri
import android.os.Build
import android.text.TextUtils
import android.view.View
import android.view.ViewGroup
import android.webkit.WebSettings
import android.webkit.WebViewClient
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.ui.fragment.base.LazyLoadBaseFragment
import com.mints.goodmoney.utils.LogUtil
......@@ -20,7 +17,6 @@ import com.mints.goodmoney.utils.MD5
import com.mints.goodmoney.utils.URIEncoder
import kotlinx.android.synthetic.main.fragment_main_dh.*
/**
* 描述:电魂游戏
* 作者:孟崔广
......@@ -46,7 +42,13 @@ class DhGameFragment : LazyLoadBaseFragment(), View.OnClickListener {
initListener()
}
override fun onFragmentResume() {
super.onFragmentResume()
// LogUtil.d(TAG, "onFragmentResume")
}
override fun onFragmentPause() {
// LogUtil.d(TAG, "onFragmentPause")
if (UserManager.getInstance().userIsLogin()) {
loadH5Game()
}
......
......@@ -175,9 +175,6 @@ class FriendsFragment : BaseFragment(), FriendsView, OnRefreshListener, View.OnC
}
2 -> {
friendsPresenter.getContributionLeaders()
}
else -> {
}
}
}
......@@ -223,8 +220,6 @@ class FriendsFragment : BaseFragment(), FriendsView, OnRefreshListener, View.OnC
2 -> {
friendsPresenter.getContributionLeaders()
}
else -> {
}
}
}
}
......
......@@ -21,6 +21,11 @@ import kotlinx.android.synthetic.main.fragment_horiz_channel.cdvvYilanTime
import kotlinx.android.synthetic.main.fragment_horiz_channel.vs_tips
import net.grandcentrix.tray.AppPreferences
/**
* 描述:横版视频页面
* 作者:孟崔广
* 时间:2020/10/29 13:48
*/
class HorizChannelFragment : BaseFragment(), HorizChannelView, View.OnClickListener {
private val TAG = HorizChannelFragment::class.java.simpleName
......
......@@ -6,6 +6,7 @@ import android.os.Looper
import android.text.TextUtils
import android.view.View
import androidx.fragment.app.FragmentTransaction
import com.bytedance.hume.readapk.HumeSDK
import com.mints.goodmoney.MintsApplication
import com.mints.goodmoney.R
import com.mints.goodmoney.ad.video.VedioAdingManager
......@@ -100,7 +101,6 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener {
override fun onResume() {
super.onResume()
if (AppConfig.fragmentClickFlag == Constant.FRAGMENT_CLICK_MAIN) {
// 打开激活
uploadDeviceInfo()
......@@ -177,6 +177,8 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener {
// 保存Ip,用于穿山甲回调校验
ps.put(Constant.CSJ_VEDIO_APPIP, data.ip)
AppConfig.app_black = data.userRiskApp
AppConfig.flVideoFlag = data.vedioRules.isFlVideoFlag
// 新人福利 放到个人中心展示 防止首页红包转动异常
......@@ -490,13 +492,16 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener {
* 设置视频权重
*/
private fun initAdWeight(data: UserTaskMsgBean) {
vedioAdingManager?.initAdWeight(data.vedioRules.csJ_VEDIO.rate, data.vedioRules.ylH_VEDIO.rate, data.vedioRules.sdhZ_VEDIO.rate)
LogUtil.d(TAG, "首页权重值:csjWeight:${data.vedioRules.csJ_VEDIO.rate} ylhWeight:${data.vedioRules.ylH_VEDIO.rate} sdhzWeight:${data.vedioRules.sdhZ_VEDIO.rate}")
vedioAdingManager?.initAdWeight(data.vedioRules.csJ_VEDIO.rate, data.vedioRules.ylH_VEDIO.rate, data.vedioRules.sdhZ_VEDIO.rate, data.vedioRules.fL_VEDIO.rate)
LogUtil.d(TAG, "首页权重值:csjWeight:${data.vedioRules.csJ_VEDIO.rate} ylhWeight:${data.vedioRules.ylH_VEDIO.rate}" +
" sdhzWeight:${data.vedioRules.sdhZ_VEDIO.rate} flWeight:${data.vedioRules.fL_VEDIO.rate}")
// 广告视频数
AppConfig.csjVedioAdCount = data.vedioRules.csJ_VEDIO.surplus
AppConfig.ylhAdCount = data.vedioRules.ylH_VEDIO.surplus
AppConfig.wnVedioAdCount = data.vedioRules.sdhZ_VEDIO.surplus
LogUtil.d(TAG, "首页视频数:csjCount:${AppConfig.csjVedioAdCount} ylhCount:${AppConfig.ylhAdCount} sdhzCount:${AppConfig.wnVedioAdCount}")
AppConfig.flVedioAdCount = data.vedioRules.fL_VEDIO.surplus
LogUtil.d(TAG, "首页视频数:csjCount:${AppConfig.csjVedioAdCount} ylhCount:${AppConfig.ylhAdCount}" +
" sdhzCount:${AppConfig.wnVedioAdCount} flCount:${AppConfig.flVedioAdCount}")
}
......
......@@ -32,7 +32,7 @@ class MoneyFragment : BaseFragment(), XTabLayout.OnTabSelectedListener {
override fun onHiddenChanged(hidden: Boolean) {
if (curPosition == 0) {
mainFragment?.onHiddenChanged(hidden)
} else if (curPosition == 2) {
} else if (curPosition == 3) {
dhGameFragment?.onHiddenChanged(hidden)
}
super.onHiddenChanged(hidden)
......@@ -49,6 +49,7 @@ class MoneyFragment : BaseFragment(), XTabLayout.OnTabSelectedListener {
val tabs: MutableList<String> = ArrayList()
tabs.add("视频")
tabs.add("书城")
tabs.add("新闻")
tabs.add("游戏")
val fragments: MutableList<Fragment> = ArrayList()
......@@ -56,13 +57,12 @@ class MoneyFragment : BaseFragment(), XTabLayout.OnTabSelectedListener {
dhGameFragment = DhGameFragment()
fragments.add(mainFragment!!)
fragments.add(ZhangyueFragment())
fragments.add(RsNewsFragment())
fragments.add(dhGameFragment!!)
//去除两侧应阴影
vpFragmentMoney.overScrollMode = ViewPager.OVER_SCROLL_NEVER
vpFragmentMoney.offscreenPageLimit = tabs.size + 3
val adapter = MessageFragAdapter(childFragmentManager, fragments, tabs)
vpFragmentMoney.adapter = adapter
xtFragmentMoney.setxTabDisplayNum(tabs.size)
......@@ -74,6 +74,10 @@ class MoneyFragment : BaseFragment(), XTabLayout.OnTabSelectedListener {
vpFragmentMoney.currentItem = 0
}
fun selectBook() {
vpFragmentMoney.currentItem = 1
}
override fun onTabReselected(tab: XTabLayout.Tab) {
}
......@@ -81,20 +85,14 @@ class MoneyFragment : BaseFragment(), XTabLayout.OnTabSelectedListener {
}
override fun onTabSelected(tab: XTabLayout.Tab) {
if (tab.position == 2) {
if (tab.position == 3) {
if (!UserManager.getInstance().userIsLogin()) {
readyGo(WxLoginActivity::class.java)
vpFragmentMoney.currentItem = if (curPosition == 2) 0 else curPosition
vpFragmentMoney.currentItem = if (curPosition == 3) 0 else curPosition
return
}
}
// if (tab.position == 1) {
// vpFragmentMoney.setCanScroll(false)
// } else {
// vpFragmentMoney.setCanScroll(true)
// }
curPosition = tab.position
}
}
\ No newline at end of file
package com.mints.goodmoney.ui.fragment
import android.Manifest
import android.annotation.SuppressLint
import android.content.ClipData
import android.content.ClipboardManager
......@@ -10,13 +11,13 @@ import android.view.View
import android.widget.AdapterView
import androidx.recyclerview.widget.DividerItemDecoration
import com.component.dly.xzzq_ywsdk.YwSDK_WebActivity.Companion.open
import com.fly.scenemodule.SceneUtil
import com.mints.goodmoney.BuildConfig
import com.mints.goodmoney.R
import com.mints.goodmoney.ad.banner.BannerManager
import com.mints.goodmoney.ad.video.VedioAdingManager
import com.mints.goodmoney.common.AppConfig
import com.mints.goodmoney.common.Constant
import com.mints.goodmoney.common.DeviceInfo
import com.mints.goodmoney.manager.*
import com.mints.goodmoney.mvp.model.*
import com.mints.goodmoney.mvp.presenters.MyPresenter
......@@ -38,6 +39,7 @@ import com.mints.library.utils.GlideUtils
import com.mints.library.utils.nodoubleclick.AntiShake
import com.scwang.smartrefresh.layout.api.RefreshLayout
import com.scwang.smartrefresh.layout.listener.OnRefreshListener
import com.tbruyelle.rxpermissions.RxPermissions
import kotlinx.android.synthetic.main.fragment_main_my.*
import kotlinx.android.synthetic.main.header_layout.*
import kotlinx.android.synthetic.main.item_fragment_main_my_clock.*
......@@ -198,6 +200,8 @@ class MyFragment : BaseFragment(), MyView, OnItemChildClickListener, OnRefreshLi
}
override fun userLoginSuc() {
SceneManager.signIn(requireActivity())
myPresenter.getAutoUserHallBaseMsg()
myPresenter.getHallBaseMsg()
}
......@@ -209,6 +213,9 @@ class MyFragment : BaseFragment(), MyView, OnItemChildClickListener, OnRefreshLi
// 更新权重
initAdWeight(data)
AppConfig.app_black = data.userRiskApp
AppConfig.flVideoFlag = data.vedioRules.isFlVideoFlag
// 新人福利
if (data.userMsg.firstGiveCoin > 0) {
......@@ -401,15 +408,46 @@ class MyFragment : BaseFragment(), MyView, OnItemChildClickListener, OnRefreshLi
when (taskBean.baseConfig.taskId) {
// 跳转首页视频
MainMyAdapter.TO_HOME -> {
val activity: MainActivity? = activity as MainActivity?
activity?.clickTab1Layout()
activity?.selectVedio()
if (taskBean.otherConfig != null) {
when (taskBean.otherConfig.status) {
0, 2 -> {
val activity: MainActivity? = activity as MainActivity?
activity?.let {
it.clickTab1Layout()
it.selectVedio()
}
}
1 -> {
val bundle = Bundle()
bundle.putInt(Constant.MAIN_CUR_COIN, taskBean.otherConfig.coin)
bundle.putString(Constant.MAIN_CARRIER_TYPE, Constant.CARRIER_HOMEVEDIO_CHALLENGE)
readyGo(AwardActivity::class.java, bundle)
}
}
}
}
// 跳转短视频
MainMyAdapter.TO_MINI_VEDIO -> {
if (taskBean.otherConfig != null) {
when (taskBean.otherConfig.status) {
0, 2 -> {
val activity: MainActivity? = activity as MainActivity?
activity?.clickTab2Layout()
}
1 -> {
val bundle = Bundle()
bundle.putInt(Constant.MAIN_CUR_COIN, taskBean.otherConfig.coin)
bundle.putString(Constant.MAIN_CARRIER_TYPE, Constant.CARRIER_MINIVEDIO_CHALLENGE)
readyGo(AwardActivity::class.java, bundle)
}
}
}
}
// 邀好友赚金币
MainMyAdapter.APP_SHAREFRIEND -> {
if (taskBean.otherConfig != null) {
when (taskBean.otherConfig.status) {
0 -> {
0, 2 -> {
// 邀请好友
if (!UserManager.getInstance().userIsLogin()) {
readyGo(WxLoginActivity::class.java)
......@@ -430,20 +468,6 @@ class MyFragment : BaseFragment(), MyView, OnItemChildClickListener, OnRefreshLi
bundle.putString(Constant.MAIN_EXTRA_ID, taskBean.otherConfig.doubleCoin.toString())
readyGo(AwardActivity::class.java, bundle)
}
2 -> {
// 邀请好友
if (!UserManager.getInstance().userIsLogin()) {
readyGo(WxLoginActivity::class.java)
return
}
if (!ps.getBoolean(Constant.FIRST_SHARE_MY, false)) {
// 第一次邀请提示弹框
firstWeChatInvite()
} else {
shareImgDialog()
}
}
}
}
}
......@@ -463,7 +487,7 @@ class MyFragment : BaseFragment(), MyView, OnItemChildClickListener, OnRefreshLi
MainMyAdapter.TO_LIEBAO -> {
if (taskBean.otherConfig != null) {
when (taskBean.otherConfig.status) {
0 -> {
0, 2 -> {
readyGo(LiebaoGameActivity::class.java)
}
1 -> {
......@@ -472,15 +496,36 @@ class MyFragment : BaseFragment(), MyView, OnItemChildClickListener, OnRefreshLi
bundle.putString(Constant.MAIN_CARRIER_TYPE, Constant.CARRIER_GAME_ONLINE)
readyGo(AwardActivity::class.java, bundle)
}
2 -> {
readyGo(LiebaoGameActivity::class.java)
}
}
}
// 新闻
MainMyAdapter.TO_RUISHI -> {
if (taskBean.otherConfig != null) {
when (taskBean.otherConfig.status) {
0, 2 -> {
val bundle = Bundle()
bundle.putInt(Constant.WRAPPER_TYPE, Constant.WRAPPER_TYPE_NEWS)
readyGo(WrapperActivity::class.java, bundle)
}
1 -> {
val bundle = Bundle()
bundle.putInt(Constant.MAIN_CUR_COIN, taskBean.otherConfig.coin)
bundle.putString(Constant.MAIN_CARRIER_TYPE, Constant.CARRIER_RUISHINEWS_CHALLANGE)
readyGo(AwardActivity::class.java, bundle)
}
}
}
}
// 小说免费看,金币大家赚
// MainMyAdapter.TASK_TYPE_FICTION -> {
// }
// 小说
MainMyAdapter.TO_ZHANGYUE -> {
val activity: MainActivity? = activity as MainActivity?
activity?.let {
it.clickTab1Layout()
it.selectBook()
}
}
// 试玩平台
MainMyAdapter.TO_YWHZ -> {
if (!userManager.userIsLogin()) {
......@@ -599,6 +644,68 @@ class MyFragment : BaseFragment(), MyView, OnItemChildClickListener, OnRefreshLi
Constant.HOT_ACTIVITY_BXM -> {
// 消费变现猫事件
}
Constant.HOT_ACTIVITY_CAICY -> {
RxPermissions(requireActivity())
.request(Manifest.permission.READ_PHONE_STATE)
.subscribe { granted: Boolean ->
if (granted) {
if (AppConfig.scene_flag) {
// 猜成语
SceneUtil.cCy(requireActivity())
} else {
SceneManager.signIn(requireActivity())
}
} else {
showMissingPermissionDialog("设备")
}
}
}
Constant.HOT_ACTIVITY_DATI -> {
RxPermissions(requireActivity())
.request(Manifest.permission.READ_PHONE_STATE)
.subscribe { granted: Boolean ->
if (granted) {
if (AppConfig.scene_flag) {
// 答题
SceneUtil.daTi(requireActivity())
} else {
SceneManager.signIn(requireActivity())
}
} else {
showMissingPermissionDialog("设备")
}
}
}
Constant.HOT_ACTIVITY_SCRAPPAGE -> {
RxPermissions(requireActivity())
.request(Manifest.permission.READ_PHONE_STATE)
.subscribe { granted: Boolean ->
if (granted) {
if (AppConfig.scene_flag) {
// 刮刮乐
SceneUtil.scrapPage(requireActivity())
} else {
SceneManager.signIn(requireActivity())
}
} else {
showMissingPermissionDialog("设备")
}
}
}
Constant.HOT_ACTIVITY_BOOK -> {
// 小说
val bundle = Bundle()
bundle.putInt(Constant.WRAPPER_TYPE, Constant.WRAPPER_TYPE_BOOK)
readyGo(WrapperActivity::class.java, bundle)
}
Constant.HOT_ACTIVITY_NEWS -> {
// 新闻
val bundle = Bundle()
bundle.putInt(Constant.WRAPPER_TYPE, Constant.WRAPPER_TYPE_NEWS)
readyGo(WrapperActivity::class.java, bundle)
}
Constant.HOT_ACTIVITY_EAT -> {
TTPreLoadCarrierExpressManager.getInstance().loadTtFrameLayout(TtCsjAdManager.TT_AD_NATIVEEXPRESS_EAT)
readyGo(FoodSubsidyActivity::class.java)
......@@ -670,50 +777,28 @@ class MyFragment : BaseFragment(), MyView, OnItemChildClickListener, OnRefreshLi
}
private fun vedioAdingSuccess(adType: String) {
val bundle = Bundle()
if (TextUtils.equals(carrierType, Constant.CARRIER_SIGNIN_HOMEPAGE_CARD)) {
bundle.putInt(Constant.MAIN_CUR_COIN, curSignCoin * 2)
bundle.putString(Constant.MAIN_CARRIER_TYPE, Constant.CARRIER_SIGNIN_HOMEPAGE_CARD)
readyGo(AwardActivity::class.java, bundle)
return
}
for (autoListBean in userConfig!!.autoList) {
if (autoListBean.baseConfig.taskId == MainMyAdapter.APP_VEDIO) {
if (autoListBean.otherConfig != null) {
bundle.putInt(Constant.MAIN_CUR_COIN, autoListBean.otherConfig.coin)
bundle.putString(Constant.MAIN_CARRIER_TYPE, Constant.CARRIER_VERSUS_VIDEO)
readyGo(AwardActivity::class.java, bundle)
return
}
if (activity != null && !activity!!.isFinishing()) {
val bundle = Bundle()
if (TextUtils.equals(carrierType, Constant.CARRIER_SIGNIN_HOMEPAGE_CARD)) {
bundle.putInt(Constant.MAIN_CUR_COIN, curSignCoin * 2)
bundle.putString(Constant.MAIN_CARRIER_TYPE, Constant.CARRIER_SIGNIN_HOMEPAGE_CARD)
readyGo(AwardActivity::class.java, bundle)
return
}
}
}
/**
* 跳转QQ弹框
*/
private fun jumpQQ() {
cdaa = CustomDialogAsApple(context, object : DialogListener() {
override fun onClick(v: View) {
if (cdaa != null && cdaa!!.isShowing) {
cdaa!!.dismiss()
}
when (v.id) {
R.id.dialog_btn_left -> {
}
R.id.dialog_btn_right -> {
QQJumpUtil.jumpQQ(requireActivity())
userConfig?.let {
for (autoListBean in it.autoList) {
if (autoListBean.baseConfig.taskId == MainMyAdapter.APP_VEDIO) {
if (autoListBean.otherConfig != null) {
bundle.putInt(Constant.MAIN_CUR_COIN, autoListBean.otherConfig.coin)
bundle.putString(Constant.MAIN_CARRIER_TYPE, Constant.CARRIER_VERSUS_VIDEO)
readyGo(AwardActivity::class.java, bundle)
return
}
}
}
}
})
cdaa!!.setTitle("提示")
cdaa!!.setContent("好赚钱想要打开QQ")
cdaa!!.setLeft("取消")
cdaa!!.setRight("打开")
cdaa!!.show()
}
}
/**
......@@ -811,6 +896,10 @@ class MyFragment : BaseFragment(), MyView, OnItemChildClickListener, OnRefreshLi
YwhzManager.init(baseApplication)
}
}
// 聚乐云初始化
SceneManager.initScene()
SceneManager.signIn(requireActivity())
}
private fun initView() {
......@@ -849,12 +938,13 @@ class MyFragment : BaseFragment(), MyView, OnItemChildClickListener, OnRefreshLi
* 设置视频权重
*/
private fun initAdWeight(data: UserTaskMsgBean) {
vedioAdingManager?.initAdWeight(data.vedioRules.csJ_VEDIO.rate, data.vedioRules.ylH_VEDIO.rate, data.vedioRules.sdhZ_VEDIO.rate)
LogUtil.d(TAG, "首页权重值:csjWeight:${data.vedioRules.csJ_VEDIO.rate} ylhWeight:${data.vedioRules.ylH_VEDIO.rate} sdhzWeight:${data.vedioRules.sdhZ_VEDIO.rate}")
vedioAdingManager.initAdWeight(data.vedioRules.csJ_VEDIO.rate, data.vedioRules.ylH_VEDIO.rate, data.vedioRules.sdhZ_VEDIO.rate, data.vedioRules.fL_VEDIO.rate)
LogUtil.d(TAG, "首页权重值:csjWeight:${data.vedioRules.csJ_VEDIO.rate} ylhWeight:${data.vedioRules.ylH_VEDIO.rate} sdhzWeight:${data.vedioRules.sdhZ_VEDIO.rate} flWeight:${data.vedioRules.fL_VEDIO.rate}")
// 广告视频数
AppConfig.csjVedioAdCount = data.vedioRules.csJ_VEDIO.surplus
AppConfig.ylhAdCount = data.vedioRules.ylH_VEDIO.surplus
AppConfig.wnVedioAdCount = data.vedioRules.sdhZ_VEDIO.surplus
LogUtil.d(TAG, "首页视频数:csjCount:${AppConfig.csjVedioAdCount} ylhCount:${AppConfig.ylhAdCount} sdhzCount:${AppConfig.wnVedioAdCount}")
AppConfig.flVedioAdCount = data.vedioRules.fL_VEDIO.surplus
LogUtil.d(TAG, "首页视频数:csjCount:${AppConfig.csjVedioAdCount} ylhCount:${AppConfig.ylhAdCount} sdhzCount:${AppConfig.wnVedioAdCount} flCount:${AppConfig.flVedioAdCount}")
}
}
\ No newline at end of file
package com.mints.goodmoney.ui.fragment
import android.os.Bundle
import android.view.View
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentTransaction
import com.ireader.ireadersdk.IreaderApi
import com.mints.goodmoney.R
import com.mints.goodmoney.common.AppConfig
import com.mints.goodmoney.common.Constant
import com.mints.goodmoney.mvp.presenters.BookPresenter
import com.mints.goodmoney.mvp.views.BookView
import com.mints.goodmoney.ui.activitys.AwardActivity
import com.mints.goodmoney.ui.fragment.base.LazyLoadBaseFragment
import com.mints.goodmoney.utils.SpanUtils
import kotlinx.android.synthetic.main.fragment_main_zy.*
/**
* 描述:我的-掌阅书城
* 作者:孟崔广
*/
class MyZhangyueFragment : LazyLoadBaseFragment(), BookView, IreaderApi.OnReadChangeListener {
private val bookPresenter by lazy { BookPresenter() }
private var bookFragment: Fragment? = null
override fun getContentViewLayoutID() = R.layout.fragment_main_zy
override fun initViewsAndEvents() {
bookPresenter.attachView(this)
val transaction: FragmentTransaction = supportFragmentManager.beginTransaction()
if (bookFragment == null) {
// bookFragment = IreaderApi.getNovelBookStoreFragment()
bookFragment = IreaderApi.getNovelChannelFragment()
transaction.add(R.id.fragment, bookFragment!!, bookFragment!!::class.java.simpleName)
IreaderApi.setReadChangeListener(this)
} else {
transaction.show(bookFragment!!)
}
transaction.commitAllowingStateLoss()
}
override fun onFragmentFirstVisible() {
}
override fun onFragmentResume() {
super.onFragmentResume()
if (AppConfig.fragmentClickFlag == Constant.FRAGMENT_CLICK_MAIN) {
bookPresenter.getReadInfo()
}
}
override fun onDestroy() {
super.onDestroy()
IreaderApi.setReadChangeListener(null)
bookPresenter.detachView()
}
override fun onReadStart() {
}
override fun onReadEnd(time: Long) {
// LogUtil.d(TAG, "onReadEnd time:" + time)
// LogUtil.d(TAG, "onReadEnd time(Int):" + (time/1000).toInt())
val seconds = (time / 1000).toInt()
// 阅读5秒以上 保存时长
if (seconds > 5) {
bookPresenter.addReadSeconds(seconds)
}
}
override fun onReadPage(time: Long) {
}
override fun readSecondsSuc(coin: Int) {
if (coin > 0) {
val bundle = Bundle()
bundle.putString(Constant.MAIN_CARRIER_TYPE, Constant.CARRIER_ZHANGYUE)
bundle.putInt(Constant.MAIN_CUR_COIN, coin)
readyGo(AwardActivity::class.java, bundle)
}
}
override fun readInfo(sumTime: Int, sumCoin: Int, readTime: Int) {
//阅读{10}分钟,奖励{xx}金币,已读{x}分钟
tvZhangContent.visibility = View.VISIBLE
if (readTime >= sumTime) {
tvZhangContent.text = "今日阅读任务已完成"
} else {
tvZhangContent.text = SpanUtils()
.append("阅读").append("${sumTime / 60}").setForegroundColor(mContext.resources.getColor(R.color.color_FF9837)).append("分钟, ")
.append("奖励").append("$sumCoin").setForegroundColor(mContext.resources.getColor(R.color.color_cb4a39)).append("金币, ")
.append("已读").append("${readTime / 60}").setForegroundColor(mContext.resources.getColor(R.color.color_FF9837)).append("分钟")
.create()
}
}
}
\ No newline at end of file
......@@ -3,7 +3,6 @@ package com.mints.goodmoney.ui.fragment
import android.os.Bundle
import android.text.TextUtils
import android.view.MotionEvent
import android.view.View
import android.webkit.WebChromeClient
import com.github.lzyzsd.jsbridge.CallBackFunction
import com.github.lzyzsd.jsbridge.DefaultHandler
......@@ -49,7 +48,7 @@ class PanFragment : BaseFragment(), PanView {
override fun onResume() {
super.onResume()
if (AppConfig.fragmentClickFlag === Constant.FRAGMENT_CLICK_PAN) {
if (AppConfig.fragmentClickFlag == Constant.FRAGMENT_CLICK_PAN) {
if (TextUtils.isEmpty(userManager?.userID)) {
// 游客登录
panPresenter.userLogin()
......@@ -73,26 +72,20 @@ class PanFragment : BaseFragment(), PanView {
*/
private fun loadTurnUrl() {
getTurnUrl()
blTurntableWebview.setOnTouchListener(object : View.OnTouchListener {
override fun onTouch(v: View?, event: MotionEvent): Boolean {
return event.action == MotionEvent.ACTION_MOVE
}
})
blTurntableWebview.setOnTouchListener { _, event -> event.action == MotionEvent.ACTION_MOVE }
blTurntableWebview.setDefaultHandler(DefaultHandler())
blTurntableWebview.webChromeClient = WebChromeClient()
blTurntableWebview.setOnLongClickListener { true }
//注册监听方法当js中调用callHandler方法时会调用此方法(handlerName必须和js中相同)
blTurntableWebview.registerHandler("getTurnResult") { data, function ->
blTurntableWebview.registerHandler("getTurnResult") { data, _ ->
val turntableBean: TurntableBean = JsonUtil.parseJson(data, TurntableBean::class.java)
if (turntableBean != null) {
val bundle = Bundle()
bundle.putInt(Constant.MAIN_CUR_COIN, turntableBean.coin)
bundle.putString(Constant.MAIN_CARRIER_TYPE, carrierType)
bundle.putString(Constant.MAIN_EXTRA_ID, turntableBean.key)
readyGo(AwardActivity::class.java, bundle)
val bundle = Bundle()
bundle.putInt(Constant.MAIN_CUR_COIN, turntableBean.coin)
bundle.putString(Constant.MAIN_CARRIER_TYPE, carrierType)
bundle.putString(Constant.MAIN_EXTRA_ID, turntableBean.key)
readyGo(AwardActivity::class.java, bundle)
androidCallJsReferse()
}
androidCallJsReferse()
}
blTurntableWebview.setDefaultHandler(object : DefaultHandler() {
override fun handler(data: String, function: CallBackFunction) {
......
package com.mints.goodmoney.ui.fragment
import android.os.Bundle
import com.mints.goodmoney.R
import com.mints.goodmoney.common.AppConfig
import com.mints.goodmoney.common.Constant
import com.mints.goodmoney.mvp.presenters.RsNewsPresenter
import com.mints.goodmoney.mvp.views.RsNewsView
import com.mints.goodmoney.ui.activitys.AwardActivity
import com.mints.goodmoney.ui.fragment.base.LazyLoadBaseFragment
import com.xr.xrsdk.FinishReadNewsCallBack
import com.xr.xrsdk.XRNewsManager
/**
* 描述:瑞狮新闻
* 作者:孟崔广
* 时间:2020/12/9 10:55
*/
class RsNewsFragment : LazyLoadBaseFragment(), RsNewsView, FinishReadNewsCallBack {
private val rsNewsPresenter by lazy { RsNewsPresenter() }
override fun getContentViewLayoutID() = R.layout.fragment_main_rsnews
override fun initViewsAndEvents() {}
override fun onFragmentFirstVisible() {
rsNewsPresenter.attachView(this)
XRNewsManager.getInstance().addNewsFragment(supportFragmentManager, R.id.flMainRsNews, Constant.FRAGMENT_TAG_RSNEWS, this)
}
override fun onDestroy() {
super.onDestroy()
rsNewsPresenter.detachView()
}
override fun readSecondsSuc(coin: Int, video: Int, supr: Int) {
if (activity != null && !activity!!.isFinishing() && coin > 0 && supr > 0) {
val bundle = Bundle()
bundle.putString(Constant.MAIN_CARRIER_TYPE, Constant.CARRIER_RUISHINEWS)
bundle.putInt(Constant.MAIN_CUR_COIN, coin)
bundle.putString(Constant.MAIN_EXTRA_ID, video.toString())
readyGo(AwardActivity::class.java, bundle)
}
}
override fun finishRead(id: String, seconds: Int) {
rsNewsPresenter.addNewsSeconds(seconds)
}
}
\ No newline at end of file
......@@ -92,7 +92,7 @@ class ZhangyueFragment : LazyLoadBaseFragment(), BookView, IreaderApi.OnReadChan
} else {
tvZhangContent.text = SpanUtils()
.append("阅读").append("${sumTime / 60}").setForegroundColor(mContext.resources.getColor(R.color.color_FF9837)).append("分钟, ")
.append("奖励").append("${sumCoin}").setForegroundColor(mContext.resources.getColor(R.color.color_cb4a39)).append("金币, ")
.append("奖励").append("$sumCoin").setForegroundColor(mContext.resources.getColor(R.color.color_cb4a39)).append("金币, ")
.append("已读").append("${readTime / 60}").setForegroundColor(mContext.resources.getColor(R.color.color_FF9837)).append("分钟")
.create()
}
......
......@@ -6,49 +6,36 @@ import android.view.MotionEvent;
import androidx.viewpager.widget.ViewPager;
public class MyViewPager extends ViewPager
{
public class MyViewPager extends ViewPager {
public MyViewPager(Context context)
{
public MyViewPager(Context context) {
super(context);
}
public MyViewPager(Context context, AttributeSet attrs)
{
public MyViewPager(Context context, AttributeSet attrs) {
super(context, attrs);
// TODO Auto-generated constructor stub
}
private boolean isCanScroll = false;
public void setCanScroll(boolean isCanScroll)
{
public void setCanScroll(boolean isCanScroll) {
this.isCanScroll = isCanScroll;
}
@Override
public boolean onTouchEvent(MotionEvent arg0)
{
if (isCanScroll)
{
public boolean onTouchEvent(MotionEvent arg0) {
if (isCanScroll) {
return super.onTouchEvent(arg0);
}
else
{
} else {
return false;
}
}
@Override
public boolean onInterceptTouchEvent(MotionEvent arg0)
{
if (isCanScroll)
{
public boolean onInterceptTouchEvent(MotionEvent arg0) {
if (isCanScroll) {
return super.onInterceptTouchEvent(arg0);
}
else
{
} else {
return false;
}
}
......
......@@ -784,8 +784,8 @@ public class BubbleSeekBar extends View {
mProgress = (mThumbCenterX - mLeft) * mDelta / mTrackLength + mMin;
mBubbleCenterRawX = mBubbleCenterRawSolidX + mThumbCenterX - mLeft;
mLayoutParams.x = (int) (mBubbleCenterRawX + 0.5f);
if (mBubbleView.getParent() != null && mWindowManager != null) {
mLayoutParams.x = (int) (mBubbleCenterRawX + 0.5f);
mWindowManager.updateViewLayout(mBubbleView, mLayoutParams);
}
mBubbleView.setProgressText(isShowProgressInFloat ?
......
......@@ -94,11 +94,6 @@ public class AESUtils {
// System.out.println("decrypted message is below :");
// System.out.println(MD5.GetMD5Code("meijie_2016").substring(8, 24));
System.out.println(detrypt("5EBue8TMfYS2P8YAZUyJUKnYvTVEblnJMwC00vC1yZHjvqq6Ws4TeaXQ+7l+iwdzoQNi2yJ9CLrG\n" +
"cfQlCjaAbr5gmLokexHida7yLofB7V5ItaxTGlXyxK3CH+Wr/lvbWKmP8YROCrtzrreqP8svuf0M\n" +
"AzKbOnPhoURvpfVS5di/dk3chtujIqC74xd5XpLJfHiXQadEX+12zq+IXa0xIWezTHjL6cJBTN6y\n" +
"xg5w6+ey7EYzEdJ118HaSTr1tLu7AkxguXJez9QxhB9nifRBvgl7tlY0oL20+yGGZ3WgR/CmWh9u\n" +
"PjEy0eB3NgmNd8SRmImXDYOQDMJqxa5AUMKjQkQ/NmrDLBdRO+9zy5Ujv7YL1KVoUmmxeH5EVPZR\n" +
"nV+E", "abcdnnnnnn123456"));
System.out.println(MD5.GetMD5Code("goodmoney_2020").substring(8, 24));
}
}
......@@ -43,14 +43,6 @@ public class ForegroundOrBackground implements Application.ActivityLifecycleCall
@Override
public void onActivityResumed(Activity activity) {
}
@Override
public void onActivityPaused(Activity activity) {
}
@Override
public void onActivityCreated(Activity activity, Bundle savedInstanceState) {
if (activity == null)
return;
String simpleName = activity.getClass().getSimpleName();
......@@ -66,6 +58,27 @@ public class ForegroundOrBackground implements Application.ActivityLifecycleCall
}
}
@Override
public void onActivityPaused(Activity activity) {
}
@Override
public void onActivityCreated(Activity activity, Bundle savedInstanceState) {
// if (activity == null)
// return;
// String simpleName = activity.getClass().getSimpleName();
// if (TextUtils.equals(simpleName, "MainActivity")) {
// // 版本更新
// if (vup == null) {
// vup = new VersionUpdatePresenter();
// }
// if (reference == null) {
// reference = new WeakReference<>(activity);
// }
// vup.updateVersion(reference.get());
// }
}
@Override
public void onActivityStarted(Activity activity) {
if (activity == null)
......
package com.mints.goodmoney.utils;
import android.Manifest;
import android.annotation.SuppressLint;
import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.Build;
import android.telephony.SubscriptionManager;
import android.telephony.TelephonyManager;
import android.util.Log;
import androidx.annotation.RequiresApi;
import com.yilan.sdk.common.util.PermissionUtil;
import java.lang.reflect.Method;
/**
* The type Sim utils.
*/
public class SimUtils {
private static final String TAG = SimUtils.class.getSimpleName();
private static final String SIM_STATE = "getSimState";
private static final String SIM_OPERATOR_NAME = "getNetworkOperatorName";
private static final String SIM_NETWORK_TYPE = "getNetworkType";
private static final String SIM_IMEI = "getImei";
private static final String SIM_LINE_NUMBER = "getLine1Number";
private static final String SIM_SUBSCRIBER_ID = "getSubscriberId";
// private static final String SIM_SUBSCRIBER_ID = "getSubscriberId";
/**
* Gets sim phonenumber.
*
* @param context the context
* @param slotIdx the slot idx
* @return the sim phonenumber
*/
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP_MR1)
public static String getSimPhonenumber(Context context, int slotIdx) {
if (PermissionUtil.checkPermission(context, Manifest.permission.READ_PHONE_STATE) ||
PermissionUtil.checkPermission(context, "android.permission.READ_PRIVILEGED_PHONE_STATE")) {
Log.d(TAG, "READ_PHONE_STATE permission has BEEN granted to getSimPhonenumber().");
if (getSimStateBySlotIdx(context, slotIdx)) {
return (String) getSimByMethod(context, SIM_LINE_NUMBER, getSubidBySlotId(context, slotIdx));
}
return null;
} else {
Log.d(TAG, "READ_PHONE_STATE permission has NOT been granted to getSimPhonenumber().");
return null;
}
}
/**
* Gets sim imei.
*
* @param context the context
* @param slotIdx the slot idx
* @return the sim imei
*/
public static String getSimImei(Context context, int slotIdx) {
if (PermissionUtil.checkPermission(context, Manifest.permission.READ_PHONE_STATE) ||
PermissionUtil.checkPermission(context, "android.permission.READ_PRIVILEGED_PHONE_STATE")) {
Log.d(TAG, "READ_PHONE_STATE permission has BEEN granted to getSimImei().");
return (String) getSimByMethod(context, SIM_IMEI, slotIdx);
} else {
Log.d(TAG, "READ_PHONE_STATE permission has NOT been granted to getSimImei().");
return null;
}
}
/**
* Gets sim network type.
*
* @param context the context
* @param slotIdx the slot idx
* @return the sim network type
*/
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP_MR1)
public static int getSimNetworkType(Context context, int slotIdx) {
if (PermissionUtil.checkPermission(context, Manifest.permission.READ_PHONE_STATE)) {
Log.d(TAG, "READ_PHONE_STATE permission has BEEN granted to getSimNetworkType().");
if (getSimStateBySlotIdx(context, slotIdx)) {
return (int) getSimByMethod(context, SIM_NETWORK_TYPE, getSubidBySlotId(context, slotIdx));
}
} else {
Log.d(TAG, "READ_PHONE_STATE permission has NOT been granted to getSimNetworkType().");
}
return TelephonyManager.NETWORK_TYPE_UNKNOWN;
}
/**
* Gets sim network name.
*
* @param context the context
* @param slotIdx the slot idx
* @return the sim network name
*/
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP_MR1)
public static String getSimNetworkName(Context context, int slotIdx) {
return getNetworkName(getSimNetworkType(context, slotIdx));
}
/**
* Gets sim operator name.
*
* @param context the context
* @param slotIdx the slot idx
* @return the sim operator name
*/
public static String getSimOperatorName(Context context, int slotIdx) {
if (getSimStateBySlotIdx(context, slotIdx)) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1) {
return (String) getSimByMethod(context, SIM_OPERATOR_NAME, getSubidBySlotId(context, slotIdx));
}
}
return null;
}
/**
* Gets sim operator name.
*
* @param context the context
* @param slotIdx the slot idx
* @return the sim operator name
*/
public static String getSimOperatorName2(Context context, int slotIdx) {
if (getSimStateBySlotIdx(context, slotIdx)) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1) {
return getSimOperatorNameById((String) getSimByMethod(context, SIM_SUBSCRIBER_ID, getSubidBySlotId(context, slotIdx)));
}
}
return null;
}
/**
* Gets sim operator name by single.
*
* @param context the context
* @return the sim operator name
*/
public static String getSimOperatorNameBySingle(Context context) {
try {
TelephonyManager telephony = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
return getSimOperatorNameById(telephony.getSimOperator());
} catch (Exception e) {
}
return "unknown";
}
private static String getSimOperatorNameById(String IMSI) {
String operatorName = "unknown";
if (IMSI != null) {
if (IMSI.startsWith("46000") || IMSI.startsWith("46002") || IMSI.startsWith("46004") || IMSI.startsWith("46007")) {
operatorName = "中国移动";
} else if (IMSI.startsWith("46001") || IMSI.startsWith("46006") || IMSI.startsWith("46009")) {
operatorName = "中国联通";
} else if (IMSI.startsWith("46003") || IMSI.startsWith("46005") || IMSI.startsWith("46011")) {
operatorName = "中国电信";
}
}
return operatorName;
}
/**
* Gets sim state by slot idx.
*
* @param context the context
* @param slotIdx :0(sim1),1(sim2)
* @return the sim state by slot idx
*/
public static boolean getSimStateBySlotIdx(Context context, int slotIdx) {
boolean isReady = false;
Object getSimState = getSimByMethod(context, SIM_STATE, slotIdx);
if (getSimState != null) {
int simState = Integer.parseInt(getSimState.toString());
if ((simState != TelephonyManager.SIM_STATE_ABSENT) && (simState != TelephonyManager.SIM_STATE_UNKNOWN)) {
isReady = true;
}
}
return isReady;
}
/**
* Gets sim by method.
*
* @param context the context
* @param method the method
* @param param the param
* @return the sim by method
*/
public static Object getSimByMethod(Context context, String method, int param) {
TelephonyManager telephony = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
try {
Class<?> telephonyClass = Class.forName(telephony.getClass().getName());
Class<?>[] parameter = new Class[1];
parameter[0] = int.class;
Method getSimState = telephonyClass.getMethod(method, parameter);
Object[] obParameter = new Object[1];
obParameter[0] = param;
Object ob_phone = getSimState.invoke(telephony, obParameter);
if (ob_phone != null) {
return ob_phone;
}
} catch (Exception e) {
e.printStackTrace();
LogUtil.d(e.getMessage());
}
return null;
}
/**
* The type Current network.
*/
public static class CurrentNetwork {
/**
* The Which sim.
*/
public String whichSim;//那张卡
/**
* The Net work name.
*/
public String netWorkName;//几G网络
/**
* The Operate name.
*/
public String operateName;//卡生厂商
}
/**
* Gets current network.
*
* @param context the context
* @return the current network
*/
@RequiresApi(api = Build.VERSION_CODES.M)
public static CurrentNetwork getCurrentNetwork(Context context) {
CurrentNetwork currentNetwork = new CurrentNetwork();
ConnectivityManager connectionManager = (ConnectivityManager) context
.getSystemService(Context.CONNECTIVITY_SERVICE);
assert connectionManager != null;
NetworkInfo networkInfo = connectionManager.getActiveNetworkInfo();
TelephonyManager tm = (TelephonyManager) context
.getSystemService(Context.TELEPHONY_SERVICE);
assert tm != null;
Log.d(TAG, "state:" + tm.getSimState());
if (networkInfo != null) {
if (networkInfo.getType() == ConnectivityManager.TYPE_MOBILE) {
boolean status = networkInfo.isConnected();
int sim1NetWorkType = getSimNetworkType(context, 0);
int sim2NetWorkType = getSimNetworkType(context, 1);
if (networkInfo.getSubtype() == sim1NetWorkType) {
if (getSimStateBySlotIdx(context, 0)) {
currentNetwork.netWorkName = getNetworkName(sim1NetWorkType);
currentNetwork.operateName = getSimOperatorName(context, 0);
currentNetwork.whichSim = "卡1";
}
} else if (networkInfo.getSubtype() == sim2NetWorkType) {
if (getSimStateBySlotIdx(context, 1)) {
currentNetwork.netWorkName = getNetworkName(sim2NetWorkType);
currentNetwork.operateName = getSimOperatorName(context, 1);
currentNetwork.whichSim = "卡2";
}
}
}
} else {
// Logger.d(TAG, "network info is null: ");
}
return currentNetwork;
}
/**
* Gets network name.
*
* @param networkType the network type
* @return the network name
*/
public static String getNetworkName(int networkType) {
switch (networkType) {
case TelephonyManager.NETWORK_TYPE_GPRS:
case TelephonyManager.NETWORK_TYPE_EDGE:
case TelephonyManager.NETWORK_TYPE_CDMA:
case TelephonyManager.NETWORK_TYPE_1xRTT:
case TelephonyManager.NETWORK_TYPE_IDEN:
return "2G";
case TelephonyManager.NETWORK_TYPE_UMTS:
case TelephonyManager.NETWORK_TYPE_EVDO_0:
case TelephonyManager.NETWORK_TYPE_EVDO_A:
case TelephonyManager.NETWORK_TYPE_HSDPA:
case TelephonyManager.NETWORK_TYPE_HSUPA:
case TelephonyManager.NETWORK_TYPE_HSPA:
case TelephonyManager.NETWORK_TYPE_EVDO_B:
case TelephonyManager.NETWORK_TYPE_EHRPD:
case TelephonyManager.NETWORK_TYPE_HSPAP:
return "3G";
case TelephonyManager.NETWORK_TYPE_LTE:
return "4G";
case TelephonyManager.NETWORK_TYPE_NR:
return "5G";
default:
return "UNKNOWN";
}
}
/**
* to
*
* @param context the context
* @param slotId the slot id
* @return subid by slot id
*/
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP_MR1)
public static int getSubidBySlotId(Context context, int slotId) {
SubscriptionManager subscriptionManager = (SubscriptionManager) context.getSystemService(
Context.TELEPHONY_SUBSCRIPTION_SERVICE);
try {
assert subscriptionManager != null;
Class<?> telephonyClass = Class.forName(subscriptionManager.getClass().getName());
Class<?>[] parameter = new Class[1];
parameter[0] = int.class;
Method getSimState = telephonyClass.getMethod("getSubId", parameter);
Object[] obParameter = new Object[1];
obParameter[0] = slotId;
Object ob_phone = getSimState.invoke(subscriptionManager, obParameter);
if (ob_phone != null) {
Log.d(TAG, "slotId:" + slotId + ";" + ((int[]) ob_phone)[0]);
return ((int[]) ob_phone)[0];
}
} catch (Exception e) {
e.printStackTrace();
}
return -1;
}
}
......@@ -50,7 +50,7 @@ public class SoundPoolUtil {
}
}
public void destoryGoldVoice() {
public void onDestory() {
if (player != null) {
player.stop();
player.release();
......
package com.mints.goodmoney.utils;
import android.app.usage.StorageStatsManager;
import android.content.Context;
import android.os.Build;
import android.os.Environment;
import android.os.StatFs;
import android.os.storage.StorageManager;
import android.os.storage.StorageVolume;
import android.util.Log;
import androidx.annotation.RequiresApi;
import java.io.File;
import java.io.IOException;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.List;
import java.util.Locale;
import java.util.UUID;
public class StorageQueryUtil {
private final static String TAG = "storage";
public static String getTotalStorageSize(Context context) {
//5.0 查外置存储
StorageManager storageManager = (StorageManager) context.getSystemService(Context.STORAGE_SERVICE);
float unit = 1000;
int version = Build.VERSION.SDK_INT;
String totalSizeReturn = "unknown";
if (version < Build.VERSION_CODES.M) {
try {
Method getVolumeList = StorageManager.class.getDeclaredMethod("getVolumeList");
StorageVolume[] volumeList = (StorageVolume[]) getVolumeList.invoke(storageManager);
long totalSize = 0;
if (volumeList != null) {
Method getPathFile = null;
for (StorageVolume volume : volumeList) {
if (getPathFile == null) {
getPathFile = volume.getClass().getDeclaredMethod("getPathFile");
}
File file = (File) getPathFile.invoke(volume);
totalSize += file.getTotalSpace();
}
}
totalSizeReturn = getUnit(totalSize, unit);
} catch (Exception e) {
e.printStackTrace();
totalSizeReturn = queryWithStatFs();
}
} else {
try {
Method getVolumes = StorageManager.class.getDeclaredMethod("getVolumes");//6.0
List<Object> getVolumeInfo = (List<Object>) getVolumes.invoke(storageManager);
for (Object obj : getVolumeInfo) {
Field getType = obj.getClass().getField("type");
int type = getType.getInt(obj);
Log.d(TAG, "type: " + type);
if (type == 1) {//TYPE_PRIVATE
long totalSize = 0L;
//获取内置内存总大小
if (version >= Build.VERSION_CODES.O) {//8.0
Method getFsUuid = obj.getClass().getDeclaredMethod("getFsUuid");
String fsUuid = (String) getFsUuid.invoke(obj);
totalSize = getTotalSize(context, fsUuid);//8.0 以后使用
} else if (version >= Build.VERSION_CODES.N_MR1) {//7.1.1
Method getPrimaryStorageSize = StorageManager.class.getMethod("getPrimaryStorageSize");//5.0 6.0 7.0没有
totalSize = (long) getPrimaryStorageSize.invoke(storageManager);
}
Method isMountedReadable = obj.getClass().getDeclaredMethod("isMountedReadable");
boolean readable = (boolean) isMountedReadable.invoke(obj);
if (readable) {
Method file = obj.getClass().getDeclaredMethod("getPath");
File f = (File) file.invoke(obj);
if (totalSize == 0) {
totalSize = f.getTotalSpace();
}
}
totalSizeReturn = getUnit(totalSize, unit);
}
}
} catch (SecurityException e) {
Log.e(TAG, "缺少权限:permission.PACKAGE_USAGE_STATS");
totalSizeReturn = "unknownWithNoPermission";
} catch (Exception e) {
e.printStackTrace();
totalSizeReturn = queryWithStatFs();
}
}
return totalSizeReturn;
}
public static void queryWithStorageManager(Context context) {
//5.0 查外置存储
StorageManager storageManager = (StorageManager) context.getSystemService(Context.STORAGE_SERVICE);
float unit = 1024, unit2 = 1000;
int version = Build.VERSION.SDK_INT;
if (version < Build.VERSION_CODES.M) {//小于6.0
try {
Method getVolumeList = StorageManager.class.getDeclaredMethod("getVolumeList");
StorageVolume[] volumeList = (StorageVolume[]) getVolumeList.invoke(storageManager);
long totalSize = 0, availableSize = 0;
if (volumeList != null) {
Method getPathFile = null;
for (StorageVolume volume : volumeList) {
if (getPathFile == null) {
getPathFile = volume.getClass().getDeclaredMethod("getPathFile");
}
File file = (File) getPathFile.invoke(volume);
totalSize += file.getTotalSpace();
availableSize += file.getUsableSpace();
}
}
Log.d(TAG, "totalSize = " + getUnit(totalSize, unit) + " ,availableSize = " + getUnit(availableSize, unit));
} catch (NoSuchMethodException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
}
} else {
try {
Method getVolumes = StorageManager.class.getDeclaredMethod("getVolumes");//6.0
List<Object> getVolumeInfo = (List<Object>) getVolumes.invoke(storageManager);
long total = 0L, used = 0L, systemSize = 0L;
for (Object obj : getVolumeInfo) {
Field getType = obj.getClass().getField("type");
int type = getType.getInt(obj);
Log.d(TAG, "type: " + type);
if (type == 1) {//TYPE_PRIVATE
long totalSize = 0L;
//获取内置内存总大小
if (version >= Build.VERSION_CODES.O) {//8.0
Method getFsUuid = obj.getClass().getDeclaredMethod("getFsUuid");
String fsUuid = (String) getFsUuid.invoke(obj);
totalSize = getTotalSize(context, fsUuid);//8.0 以后使用
} else if (version >= Build.VERSION_CODES.N_MR1) {//7.1.1
Method getPrimaryStorageSize = StorageManager.class.getMethod("getPrimaryStorageSize");//5.0 6.0 7.0没有
totalSize = (long) getPrimaryStorageSize.invoke(storageManager);
}
Method isMountedReadable = obj.getClass().getDeclaredMethod("isMountedReadable");
boolean readable = (boolean) isMountedReadable.invoke(obj);
if (readable) {
Method file = obj.getClass().getDeclaredMethod("getPath");
File f = (File) file.invoke(obj);
if (totalSize == 0) {
totalSize = f.getTotalSpace();
}
systemSize = totalSize - f.getTotalSpace();
used += totalSize - f.getFreeSpace();
total += totalSize;
}
Log.d(TAG, "type = " + type + "totalSize = " + getUnit(totalSize, unit)
+ " ,used(with system) = " + getUnit(used, unit)
+ " ,free = " + getUnit(totalSize - used, unit));
} else if (type == 0) {//TYPE_PUBLIC
//外置存储
Method isMountedReadable = obj.getClass().getDeclaredMethod("isMountedReadable");
boolean readable = (boolean) isMountedReadable.invoke(obj);
if (readable) {
Method file = obj.getClass().getDeclaredMethod("getPath");
File f = (File) file.invoke(obj);
used += f.getTotalSpace() - f.getFreeSpace();
total += f.getTotalSpace();
}
} else if (type == 2) {//TYPE_EMULATED
}
}
Log.d(TAG, "总内存 total = " + getUnit(total, unit) + "\n已用 used(with system) = " + getUnit(used, unit)
+ "可用 available = " + getUnit(total - used, unit) + "系统大小:" + getUnit(systemSize, unit));
Log.d(TAG, "总内存 total = " + getUnit(total, unit2) + "\n已用 used(with system) = " + getUnit(used, 1000)
+ "可用 available = " + getUnit(total - used, unit2) + "系统大小:" + getUnit(systemSize, unit2));
} catch (SecurityException e) {
Log.e(TAG, "缺少权限:permission.PACKAGE_USAGE_STATS");
} catch (Exception e) {
e.printStackTrace();
queryWithStatFs();
}
}
}
public static String queryWithStatFs() {
StatFs statFs = new StatFs(Environment.getExternalStorageDirectory().getPath());
//存储块
long blockCount = statFs.getBlockCount();
//块大小
long blockSize = statFs.getBlockSize();
//可用块数量
long availableCount = statFs.getAvailableBlocks();
//剩余块数量,注:这个包含保留块(including reserved blocks)即应用无法使用的空间
long freeBlocks = statFs.getFreeBlocks();
//level 18
// long totalSize = statFs.getTotalBytes();
// long availableSize = statFs.getAvailableBytes();
Log.d(TAG, "=========");
Log.d(TAG, "total = " + getUnit(blockSize * blockCount, 1024));
Log.d(TAG, "available = " + getUnit(blockSize * availableCount, 1024));
Log.d(TAG, "free = " + getUnit(blockSize * freeBlocks, 1024));
return getUnit(blockSize * blockCount, 1024);
}
private static String[] units = {"B", "KB", "MB", "GB", "TB"};
// /**
// * 进制转换
// */
// public static String getUnit(float size, float base) {
// int index = 0;
// while (size > base && index < 4) {
// size = size / base;
// index++;
// }
// return String.format(Locale.getDefault(), " %.2f %s ", size, units[index]);
// }
/**
* 进制转换 无空格无小数点
*/
public static String getUnit(float size, float base) {
int index = 0;
while (size > base && index < 4) {
size = size / base;
index++;
}
return String.format(Locale.getDefault(), "%.0f%s", size, units[index]);
}
/**
* API 26 android O
* 获取总共容量大小,包括系统大小
*/
@RequiresApi(Build.VERSION_CODES.O)
public static long getTotalSize(Context context, String fsUuid) {
try {
UUID id;
if (fsUuid == null) {
id = StorageManager.UUID_DEFAULT;
} else {
id = UUID.fromString(fsUuid);
}
StorageStatsManager stats = context.getSystemService(StorageStatsManager.class);
return stats.getTotalBytes(id);
} catch (NoSuchFieldError | NoClassDefFoundError | NullPointerException | IOException e) {
e.printStackTrace();
return -1;
}
}
}
\ No newline at end of file
......@@ -2,6 +2,13 @@ package com.mints.goodmoney.utils
import android.app.ActivityManager
import android.content.Context
import android.os.Environment
import android.os.StatFs
import java.io.BufferedReader
import java.io.File
import java.io.FileReader
import kotlin.math.ceil
object SystemUtils {
......@@ -21,13 +28,56 @@ object SystemUtils {
fun getProcessName(cxt: Context, pid: Int): String? {
val am: ActivityManager = cxt.getSystemService(Context.ACTIVITY_SERVICE) as ActivityManager
val runningApps: List<ActivityManager.RunningAppProcessInfo> =
am.runningAppProcesses
?: return null
am.runningAppProcesses
?: return null
for (procInfo in runningApps) {
if (procInfo.pid === pid) {
if (procInfo.pid == pid) {
return procInfo.processName
}
}
return null
}
/**
* ram
*/
fun getTotalMemory(): String {
// 系统内存信息文件
val file = "/proc/meminfo"
val memInfo: String
val strs: Array<String>
var memory: Long = 0
try {
val fileReader = FileReader(file)
val bufferedReader = BufferedReader(
fileReader,
8192
)
// 读取meminfo第一行,系统内存大小
memInfo = bufferedReader.readLine()
strs = memInfo.split("\\s+".toRegex()).toTypedArray()
// 获得系统总内存,单位KB
memory = Integer.valueOf(strs[1]).toLong()
bufferedReader.close()
} catch (e: Exception) {
e.printStackTrace()
}
return "" + ceil((memory.toFloat() / (1024 * 1024).toDouble())).toInt() + "GB"
}
/**
* 获取手机内部空间总大小
*
* @return 大小,字节为单位
*/
fun getTotalInternalMemorySize(): String {
//获取内部存储根目录
val path: File = Environment.getExternalStorageDirectory()
//系统的空间描述类
val stat = StatFs(path.absolutePath)
//每个区块占字节数
val totalSize = stat.totalBytes
return "" + ceil((totalSize.toFloat() / (1024 * 1024 * 1024).toDouble())).toInt() + "GB"
}
}
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<!-- 边 -->
<!-- <item>-->
<!-- <shape android:shape="rectangle">-->
<!-- <padding android:top="1dp" />-->
<!-- <solid android:color="#00CCCCCC" />-->
<!-- <corners-->
<!-- android:topLeftRadius="20dp"-->
<!-- android:topRightRadius="20dp" />-->
<!-- </shape>-->
<!-- </item>-->
<!-- <item>-->
<!-- <shape android:shape="rectangle">-->
<!-- <padding android:top="1dp" />-->
<!-- <solid android:color="#10CCCCCC" />-->
<!-- <corners-->
<!-- android:topLeftRadius="20dp"-->
<!-- android:topRightRadius="20dp" />-->
<!-- </shape>-->
<!-- </item>-->
<!-- <item>-->
<!-- <shape android:shape="rectangle">-->
<!-- <padding android:top="1dp" />-->
<!-- <solid android:color="#20CCCCCC" />-->
<!-- <corners-->
<!-- android:topLeftRadius="20dp"-->
<!-- android:topRightRadius="20dp" />-->
<!-- </shape>-->
<!-- </item>-->
<item>
<shape android:shape="rectangle">
<padding
android:bottom="1dp"
android:top="1dp" />
<solid android:color="#30CCCCCC" />
<corners
android:topLeftRadius="20dp"
android:topRightRadius="20dp" />
</shape>
</item>
<!-- 中心背景 -->
<item>
<shape
android:shape="rectangle"
android:useLevel="false">
<!-- 实心 -->
<solid android:color="#ffffff" />
<corners
android:topLeftRadius="20dp"
android:topRightRadius="20dp" />
</shape>
</item>
</layer-list>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?><!-- 中心背景 -->
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<!-- 实心 -->
<solid android:color="#ffffff" />
<corners
android:topLeftRadius="20dp"
android:topRightRadius="20dp" />
</shape>
\ No newline at end of file
......@@ -8,7 +8,8 @@
<com.mints.goodmoney.ui.widgets.ElasticScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="match_parent"
android:overScrollMode="never">
<LinearLayout
android:layout_width="match_parent"
......@@ -47,6 +48,7 @@
<include
android:id="@+id/item_feedBack"
layout="@layout/item_settings" />
<Button
android:id="@+id/btn_switch"
android:layout_width="200dp"
......
<?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="match_parent"
android:background="@color/white"
android:orientation="vertical">
<include layout="@layout/header_layout" />
<FrameLayout
android:id="@+id/flWrapper"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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="match_parent"
android:orientation="vertical">
......@@ -38,7 +37,6 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/color_F8F8F8"
android:orientation="vertical">
<RelativeLayout
......@@ -102,7 +100,8 @@
android:layout_marginTop="10dp"
android:layout_marginEnd="15dp"
android:layout_marginBottom="10dp"
android:background="@drawable/shape_white_border"
android:background="@drawable/shape_gold_card"
android:elevation="2dip"
android:padding="15dp">
<TextView
......@@ -253,7 +252,8 @@
android:layout_marginStart="15dp"
android:layout_marginEnd="15dp"
android:layout_marginBottom="10dp"
android:background="@drawable/shape_white_border"
android:background="@drawable/shape_gold_card"
android:elevation="2dip"
android:padding="15dp">
<TextView
......@@ -294,8 +294,7 @@
android:orientation="vertical"
app:layout_constraintEnd_toStartOf="@id/ll2"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/line"
tools:layout_editor_absoluteY="9dp">
app:layout_constraintTop_toBottomOf="@id/line">
<TextView
android:id="@+id/friends_sum"
......@@ -322,8 +321,7 @@
android:orientation="vertical"
app:layout_constraintEnd_toStartOf="@id/ll3"
app:layout_constraintStart_toEndOf="@id/ll1"
app:layout_constraintTop_toBottomOf="@id/line"
tools:layout_editor_absoluteY="9dp">
app:layout_constraintTop_toBottomOf="@id/line">
<TextView
android:id="@+id/friends_directly_sum"
......@@ -353,8 +351,7 @@
android:orientation="vertical"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/ll2"
app:layout_constraintTop_toBottomOf="@id/line"
tools:layout_editor_absoluteY="9dp">
app:layout_constraintTop_toBottomOf="@id/line">
<TextView
android:id="@+id/friends_indirect_sum"
......
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/flMainRsNews"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white" />
\ No newline at end of file
......@@ -16,6 +16,13 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginBottom="20dp" />
android:layout_marginBottom="10dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginBottom="20dp"
android:text="请关注公众号:金币宝箱,获取更多赚钱资讯" />
</merge>
\ No newline at end of file
......@@ -65,7 +65,8 @@
android:layout_marginStart="15dp"
android:layout_marginEnd="15dp"
android:layout_marginBottom="10dp"
android:background="@drawable/shape_white_border">
android:background="@drawable/shape_gold_card"
android:elevation="2dip">
<ImageView
android:id="@+id/imageView2"
......
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