Commit 4e5583cc authored by mengcuiguang's avatar mengcuiguang

添加珊瑚CPD广告数曝光,时间配置。大转盘页面修改。代码位修改

parent 7dabf76c
......@@ -9,8 +9,8 @@ android {
applicationId "com.mints.goodmoney"
minSdkVersion rootProject.ext.androidMinSdkVersion
targetSdkVersion rootProject.ext.androidTargetSdkVersion
versionCode 13
versionName "1.1.2"
versionCode 14
versionName "1.1.3"
flavorDimensions "default"
// dex突破65535的限制
......
......@@ -33,11 +33,12 @@ public final class CoralDownload {
public void pull() {
int type;
if (BuildConfig.DEBUG) {
type = RELEASE_TASK_TYPE_DEBUG;
} else {
type = RELEASE_TASK_TYPE_RELEASE;
}
// if (BuildConfig.DEBUG) {
// type = RELEASE_TASK_TYPE_DEBUG;
// } else {
// type = RELEASE_TASK_TYPE_RELEASE;
// }
type = RELEASE_TASK_TYPE_RELEASE;
new ADLoader(MintsApplication.getContext())
.get(ADType.APP_DOWNLOAD)
......
......@@ -118,7 +118,7 @@ public class CsjVideoAdManager extends BaseVideoAd {
case Constant.CARRIER_SMALLHOMEVEDIO_DOUBLE:// 短视频翻倍
codeId = TtCsjAdManager.TT_AD_VEDIO_SMALLHOMEVEDIO;
break;
default:// 在线收益翻倍
default:
codeId = TtCsjAdManager.TT_AD_VEDIO_MOREDIALOG;
break;
}
......
......@@ -66,11 +66,7 @@ class ShVideoAdManager private constructor(activity: Activity) :
this.activity = activity
isClickScreen = true
val type = if (BuildConfig.DEBUG) {
TZ_REWRAD_TYPE_DEBUG
} else {
TZ_REWRAD_TYPE_RELEASE
}
val type = TZ_REWRAD_TYPE_RELEASE
ADLoader(activity)
.get(ADType.REWARD_VIDEO)
......
......@@ -53,6 +53,11 @@ public class AppConfig {
*/
public static boolean xmlyAdFlag = false;
/**
* 广告隐藏显示 true-走原有流程
*/
public static boolean showAdFlag = true;
/**
* app应用首页 0-主页 1-大转盘 2-邀请好友 3-我
*/
......
package com.mints.goodmoney.manager
/**
* Cpd下载
*/
object CpdManager {
const val BUSINESS_ID = "guest"
const val TOKEN = "00000000000000000000000000000000"
}
\ No newline at end of file
......@@ -27,17 +27,19 @@ public class TtCsjAdManager {
public static String TT_AD_BANNER_JULEYUN = "945675532";// 聚乐云
/*激励视频*/
public static String TT_AD_VEDIO_MAIN_DEV = "945561938";// 开发使用
public static String TT_AD_VEDIO_DRINK = "945562032";//喝水打卡
public static String TT_AD_VEDIO_MAIN = "945562036";// 我的界面视频
public static String TT_AD_VEDIO_ERASE = "945562037";// 刮刮乐
public static String TT_AD_VEDIO_TURNABLE = "945562039";// 大转盘
public static String TT_AD_VEDIO_DRINK = "945562040";//喝水打卡
public static String TT_AD_VEDIO_MAIN = "945562040";// 我的界面视频
public static String TT_AD_VEDIO_ERASE = "945562040";// 刮刮乐
public static String TT_AD_VEDIO_TURNABLE = "945562040";// 大转盘
public static String TT_AD_VEDIO_MOREDIALOG = "945562040";// 气泡
public static String TT_AD_VEDIO_SIGN = "945730109";// 签到
public static String TT_AD_VEDIO_OFFINELINE = "945730111";// 离线弹框
public static String TT_AD_VEDIO_BLESSINGBAG = "945730117";// 福袋
public static String TT_AD_VEDIO_SIGN = "945562040";// 签到
public static String TT_AD_VEDIO_OFFINELINE = "945562040";// 离线弹框
public static String TT_AD_VEDIO_GAME = "945562067";// 猎豹
public static String TT_AD_VEDIO_JULEYUN = "945675529";// 聚乐云
public static String TT_AD_VEDIO_BIANXIANMAO = "945743459";// 变现猫
public static String TT_AD_VEDIO_BLESSINGBAG = "945730117";// 福袋
public static String TT_AD_VEDIO_HOMEVEDIO = "945744137";// 首页视频翻倍
public static String TT_AD_VEDIO_SMALLHOMEVEDIO = "945744186";// 短视频翻倍
/*全屏视频*/
......@@ -175,14 +177,15 @@ public class TtCsjAdManager {
TT_AD_NATIVEEXPRESS_MORNINGCLOCK = "945627921";
TT_AD_NATIVEEXPRESS_EAT = "945627922";
// 激励视频
TT_AD_VEDIO_DRINK = "945562032";
TT_AD_VEDIO_MAIN = "945562036";
TT_AD_VEDIO_ERASE = "945562037";
TT_AD_VEDIO_TURNABLE = "945562039";
TT_AD_VEDIO_DRINK = "945562040";
TT_AD_VEDIO_MAIN = "945562040";
TT_AD_VEDIO_ERASE = "945562040";
TT_AD_VEDIO_TURNABLE = "945562040";
TT_AD_VEDIO_MOREDIALOG = "945562040";
TT_AD_VEDIO_OFFINELINE = "945730111";
TT_AD_VEDIO_OFFINELINE = "945562040";
TT_AD_VEDIO_SIGN = "945562040";
TT_AD_VEDIO_BLESSINGBAG = "945730117";
TT_AD_VEDIO_SIGN = "945730109";
TT_AD_VEDIO_HOMEVEDIO = "945744137";
TT_AD_VEDIO_SMALLHOMEVEDIO = "945744186";
// banner
......
package com.mints.goodmoney.manager
import android.app.Application
import com.mints.goodmoney.BuildConfig
import com.mints.goodmoney.MintsApplication
import com.mints.library.utils.CommonUtils
import com.tz.sdk.core.engine.ADEngine
......@@ -22,7 +21,7 @@ object TzManager {
.appKey("547ffff6446c5a8acd4175fb7a71a0d1")
.appSecret("1c00e59f2257bdfdd4ad9363b41621b5")
.appChannel(CommonUtils.getAppMetaData(MintsApplication.getContext(), "CHANNEL_NAME"))
.forTest(BuildConfig.DEBUG)
.forTest(false)
.build(),
object : IADEngineState {
override fun onIdle() {}
......
......@@ -22,16 +22,17 @@ object YlhAdManager {
var YLH_AD_SPLASH_POSTID = "7021944730189381"
/* vedio-postid */
var YLH_AD_VEDIO_DRINK_POSTID = "2031043750380462" //喝水打卡
var YLH_AD_VEDIO_MAIN_POSTID = "8081940760988417" //我的界面视频
var YLH_AD_VEDIO_ERASE_POSTID = "9061142700180449" //挑战刮刮乐
var YLH_AD_VEDIO_TURNABLE_POSTID = "7001353223571334" //大转盘
var YLH_AD_VEDIO_DRINK_POSTID = "9001346780383626" //喝水打卡
var YLH_AD_VEDIO_MAIN_POSTID = "9001346780383626" //我的界面视频
var YLH_AD_VEDIO_ERASE_POSTID = "9001346780383626" //挑战刮刮乐
var YLH_AD_VEDIO_TURNABLE_POSTID = "9001346780383626" //大转盘
var YLH_AD_VEDIO_MOREDIALOG_POSTID = "9001346780383626" //气泡
var YLH_AD_VEDIO_SIGN_POSTID = "2091354158635490" //签到
var YLH_AD_VEDIO_OFFINELINE_POSTID = "2031954198632389" //离线弹框
var YLH_AD_VEDIO_BLESSINGBAG_POSTID = "1081758148138388" //福袋
var YLH_AD_VEDIO_SIGN_POSTID = "9001346780383626" //签到
var YLH_AD_VEDIO_OFFINELINE_POSTID = "9001346780383626" //离线弹框
var YLH_AD_VEDIO_GAME_POSTID = "9051646750686770" //猎豹游戏
var YLH_AD_VEDIO_JULEYUN_POSTID = "1011746770898338" //聚乐云
var YLH_AD_VEDIO_BLESSINGBAG_POSTID = "1081758148138388" //福袋
var YLH_AD_VEDIO_HOMEVEDIO_POSTID= "4051451341464487" // 首页视频翻倍
var YLH_AD_VEDIO_SMALLHOMEVEDIO_POSTID= "9051152341362610" // 短视频翻倍
......@@ -105,14 +106,15 @@ object YlhAdManager {
// 开屏
YLH_AD_SPLASH_POSTID = "7021944730189381"
// 激励视频
YLH_AD_VEDIO_DRINK_POSTID = "2031043750380462"
YLH_AD_VEDIO_MAIN_POSTID = "8081940760988417"
YLH_AD_VEDIO_ERASE_POSTID = "9061142700180449"
YLH_AD_VEDIO_TURNABLE_POSTID = "7001353223571334"
YLH_AD_VEDIO_DRINK_POSTID = "9001346780383626"
YLH_AD_VEDIO_MAIN_POSTID = "9001346780383626"
YLH_AD_VEDIO_ERASE_POSTID = "9001346780383626"
YLH_AD_VEDIO_TURNABLE_POSTID = "9001346780383626"
YLH_AD_VEDIO_MOREDIALOG_POSTID = "9001346780383626"
YLH_AD_VEDIO_SIGN_POSTID = "9001346780383626"
YLH_AD_VEDIO_OFFINELINE_POSTID = "9001346780383626"
YLH_AD_VEDIO_BLESSINGBAG_POSTID = "1081758148138388"
YLH_AD_VEDIO_SIGN_POSTID = "2091354158635490"
YLH_AD_VEDIO_OFFINELINE_POSTID = "2031954198632389"
YLH_AD_VEDIO_HOMEVEDIO_POSTID = "4051451341464487"
YLH_AD_VEDIO_SMALLHOMEVEDIO_POSTID = "9051152341362610"
......
package com.mints.goodmoney.mvp.model;
import java.io.Serializable;
public class PanActionInfo implements Serializable {
private int actionType;//0-微转,1-珊瑚下载,2-分红,3-鱼丸盒子,4-每日任务
private String emark;
private int max;
private int complete;
private int time;
private int coin;
public int getActionType() {
return actionType;
}
public String getEmark() {
return emark;
}
public int getMax() {
return max;
}
public int getComplete() {
return complete;
}
public int getTime() {
return time;
}
public int getCoin() {
return coin;
}
}
package com.mints.goodmoney.net;
import com.google.gson.Gson;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.Reader;
import java.io.Writer;
import java.lang.annotation.Annotation;
import java.lang.reflect.Type;
import java.nio.charset.Charset;
import okhttp3.MediaType;
import okhttp3.RequestBody;
import okhttp3.ResponseBody;
import okio.Buffer;
import retrofit2.Converter;
import retrofit2.Retrofit;
/**
* common gson
*/
public class CommonGsonConverterFactory extends Converter.Factory {
private final Gson gson;
public static CommonGsonConverterFactory create() {
return create(new Gson());
}
public static CommonGsonConverterFactory create(Gson gson) {
return new CommonGsonConverterFactory(gson);
}
private CommonGsonConverterFactory(Gson gson) {
if (gson == null) throw new NullPointerException("gson == null");
this.gson = gson;
}
@Override
public Converter<ResponseBody, ?> responseBodyConverter(Type type, Annotation[] annotations,
Retrofit retrofit) {
return new GsonResponseBodyConverter<>(gson, type);
}
@Override
public Converter<?, RequestBody> requestBodyConverter(Type type,
Annotation[] parameterAnnotations, Annotation[] methodAnnotations, Retrofit retrofit) {
return new GsonRequestBodyConverter<>(gson, type);
}
// 这里创建从ResponseBody其它类型的Converter
// 主要用于对响应体的处理
final class GsonResponseBodyConverter<T> implements Converter<ResponseBody, T> {
private final Gson gson;
private final Type type;
GsonResponseBodyConverter(Gson gson, Type type) {
this.gson = gson;
this.type = type;
}
@Override
public T convert(ResponseBody value) throws IOException {
Reader reader = value.charStream();
try {
T t = gson.fromJson(reader, type);
// loginInvalid(t);
return t;
} finally {
try {
if (reader != null)
reader.close();
} catch (IOException ignored) {
ignored.printStackTrace();
}
}
}
}
// 在这里创建 从自定类型到ResponseBody 的Converter
// 主要用于对Part、PartMap、Body注解的处理
final class GsonRequestBodyConverter<T> implements Converter<T, RequestBody> {
private final MediaType MEDIA_TYPE = MediaType.parse("application/json; charset=UTF-8");
private final Charset UTF_8 = Charset.forName("UTF-8");
private final Gson gson;
private final Type type;
GsonRequestBodyConverter(Gson gson, Type type) {
this.gson = gson;
this.type = type;
}
@Override
public RequestBody convert(T value) throws IOException {
Buffer buffer = new Buffer();
Writer writer = new OutputStreamWriter(buffer.outputStream(), UTF_8);
gson.toJson(value, type, writer);
writer.flush();
return RequestBody.create(MEDIA_TYPE, buffer.readByteString());
}
}
}
package com.mints.goodmoney.net;
import android.text.TextUtils;
import com.mints.goodmoney.BuildConfig;
import com.orhanobut.logger.Logger;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import okhttp3.OkHttpClient;
import okhttp3.logging.HttpLoggingInterceptor;
import retrofit2.Retrofit;
import retrofit2.adapter.rxjava.RxJavaCallAdapterFactory;
import retrofit2.http.Body;
import retrofit2.http.GET;
import retrofit2.http.POST;
import retrofit2.http.Url;
import rx.Observable;
/**
* 描述:CPD 服务器交互
* 作者:孟崔广
* 时间:2021/1/18 13:46
*/
public interface CpdService {
String CPD_IP = "http://api.musesmobi.com:8111/";//测试
/**
* 请求广告
*
* @return
*/
@POST("api/cpd/1/detail/default")
Observable<Object> getAdVedio(@Body Map<String, Object> vo);
/**
* 提交监测
*
* @return
*/
@GET
Observable<Object> cmtImp(@Url String url);
class Factory {
public static CpdService create() {
OkHttpClient.Builder builder = new OkHttpClient.Builder();
builder.retryOnConnectionFailure(false);
builder.connectTimeout(20, TimeUnit.SECONDS);
builder.readTimeout(20, TimeUnit.SECONDS);
builder.writeTimeout(20, TimeUnit.SECONDS);
if (BuildConfig.DEBUG) {
HttpLoggingInterceptor logging = new HttpLoggingInterceptor(message -> {
if (TextUtils.isEmpty(message)) return;
String s = message.substring(0, 1);
String request = message.substring(0, 4);
if ("{".equals(s) || "[".equals(s)) {
Logger.json(message);
} else if (request.contains("-->") || request.contains("<--")) {
Logger.d("Method" + message);
} else {
Logger.d("params:" + message);
}
});
logging.setLevel(HttpLoggingInterceptor.Level.BODY);
builder.interceptors().add(logging);
}
Retrofit retrofit = new Retrofit.Builder()
.client(builder.build())
.baseUrl(CPD_IP)
.addConverterFactory(CommonGsonConverterFactory.create())
.addCallAdapterFactory(RxJavaCallAdapterFactory.create())
.build();
return retrofit.create(CpdService.class);
}
}
}
......@@ -156,6 +156,13 @@ class MainActivity : BaseActivity(), MainView, View.OnClickListener {
}
}
fun turnDayTask() {
clickTab5Layout()
myFragment?.let {
(it as MyFragment).turnDayTask()
}
}
/**
* 点击第二个tab
*/
......@@ -181,7 +188,7 @@ class MainActivity : BaseActivity(), MainView, View.OnClickListener {
/**
* 点击第四个tab
*/
private fun clickTab4Layout() {
fun clickTab4Layout() {
AppConfig.fragmentClickFlag = Constant.FRAGMENT_CLICK_FRIENDS
if (friendsFragment == null) {
friendsFragment = FriendsFragment()
......@@ -259,4 +266,12 @@ class MainActivity : BaseActivity(), MainView, View.OnClickListener {
}
currentFragment = fragment
}
fun showShortVedioLayout(){
if (AppConfig.showAdFlag) {
tab_rl_channel.visibility = View.VISIBLE
} else {
tab_rl_channel.visibility = View.GONE
}
}
}
\ No newline at end of file
......@@ -13,8 +13,10 @@ import com.mints.goodmoney.mvp.model.TzTaskBean
import com.mints.goodmoney.ui.adapter.listener.OnItemChildClickListener
import com.mints.goodmoney.ui.adapter.listener.OnItemClickListener
import com.mints.library.utils.GlideUtils
import com.tz.sdk.coral.ad.CoralAD
import com.tz.sdk.core.ui.ADContainer
class TaskAdapter(val dataList: List<TzTaskBean>, val context: Context) : RecyclerView.Adapter<TaskAdapter.ViewHolder>() {
class TaskAdapter(val dataList: List<TzTaskBean>, val taskList: List<CoralAD>, val context: Context) : RecyclerView.Adapter<TaskAdapter.ViewHolder>() {
private var mCurrentPosition = 0
......@@ -25,8 +27,7 @@ class TaskAdapter(val dataList: List<TzTaskBean>, val context: Context) : Recycl
val ivAvatar: ImageView = view.findViewById(R.id.item_iv_avatar)
val tvTitle: TextView = view.findViewById(R.id.item_tv_title)
val tvCoin: TextView = view.findViewById(R.id.item_tv_coin)
// val tvText: TextView = view.findViewById(R.id.item_tv_text)
val adContainer: ADContainer = view.findViewById(R.id.ad_container)
val btnSubmit: Button = view.findViewById(R.id.item_btn_submit)
}
......@@ -37,34 +38,30 @@ class TaskAdapter(val dataList: List<TzTaskBean>, val context: Context) : Recycl
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
val data = dataList[position]
val task = taskList[position]
GlideUtils.loadImageView(context, data.icon, holder.ivAvatar)
holder.tvTitle.text = data.title
holder.tvCoin.text = "+" + data.coin + "金币"
holder.adContainer.setAdModel(task)
when (data.state) {
0 -> holder.btnSubmit.text = "立即下载"
1 -> holder.btnSubmit.text = "去试玩"
2 -> holder.btnSubmit.text = "立即领取"
3 -> holder.btnSubmit.text = "已完成"
4 -> holder.btnSubmit.text = "继续试玩"
0 -> {
holder.btnSubmit.text = "立即下载"
}
1 -> {
holder.btnSubmit.text = "去试玩"
}
2 -> {
holder.btnSubmit.text = "立即领取"
}
3 -> {
holder.btnSubmit.text = "已完成"
}
4 -> {
holder.btnSubmit.text = "继续试玩"
}
}
//当前选中
// if (getPosition() == position) {
// holder.tvTitle.setTextColor(ContextCompat.getColor(context, R.color.white))
// holder.tvCoin.setTextColor(ContextCompat.getColor(context, R.color.white))
// holder.tvText.setTextColor(ContextCompat.getColor(context, R.color.white))
// holder.itemView.setBackgroundResource(R.drawable.shape_vip_adapter_none)
// holder.btnSubmit.setBackgroundResource(R.drawable.shape_my_red)
// } else {
// holder.tvTitle.setTextColor(ContextCompat.getColor(context, R.color.black))
// holder.tvCoin.setTextColor(ContextCompat.getColor(context, R.color.color_FF9837))
// holder.tvText.setTextColor(ContextCompat.getColor(context, R.color.gray))
// holder.itemView.setBackgroundResource(R.drawable.shape_dialog_bg)
// holder.btnSubmit.setBackgroundResource(R.drawable.shape_btn_switch)
// }
if (::mOnItemClickListener.isInitialized) {
holder.itemView.setOnClickListener {
setPosition(position)
......@@ -73,9 +70,13 @@ class TaskAdapter(val dataList: List<TzTaskBean>, val context: Context) : Recycl
}
if (::mOnItemChildClickListener.isInitialized) {
holder.btnSubmit.setOnClickListener {
setPosition(position)
mOnItemChildClickListener.onItemChildClick(it, position)
if (holder.btnSubmit.visibility == View.VISIBLE) {
holder.btnSubmit.setOnClickListener {
setPosition(position)
mOnItemChildClickListener.onItemChildClick(it, position)
}
}else{
holder.btnSubmit.setOnClickListener(null)
}
}
}
......
......@@ -25,6 +25,7 @@ import com.mints.goodmoney.mvp.model.UserTaskMsgBean
import com.mints.goodmoney.mvp.presenters.HomePresenter
import com.mints.goodmoney.mvp.views.HomeView
import com.mints.goodmoney.ui.activitys.AwardActivity
import com.mints.goodmoney.ui.activitys.MainActivity
import com.mints.goodmoney.ui.activitys.WebActivity
import com.mints.goodmoney.ui.fragment.base.BaseFragment
import com.mints.goodmoney.ui.widgets.BindWxDialog
......@@ -223,6 +224,12 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener {
}
ChannelManager.updataCodeIdForRegisterChannel(data.adcode)
// 隐藏 短视频、首页视频、书城
val activity: MainActivity? = activity as MainActivity?
activity?.let {
it.showShortVedioLayout()
}
// 新人福利 放到个人中心展示 防止首页红包转动异常
// 设置视频权重
......
......@@ -5,6 +5,7 @@ import androidx.fragment.app.FragmentManager
import androidx.fragment.app.FragmentTransaction
import com.androidkun.xtablayout.XTabLayout
import com.mints.goodmoney.R
import com.mints.goodmoney.common.AppConfig
import com.mints.goodmoney.ui.fragment.base.BaseFragment
import kotlinx.android.synthetic.main.fragment_main_money.*
......@@ -41,12 +42,18 @@ class MoneyFragment : BaseFragment(), XTabLayout.OnTabSelectedListener {
}
override fun onHiddenChanged(hidden: Boolean) {
if (curPosition == 0) {
mainFragment?.onHiddenChanged(hidden)
}
else if (curPosition == 3) {
liebaoGameFragment?.onHiddenChanged(hidden)
if (AppConfig.showAdFlag) {
if (curPosition == 0) {
mainFragment?.onHiddenChanged(hidden)
} else if (curPosition == 3) {
liebaoGameFragment?.onHiddenChanged(hidden)
}
} else {
if (curPosition == 1) {
liebaoGameFragment?.onHiddenChanged(hidden)
}
}
super.onHiddenChanged(hidden)
}
......@@ -58,55 +65,58 @@ class MoneyFragment : BaseFragment(), XTabLayout.OnTabSelectedListener {
}
private fun initView() {
// val tabs: MutableList<String> = ArrayList()
// tabs.add("视频")
// tabs.add("书城")
// tabs.add("新闻")
// tabs.add("游戏")
//
// val fragments: MutableList<Fragment> = ArrayList()
// mainFragment = MainFragment()
// liebaoGameFragment = LiebaoGameFragment()
// fragments.add(mainFragment!!)
// fragments.add(MyZhangyueFragment())
// fragments.add(RsNewsFragment())
// fragments.add(liebaoGameFragment!!)
//
// //去除两侧应阴影
// vpFragmentMoney.overScrollMode = ViewPager.OVER_SCROLL_NEVER
// vpFragmentMoney.offscreenPageLimit = tabs.size + 3
// val adapter = MessageFragAdapter(childFragmentManager, fragments, tabs)
// vpFragmentMoney.adapter = adapter
// xtFragmentMoney.setxTabDisplayNum(tabs.size)
// xtFragmentMoney.setupWithViewPager(vpFragmentMoney)
if (mainFragment == null) {
mainFragment = MainFragment()
}
if (!mainFragment!!.isAdded) {
// 提交事务
childFragmentManager.beginTransaction().add(R.id.fragment_container, mainFragment!!).commitAllowingStateLoss()
// 记录当前Fragment
currentFragment = mainFragment
}
if (AppConfig.showAdFlag) {
if (mainFragment == null) {
mainFragment = MainFragment()
}
if (!mainFragment!!.isAdded) {
// 提交事务
childFragmentManager.beginTransaction().add(R.id.fragment_container, mainFragment!!).commitAllowingStateLoss()
// 记录当前Fragment
currentFragment = mainFragment
}
xtFragmentMoney.setxTabDisplayNum(4)
val newTab1 = xtFragmentMoney.newTab()
newTab1.text = "视频"
val newTab2 = xtFragmentMoney.newTab()
newTab2.text = "书城"
xtFragmentMoney.setxTabDisplayNum(4)
val newTab1 = xtFragmentMoney.newTab()
newTab1.text = "视频"
val newTab2 = xtFragmentMoney.newTab()
newTab2.text = "书城"
// val newTab3 = xtFragmentMoney.newTab()
// newTab3.text = "新闻"
val newTab4 = xtFragmentMoney.newTab()
newTab4.text = "听书"
val newTab5 = xtFragmentMoney.newTab()
newTab5.text = "游戏"
xtFragmentMoney.addTab(newTab1)
xtFragmentMoney.addTab(newTab2)
val newTab4 = xtFragmentMoney.newTab()
newTab4.text = "听书"
val newTab5 = xtFragmentMoney.newTab()
newTab5.text = "游戏"
xtFragmentMoney.addTab(newTab1)
xtFragmentMoney.addTab(newTab2)
// xtFragmentMoney.addTab(newTab3)
xtFragmentMoney.addTab(newTab4)
xtFragmentMoney.addTab(newTab5)
xtFragmentMoney.addOnTabSelectedListener(this)
} else {
if (xmlyGameFragment == null) {
xmlyGameFragment = XmlyFragment()
}
if (!xmlyGameFragment!!.isAdded) {
// 提交事务
childFragmentManager.beginTransaction().add(R.id.fragment_container, xmlyGameFragment!!).commitAllowingStateLoss()
// 记录当前Fragment
currentFragment = xmlyGameFragment
}
xtFragmentMoney.setxTabDisplayNum(2)
val newTab4 = xtFragmentMoney.newTab()
newTab4.text = "听书"
val newTab5 = xtFragmentMoney.newTab()
newTab5.text = "游戏"
// xtFragmentMoney.addTab(newTab3)
xtFragmentMoney.addTab(newTab4)
xtFragmentMoney.addTab(newTab5)
xtFragmentMoney.addOnTabSelectedListener(this)
xtFragmentMoney.addTab(newTab4)
xtFragmentMoney.addTab(newTab5)
xtFragmentMoney.addOnTabSelectedListener(this)
}
}
/**
......@@ -171,16 +181,32 @@ class MoneyFragment : BaseFragment(), XTabLayout.OnTabSelectedListener {
// }
when (tab.position) {
0 -> {
if (mainFragment == null) {
mainFragment = MainFragment()
if (AppConfig.showAdFlag) {
if (mainFragment == null) {
mainFragment = MainFragment()
}
addOrShowFragment(childFragmentManager, mainFragment!!, FRAGMENT_TAG_VIDEO)
} else {
if (xmlyGameFragment == null) {
xmlyGameFragment = XmlyFragment()
}
addOrShowFragment(childFragmentManager, xmlyGameFragment!!, FRAGMENT_TAG_XMLY)
}
addOrShowFragment(childFragmentManager, mainFragment!!, FRAGMENT_TAG_VIDEO)
}
1 -> {
if (bookStoreFragment == null) {
bookStoreFragment = ZhangyueFragment()
if (AppConfig.showAdFlag) {
if (bookStoreFragment == null) {
bookStoreFragment = ZhangyueFragment()
}
addOrShowFragment(childFragmentManager, bookStoreFragment!!, FRAGMENT_TAG_BOOKSTORE)
} else {
if (liebaoGameFragment == null) {
liebaoGameFragment = LiebaoGameFragment()
}
addOrShowFragment(childFragmentManager, liebaoGameFragment!!, FRAGMENT_TAG_GAME)
}
addOrShowFragment(childFragmentManager, bookStoreFragment!!, FRAGMENT_TAG_BOOKSTORE)
}
// 2 -> {
// if (newsFragment == null) {
......
......@@ -17,7 +17,6 @@ import com.mints.goodmoney.R
import com.mints.goodmoney.ad.banner.BannerManager
import com.mints.goodmoney.ad.express.TTPreLoadCarrierExpressManager
import com.mints.goodmoney.ad.express.TTPreLoadExpressXmlyManager
import com.mints.goodmoney.ad.video.VideoAdingManager
import com.mints.goodmoney.common.AppConfig
import com.mints.goodmoney.common.Constant
......@@ -35,7 +34,10 @@ import com.mints.goodmoney.ui.widgets.CustomDialogAsApple
import com.mints.goodmoney.ui.widgets.DialogListener
import com.mints.goodmoney.ui.widgets.ShareDialog
import com.mints.goodmoney.ui.widgets.seekbar.BubbleUtils
import com.mints.goodmoney.utils.*
import com.mints.goodmoney.utils.AppUtil
import com.mints.goodmoney.utils.LogUtil
import com.mints.goodmoney.utils.QQJumpUtil
import com.mints.goodmoney.utils.SpanUtils
import com.mints.library.net.netstatus.NetUtils
import com.mints.library.utils.CommonUtils
import com.mints.library.utils.GlideUtils
......@@ -56,6 +58,7 @@ import kotlinx.android.synthetic.main.view_title.*
import net.grandcentrix.tray.AppPreferences
import java.math.BigDecimal
import java.util.*
import kotlin.concurrent.schedule
private val TAG = MyFragment::class.java.simpleName
......@@ -462,6 +465,8 @@ class MyFragment : BaseFragment(),
val bundle = Bundle()
bundle.putInt(TaskActivity.TASK_COIN, taskBean.otherConfig.coin)
bundle.putInt(TaskActivity.TASK_USE_TIME, taskBean.otherConfig.needSeconds)
bundle.putInt(TaskActivity.TASK_USE_MAX, taskBean.otherConfig.max)
bundle.putInt(TaskActivity.TASK_USE_COMPLETE, taskBean.otherConfig.complete)
readyGo(TaskActivity::class.java, bundle)
}
// 跳转高额视频
......@@ -907,6 +912,8 @@ class MyFragment : BaseFragment(),
val bundle = Bundle()
bundle.putInt(TaskActivity.TASK_COIN, listBean.otherConfig.coin)
bundle.putInt(TaskActivity.TASK_USE_TIME, listBean.otherConfig.needSeconds)
bundle.putInt(TaskActivity.TASK_USE_MAX, listBean.otherConfig.max)
bundle.putInt(TaskActivity.TASK_USE_COMPLETE, listBean.otherConfig.complete)
readyGo(TaskActivity::class.java, bundle)
return
}
......@@ -1306,4 +1313,20 @@ class MyFragment : BaseFragment(),
intentFilter.addAction(AppInstallService.APP_INSTALL_ACTION)
mContext.registerReceiver(this.mReceiverBroadcastReceiver, intentFilter)
}
/**
* 坐标移动至每日任务
*/
fun turnDayTask() {
if (signCardBean != null) {
scrollviewMy.scrollTo(0, llMyRoot.height - viewTitleDayTask.height)
return
}
Timer().schedule(800) {
activity?.runOnUiThread {
scrollviewMy.scrollTo(0, llMyRoot.height - viewTitleDayTask.height)
}
}
}
}
\ No newline at end of file
package com.mints.goodmoney.ui.fragment
import android.os.Build
import android.os.Bundle
import android.text.TextUtils
import android.view.MotionEvent
import android.view.View
import android.webkit.WebChromeClient
import androidx.annotation.RequiresApi
import com.component.dly.xzzq_ywsdk.YwSDK_WebActivity
import com.github.lzyzsd.jsbridge.CallBackFunction
import com.github.lzyzsd.jsbridge.DefaultHandler
import com.mints.goodmoney.BuildConfig
......@@ -11,12 +15,20 @@ 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.manager.YwhzManager
import com.mints.goodmoney.mvp.model.PanActionInfo
import com.mints.goodmoney.mvp.model.TurntableBean
import com.mints.goodmoney.mvp.presenters.PanPresenter
import com.mints.goodmoney.mvp.views.PanView
import com.mints.goodmoney.ui.activitys.AwardActivity
import com.mints.goodmoney.ui.activitys.MainActivity
import com.mints.goodmoney.ui.activitys.TaskActivity
import com.mints.goodmoney.ui.activitys.WxLoginActivity
import com.mints.goodmoney.ui.fragment.base.BaseFragment
import com.mints.library.utils.json.JsonUtil
import com.xiangzi.articlesdk.callback.IXzArticleSdkInitCallback
import com.xiangzi.articlesdk.core.XzArticleCoreImpl
import com.xiangzi.articlesdk.exception.XzSdkException
import kotlinx.android.synthetic.main.fragment_main_pan.*
/**
......@@ -28,13 +40,19 @@ class PanFragment : BaseFragment(), PanView {
private val panPresenter by lazy { PanPresenter() }
private val userManager by lazy { UserManager.getInstance() }
private var isLoadPanSuc = false // 是否加载大转盘成功
private val carrierType = Constant.CARRIER_CHALLENGE_TURN
override fun getContentViewLayoutID() = R.layout.fragment_main_pan
override fun initViewsAndEvents() {
panPresenter.attachView(this)
if (!TextUtils.isEmpty(userManager.userID)) {
// 登录成功的用户初始化鱼丸盒子
if (userManager.userIsLogin()) {
YwhzManager.init(baseApplication)
}
}
}
override fun onHiddenChanged(hidden: Boolean) {
......@@ -72,9 +90,17 @@ class PanFragment : BaseFragment(), PanView {
*/
private fun loadTurnUrl() {
getTurnUrl()
blTurntableWebview.setOnTouchListener { _, event -> event.action == MotionEvent.ACTION_MOVE }
// blTurntableWebview.setOnTouchListener { _, event -> event.action == MotionEvent.ACTION_MOVE }
blTurntableWebview.setDefaultHandler(DefaultHandler())
blTurntableWebview.webChromeClient = WebChromeClient()
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
// blTurntableWebview.setOnScrollChangeListener(
// object : View.OnScrollChangeListener {
// override fun onScrollChange(v: View?, scrollX: Int, scrollY: Int, oldScrollX: Int, oldScrollY: Int) {
// blTurntableWebview.scrollTo(0,scrollY)
// }
// })
// }
blTurntableWebview.setOnLongClickListener { true }
//注册监听方法当js中调用callHandler方法时会调用此方法(handlerName必须和js中相同)
blTurntableWebview.registerHandler("getTurnResult") { data, _ ->
......@@ -87,6 +113,9 @@ class PanFragment : BaseFragment(), PanView {
androidCallJsReferse()
}
blTurntableWebview.registerHandler("actionPageForType") { data, _ ->
actionPageForType(data)
}
blTurntableWebview.setDefaultHandler(object : DefaultHandler() {
override fun handler(data: String, function: CallBackFunction) {
showToast(data)
......@@ -94,12 +123,70 @@ class PanFragment : BaseFragment(), PanView {
})
}
private fun actionPageForType(data: String?) {
if (TextUtils.isEmpty(data)) return
val panActionInfo: PanActionInfo = JsonUtil.parseJson(data, PanActionInfo::class.java)
//0-微转,1-珊瑚下载,2-分红,3-鱼丸盒子,4-每日任务
when (panActionInfo.actionType) {
0 -> {
if (!userManager.userIsLogin()) {
readyGo(WxLoginActivity::class.java)
return
}
shareArticle(panActionInfo.coin)
}
1 -> {
if (!userManager.userIsLogin()) {
readyGo(WxLoginActivity::class.java)
return
}
val bundle = Bundle()
bundle.putInt(TaskActivity.TASK_COIN, panActionInfo.coin)
bundle.putInt(TaskActivity.TASK_USE_TIME, panActionInfo.time)
bundle.putInt(TaskActivity.TASK_USE_MAX, panActionInfo.max)
bundle.putInt(TaskActivity.TASK_USE_COMPLETE, panActionInfo.complete)
readyGo(TaskActivity::class.java, bundle)
}
2 -> {
if (!userManager.userIsLogin()) {
readyGo(WxLoginActivity::class.java)
return
}
val activity: MainActivity? = activity as MainActivity?
activity?.clickTab4Layout()
}
3 -> {
if (!userManager.userIsLogin()) {
readyGo(WxLoginActivity::class.java)
return
}
try {
activity?.let { YwSDK_WebActivity.open(it) }
} catch (e: Exception) {
e.printStackTrace()
showToast("请重新退出账号登录")
}
}
4 -> {
val activity: MainActivity? = activity as MainActivity?
activity?.let {
it.turnDayTask()
}
}
}
}
/**
* 获取转盘url
*/
private fun getTurnUrl() {
val tokenID = userManager.tokenID
val url: String = BuildConfig.MainIp + "turn/turn.html?carrierType=" + carrierType + "&token=" + tokenID
val url: String = BuildConfig.MainIp + "turn/turnWithInner.html?carrierType=" + carrierType + "&token=" + tokenID
blTurntableWebview.loadUrl(url)
}
......@@ -112,4 +199,27 @@ class PanFragment : BaseFragment(), PanView {
}
}
/**
* 分享文章
*/
private fun shareArticle(coin: Int) {
if (XzArticleCoreImpl.get().initIsSuccess()) {
XzArticleCoreImpl.get().openArticleListActivity(requireActivity())
} else {
try {
XzArticleCoreImpl.get().initUser(userManager.userID, coin.toString(), "金币",
object : IXzArticleSdkInitCallback {
override fun initSuccess() {
shareArticle(coin)
}
override fun initFailed(errMsg: String) {
showToast("初始化失败,请稍候重试~")
}
})
} catch (e: XzSdkException) {
e.printStackTrace()
}
}
}
}
\ No newline at end of file
......@@ -58,9 +58,9 @@ class TaskDialog(context: Context) :
fun setData(data: CoralAD, seconds: Int, coin: Int) {
tvText1.text = "下载并试玩$seconds" + "秒"
tvText2.text = "+$coin" + "金币"
tvTitle.text = data.description
tvTitle.text = data.title
GlideUtils.loadImageView(context, data.icon, ivAvatar)
tvInfo.text = data.title
tvInfo.text = data.description
adContainer?.setAdModel(data)
}
......
......@@ -21,6 +21,7 @@
android:layout_height="wrap_content" />
<androidx.core.widget.NestedScrollView
android:id="@+id/scrollviewMy"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:overScrollMode="never">
......@@ -30,6 +31,12 @@
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:id="@+id/llMyRoot"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<include layout="@layout/item_fragment_main_my_title" />
<include layout="@layout/item_fragment_main_my_clock" />
......@@ -49,7 +56,7 @@
<include layout="@layout/item_divider_gray" />
<include layout="@layout/view_title" />
</LinearLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recy_my"
android:layout_width="match_parent"
......
......@@ -6,39 +6,52 @@
android:gravity="center_horizontal"
android:orientation="vertical">
<ImageView
android:id="@+id/item_iv_avatar"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_marginTop="10dp"
android:src="@mipmap/ic_launcher_main" />
<com.tz.sdk.core.ui.ADContainer
android:id="@+id/ad_container"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView
android:id="@+id/item_tv_title"
android:layout_width="80dp"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:ellipsize="end"
android:gravity="center_vertical"
android:lines="1"
android:maxLines="1" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:orientation="vertical">
<ImageView
android:id="@+id/item_iv_avatar"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_marginTop="10dp"
android:src="@mipmap/ic_launcher_main" />
<TextView
android:id="@+id/item_tv_coin"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="+300金币"
android:textColor="@color/color_FF9837"
android:textSize="18sp" />
<TextView
android:id="@+id/item_tv_title"
android:layout_width="80dp"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:ellipsize="end"
android:gravity="center_vertical"
android:lines="1"
android:maxLines="1" />
<TextView
android:id="@+id/item_tv_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="剩余99+份"
android:textColor="@color/color_ccc"
android:textSize="12sp" />
<TextView
android:id="@+id/item_tv_coin"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="+300金币"
android:textColor="@color/color_FF9837"
android:textSize="18sp" />
<TextView
android:id="@+id/item_tv_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="剩余99+份"
android:textColor="@color/color_ccc"
android:textSize="12sp" />
</LinearLayout>
</com.tz.sdk.core.ui.ADContainer>
<Button
android:id="@+id/item_btn_submit"
......
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/viewTitleDayTask"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginStart="15dp"
......
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