Commit 28a54830 authored by mengcuiguang's avatar mengcuiguang

修改大转盘

parent 4434c354
......@@ -8,6 +8,7 @@ local.properties
/gradle
#lib project
app/build
wheelsruflibray/build
shareSdkLib/build
picture_library/build
ucrop/build
......
......@@ -9,8 +9,8 @@ android {
applicationId "com.mints.goodmoney"
minSdkVersion rootProject.ext.androidMinSdkVersion
targetSdkVersion rootProject.ext.androidTargetSdkVersion
versionCode 22
versionName "1.2.1"
versionCode 23
versionName "1.2.2"
flavorDimensions "default"
// dex突破65535的限制
......@@ -179,6 +179,11 @@ dependencies {
implementation 'com.mindorks.android:prdownloader:0.6.0'
// 圆角库
implementation 'com.github.SheHuan:NiceImageView:1.0.5'
// 跑马灯
implementation 'com.sunfusheng:marqueeview:1.2.0'
// 转盘
implementation project(':wheelsruflibrary')
// 工具类
// gson
......@@ -232,12 +237,6 @@ dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.4.0"
implementation 'com.liulishuo.filedownloader:library:1.7.7'
implementation "org.greenrobot:eventbus:3.1.0-RC"
// 掌阅书城
implementation(name: 'iReader-release-1.0.1', ext: 'aar')
implementation 'com.alibaba:fastjson:1.2.11'
implementation 'androidx.annotation:annotation:1.0.0'
implementation 'androidx.core:core:1.0.0'
implementation 'androidx.fragment:fragment:1.0.0'
// 变现猫
implementation(name: 'bxmsdk-release-3.3.1', ext: 'aar')
// 闪电盒子
......@@ -282,6 +281,7 @@ dependencies {
implementation 'com.squareup.retrofit2:adapter-rxjava2:2.6.2'
implementation 'com.squareup.retrofit2:converter-scalars:2.6.2'
implementation 'com.squareup.retrofit2:converter-gson:2.6.2'
implementation 'com.alibaba:fastjson:1.2.11'
// 激励视频RTA
......
......@@ -427,42 +427,6 @@
# ===================== 推啊AD START ================
-dontwarn com.lechuan.midunovel.**
-keep class com.lechuan.midunovel.** { *; }
# ======================= 推啊AD END ================
# ===================== 掌阅书城 START ================
-keep class com.zhangyue.**{*;}
-keep class com.ireader.ireadersdk.IreaderApi {*;}
-dontwarn com.alibaba.fastjson.**
-keep class com.alibaba.fastjson.** { *; }
-keep public class * extends androidx.fragment.app.Fragment
-keep class androidx.core.app.NotificationCompat**{
public *;
}
-dontwarn androidx.**
-keep class androidx.** { *;}
-keep public class * extends androidx.**
-keep public class * extends androidx.fragment.app.FragmentContainer
-keep class com.squareup.okhttp.** { *;}
-keep class okhttp3.** { *; }
-keep interface okhttp3.** { *; }
-keep class okio.**{ *; }
-keep interface okio.**{ *; }
-dontwarn com.squareup.okhttp.**
-dontwarn okio.**
-dontwarn okhttp3.**
-keep class com.qq.e.** {
public protected *;
}
# ======================= 掌阅书城 END ================
......
package com.mints.goodmoney.manager
import android.app.Application
import com.ireader.ireadersdk.IreaderApi
import com.mints.goodmoney.MintsApplication
import java.lang.Exception
/**
* 描述:掌阅书城
* 作者:孟崔广
*/
object ZhangyueManager {
private const val APPID = "10054"
fun onCreateIreader(application: Application) {
// try {
// IreaderApi.onCreate(application)
// val config = Config.Builder()
// .setZYAppId(APPID)
// .setOaId(MintsApplication.OAID)
// .setSupportCSJ(true)
// .setSupportGDT(true)
// .build()
// IreaderApi.attachBaseContext(application, config)
// } catch (e: Exception) {
// e.printStackTrace()
// }
try {
IreaderApi.attachBaseContext(application)
IreaderApi.onCreate(application, APPID)
} catch (e: Exception) {
e.printStackTrace()
}
}
fun onDestory() {
IreaderApi.onAppExit()
}
}
\ No newline at end of file
package com.mints.goodmoney.mvp.model;
import java.io.Serializable;
public class ClickTurnBean implements Serializable {
/**
* config : {"count":250,"type":"coin","key":"t5","index":5,"title":"250金币"}
* sumCoin : 7580
* coinKey : 2108214495303800003
* turntableKey : 2108214495303800003
*/
private ConfigBean config;
private int sumCoin;
private String coinKey;
private String turntableKey;
public ConfigBean getConfig() {
return config;
}
public void setConfig(ConfigBean config) {
this.config = config;
}
public int getSumCoin() {
return sumCoin;
}
public void setSumCoin(int sumCoin) {
this.sumCoin = sumCoin;
}
public String getCoinKey() {
return coinKey;
}
public void setCoinKey(String coinKey) {
this.coinKey = coinKey;
}
public String getTurntableKey() {
return turntableKey;
}
public void setTurntableKey(String turntableKey) {
this.turntableKey = turntableKey;
}
public class ConfigBean implements Serializable{
/**
* count : 250
* type : coin
* key : t5
* index : 5
* title : 250金币
*/
private int count;
private String type;
private String key;
private int index;
private String title;
public int getCount() {
return count;
}
public void setCount(int count) {
this.count = count;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
public int getIndex() {
return index;
}
public void setIndex(int index) {
this.index = index;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
}
}
package com.mints.goodmoney.mvp.model;
import java.io.Serializable;
import java.util.List;
public class TurnBean implements Serializable {
/**
* configs : [{"count":150,"type":"coin","key":"t1","index":0,"title":"150金币"},{"count":10,"type":"cash","key":"t2","index":1,"title":"现金10元"},{"count":200,"type":"coin","key":"t8","index":2,"title":"200金币"},{"count":100,"type":"coin","key":"t3","index":3,"title":"100金币"},{"count":300,"type":"coin","key":"t4","index":4,"title":"300金币"},{"count":250,"type":"coin","key":"t5","index":5,"title":"250金币"},{"count":350,"type":"coin","key":"t6","index":6,"title":"350金币"},{"count":40,"type":"cash","key":"t7","index":7,"title":"现金40元"}]
* max : 30
*/
private List<ConfigsBean> configs;
private int max;
private String titleMsg;
private int surplus;
private List<BottomsBean> bottoms;
public List<ConfigsBean> getConfigs() {
return configs;
}
public String getTitleMsg() {
return titleMsg;
}
public void setTitleMsg(String titleMsg) {
this.titleMsg = titleMsg;
}
public int getSurplus() {
return surplus;
}
public void setSurplus(int surplus) {
this.surplus = surplus;
}
public void setConfigs(List<ConfigsBean> configs) {
this.configs = configs;
}
public int getMax() {
return max;
}
public void setMax(int max) {
this.max = max;
}
public List<BottomsBean> getBottoms() {
return bottoms;
}
public void setBottoms(List<BottomsBean> bottoms) {
this.bottoms = bottoms;
}
public class BottomsBean implements Serializable {
/**
* title : 高额赚
* icon : https://mints-pkg.oss-cn-beijing.aliyuncs.com/pkg_goodmoney/img/readnews.png
* toOtherKey : 1
* rewardTitle : 抽奖 +1
*/
private String title;
private String icon;
private String toOtherKey;
private String rewardTitle;
private ParamsBean params;
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getIcon() {
return icon;
}
public void setIcon(String icon) {
this.icon = icon;
}
public String getToOtherKey() {
return toOtherKey;
}
public void setToOtherKey(String toOtherKey) {
this.toOtherKey = toOtherKey;
}
public String getRewardTitle() {
return rewardTitle;
}
public void setRewardTitle(String rewardTitle) {
this.rewardTitle = rewardTitle;
}
public class ParamsBean implements Serializable {
private int max;
private int complete;
private int coin;
public int getMax() {
return max;
}
public int getComplete() {
return complete;
}
public int getCoin() {
return coin;
}
}
}
public class ConfigsBean implements Serializable {
/**
* count : 150
* type : coin
* key : t1
* index : 0
* title : 150金币
*/
private int count;
private String type;
private String key;
private int index;
private String title;
public int getCount() {
return count;
}
public void setCount(int count) {
this.count = count;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
public int getIndex() {
return index;
}
public void setIndex(int index) {
this.index = index;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
}
}
package com.mints.goodmoney.mvp.presenters
import android.text.TextUtils
import com.mints.goodmoney.MintsApplication
import com.mints.goodmoney.common.DeviceInfo
import com.mints.library.net.neterror.BaseSubscriber
import com.mints.library.net.neterror.Throwable
import com.mints.goodmoney.manager.AppHttpManager
import com.mints.goodmoney.manager.ShumeiManager
import com.mints.goodmoney.manager.UserManager
import com.mints.goodmoney.mvp.model.BaseResponse
import com.mints.goodmoney.mvp.model.ClickTurnBean
import com.mints.goodmoney.mvp.model.TurnBean
import com.mints.goodmoney.mvp.model.UserBean
import com.mints.goodmoney.mvp.views.PanView
import com.mints.goodmoney.mvp.views.TurnTableView
import com.mints.goodmoney.utils.DeviceUuidFactory
import java.util.*
class TurnTablePresenter : BasePresenter<TurnTableView>() {
fun getTurnMsg() {
AppHttpManager.getInstance(loanApplication)
.call(loanService.getTurnMsg(),
object : BaseSubscriber<BaseResponse<TurnBean>>() {
override fun onCompleted() {
}
override fun onError(e: Throwable) {
if (isLinkView) return
view.showToast(e.message)
}
override fun onNext(baseResponse: BaseResponse<TurnBean>) {
if (isLinkView) return
val code = baseResponse.getStatus()
val message = baseResponse.getMessage()
when (code) {
200 -> {
view.getTurnTableSuc(baseResponse.data)
}
else -> view.showToast(message)
}
}
})
}
fun addTurnToOtherMsg(toOtherKey: String) {
val vo = HashMap<String, Any>()
vo["toOther"] = toOtherKey
AppHttpManager.getInstance(loanApplication)
.call(loanService.addTurnToOtherMsg(vo),
object : BaseSubscriber<BaseResponse<Any>>() {
override fun onCompleted() {
}
override fun onError(e: Throwable) {
if (isLinkView) return
view.showToast(e.message)
}
override fun onNext(baseResponse: BaseResponse<Any>) {
if (isLinkView) return
val code = baseResponse.getStatus()
val message = baseResponse.getMessage()
when (code) {
200 -> {
}
else -> view.showToast(message)
}
}
})
}
fun cashoutLeaders() {
AppHttpManager.getInstance(loanApplication)
.call(loanService.cashoutLeaders(),
object : BaseSubscriber<BaseResponse<Any>>() {
override fun onCompleted() {
}
override fun onError(e: Throwable) {
if (isLinkView) return
view.showToast(e.message)
}
override fun onNext(baseResponse: BaseResponse<Any>) {
if (isLinkView) return
val code = baseResponse.getStatus()
val message = baseResponse.getMessage()
when (code) {
200 -> {
view.cashoutLeadersSuc()
}
else -> view.showToast(message)
}
}
})
}
fun clickForTurn() {
AppHttpManager.getInstance(loanApplication)
.call(loanService.clickForTurn(),
object : BaseSubscriber<BaseResponse<ClickTurnBean>>() {
override fun onCompleted() {
}
override fun onError(e: Throwable) {
if (isLinkView) return
view.showToast(e.message)
}
override fun onNext(baseResponse: BaseResponse<ClickTurnBean>) {
if (isLinkView) return
val code = baseResponse.getStatus()
val message = baseResponse.getMessage()
when (code) {
200 -> {
view.clickForTurnSuc(baseResponse.data)
}
else -> view.showToast(message)
}
}
})
}
/**
* 游客登录
*/
fun userLogin() {
val vo = HashMap<String, Any>()
vo["device"] = DeviceUuidFactory().deviceUuid.toString()
vo["shumeiId"] = ShumeiManager.getInstance().shumeiDeviceId
AppHttpManager.getInstance(loanApplication)
.call(loanService.visitorlogin(vo),
object : BaseSubscriber<BaseResponse<UserBean>>() {
override fun onCompleted() {
}
override fun onError(e: Throwable) {
}
override fun onNext(baseResponse: BaseResponse<UserBean>) {
if (isLinkView) return
val code = baseResponse.getStatus()
val message = baseResponse.getMessage()
val data: UserBean? = baseResponse.getData()
when (code) {
200 -> if (data != null) {
UserManager.getInstance().saveUserInfo(data)
saveTerminalInfo()
}
else -> view.showToast(message)
}
}
})
}
/**
* 提交设备信息
*
* @param context
*/
fun saveTerminalInfo() {
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.newModel
vo["uuid"] = DeviceUuidFactory().deviceUuid
vo["osversion"] = deviceInfo.oSVersion
vo["appversion"] = deviceInfo.versionName
vo["shumeiId"] = ShumeiManager.getInstance().getShumeiDeviceId()
AppHttpManager.getInstance(loanApplication)
.call(loanService.saveTerminalInfo(vo),
object : BaseSubscriber<BaseResponse<Any>>() {
override fun onCompleted() {
if (isLinkView) return
}
override fun onError(e: Throwable) {
if (isLinkView) return
}
override fun onNext(baseResponse: BaseResponse<Any>) {
if (isLinkView) return
val code = baseResponse.status
when (code) {
200 -> {
getTurnMsg()
}
}
}
})
}
}
\ No newline at end of file
package com.mints.goodmoney.mvp.views
import com.mints.goodmoney.mvp.model.ClickTurnBean
import com.mints.goodmoney.mvp.model.TurnBean
interface TurnTableView : BaseView {
fun getTurnTableSuc(data: TurnBean)
fun cashoutLeadersSuc()
fun clickForTurnSuc(data: ClickTurnBean)
}
\ No newline at end of file
......@@ -7,6 +7,7 @@ import com.mints.goodmoney.BuildConfig;
import com.mints.goodmoney.mvp.model.AccountMsgBean;
import com.mints.goodmoney.mvp.model.BannerBean;
import com.mints.goodmoney.mvp.model.BaseResponse;
import com.mints.goodmoney.mvp.model.ClickTurnBean;
import com.mints.goodmoney.mvp.model.CommonParamBean;
import com.mints.goodmoney.mvp.model.DrawcashBean;
import com.mints.goodmoney.mvp.model.DrawcashRecordBean;
......@@ -20,6 +21,7 @@ import com.mints.goodmoney.mvp.model.MorningClockBean;
import com.mints.goodmoney.mvp.model.MyInfo;
import com.mints.goodmoney.mvp.model.SignCardBean;
import com.mints.goodmoney.mvp.model.TaskCpdBean;
import com.mints.goodmoney.mvp.model.TurnBean;
import com.mints.goodmoney.mvp.model.UserBean;
import com.mints.goodmoney.mvp.model.UserTaskMsgBean;
import com.mints.goodmoney.mvp.model.Version;
......@@ -577,6 +579,38 @@ public interface LoanService {
@POST("common/reportErrornterface")
Observable<BaseResponse<JsonObject>> reportErrornterface(@Body Map<String, Object> vo);
/**
* 获取大转盘信息
*
* @return
*/
@POST("api/turn/getTurnMsg")
Observable<BaseResponse<TurnBean>> getTurnMsg();
/**
* 点击获取转盘信息
*
* @return
*/
@POST("api/turn/clickForTurn")
Observable<BaseResponse<ClickTurnBean>> clickForTurn();
/**
* 提现列表展示
*
* @return
*/
@POST("common/cashoutLeaders")
Observable<BaseResponse<Object>> cashoutLeaders();
/**
* 大转盘点击入口
*
* @return
*/
@POST("api/turn/addTurnToOtherMsg")
Observable<BaseResponse<Object>> addTurnToOtherMsg(@Body Map<String, Object> vo);
/**
* 默认http工厂
*/
......@@ -591,29 +625,29 @@ public interface LoanService {
builder.readTimeout(20, TimeUnit.SECONDS);
builder.writeTimeout(20, TimeUnit.SECONDS);
// if (BuildConfig.DEBUG) {
// HttpLoggingInterceptor logging = new HttpLoggingInterceptor();
// logging.setLevel(HttpLoggingInterceptor.Level.BODY);
// builder.interceptors().add(logging);
// }
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);
}
});
HttpLoggingInterceptor logging = new HttpLoggingInterceptor();
logging.setLevel(HttpLoggingInterceptor.Level.BODY);
builder.interceptors().add(logging);
}
// 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);
// }
OkHttpInterceptor okHttpInterceptor = new OkHttpInterceptor(AESUtils.getDefaultKey());
// builder.interceptors().add(domainInterceptor);
builder.interceptors().add(okHttpInterceptor);
......
......@@ -9,7 +9,6 @@ import android.view.View
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentManager
import androidx.fragment.app.FragmentTransaction
import com.ireader.ireadersdk.IreaderApi
import com.mints.goodmoney.R
import com.mints.goodmoney.ad.express.TTPreLoadCarrierExpressManager
import com.mints.goodmoney.ad.video.VideoAdingManager
......@@ -18,7 +17,6 @@ import com.mints.goodmoney.common.Constant
import com.mints.goodmoney.manager.MokuManager
import com.mints.goodmoney.manager.SceneManager
import com.mints.goodmoney.manager.UserManager
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.*
......@@ -36,7 +34,7 @@ class MainActivity : BaseActivity(), MainView, View.OnClickListener {
// 底部标签切换的Fragment
private var moneyFragment: Fragment? = null
private var panFragment: Fragment? = null
private var turnTableFragment: Fragment? = null
private var friendsFragment: Fragment? = null
private var myFragment: Fragment? = null
......@@ -52,8 +50,6 @@ class MainActivity : BaseActivity(), MainView, View.OnClickListener {
override fun getContentViewLayoutID() = R.layout.activity_main
override fun initViewsAndEvents() {
ZhangyueManager.onCreateIreader(baseApplication)
showShortVedioLayout()
if (moneyFragment == null) {
......@@ -101,8 +97,6 @@ class MainActivity : BaseActivity(), MainView, View.OnClickListener {
override fun isApplyKitKatTranslucency() = false
public override fun onDestroy() {
IreaderApi.onAppExit()
super.onDestroy()
TTPreLoadCarrierExpressManager.getInstance().onDestroy()
......@@ -269,10 +263,10 @@ class MainActivity : BaseActivity(), MainView, View.OnClickListener {
*/
private fun clickTab3Layout() {
AppConfig.fragmentClickFlag = Constant.FRAGMENT_CLICK_THREE
if (panFragment == null) {
panFragment = PanFragment()
if (turnTableFragment == null) {
turnTableFragment = TurnTableFragment()
}
addOrShowFragment(supportFragmentManager, panFragment!!, Constant.FRAGMENT_TAG_THREE)
addOrShowFragment(supportFragmentManager, turnTableFragment!!, Constant.FRAGMENT_TAG_THREE)
tab_iv_one.isSelected = false
tab_tv_one.isSelected = false
tab_iv_two.isSelected = false
......
......@@ -52,14 +52,10 @@ class WrapperActivity : BaseActivity(), View.OnClickListener {
Constant.WRAPPER_TYPE_NEWS -> {
layoutWrapper.visibility = View.INVISIBLE
val layoutParams = layoutWrapper.layoutParams
layoutParams.height=BubbleUtils.dp2px(30)
layoutParams.height = BubbleUtils.dp2px(30)
tv_title.text = "新闻"
currentFragment = RsNewsFragment()
}
Constant.WRAPPER_TYPE_BOOK -> {
tv_title.text = "书城"
currentFragment = MyZhangyueFragment()
}
Constant.WRAPPER_TYPE_FRIENDS -> {
tv_title.text = "瓜分百万现金福利"
currentFragment = FriendsFragment(true)
......@@ -73,8 +69,8 @@ class WrapperActivity : BaseActivity(), View.OnClickListener {
currentFragment = WzFragment(true)
}
else -> {
tv_title.text = "书城"
currentFragment = MyZhangyueFragment()
tv_title.text = "瓜分百万现金福利"
currentFragment = FriendsFragment(true)
}
}
......
package com.mints.goodmoney.ui.adapter;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.TextView;
import com.mints.goodmoney.R;
import com.mints.goodmoney.common.Constant;
import com.mints.goodmoney.manager.BxmManager;
import com.mints.goodmoney.manager.UserManager;
import com.mints.goodmoney.mvp.model.BannerBean;
import com.mints.goodmoney.mvp.model.TurnBean;
import com.mints.library.utils.GlideUtils;
import java.util.List;
public class TurnTableAdapter extends BaseAdapter {
private List<TurnBean.BottomsBean> orders;
private Activity activity;
public TurnTableAdapter(Activity activity, List<TurnBean.BottomsBean> orders) {
this.orders = orders;
this.activity = activity;
}
@Override
public int getCount() {
return orders == null ? 0 : orders.size();
}
@Override
public Object getItem(int position) {
return orders.get(position);
}
@Override
public long getItemId(int position) {
return position;
}
@SuppressLint("WrongViewCast")
@Override
public View getView(int position, View convertView, ViewGroup parent) {
ViewHolder viewHolder;
if (convertView == null) {
LayoutInflater inflater = LayoutInflater.from(activity);
convertView = inflater.inflate(R.layout.item_list_turn, null);
viewHolder = new ViewHolder();
viewHolder.ic_turn_icon = convertView.findViewById(R.id.ic_turn_icon);
viewHolder.tv_turn_top = convertView.findViewById(R.id.tv_turn_top);
viewHolder.tv_turn_bottom = convertView.findViewById(R.id.tv_turn_bottom);
convertView.setTag(viewHolder);
} else {
viewHolder = (ViewHolder) convertView.getTag();
}
TurnBean.BottomsBean data = orders.get(position);
if (data != null) {
GlideUtils.loadImageView(activity, data.getIcon(), viewHolder.ic_turn_icon);
viewHolder.tv_turn_top.setText(TextUtils.isEmpty(data.getRewardTitle()) ? "" : data.getRewardTitle());
viewHolder.tv_turn_bottom.setText(data.getTitle());
}
return convertView;
}
class ViewHolder {
public ImageView ic_turn_icon;
public TextView tv_turn_top;
public TextView tv_turn_bottom;
}
}
......@@ -27,7 +27,7 @@ class MoneyFragment : BaseFragment(), XTabLayout.OnTabSelectedListener {
private var currentFragment: Fragment? = null
private var mainFragment: Fragment? = null
private var bookStoreFragment: Fragment? = null
// private var bookStoreFragment: Fragment? = null
// private var newsFragment: Fragment? = null
private var xmlyGameFragment: Fragment? = null
......@@ -73,11 +73,9 @@ class MoneyFragment : BaseFragment(), XTabLayout.OnTabSelectedListener {
currentFragment = mainFragment
}
xtFragmentMoney.setxTabDisplayNum(5)
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()
......@@ -87,7 +85,6 @@ class MoneyFragment : BaseFragment(), XTabLayout.OnTabSelectedListener {
val newTab6 = xtFragmentMoney.newTab()
newTab6.text = "来电秀"
xtFragmentMoney.addTab(newTab1)
xtFragmentMoney.addTab(newTab2)
// xtFragmentMoney.addTab(newTab3)
xtFragmentMoney.addTab(newTab4)
xtFragmentMoney.addTab(newTab5)
......@@ -144,17 +141,10 @@ class MoneyFragment : BaseFragment(), XTabLayout.OnTabSelectedListener {
}
fun selectBook() {
// vpFragmentMoney.currentItem = 1
xtFragmentMoney.getTabAt(1)?.select()
if (bookStoreFragment == null) {
bookStoreFragment = ZhangyueFragment()
}
addOrShowFragment(childFragmentManager, bookStoreFragment!!, FRAGMENT_TAG_BOOKSTORE)
}
fun selectXmly() {
xtFragmentMoney.getTabAt(2)?.select()
xtFragmentMoney.getTabAt(1)?.select()
if (xmlyGameFragment == null) {
xmlyGameFragment = XmlyFragment()
}
......@@ -184,30 +174,18 @@ class MoneyFragment : BaseFragment(), XTabLayout.OnTabSelectedListener {
}
1 -> {
if (bookStoreFragment == null) {
bookStoreFragment = ZhangyueFragment()
}
addOrShowFragment(childFragmentManager, bookStoreFragment!!, FRAGMENT_TAG_BOOKSTORE)
}
// 2 -> {
// if (newsFragment == null) {
// newsFragment = RsNewsFragment()
// }
// addOrShowFragment(childFragmentManager, newsFragment!!, FRAGMENT_TAG_NEWS)
// }
2 -> {
if (xmlyGameFragment == null) {
xmlyGameFragment = XmlyFragment()
}
addOrShowFragment(childFragmentManager, xmlyGameFragment!!, FRAGMENT_TAG_XMLY)
}
3 -> {
2 -> {
if (liebaoGameFragment == null) {
liebaoGameFragment = LiebaoGameFragment()
}
addOrShowFragment(childFragmentManager, liebaoGameFragment!!, FRAGMENT_TAG_GAME)
}
4 -> {
3 -> {
if (kuYinyueFragment == null) {
kuYinyueFragment = KuYinYueFragment()
}
......
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.manager.ZhangyueManager
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_ONE) {
bookPresenter.getReadInfo()
}
}
override fun onDestroy() {
super.onDestroy()
IreaderApi.setReadChangeListener(null)
ZhangyueManager.onDestory()
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()
}
}
// override fun addBookShelf(p0: Bundle?) {
// TODO("Not yet implemented")
// }
//
// override fun onReadStart(p0: Bundle?) {
// TODO("Not yet implemented")
// }
//
// override fun onReadEnd(p0: Bundle?) {
// val seconds = (p0!!.getLong(IreaderApi.BOOK_TIME) / 1000).toInt()
// // 阅读5秒以上 保存时长
// if (seconds > 5) {
// bookPresenter.addReadSeconds(seconds)
// }
// }
//
// override fun onDeleteBook(p0: String?) {
// TODO("Not yet implemented")
// }
//
// override fun onReadPage(p0: Bundle?) {
// TODO("Not yet implemented")
// }
//
// override fun onChangeNight(p0: Boolean) {
// TODO("Not yet implemented")
// }
}
\ 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.manager.ZhangyueManager
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 ZhangyueFragment : 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() {
}
override fun onFragmentFirstVisible() {
bookPresenter.attachView(this)
val transaction: FragmentTransaction = supportFragmentManager.beginTransaction()
if (bookFragment == null) {
bookFragment = IreaderApi.getNovelBookStoreFragment()
transaction.add(R.id.fragment, bookFragment!!, bookFragment!!::class.java.simpleName)
IreaderApi.setReadChangeListener(this)
} else {
transaction.show(bookFragment!!)
}
transaction.commitAllowingStateLoss()
}
override fun onFragmentResume() {
super.onFragmentResume()
if (AppConfig.fragmentClickFlag == Constant.FRAGMENT_CLICK_ONE) {
bookPresenter.getReadInfo()
}
}
override fun onDestroy() {
super.onDestroy()
IreaderApi.setReadChangeListener(null)
ZhangyueManager.onDestory()
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()
}
}
// override fun addBookShelf(p0: Bundle?) {
// }
//
// override fun onReadStart(p0: Bundle?) {
// }
//
// override fun onReadEnd(p0: Bundle?) {
// // LogUtil.d(TAG, "onReadEnd time:" + time)
//// LogUtil.d(TAG, "onReadEnd time(Int):" + (time/1000).toInt())
//
// val seconds = (p0!!.getLong(IreaderApi.BOOK_TIME).toLong() / 1000).toInt()
// // 阅读5秒以上 保存时长
// if (seconds > 5) {
// bookPresenter.addReadSeconds(seconds)
// }
// }
//
// override fun onDeleteBook(p0: String?) {
// }
//
// override fun onReadPage(p0: Bundle?) {
// }
//
// override fun onChangeNight(p0: Boolean) {
// }
}
\ No newline at end of file
......@@ -6,9 +6,9 @@
<item android:id="@android:id/background">
<shape>
<stroke
android:width="@dimen/dp_1"
android:width="1dp"
android:color="#E5E5E5" />
<corners android:radius="@dimen/dp_5" />
<corners android:radius="5dp" />
<solid android:color="#FAFAFA" />
<gradient
......@@ -26,7 +26,7 @@
<clip>
<shape android:shape="rectangle">
<solid android:color="#E9DDB6" />
<corners android:radius="@dimen/dp_5" />
<corners android:radius="5dp" />
</shape>
</clip>
</item>
......@@ -38,9 +38,9 @@
<clip>
<shape>
<stroke
android:width="@dimen/dp_1"
android:width="1dp"
android:color="#E5E5E5" />
<corners android:radius="@dimen/dp_5" />
<corners android:radius="5dp" />
<gradient
android:angle="0"
android:centerColor="#FB560C"
......
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<!-- 填充的颜色 -->
<solid android:color="#50ffffff" />
<!-- 设置按钮的四个角为弧形 -->
<!-- android:radius 弧形的半径 -->
<corners android:radius="10dip" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:wheelSurfView="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:tools="http://schemas.android.com/tools"
android:overScrollMode="never">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@mipmap/bg_turntable"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="30dp"
android:layout_marginTop="30dp"
android:gravity="center_vertical">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="6dp"
android:src="@mipmap/ic_voice" />
<com.sunfusheng.marqueeview.MarqueeView
android:id="@+id/marqueeView"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
app:mvAnimDuration="1000"
app:mvInterval="4000"
app:mvSingleLine="true"
app:mvTextColor="@color/color_cb4a39"
app:mvTextSize="15sp" />
</LinearLayout>
<TextView
android:id="@+id/tvHintTurnTable"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="120dp"
tools:text="每日0点重置抽奖次数"
android:textColor="@color/red"
android:textSize="18sp" />
<com.cretin.www.wheelsruflibrary.view.WheelSurfView
android:id="@+id/turnTableView"
android:layout_width="330dp"
android:layout_height="330dp"
android:layout_gravity="center_horizontal"
android:layout_marginTop="20dp"
wheelSurfView:typenum="-1" />
<include layout="@layout/layout_turn_btn" />
</LinearLayout>
</androidx.core.widget.NestedScrollView>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical">
<TextView
android:id="@+id/tv_turn_top"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginBottom="6dp"
tools:text="抽奖+1"
android:textColor="@color/red"
android:textSize="14sp" />
<ImageView
android:id="@+id/ic_turn_icon"
android:layout_width="38dp"
android:layout_height="38dp"
android:layout_gravity="center_horizontal"
android:scaleType="fitXY"
tools:src="@mipmap/ic_launcher_main" />
<TextView
android:id="@+id/tv_turn_bottom"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="8dp"
tools:text="搜索赚"
android:textColor="@color/red"
android:textSize="14sp" />
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginBottom="5dp"
android:background="@drawable/shape_turn_btn"
android:elevation="18dp"
android:orientation="vertical"
android:paddingTop="4dp"
android:paddingBottom="10dp">
<TextView
android:id="@+id/tvTurnTimes"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:textColor="@color/black"
android:layout_marginBottom="6dp"
android:textSize="12sp" />
<com.mints.goodmoney.ui.widgets.ExpandableGridView
android:id="@+id/gvTurnTable"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:columnWidth="80dp"
android:divider="@null"
android:dividerHeight="10pt"
android:elevation="6dip"
android:listSelector="#00000000"
android:numColumns="4"
android:scrollbars="none"
android:stretchMode="spacingWidthUniform" />
<TextView
android:id="@+id/tvTurnMore"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:drawableTop="@mipmap/ic_arrow_down"
android:drawablePadding="4dp"
android:text="点击获取更多奖励"
android:textColor="@color/red"
android:textSize="14sp"></TextView>
</LinearLayout>
\ No newline at end of file
include ':demo'
include ':app'
include ':shareSdkLib'
\ No newline at end of file
include ':shareSdkLib'
include ':wheelsruflibrary'
\ No newline at end of file
apply plugin: 'com.android.library'
android {
compileSdkVersion 26
defaultConfig {
minSdkVersion 14
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:26.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
}
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
package com.cretin.www.wheelsruflibrary;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith( AndroidJUnit4.class )
public class ExampleInstrumentedTest {
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.cretin.www.wheelsruflibrary.test", appContext.getPackageName());
}
}
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.cretin.www.wheelsruflibrary"/>
package com.cretin.www.wheelsruflibrary.listener;
import android.animation.ValueAnimator;
import android.widget.ImageView;
/**
* Created by cretin on 2017/12/27.
* 用于回调动画过程和结果
*/
public interface RotateListener {
/**
* 动画结束 返回当前位置 注意 位置是最上面是1 然后依次逆时针递增
*
* @param position
* @param des 所指分区文字描述
*/
void rotateEnd(int position, String des);
/**
* 动画进行中 返回动画中间量
*
* @param valueAnimator
*/
void rotating(ValueAnimator valueAnimator);
/**
* 点击了按钮 但是没有旋转 调用者可以在这里处理一些逻辑 比如弹出对话框确定用户是否要抽奖
*
* @param goImg
*/
void rotateBefore(ImageView goImg);
}
<?xml version="1.0" encoding="utf-8"?>
<resources>
<declare-styleable name="wheelSurfView">
<!--类型 根据类型来加载资源 1 默认类型 用户需要提供文字和图片 2 暴力模式 用户只需要提供一张圆形的用来旋转的图片-->
<attr name="type" format="integer"/>
<!--最低圈数 默认值3 也就是说每次旋转都会最少转3圈-->
<attr name="minTimes" format="integer"/>
<!--扇形的数量 也就是奖品的份数-->
<attr name="typenum" format="integer"/>
<!--每一个扇形旋转消耗的时间-->
<attr name="vartime" format="integer"/>
<!--类型为1的时候 需要提供每个扇形上面的文字描述 长度必须和typenum一致-->
<attr name="deses" format="reference"/>
<!--类型为1的时候 需要提供每个扇形上面的图片展示 长度必须和typenum一致-->
<attr name="icons" format="reference"/>
<!--类型为1的时候 需要提供每个扇形背景颜色 长度必须和typenum一致-->
<attr name="colors" format="reference"/>
<!--中间图片的引用 有默认值 不填则使用默认值-->
<attr name="goImg" format="reference"/>
<!--圆环的图片引用 有默认值 不填则使用默认值-->
<attr name="huanImg" format="reference"/>
<!--如果类型为2 此值必填-->
<attr name="mainImg" format="reference"/>
<!--文字大小-->
<attr name="textSize" format="dimension"/>
<!--文字颜色-->
<attr name="textColor" format="reference|color"/>
</declare-styleable>
</resources>
\ No newline at end of file
<resources>
<string name="app_name">WheelSrufLibrary</string>
</resources>
package com.cretin.www.wheelsruflibrary;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
}
\ No newline at end of file
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