Compare commits
71 Commits
| Author | SHA1 | Date |
|---|---|---|
|
|
6831cfa898 | |
|
|
9bf2e8fef0 | |
|
|
4feda5f879 | |
|
|
4c4500b895 | |
|
|
81ab5823ec | |
|
|
294100b146 | |
|
|
2b8b0fb38d | |
|
|
9e2b880a32 | |
|
|
57ae7ff4ff | |
|
|
95742607a0 | |
|
|
f2cbc14727 | |
|
|
47e4d3dba5 | |
|
|
abe2f0ab90 | |
|
|
3b0abf5235 | |
|
|
9189b845ef | |
|
|
929a95ed9c | |
|
|
0991ab3993 | |
|
|
4ff522f3cd | |
|
|
a6c56d6539 | |
|
|
d7be7c30cb | |
|
|
66bcd4eb51 | |
|
|
114f7befbc | |
|
|
0bf9922be7 | |
|
|
e6c0220019 | |
|
|
ff0ee2d612 | |
|
|
82ff8c5c51 | |
|
|
77d93b0211 | |
|
|
3c081c230a | |
|
|
e93d76f316 | |
|
|
483fa7e930 | |
|
|
ca1f3662b0 | |
|
|
460270212d | |
|
|
ef8d084744 | |
|
|
797d1c01a9 | |
|
|
554eaf31a3 | |
|
|
9d8fc70c10 | |
|
|
16efb504e3 | |
|
|
62db69b1d4 | |
|
|
93543545c5 | |
|
|
32d201030d | |
|
|
6f650df200 | |
|
|
0e034f340d | |
|
|
b07c1cf4ab | |
|
|
0b0805d6bc | |
|
|
da56a8cb42 | |
|
|
97f9a39e95 | |
|
|
a063466f15 | |
|
|
dc7ff87e33 | |
|
|
63d636ff1a | |
|
|
1542db851e | |
|
|
f4aebf8e9c | |
|
|
6ea2af01fe | |
|
|
738b0b3ae9 | |
|
|
5fdf3a4ad9 | |
|
|
e00bf1da76 | |
|
|
f5162cb3a8 | |
|
|
df87261b62 | |
|
|
58b33b9399 | |
|
|
8b37a63a4a | |
|
|
cfe4acbb78 | |
|
|
a8ab37a17b | |
|
|
86214129b6 | |
|
|
fc7fd9d578 | |
|
|
b099f4cd99 | |
|
|
9efe53bf0d | |
|
|
cb1e475a83 | |
|
|
de9f003d26 | |
|
|
df332187d6 | |
|
|
88c2d8cf34 | |
|
|
3eb186063f | |
|
|
5a15d7d997 |
|
|
@ -2,7 +2,15 @@
|
|||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
|
||||
<uses-feature
|
||||
android:name="android.hardware.camera"
|
||||
android:required="false" />
|
||||
|
||||
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
|
||||
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.CAMERA" />
|
||||
|
||||
|
||||
<application
|
||||
android:name=".VidiDinApp"
|
||||
|
|
@ -16,10 +24,10 @@
|
|||
android:theme="@style/Theme.Architectureandroid">
|
||||
<activity
|
||||
android:name=".main.MainActivity"
|
||||
android:exported="true">
|
||||
android:exported="true"
|
||||
android:launchMode="singleTask">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
|
@ -35,6 +43,7 @@
|
|||
<activity android:name=".features.feedback.FeedbackActivity" android:exported="false" />
|
||||
<activity android:name=".features.withdrawrecord.WithdrawRecordActivity" android:exported="false" />
|
||||
<activity android:name=".features.privacy.PrivacyActivity" android:exported="false" />
|
||||
<activity android:name=".features.watchad.WatchAdActivity" android:exported="false" />
|
||||
|
||||
|
||||
|
||||
|
|
@ -46,6 +55,19 @@
|
|||
android:name="com.gamedog.vididin.router.RouterInitializer"
|
||||
android:value="androidx.startup" />
|
||||
</provider>
|
||||
|
||||
|
||||
<receiver
|
||||
android:name=".manager.DateChangeReceiver"
|
||||
android:enabled="true"
|
||||
android:exported="true">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.DATE_CHANGED" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
|
||||
|
||||
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
|
|
@ -4,7 +4,10 @@
|
|||
"module_name": "任务中心",
|
||||
"page_path": "底部第二个页签",
|
||||
"layout_style": "上下滑动长页面",
|
||||
"currency_display": ["金币账户", "巴西雷亚尔现金账户"]
|
||||
"currency_display": [
|
||||
"金币账户",
|
||||
"巴西雷亚尔现金账户"
|
||||
]
|
||||
},
|
||||
"task_categories": [
|
||||
{
|
||||
|
|
@ -50,13 +53,34 @@
|
|||
"target_action": "用户每日完成签到操作(支持广告补签)",
|
||||
"reward_type": "金币",
|
||||
"reward_details": [
|
||||
{"day": 1, "value": 100},
|
||||
{"day": 2, "value": 300},
|
||||
{"day": 3, "value": 300},
|
||||
{"day": 4, "value": 500},
|
||||
{"day": 5, "value": 300},
|
||||
{"day": 6, "value": 300},
|
||||
{"day": 7, "value": 800}
|
||||
{
|
||||
"day": 1,
|
||||
"value": 100
|
||||
},
|
||||
{
|
||||
"day": 2,
|
||||
"value": 300
|
||||
},
|
||||
{
|
||||
"day": 3,
|
||||
"value": 300
|
||||
},
|
||||
{
|
||||
"day": 4,
|
||||
"value": 500
|
||||
},
|
||||
{
|
||||
"day": 5,
|
||||
"value": 300
|
||||
},
|
||||
{
|
||||
"day": 6,
|
||||
"value": 300
|
||||
},
|
||||
{
|
||||
"day": 7,
|
||||
"value": 800
|
||||
}
|
||||
],
|
||||
"support_makeup": true,
|
||||
"makeup_method": "观看15-30秒激励视频",
|
||||
|
|
@ -78,13 +102,34 @@
|
|||
"target_action": "用户当日完成签到操作",
|
||||
"reward_type": "金币",
|
||||
"reward_details": [
|
||||
{"day": 1, "value": 100},
|
||||
{"day": 2, "value": 300},
|
||||
{"day": 3, "value": 300},
|
||||
{"day": 4, "value": 500},
|
||||
{"day": 5, "value": 300},
|
||||
{"day": 6, "value": 300},
|
||||
{"day": 7, "value": 500}
|
||||
{
|
||||
"day": 1,
|
||||
"value": 100
|
||||
},
|
||||
{
|
||||
"day": 2,
|
||||
"value": 300
|
||||
},
|
||||
{
|
||||
"day": 3,
|
||||
"value": 300
|
||||
},
|
||||
{
|
||||
"day": 4,
|
||||
"value": 500
|
||||
},
|
||||
{
|
||||
"day": 5,
|
||||
"value": 300
|
||||
},
|
||||
{
|
||||
"day": 6,
|
||||
"value": 300
|
||||
},
|
||||
{
|
||||
"day": 7,
|
||||
"value": 500
|
||||
}
|
||||
],
|
||||
"double_reward_method": "观看15-30秒激励视频",
|
||||
"support_makeup": true,
|
||||
|
|
@ -99,9 +144,18 @@
|
|||
"target_action": "用户累计观看短视频",
|
||||
"reward_type": "金币",
|
||||
"reward_details": [
|
||||
{"target_count": 10, "value": 100},
|
||||
{"target_count": 20, "value": 150},
|
||||
{"target_count": 30, "value": 200}
|
||||
{
|
||||
"target_count": 10,
|
||||
"value": 100
|
||||
},
|
||||
{
|
||||
"target_count": 20,
|
||||
"value": 150
|
||||
},
|
||||
{
|
||||
"target_count": 30,
|
||||
"value": 200
|
||||
}
|
||||
],
|
||||
"reward_stackable": true,
|
||||
"is_one_time": false,
|
||||
|
|
@ -114,9 +168,18 @@
|
|||
"target_action": "用户累计观看激励视频",
|
||||
"reward_type": "金币",
|
||||
"reward_details": [
|
||||
{"target_count": 1, "value": 100},
|
||||
{"target_count": 5, "value": 150},
|
||||
{"target_count": 10, "value": 200}
|
||||
{
|
||||
"target_count": 1,
|
||||
"value": 100
|
||||
},
|
||||
{
|
||||
"target_count": 5,
|
||||
"value": 150
|
||||
},
|
||||
{
|
||||
"target_count": 10,
|
||||
"value": 200
|
||||
}
|
||||
],
|
||||
"daily_limit": 10,
|
||||
"reward_stackable": true,
|
||||
|
|
@ -125,6 +188,104 @@
|
|||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"box_task": {
|
||||
"category_id": "bonuses_task",
|
||||
"category_name": "福利宝箱(Prémios únicos)",
|
||||
"valid_period": "每个宝箱持续3天,完成对应任务即可领取现金奖励。",
|
||||
"display_priority": 3,
|
||||
"chests": [
|
||||
{
|
||||
"chest_id": "1",
|
||||
"chest_name": "福利宝箱1",
|
||||
"chest_desc": "完成福利宝箱1的全部任务后,获得R$0.1现金奖励",
|
||||
"duration_days": 3,
|
||||
"reward_type": "货币",
|
||||
"reward_value": 0.1,
|
||||
"is_one_time": true,
|
||||
"status": "active",
|
||||
"tasks": [
|
||||
{
|
||||
"task_id": "chest1_task1",
|
||||
"task_name": "观看1个广告",
|
||||
"required_count": 1,
|
||||
"task_type": 1
|
||||
},
|
||||
{
|
||||
"task_id": "chest1_task2",
|
||||
"task_name": "观看3个视频",
|
||||
"required_count": 3,
|
||||
"task_type": 2
|
||||
},
|
||||
{
|
||||
"task_id": "chest1_task3",
|
||||
"task_name": "完成1次签到",
|
||||
"required_count": 1,
|
||||
"task_type": 3
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"chest_id": "2",
|
||||
"chest_name": "福利宝箱2",
|
||||
"chest_desc": "完成福利宝箱2的全部任务后,获得R$1现金奖励",
|
||||
"duration_days": 3,
|
||||
"reward_type": "货币",
|
||||
"reward_value": 1,
|
||||
"is_one_time": true,
|
||||
"status": "locked",
|
||||
"tasks": [
|
||||
{
|
||||
"task_id": "chest2_task1",
|
||||
"task_name": "观看15个广告",
|
||||
"required_count": 15,
|
||||
"task_type": 1
|
||||
},
|
||||
{
|
||||
"task_id": "chest2_task2",
|
||||
"task_name": "观看30个视频",
|
||||
"required_count": 30,
|
||||
"task_type": 2
|
||||
},
|
||||
{
|
||||
"task_id": "chest2_task3",
|
||||
"task_name": "参与1次0元购",
|
||||
"required_count": 1,
|
||||
"task_type": 4
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"chest_id": "3",
|
||||
"chest_name": "福利宝箱3",
|
||||
"chest_desc": "完成福利宝箱3的全部任务后,获得R$2现金奖励",
|
||||
"duration_days": 3,
|
||||
"reward_type": "货币",
|
||||
"reward_value": 2,
|
||||
"is_one_time": true,
|
||||
"status": "locked",
|
||||
"tasks": [
|
||||
{
|
||||
"task_id": "chest3_task1",
|
||||
"task_name": "观看30个广告",
|
||||
"required_count": 30,
|
||||
"task_type": 1
|
||||
},
|
||||
{
|
||||
"task_id": "chest3_task2",
|
||||
"task_name": "观看50个视频",
|
||||
"required_count": 50,
|
||||
"task_type": 2
|
||||
},
|
||||
{
|
||||
"task_id": "chest3_task3",
|
||||
"task_name": "参与10次0元购",
|
||||
"required_count": 10,
|
||||
"task_type": 4
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,130 @@
|
|||
{
|
||||
"task_module_config": {
|
||||
"basic_info": {
|
||||
"module_name": "任务中心",
|
||||
"page_path": "底部第二个页签",
|
||||
"layout_style": "上下滑动长页面",
|
||||
"currency_display": ["金币账户", "巴西雷亚尔现金账户"]
|
||||
},
|
||||
"task_categories": [
|
||||
{
|
||||
"category_id": "newbie_task",
|
||||
"category_name": "新手任务(Missão Para Iniciantes)",
|
||||
"valid_period": "注册后7天内",
|
||||
"display_priority": 1,
|
||||
"tasks": [
|
||||
{
|
||||
"task_id": "newbie_first_withdraw",
|
||||
"task_name": "完成第一次提现",
|
||||
"task_desc": "完成首次提现操作(0.1 BRL门槛),即可获得100金币奖励",
|
||||
"target_action": "用户完成首次提现流程(含绑定Pix账户、观看广告)",
|
||||
"reward_type": "金币",
|
||||
"reward_value": 100,
|
||||
"is_one_time": true,
|
||||
"status": "active"
|
||||
},
|
||||
{
|
||||
"task_id": "newbie_push_notify",
|
||||
"task_name": "开启消息推送",
|
||||
"task_desc": "启用APP消息推送权限,实时获取任务更新与奖励通知",
|
||||
"target_action": "用户授权APP系统推送通知",
|
||||
"reward_type": "金币",
|
||||
"reward_value": 300,
|
||||
"is_one_time": true,
|
||||
"status": "active"
|
||||
},
|
||||
{
|
||||
"task_id": "newbie_join_discord",
|
||||
"task_name": "加入Discord社区",
|
||||
"task_desc": "通过APP内链接加入官方Discord社区,获取专属活动与客服支持",
|
||||
"target_action": "用户通过指定链接成功加入Discord社区",
|
||||
"reward_type": "金币",
|
||||
"reward_value": 200,
|
||||
"is_one_time": true,
|
||||
"status": "active"
|
||||
},
|
||||
{
|
||||
"task_id": "newbie_7day_checkin",
|
||||
"task_name": "7日连续签到",
|
||||
"task_desc": "连续7天完成签到,奖励逐级递增,第7天最高可得800金币",
|
||||
"target_action": "用户每日完成签到操作(支持广告补签)",
|
||||
"reward_type": "金币",
|
||||
"reward_details": [
|
||||
{"day": 1, "value": 100},
|
||||
{"day": 2, "value": 300},
|
||||
{"day": 3, "value": 300},
|
||||
{"day": 4, "value": 500},
|
||||
{"day": 5, "value": 300},
|
||||
{"day": 6, "value": 300},
|
||||
{"day": 7, "value": 800}
|
||||
],
|
||||
"support_makeup": true,
|
||||
"makeup_method": "观看15-30秒激励视频",
|
||||
"is_one_time": true,
|
||||
"status": "active"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"category_id": "daily_task",
|
||||
"category_name": "日常任务(Missão Diária)",
|
||||
"valid_period": "每日凌晨00:00重置",
|
||||
"display_priority": 2,
|
||||
"tasks": [
|
||||
{
|
||||
"task_id": "daily_checkin",
|
||||
"task_name": "每日签到",
|
||||
"task_desc": "每日签到可获金币,7天为一周期,奖励循环递增(支持双倍广告奖励)",
|
||||
"target_action": "用户当日完成签到操作",
|
||||
"reward_type": "金币",
|
||||
"reward_details": [
|
||||
{"day": 1, "value": 100},
|
||||
{"day": 2, "value": 300},
|
||||
{"day": 3, "value": 300},
|
||||
{"day": 4, "value": 500},
|
||||
{"day": 5, "value": 300},
|
||||
{"day": 6, "value": 300},
|
||||
{"day": 7, "value": 500}
|
||||
],
|
||||
"double_reward_method": "观看15-30秒激励视频",
|
||||
"support_makeup": true,
|
||||
"makeup_method": "观看15-30秒激励视频",
|
||||
"is_one_time": false,
|
||||
"status": "active"
|
||||
},
|
||||
{
|
||||
"task_id": "daily_video_ladder",
|
||||
"task_name": "阶梯观看视频",
|
||||
"task_desc": "累计观看指定数量短视频,分3档领取奖励(与基础观看收益叠加)",
|
||||
"target_action": "用户累计观看短视频",
|
||||
"reward_type": "金币",
|
||||
"reward_details": [
|
||||
{"target_count": 10, "value": 100},
|
||||
{"target_count": 20, "value": 150},
|
||||
{"target_count": 30, "value": 200}
|
||||
],
|
||||
"reward_stackable": true,
|
||||
"is_one_time": false,
|
||||
"status": "active"
|
||||
},
|
||||
{
|
||||
"task_id": "daily_ad_ladder",
|
||||
"task_name": "阶梯观看激励视频",
|
||||
"task_desc": "累计观看指定数量激励视频,分3档领取奖励(每日上限10次)",
|
||||
"target_action": "用户累计观看激励视频",
|
||||
"reward_type": "金币",
|
||||
"reward_details": [
|
||||
{"target_count": 1, "value": 100},
|
||||
{"target_count": 5, "value": 150},
|
||||
{"target_count": 10, "value": 200}
|
||||
],
|
||||
"daily_limit": 10,
|
||||
"reward_stackable": true,
|
||||
"is_one_time": false,
|
||||
"status": "active"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
@ -1,6 +1,11 @@
|
|||
package com.gamedog.vididin
|
||||
|
||||
object VidiConst {
|
||||
|
||||
|
||||
const val URL_DISCORD: String = "https://www.baidu.com"
|
||||
const val URL_GAME: String = "https://www.baidu.com"
|
||||
|
||||
/**
|
||||
* 描述:网络常量
|
||||
*
|
||||
|
|
@ -16,6 +21,11 @@ object VidiConst {
|
|||
*/
|
||||
const val YOUTUBE_API_KEY = "AIzaSyBm9k2lS_j7Fdd43NEPkcfikJRotup5DMY"
|
||||
|
||||
const val GOLD_IN_CONFIG: String = "金币"
|
||||
|
||||
const val PER_CASH_COST_GOLD_NUM = 1000
|
||||
const val WATCH_AD_REWARD_GOLD = 200
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -6,4 +6,36 @@ object VididinEvents {
|
|||
const val Event_Account_Cash_Changed = 602
|
||||
const val Event_Account_Bank_Info_Changed = 603
|
||||
|
||||
|
||||
const val Event_HOME_WATCH_Time_TICK = 700
|
||||
const val Event_Finish_One_Video = 701
|
||||
const val Event_Finish_One_Ad = 702
|
||||
const val Event_Finish_One_Sign = 703
|
||||
const val Event_Finish_One_Zerobuy = 704
|
||||
|
||||
const val EVENT_DAILY_WATCHED_VIDEO_NUM_CHANGED = 705
|
||||
const val EVENT_DAILY_WATCHED_AD_NUM_CHANGED = 706
|
||||
|
||||
const val EVENT_BOX_TASK_STATE_CHANGED = 707
|
||||
const val EVENT_NEWBIE_NOTIFY_TASK_CHANGED = 708
|
||||
const val EVENT_NEWBIE_FIRST_WITHDRAW_TASK_CHANGED = 709
|
||||
const val EVENT_NEWBIE_DISCORD_TASK_CHANGED = 710
|
||||
|
||||
|
||||
|
||||
const val Event_AD_TASK_TYPE_Convert_Gold_2_Cash = 800
|
||||
const val Event_AD_TASK_TYPE_Watch_Ad_Earn_Gold = 801
|
||||
const val Event_AD_TASK_TYPE_Watch_Ad_Daily = 802
|
||||
const val Event_AD_TASK_TYPE_Withdraw = 803
|
||||
const val Event_AD_TASK_TYPE_Complement = 804
|
||||
const val Event_AD_TASK_TYPE_BOX_TASK = 805
|
||||
|
||||
|
||||
|
||||
|
||||
// UI jump related
|
||||
const val EVENT_JUMP_2_FIRST_WITHDRAW = 900
|
||||
const val EVENT_JUMP_2_VIDEO = 901
|
||||
const val EVENT_JUMP_2_SIGN= 902
|
||||
|
||||
}
|
||||
|
|
@ -103,10 +103,10 @@ class MainTabsAdapter(
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
private fun ViewBinding.onTabClickAgainHandle(index: Int) {
|
||||
val currentFragment = mainFragmentStateAdapter.getFragmentByIndex(index)
|
||||
if (currentFragment is OnTabClickRefreshListener) {
|
||||
// 刷新 - 展示Loading
|
||||
currentFragment.onTabClickRefresh(object : OnTabClickRefreshFinishListener {
|
||||
override fun onTabClickRefreshFinish() {
|
||||
setTabStyle(1)
|
||||
|
|
|
|||
|
|
@ -6,7 +6,9 @@ data class Account(
|
|||
val deviceUUId: String,
|
||||
val token: String="",
|
||||
val createdAt: Long,
|
||||
@Volatile
|
||||
var goldCount: Long = 0L,
|
||||
@Volatile
|
||||
var cashCount: Float = 0F,
|
||||
var bankInfo: BankInfo? = null,
|
||||
)
|
||||
|
|
|
|||
|
|
@ -12,12 +12,14 @@ import com.gamedog.vididin.router.DefaultFeedbackRouter
|
|||
import com.gamedog.vididin.router.DefaultPrivacyRouter
|
||||
import com.gamedog.vididin.router.DefaultSplashRouter
|
||||
import com.gamedog.vididin.router.DefaultVersionRouter
|
||||
import com.gamedog.vididin.router.DefaultWatchAdRouter
|
||||
import com.gamedog.vididin.router.DefaultWithdrawRecordRouter
|
||||
import com.gamedog.vididin.router.IRouterFeedback
|
||||
import com.gamedog.vididin.router.IRouterPrivacy
|
||||
import com.gamedog.vididin.router.IRouterSplash
|
||||
import com.gamedog.vididin.router.IRouterVersion
|
||||
import com.gamedog.vididin.router.IRouterWithdrawRecord
|
||||
import com.gamedog.vididin.router.IRouterWatchAd
|
||||
import dagger.Module
|
||||
import dagger.Provides
|
||||
import dagger.hilt.InstallIn
|
||||
|
|
@ -99,3 +101,11 @@ object VersionModule {
|
|||
@Singleton
|
||||
fun provideRouter(): IRouterVersion = DefaultVersionRouter()
|
||||
}
|
||||
|
||||
@Module
|
||||
@InstallIn(SingletonComponent::class)
|
||||
object WatchAd {
|
||||
@Provides
|
||||
@Singleton
|
||||
fun provideRouter(): IRouterWatchAd = DefaultWatchAdRouter()
|
||||
}
|
||||
|
|
@ -13,6 +13,7 @@ import com.gamedog.vididin.router.IRouterPrivacy
|
|||
import com.gamedog.vididin.router.IRouterSplash
|
||||
import com.gamedog.vididin.router.IRouterVersion
|
||||
import com.gamedog.vididin.router.IRouterWithdrawRecord
|
||||
import com.gamedog.vididin.router.IRouterWatchAd
|
||||
import dagger.hilt.EntryPoint
|
||||
import dagger.hilt.InstallIn
|
||||
import dagger.hilt.components.SingletonComponent
|
||||
|
|
@ -38,6 +39,7 @@ interface RouterEntryPoint {
|
|||
fun feedbackRouter(): IRouterFeedback
|
||||
fun splashRouter(): IRouterSplash
|
||||
fun withdrawRecordRouter(): IRouterWithdrawRecord
|
||||
fun watchAdRouter(): IRouterWatchAd
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,11 +3,33 @@ package com.gamedog.vididin.features.benefit
|
|||
import android.app.Activity
|
||||
import android.content.Intent
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.LinearLayout
|
||||
import androidx.activity.viewModels
|
||||
import com.ama.core.architecture.appBase.AppViewsActivity
|
||||
import com.ama.core.architecture.ext.toast
|
||||
import com.ama.core.architecture.util.AndroidUtil
|
||||
import com.ama.core.architecture.util.ResUtil
|
||||
import com.ama.core.architecture.util.eventbus.NotifyMan
|
||||
import com.ama.core.architecture.util.setOnClickBatch
|
||||
import com.gamedog.vididin.R
|
||||
import com.gamedog.vididin.VididinEvents
|
||||
import com.gamedog.vididin.core.login.login.AccountManager
|
||||
import com.gamedog.vididin.features.benefit.widget.BenefitTaskItemView
|
||||
import com.gamedog.vididin.main.fragments.task.DailySignDialog
|
||||
import com.gamedog.vididin.main.interfaces.OnTabStyleListener
|
||||
import com.gamedog.vididin.manager.TaskManager
|
||||
import com.gamedog.vididin.manager.TaskManager.Companion.BOX_SUB_TASK_TYPE_AD
|
||||
import com.gamedog.vididin.manager.TaskManager.Companion.BOX_SUB_TASK_TYPE_VIDEO
|
||||
import com.gamedog.vididin.manager.TaskManager.Companion.BOX_SUB_TASK_TYPE_SIGN
|
||||
import com.gamedog.vididin.manager.TaskManager.Companion.BOX_SUB_TASK_TYPE_ZERO_BUY
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
import kotlin.getValue
|
||||
import com.gamedog.vididin.manager.taskbeans.BaseTaskState.Companion.STATE_FINISH
|
||||
import com.gamedog.vididin.manager.taskbeans.BaseTaskState.Companion.STATE_CLAIMED
|
||||
import com.gamedog.vididin.manager.taskbeans.BaseTaskState.Companion.STATE_EXPIRED
|
||||
import com.gamedog.vididin.router.Router
|
||||
import com.gamedog.vididin.databinding.ActivityBenefitBinding as ViewBinding
|
||||
import com.gamedog.vididin.main.MainUiState as UiState
|
||||
import com.gamedog.vididin.main.MainViewModel as ViewModel
|
||||
|
|
@ -16,6 +38,8 @@ import com.gamedog.vididin.main.MainViewModel as ViewModel
|
|||
@AndroidEntryPoint
|
||||
class BenefitActivity : AppViewsActivity<ViewBinding, UiState, ViewModel>(), OnTabStyleListener {
|
||||
|
||||
private val mSubTaskViewList = mutableListOf<BenefitTaskItemView>()
|
||||
|
||||
|
||||
override val mViewModel: ViewModel by viewModels()
|
||||
override fun inflateViewBinding(inflater: LayoutInflater) = ViewBinding.inflate(inflater)
|
||||
|
|
@ -26,21 +50,20 @@ class BenefitActivity : AppViewsActivity<ViewBinding, UiState, ViewModel>(), OnT
|
|||
|
||||
|
||||
override fun ViewBinding.initViews() {
|
||||
|
||||
taskItem1.setActionFun {
|
||||
gotoWatchVideo()
|
||||
}
|
||||
taskItem2.setActionFun {
|
||||
gotoWatchVideo()
|
||||
}
|
||||
taskItem3.setActionFun {
|
||||
gotoWatchVideo()
|
||||
titlebar.setTitleText(R.string.benefit)
|
||||
initViewsByTaskState()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
override fun ViewBinding.initListeners() {
|
||||
|
||||
registerEvents({ data->
|
||||
when (data?.mEventType) {
|
||||
VididinEvents.EVENT_BOX_TASK_STATE_CHANGED -> {
|
||||
updateUI()
|
||||
}
|
||||
}
|
||||
}, VididinEvents.EVENT_BOX_TASK_STATE_CHANGED)
|
||||
}
|
||||
|
||||
override fun ViewBinding.initObservers() {
|
||||
|
|
@ -56,10 +79,182 @@ class BenefitActivity : AppViewsActivity<ViewBinding, UiState, ViewModel>(), OnT
|
|||
}
|
||||
|
||||
|
||||
private fun gotoWatchVideo() {
|
||||
//TODO("Not yet implemented")
|
||||
private fun initViewsByTaskState() {
|
||||
initAddSubTaskViews()
|
||||
updateSubTasksUI()
|
||||
updateTopBoxesUI()
|
||||
}
|
||||
|
||||
private fun updateUI() {
|
||||
updateSubTasksUI()
|
||||
updateTopBoxesUI()
|
||||
}
|
||||
|
||||
private fun initAddSubTaskViews() {
|
||||
val taskStateHelper = TaskManager.instance().boxTaskStatus()
|
||||
val currentBoxState = taskStateHelper.getStatusBean().tasks[taskStateHelper.getCurrentBoxIndex()]
|
||||
|
||||
currentBoxState.tasks.forEachIndexed { index, subTask ->
|
||||
val separateLine = View(this@BenefitActivity)
|
||||
separateLine.setBackgroundResource(R.color.gray_f2)
|
||||
binding.llSubTaskContainer.addView(separateLine, ViewGroup.LayoutParams.MATCH_PARENT, ResUtil.getPixelSize(R.dimen.dp1))
|
||||
|
||||
val subTaskView = BenefitTaskItemView(this@BenefitActivity)
|
||||
subTaskView.setActionFun { handleActionButClicked(subTask.task_type) }
|
||||
val subViewParam = LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)
|
||||
subViewParam.topMargin = ResUtil.getPixelSize(R.dimen.dp10)
|
||||
subViewParam.bottomMargin = ResUtil.getPixelSize(R.dimen.dp10)
|
||||
binding.llSubTaskContainer.addView(subTaskView, subViewParam)
|
||||
|
||||
mSubTaskViewList.add(subTaskView)
|
||||
}
|
||||
}
|
||||
|
||||
private fun handleActionButClicked(taskType: Int) {
|
||||
when (taskType) {
|
||||
BOX_SUB_TASK_TYPE_AD -> {
|
||||
Router.WatchAd.startActivity(this@BenefitActivity, VididinEvents.Event_AD_TASK_TYPE_BOX_TASK, null)
|
||||
}
|
||||
|
||||
BOX_SUB_TASK_TYPE_SIGN -> {
|
||||
DailySignDialog(this@BenefitActivity).show()
|
||||
}
|
||||
|
||||
BOX_SUB_TASK_TYPE_VIDEO -> {
|
||||
finish()
|
||||
NotifyMan.instance().sendEvent(VididinEvents.EVENT_JUMP_2_VIDEO, null)
|
||||
}
|
||||
|
||||
BOX_SUB_TASK_TYPE_ZERO_BUY -> {
|
||||
Router.ZeroBuy.startActivity(this@BenefitActivity)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private fun updateSubTasksUI() {
|
||||
val taskStateHelper = TaskManager.instance().boxTaskStatus()
|
||||
val currentBoxIndex = taskStateHelper.getCurrentBoxIndex()
|
||||
val subTaskStateList = taskStateHelper.getStatusBean().tasks[currentBoxIndex].tasks
|
||||
|
||||
if (subTaskStateList.size == mSubTaskViewList.size) {
|
||||
mSubTaskViewList.forEachIndexed { index, view ->
|
||||
view.updateUIByState(subTaskStateList[index], currentBoxIndex,index)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun updateTopBoxesUI() {
|
||||
val taskStateHelper = TaskManager.instance().boxTaskStatus()
|
||||
val boxStateList = taskStateHelper.getStatusBean().tasks
|
||||
|
||||
with (binding) {
|
||||
boxStateList.forEachIndexed { index, curBoxState ->
|
||||
val stateEnum = taskStateHelper.getBoxStateEnum(index)
|
||||
if (index == 0) {
|
||||
ivSubtask1.setImageResource(getIconResByState(stateEnum))
|
||||
tvSubtask1State.setText(getStrResByState(stateEnum))
|
||||
tvSubtask1State.setTextColor(getStrColorByState(stateEnum))
|
||||
|
||||
with (tvSubtask1Reward) {
|
||||
compoundDrawablePadding = if (stateEnum == STATE_FINISH || stateEnum == STATE_CLAIMED) 0 else ResUtil.getPixelSize(R.dimen.dp3)
|
||||
val tvRewardIcon = getRewardTvDrawableRes(stateEnum)
|
||||
setCompoundDrawables(ResUtil.getDrawable(tvRewardIcon), null, null, null)
|
||||
val needShowNum = R.mipmap.icon_check_mark != tvRewardIcon
|
||||
setText(if (needShowNum) { ResUtil.getString(R.string.cash) + " " + curBoxState.reward_value} else "")
|
||||
}
|
||||
}
|
||||
|
||||
if (index == 1) {
|
||||
ivSubtask2.setImageResource(getIconResByState(stateEnum))
|
||||
tvSubtask2State.setText(getStrResByState(stateEnum))
|
||||
tvSubtask2State.setTextColor(getStrColorByState(stateEnum))
|
||||
|
||||
with (tvSubtask2Reward) {
|
||||
compoundDrawablePadding = if (stateEnum == STATE_FINISH || stateEnum == STATE_CLAIMED) 0 else ResUtil.getPixelSize(R.dimen.dp3)
|
||||
val tvRewardIcon = getRewardTvDrawableRes(stateEnum)
|
||||
setCompoundDrawables(ResUtil.getDrawable(tvRewardIcon), null, null, null)
|
||||
val needShowNum = R.mipmap.icon_check_mark != tvRewardIcon
|
||||
setText(if (needShowNum) { ResUtil.getString(R.string.cash) + " " + curBoxState.reward_value} else "")
|
||||
}
|
||||
}
|
||||
|
||||
if (index == 2) {
|
||||
ivSubtask3.setImageResource(getIconResByState(stateEnum))
|
||||
tvSubtask3State.setText(getStrResByState(stateEnum))
|
||||
tvSubtask3State.setTextColor(getStrColorByState(stateEnum))
|
||||
|
||||
with (tvSubtask3Reward) {
|
||||
compoundDrawablePadding = if (stateEnum == STATE_FINISH || stateEnum == STATE_CLAIMED) 0 else ResUtil.getPixelSize(R.dimen.dp3)
|
||||
val tvRewardIcon = getRewardTvDrawableRes(stateEnum)
|
||||
setCompoundDrawables(ResUtil.getDrawable(tvRewardIcon), null, null, null)
|
||||
val needShowNum = R.mipmap.icon_check_mark != tvRewardIcon
|
||||
setText(if (needShowNum) { ResUtil.getString(R.string.cash) + " " + curBoxState.reward_value} else "")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
val couldClaimCashNum = taskStateHelper.getCouldClaimCashNum()
|
||||
with (tvResgatar) {
|
||||
if (couldClaimCashNum > 0) {
|
||||
setBackgroundResource(R.mipmap.icon_but_bg_green)
|
||||
isClickable = true
|
||||
} else {
|
||||
setBackgroundResource(R.mipmap.but_bg_grady)
|
||||
isClickable = false
|
||||
}
|
||||
|
||||
setOnClickListener {
|
||||
if (taskStateHelper.executeClaimCash()) {
|
||||
AndroidUtil.showToast(String.format(ResUtil.getString(R.string.has_claim_box_cash_hint), couldClaimCashNum))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 总进度条, 奖励金额
|
||||
val totalProgress = taskStateHelper.getCurrentBoxTotalProgress()
|
||||
progressTasks.setProgress(totalProgress)
|
||||
tvProgressNum.text = "($totalProgress%)"
|
||||
tvHintRewardNum.text = buildString {
|
||||
append(ResUtil.getString(R.string.cash))
|
||||
append(" ")
|
||||
append(taskStateHelper.getStatusBean().tasks[taskStateHelper.getCurrentBoxIndex()].reward_value)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun getIconResByState(state: Int): Int {
|
||||
when (state) {
|
||||
STATE_EXPIRED -> return R.mipmap.benefit_item_expired
|
||||
STATE_FINISH, STATE_CLAIMED -> return R.mipmap.benefit_item_finished
|
||||
else -> return R.mipmap.benefit_item_ongoing
|
||||
}
|
||||
}
|
||||
|
||||
private fun getStrResByState(state: Int): Int {
|
||||
when (state) {
|
||||
STATE_EXPIRED -> return R.string.expired
|
||||
STATE_FINISH, STATE_CLAIMED -> return R.string.finished
|
||||
else -> return R.string.ongoing
|
||||
}
|
||||
}
|
||||
|
||||
private fun getStrColorByState(state: Int): Int {
|
||||
when (state) {
|
||||
STATE_EXPIRED -> return R.color.gray_60
|
||||
STATE_FINISH, STATE_CLAIMED -> return R.color.green_39
|
||||
else -> return R.color.red_5c
|
||||
}
|
||||
}
|
||||
|
||||
private fun getRewardTvDrawableRes(state: Int): Int {
|
||||
when (state) {
|
||||
STATE_EXPIRED -> return R.mipmap.icon_cash_s_disable
|
||||
STATE_FINISH, STATE_CLAIMED -> return R.mipmap.icon_check_mark
|
||||
else -> return R.mipmap.icon_cash_s
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
companion object {
|
||||
|
|
|
|||
|
|
@ -5,7 +5,10 @@ import android.util.AttributeSet
|
|||
import android.view.LayoutInflater
|
||||
import android.widget.LinearLayout
|
||||
import com.ama.core.architecture.util.setOnClickBatch
|
||||
import com.gamedog.vididin.R
|
||||
import com.gamedog.vididin.databinding.BenefitTaskItemViewBinding
|
||||
import com.gamedog.vididin.manager.TaskManager
|
||||
import com.gamedog.vididin.manager.taskbeans.TaskStateBoxSub
|
||||
|
||||
|
||||
class BenefitTaskItemView @JvmOverloads constructor(
|
||||
|
|
@ -40,11 +43,29 @@ class BenefitTaskItemView @JvmOverloads constructor(
|
|||
}
|
||||
|
||||
|
||||
fun setProgressInfo(progress: String) {
|
||||
mBinding.tvProgressInfo.text = progress
|
||||
fun updateUIByState(subTaskState: TaskStateBoxSub, boxIndex: Int, subTaskIndex: Int) {
|
||||
with (mBinding) {
|
||||
val finishNum = if (subTaskState.finishedNum > subTaskState.required_count) subTaskState.required_count else subTaskState.finishedNum
|
||||
val progressNum: Int = finishNum * 100 / subTaskState.required_count
|
||||
|
||||
//ivItemIcon.setImageResource(R.mipmap.icon_cash_s)
|
||||
tvItemTitle.setText(TaskManager.instance().boxTaskStatus().getSubTaskHintStrRes(boxIndex, subTaskIndex))
|
||||
progressBar.setProgress(progressNum)
|
||||
tvProgressInfo.text = "($finishNum/${subTaskState.required_count})"
|
||||
|
||||
with (tvAction) {
|
||||
if (progressNum < 100) {
|
||||
isClickable = true
|
||||
setBackgroundResource( R.drawable.bg_benefit_item_action_bg)
|
||||
setText(R.string.go_and_do)
|
||||
} else {
|
||||
isClickable = false
|
||||
setBackgroundResource( R.drawable.bg_sub_task_disable)
|
||||
setText(R.string.finished)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -28,17 +28,14 @@ class PrivacyActivity : AppViewsActivity<ViewBinding, UiState, ViewModel>(), OnT
|
|||
with(binding) {
|
||||
titlebar.setBackIconColor(R.color.black)
|
||||
titlebar.setTitleText(R.string.privacy, R.color.black)
|
||||
|
||||
webView.loadUrl("https://www.baidu.com")
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
override fun ViewBinding.initWindowInsets() {
|
||||
ViewCompat.setOnApplyWindowInsetsListener(contentRoot) { v, insets ->
|
||||
val systemBars =
|
||||
insets.getInsets(WindowInsetsCompat.Type.systemBars() or WindowInsetsCompat.Type.displayCutout())
|
||||
v.updatePadding(top = systemBars.top)
|
||||
insets
|
||||
}
|
||||
setImmerseRootView(contentRoot)
|
||||
}
|
||||
|
||||
override fun ViewBinding.initListeners() {
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ import androidx.core.view.ViewCompat
|
|||
import androidx.core.view.WindowInsetsCompat
|
||||
import androidx.core.view.updatePadding
|
||||
import com.ama.core.architecture.appBase.AppViewsActivity
|
||||
import com.gamedog.vididin.R
|
||||
import com.gamedog.vididin.main.interfaces.OnTabStyleListener
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
import kotlin.getValue
|
||||
|
|
|
|||
|
|
@ -4,10 +4,8 @@ import android.app.Activity
|
|||
import android.content.Intent
|
||||
import android.view.LayoutInflater
|
||||
import androidx.activity.viewModels
|
||||
import androidx.core.view.ViewCompat
|
||||
import androidx.core.view.WindowInsetsCompat
|
||||
import androidx.core.view.updatePadding
|
||||
import com.ama.core.architecture.appBase.AppViewsActivity
|
||||
import com.ama.core.architecture.util.AndroidUtil
|
||||
import com.gamedog.vididin.R
|
||||
import com.gamedog.vididin.main.interfaces.OnTabStyleListener
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
|
|
@ -28,17 +26,15 @@ class VersionActivity : AppViewsActivity<ViewBinding, UiState, ViewModel>(), OnT
|
|||
with(binding) {
|
||||
titlebar.setBackIconColor(R.color.black)
|
||||
titlebar.setTitleText(R.string.version, R.color.black)
|
||||
|
||||
|
||||
tvVersion.text = AndroidUtil.getAppVersionInfo()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
override fun ViewBinding.initWindowInsets() {
|
||||
ViewCompat.setOnApplyWindowInsetsListener(contentRoot) { v, insets ->
|
||||
val systemBars =
|
||||
insets.getInsets(WindowInsetsCompat.Type.systemBars() or WindowInsetsCompat.Type.displayCutout())
|
||||
v.updatePadding(top = systemBars.top)
|
||||
insets
|
||||
}
|
||||
setImmerseRootView(contentRoot)
|
||||
}
|
||||
|
||||
override fun ViewBinding.initListeners() {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,121 @@
|
|||
package com.gamedog.vididin.features.watchad
|
||||
|
||||
import android.app.Activity
|
||||
import android.content.Intent
|
||||
import android.os.CountDownTimer
|
||||
import android.view.LayoutInflater
|
||||
import androidx.activity.addCallback
|
||||
import androidx.activity.viewModels
|
||||
import androidx.core.view.ViewCompat
|
||||
import androidx.core.view.WindowInsetsCompat
|
||||
import androidx.core.view.updatePadding
|
||||
import com.ama.core.architecture.appBase.AppViewsActivity
|
||||
import com.ama.core.architecture.util.AndroidUtil
|
||||
import com.ama.core.architecture.util.eventbus.NotifyMan
|
||||
import com.gamedog.vididin.VidiConst
|
||||
import com.gamedog.vididin.VididinEvents
|
||||
import com.gamedog.vididin.main.fragments.task.DailySignSuccessDialog
|
||||
import com.gamedog.vididin.main.interfaces.OnTabStyleListener
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
import kotlin.getValue
|
||||
import com.gamedog.vididin.databinding.ActivityWatchAdBinding as ViewBinding
|
||||
import com.gamedog.vididin.main.MainUiState as UiState
|
||||
import com.gamedog.vididin.main.MainViewModel as ViewModel
|
||||
|
||||
|
||||
@AndroidEntryPoint
|
||||
class WatchAdActivity : AppViewsActivity<ViewBinding, UiState, ViewModel>(), OnTabStyleListener {
|
||||
|
||||
override val mViewModel: ViewModel by viewModels()
|
||||
override fun inflateViewBinding(inflater: LayoutInflater) = ViewBinding.inflate(inflater)
|
||||
|
||||
|
||||
private lateinit var mCountDownTimer: CountDownTimer
|
||||
private var mTaskType: Int = 0
|
||||
private var mTaskData: String? = null
|
||||
|
||||
override fun ViewBinding.initViews() {
|
||||
with(binding) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
override fun ViewBinding.initWindowInsets() {
|
||||
ViewCompat.setOnApplyWindowInsetsListener(contentRoot) { v, insets ->
|
||||
val systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars() or WindowInsetsCompat.Type.displayCutout())
|
||||
v.updatePadding(top = systemBars.top)
|
||||
insets
|
||||
}
|
||||
}
|
||||
|
||||
override fun ViewBinding.initListeners() {
|
||||
onBackPressedDispatcher.addCallback(this@WatchAdActivity) {
|
||||
AndroidUtil.showToast("Can't exit while watching video")
|
||||
}
|
||||
|
||||
stateCounter()
|
||||
}
|
||||
|
||||
|
||||
private fun notifyAdWatchFinish() {
|
||||
NotifyMan.instance().sendEvent(mTaskType, null)
|
||||
|
||||
if (mTaskType != VididinEvents.Event_AD_TASK_TYPE_Watch_Ad_Earn_Gold) {
|
||||
NotifyMan.instance().sendEvent(VididinEvents.Event_Finish_One_Ad, NotifyMan.NotifyData(1))
|
||||
}
|
||||
}
|
||||
|
||||
private fun stateCounter() {
|
||||
mCountDownTimer = object : CountDownTimer(3000, 1000) {
|
||||
override fun onTick(millisUntilFinished: Long) {
|
||||
val secondsRemaining = millisUntilFinished / 1000
|
||||
binding.tvAdCounter.text = "${secondsRemaining}"
|
||||
}
|
||||
|
||||
override fun onFinish() {
|
||||
notifyAdWatchFinish()
|
||||
finish()
|
||||
}
|
||||
}
|
||||
mCountDownTimer.start()
|
||||
}
|
||||
|
||||
override fun readIntent(intent: Intent) {
|
||||
super.readIntent(intent)
|
||||
mTaskType = intent.getIntExtra(KEY_TASK_TYPE, 0)
|
||||
mTaskData = intent.getStringExtra(KEY_TASK_DATA)
|
||||
}
|
||||
|
||||
|
||||
override fun onDestroy() {
|
||||
super.onDestroy()
|
||||
mCountDownTimer.cancel()
|
||||
}
|
||||
|
||||
override fun ViewBinding.initObservers() {
|
||||
//TODO("Not yet implemented")
|
||||
}
|
||||
|
||||
override fun ViewBinding.onUiStateCollect(uiState: UiState) {
|
||||
//TODO("Not yet implemented")
|
||||
}
|
||||
|
||||
override fun onTabIsDarkFont(isDarkFont: Boolean) {
|
||||
//TODO("Not yet implemented")
|
||||
}
|
||||
|
||||
|
||||
companion object {
|
||||
private val KEY_TASK_TYPE = "KEY_TASK_TYPE"
|
||||
private val KEY_TASK_DATA = "KEY_TASK_DATA"
|
||||
|
||||
internal fun startActivity(activity: Activity, taskType: Int, taskDataJson: String?) {
|
||||
val intent = Intent(activity.applicationContext, WatchAdActivity::class.java)
|
||||
intent.putExtra(KEY_TASK_TYPE, taskType)
|
||||
intent.putExtra(KEY_TASK_DATA, taskDataJson)
|
||||
activity.startActivity(intent)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -48,4 +48,12 @@ object BankUtil {
|
|||
val remainder = sum % 11
|
||||
return if (remainder < 2) 0 else 11 - remainder
|
||||
}
|
||||
|
||||
|
||||
private fun executeWithDraw() {
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -8,7 +8,6 @@ import com.ama.core.architecture.appBase.AppViewsActivity
|
|||
import com.ama.core.architecture.util.setOnClickBatch
|
||||
import com.gamedog.vididin.R
|
||||
import com.gamedog.vididin.VididinEvents
|
||||
import com.gamedog.vididin.beans.Account
|
||||
import com.gamedog.vididin.core.login.login.AccountManager
|
||||
import com.gamedog.vididin.features.withdraw.widget.WithDrawItemView
|
||||
import com.gamedog.vididin.main.interfaces.OnTabStyleListener
|
||||
|
|
@ -36,6 +35,8 @@ class WithDrawActivity : AppViewsActivity<ViewBinding, UiState, ViewModel>(), On
|
|||
}
|
||||
|
||||
override fun ViewBinding.initViews() {
|
||||
titlebar.setTitleText(R.string.sacar)
|
||||
|
||||
mItemViewList.add(withdraw01)
|
||||
mItemViewList.add(withdraw10)
|
||||
mItemViewList.add(withdraw20)
|
||||
|
|
@ -73,7 +74,7 @@ class WithDrawActivity : AppViewsActivity<ViewBinding, UiState, ViewModel>(), On
|
|||
updateUIItemSelectStates(itemIndex)
|
||||
})
|
||||
|
||||
withdrawPix2.setIconAndText(R.mipmap.pix2, R.string.pix2, {
|
||||
withdrawPix2.setIconAndText(R.mipmap.pix2_big, R.string.pix2, {
|
||||
|
||||
})
|
||||
|
||||
|
|
@ -85,8 +86,11 @@ class WithDrawActivity : AppViewsActivity<ViewBinding, UiState, ViewModel>(), On
|
|||
when(this) {
|
||||
tvSacar -> {
|
||||
val hasBindBank = AccountManager.hasValidBankInfo()
|
||||
val cashNum = mItemViewList.get(mCurSelectedIndex).getCashNum()
|
||||
if (!hasBindBank) {
|
||||
WithdrawBindBankDialog(this@WithDrawActivity).show()
|
||||
WithdrawBindBankDialog(this@WithDrawActivity).setWithDrawCashNum(cashNum).show()
|
||||
} else {
|
||||
WithdrawInfoConfirmDialog(this@WithDrawActivity).setWithDrawCashNum(cashNum).show()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.gamedog.vididin.features.withdraw
|
|||
|
||||
|
||||
|
||||
import android.app.Activity
|
||||
import android.content.Context
|
||||
import android.text.Editable
|
||||
import android.text.TextWatcher
|
||||
|
|
@ -11,10 +12,11 @@ import com.ama.core.architecture.widget.BindingDialog
|
|||
import com.gamedog.vididin.R
|
||||
import com.gamedog.vididin.core.login.login.AccountManager
|
||||
import com.gamedog.vididin.databinding.DialogWithdrawBindingBankBinding as ViewBinding
|
||||
import com.gamedog.vididin.router.Router
|
||||
|
||||
|
||||
class WithdrawBindBankDialog(context: Context) : BindingDialog<ViewBinding>(context, ViewBinding::inflate) {
|
||||
class WithdrawBindBankDialog(activity: Activity) : BindingDialog<ViewBinding>(activity, ViewBinding::inflate) {
|
||||
|
||||
private var mWithdrawCashNum: Float = 0F
|
||||
|
||||
init {
|
||||
build()
|
||||
|
|
@ -36,6 +38,8 @@ class WithdrawBindBankDialog(context: Context) : BindingDialog<ViewBinding>(cont
|
|||
|
||||
tvConfirm -> {
|
||||
saveBankAccount(mBinding.tvCpfEdit.text.toString().trim())
|
||||
WithdrawInfoConfirmDialog(mActivity).setWithDrawCashNum(mWithdrawCashNum).show()
|
||||
dismiss()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -90,14 +94,17 @@ class WithdrawBindBankDialog(context: Context) : BindingDialog<ViewBinding>(cont
|
|||
}
|
||||
}
|
||||
|
||||
private fun gotoWatchVideo() {
|
||||
ownerActivity?.let { Router.Withdraw.startActivity(it) }
|
||||
}
|
||||
|
||||
|
||||
override fun onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow()
|
||||
}
|
||||
|
||||
|
||||
fun setWithDrawCashNum(withdrawNum: Float): WithdrawBindBankDialog {
|
||||
mWithdrawCashNum = withdrawNum
|
||||
return this
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,42 +0,0 @@
|
|||
package com.gamedog.vididin.features.withdraw
|
||||
|
||||
|
||||
import android.content.Context
|
||||
import com.ama.core.architecture.util.setOnClickBatch
|
||||
import com.ama.core.architecture.widget.BindingDialog
|
||||
import com.gamedog.vididin.databinding.DialogWithdrawBindingBankFinishBinding as ViewBinding
|
||||
import com.gamedog.vididin.router.Router
|
||||
|
||||
|
||||
class WithdrawBindBankFinishDialog(context: Context) : BindingDialog<ViewBinding>(context, ViewBinding::inflate) {
|
||||
|
||||
init {
|
||||
build()
|
||||
}
|
||||
|
||||
|
||||
private fun build() {
|
||||
with()
|
||||
setCenter()
|
||||
setMaskValue(0.8f)
|
||||
setCanCancel(false)
|
||||
|
||||
mBinding.run {
|
||||
setOnClickBatch(tvConfirm, ivClose) {
|
||||
when (this) {
|
||||
tvConfirm, ivClose -> {
|
||||
dismiss()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun gotoWatchVideo() {
|
||||
ownerActivity?.let { Router.Withdraw.startActivity(it) }
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -1,14 +1,14 @@
|
|||
package com.gamedog.vididin.features.withdraw
|
||||
|
||||
|
||||
import android.content.Context
|
||||
import android.app.Activity
|
||||
import com.ama.core.architecture.util.setOnClickBatch
|
||||
import com.ama.core.architecture.widget.BindingDialog
|
||||
import com.gamedog.vididin.databinding.DialogWithdrawFailBinding as ViewBinding
|
||||
import com.gamedog.vididin.router.Router
|
||||
|
||||
|
||||
class WithdrawFailDialog(context: Context) : BindingDialog<ViewBinding>(context, ViewBinding::inflate) {
|
||||
class WithdrawFailDialog(context: Activity) : BindingDialog<ViewBinding>(context, ViewBinding::inflate) {
|
||||
|
||||
init {
|
||||
build()
|
||||
|
|
@ -22,9 +22,17 @@ class WithdrawFailDialog(context: Context) : BindingDialog<ViewBinding>(context,
|
|||
setCanCancel(false)
|
||||
|
||||
mBinding.run {
|
||||
setOnClickBatch(tvConfirm, ivClose) {
|
||||
setOnClickBatch(tvActionFeedback, tvActionConfirm, ivClose) {
|
||||
when (this) {
|
||||
tvConfirm, ivClose -> {
|
||||
ivClose -> {
|
||||
dismiss()
|
||||
}
|
||||
|
||||
tvActionFeedback -> {
|
||||
gotoFeedback()
|
||||
}
|
||||
|
||||
tvActionConfirm -> {
|
||||
dismiss()
|
||||
}
|
||||
}
|
||||
|
|
@ -32,8 +40,9 @@ class WithdrawFailDialog(context: Context) : BindingDialog<ViewBinding>(context,
|
|||
}
|
||||
}
|
||||
|
||||
private fun gotoWatchVideo() {
|
||||
ownerActivity?.let { Router.Withdraw.startActivity(it) }
|
||||
|
||||
private fun gotoFeedback() {
|
||||
Router.Feedback.startActivity(mActivity)
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,70 @@
|
|||
package com.gamedog.vididin.features.withdraw
|
||||
|
||||
|
||||
import android.app.Activity
|
||||
import android.content.Context
|
||||
import com.ama.core.architecture.util.ResUtil
|
||||
import com.ama.core.architecture.util.setOnClickBatch
|
||||
import com.ama.core.architecture.widget.BindingDialog
|
||||
import com.gamedog.vididin.R
|
||||
import com.gamedog.vididin.core.login.login.AccountManager
|
||||
import com.gamedog.vididin.databinding.DialogWithdrawInfoConfirmBinding as ViewBinding
|
||||
import com.gamedog.vididin.router.Router
|
||||
|
||||
|
||||
class WithdrawInfoConfirmDialog(context: Activity) : BindingDialog<ViewBinding>(context, ViewBinding::inflate) {
|
||||
|
||||
private var mWithdrawCashNum: Float = 0F
|
||||
|
||||
init {
|
||||
build()
|
||||
}
|
||||
|
||||
|
||||
private fun build() {
|
||||
with()
|
||||
setCenter()
|
||||
setMaskValue(0.8f)
|
||||
setCanCancel(false)
|
||||
|
||||
mBinding.run {
|
||||
setOnClickBatch(tvActionAlter, tvActionApply, ivClose) {
|
||||
when (this) {
|
||||
ivClose -> {
|
||||
dismiss()
|
||||
}
|
||||
|
||||
tvActionAlter -> {
|
||||
dismiss()
|
||||
}
|
||||
|
||||
tvActionApply -> {
|
||||
WithdrawWatchAdDialog(mActivity).show()
|
||||
dismiss()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private fun gotoWatchVideo() {
|
||||
Router.Withdraw.startActivity(mActivity)
|
||||
}
|
||||
|
||||
|
||||
fun setWithDrawCashNum(withdrawNum: Float): WithdrawInfoConfirmDialog {
|
||||
mWithdrawCashNum = withdrawNum
|
||||
|
||||
mBinding.tvCashNum.text = buildString {
|
||||
append(ResUtil.getString(R.string.cash))
|
||||
append(" ")
|
||||
append(mWithdrawCashNum)
|
||||
}
|
||||
mBinding.tvCpfAccount.text = AccountManager.getBankInfo()?.bankAccount
|
||||
|
||||
return this
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -1,14 +1,14 @@
|
|||
package com.gamedog.vididin.features.withdraw
|
||||
|
||||
|
||||
import android.app.Activity
|
||||
import android.content.Context
|
||||
import com.ama.core.architecture.util.setOnClickBatch
|
||||
import com.ama.core.architecture.widget.BindingDialog
|
||||
import com.gamedog.vididin.databinding.DialogWithdrawSuccessBinding as ViewBinding
|
||||
import com.gamedog.vididin.router.Router
|
||||
|
||||
|
||||
class WithdrawSuccessDialog(context: Context) : BindingDialog<ViewBinding>(context, ViewBinding::inflate) {
|
||||
class WithdrawSuccessDialog(context: Activity) : BindingDialog<ViewBinding>(context, ViewBinding::inflate) {
|
||||
|
||||
init {
|
||||
build()
|
||||
|
|
@ -22,21 +22,17 @@ class WithdrawSuccessDialog(context: Context) : BindingDialog<ViewBinding>(conte
|
|||
setCanCancel(false)
|
||||
|
||||
mBinding.run {
|
||||
setOnClickBatch(tvConfirm, ivClose) {
|
||||
setOnClickBatch(flAction, ivClose) {
|
||||
when (this) {
|
||||
tvConfirm, ivClose -> {
|
||||
ivClose -> {
|
||||
dismiss()
|
||||
}
|
||||
flAction -> {
|
||||
dismiss()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun gotoWatchVideo() {
|
||||
ownerActivity?.let { Router.Withdraw.startActivity(it) }
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,57 @@
|
|||
package com.gamedog.vididin.features.withdraw
|
||||
|
||||
|
||||
import android.app.Activity
|
||||
import com.ama.core.architecture.util.setOnClickBatch
|
||||
import com.ama.core.architecture.widget.BindingDialog
|
||||
import com.gamedog.vididin.R
|
||||
import com.gamedog.vididin.databinding.DialogWithdrawWatchAdBinding as ViewBinding
|
||||
|
||||
|
||||
class WithdrawWatchAdDialog(context: Activity) : BindingDialog<ViewBinding>(context, ViewBinding::inflate) {
|
||||
|
||||
private var mWithdrawCashNum: Float = 0F
|
||||
|
||||
init {
|
||||
build()
|
||||
}
|
||||
|
||||
|
||||
private fun build() {
|
||||
with()
|
||||
setCenter()
|
||||
setMaskValue(0.8f)
|
||||
setCanCancel(false)
|
||||
|
||||
mBinding.run {
|
||||
progressBar.setBarColor(R.color.blue_ba, R.color.blue_ff)
|
||||
|
||||
setOnClickBatch(flAction, ivClose) {
|
||||
when (this) {
|
||||
ivClose -> {
|
||||
dismiss()
|
||||
}
|
||||
|
||||
flAction -> {
|
||||
gotoWatchVideo()
|
||||
dismiss()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private fun gotoWatchVideo() {
|
||||
// TODO -
|
||||
//Router.Withdraw.startActivity(mActivity)
|
||||
|
||||
WithdrawFailDialog(mActivity).show()
|
||||
WithdrawSuccessDialog(mActivity).show()
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -54,5 +54,9 @@ class WithDrawItemView @JvmOverloads constructor(
|
|||
mBinding.root.setBackgroundResource(if (mIsSelected) R.drawable.withdraw_item_bg_selected else R.drawable.withdraw_item_bg_unselected)
|
||||
}
|
||||
|
||||
fun getCashNum(): Float {
|
||||
return mCashNum
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -10,6 +10,7 @@ import androidx.core.view.updatePadding
|
|||
import com.ama.core.architecture.appBase.AppViewsActivity
|
||||
import com.ama.core.architecture.util.setOnClickBatch
|
||||
import com.gamedog.vididin.R
|
||||
import com.gamedog.vididin.core.login.login.AccountManager
|
||||
import com.gamedog.vididin.main.interfaces.OnTabStyleListener
|
||||
import com.gamedog.vididin.router.Router
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
|
|
@ -38,6 +39,7 @@ class ZeroBuyActivity : AppViewsActivity<ViewBinding, UiState, ViewModel>(), OnT
|
|||
}
|
||||
}
|
||||
|
||||
tvZeroGoldNum.text = AccountManager.getGold().toString()
|
||||
|
||||
titlebar.setTitleText(R.string.zero_buy)
|
||||
titlebar.addRightIcon(R.mipmap.icon_question_mark, {
|
||||
|
|
@ -50,12 +52,7 @@ class ZeroBuyActivity : AppViewsActivity<ViewBinding, UiState, ViewModel>(), OnT
|
|||
}
|
||||
|
||||
override fun ViewBinding.initWindowInsets() {
|
||||
ViewCompat.setOnApplyWindowInsetsListener(contentRoot) { v, insets ->
|
||||
val systemBars =
|
||||
insets.getInsets(WindowInsetsCompat.Type.systemBars() or WindowInsetsCompat.Type.displayCutout())
|
||||
v.updatePadding(top = systemBars.top)
|
||||
insets
|
||||
}
|
||||
setImmerseRootView(contentRoot)
|
||||
}
|
||||
|
||||
private fun showHintInfo() {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.gamedog.vididin.features.zero
|
||||
|
||||
|
||||
import android.app.Activity
|
||||
import android.content.Context
|
||||
import com.ama.core.architecture.util.setOnClickBatch
|
||||
import com.ama.core.architecture.widget.BindingDialog
|
||||
|
|
@ -8,7 +9,7 @@ import com.gamedog.vididin.databinding.DialogZeroBuyFailBinding as ViewBinding
|
|||
import com.gamedog.vididin.router.Router
|
||||
|
||||
|
||||
class ZeroBuyFailDialog(context: Context) : BindingDialog<ViewBinding>(context, ViewBinding::inflate) {
|
||||
class ZeroBuyFailDialog(context: Activity) : BindingDialog<ViewBinding>(context, ViewBinding::inflate) {
|
||||
|
||||
init {
|
||||
build()
|
||||
|
|
@ -33,7 +34,7 @@ class ZeroBuyFailDialog(context: Context) : BindingDialog<ViewBinding>(context,
|
|||
}
|
||||
|
||||
private fun gotoWatchVideo() {
|
||||
ownerActivity?.let { Router.Withdraw.startActivity(it) }
|
||||
Router.Withdraw.startActivity(mActivity)
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.gamedog.vididin.features.zero
|
||||
|
||||
|
||||
import android.app.Activity
|
||||
import android.content.Context
|
||||
import com.ama.core.architecture.util.setOnClickBatch
|
||||
import com.ama.core.architecture.widget.BindingDialog
|
||||
|
|
@ -8,7 +9,7 @@ import com.gamedog.vididin.databinding.DialogZeroBuyNotWinBinding as ViewBinding
|
|||
import com.gamedog.vididin.router.Router
|
||||
|
||||
|
||||
class ZeroBuyNotWinDialog(context: Context) : BindingDialog<ViewBinding>(context, ViewBinding::inflate) {
|
||||
class ZeroBuyNotWinDialog(context: Activity) : BindingDialog<ViewBinding>(context, ViewBinding::inflate) {
|
||||
|
||||
init {
|
||||
build()
|
||||
|
|
@ -33,7 +34,7 @@ class ZeroBuyNotWinDialog(context: Context) : BindingDialog<ViewBinding>(context
|
|||
}
|
||||
|
||||
private fun gotoWatchVideo() {
|
||||
ownerActivity?.let { Router.Withdraw.startActivity(it) }
|
||||
Router.Withdraw.startActivity(mActivity)
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.gamedog.vididin.features.zero
|
||||
|
||||
|
||||
import android.app.Activity
|
||||
import android.content.Context
|
||||
import com.ama.core.architecture.util.setOnClickBatch
|
||||
import com.ama.core.architecture.widget.BindingDialog
|
||||
|
|
@ -8,7 +9,7 @@ import com.gamedog.vididin.databinding.DialogZeroBuyRuleBinding as ViewBinding
|
|||
import com.gamedog.vididin.router.Router
|
||||
|
||||
|
||||
class ZeroBuyRulesDialog(context: Context) : BindingDialog<ViewBinding>(context, ViewBinding::inflate) {
|
||||
class ZeroBuyRulesDialog(context: Activity) : BindingDialog<ViewBinding>(context, ViewBinding::inflate) {
|
||||
|
||||
init {
|
||||
build()
|
||||
|
|
@ -33,7 +34,7 @@ class ZeroBuyRulesDialog(context: Context) : BindingDialog<ViewBinding>(context,
|
|||
}
|
||||
|
||||
private fun gotoWatchVideo() {
|
||||
ownerActivity?.let { Router.Withdraw.startActivity(it) }
|
||||
Router.Withdraw.startActivity(mActivity)
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.gamedog.vididin.features.zero
|
||||
|
||||
|
||||
import android.app.Activity
|
||||
import android.content.Context
|
||||
import com.ama.core.architecture.util.setOnClickBatch
|
||||
import com.ama.core.architecture.widget.BindingDialog
|
||||
|
|
@ -8,7 +9,7 @@ import com.gamedog.vididin.databinding.DialogZeroBuyWinBinding as ViewBinding
|
|||
import com.gamedog.vididin.router.Router
|
||||
|
||||
|
||||
class ZeroBuyWinDialog(context: Context) : BindingDialog<ViewBinding>(context, ViewBinding::inflate) {
|
||||
class ZeroBuyWinDialog(context: Activity) : BindingDialog<ViewBinding>(context, ViewBinding::inflate) {
|
||||
|
||||
init {
|
||||
build()
|
||||
|
|
@ -33,7 +34,7 @@ class ZeroBuyWinDialog(context: Context) : BindingDialog<ViewBinding>(context, V
|
|||
}
|
||||
|
||||
private fun gotoWatchVideo() {
|
||||
ownerActivity?.let { Router.Withdraw.startActivity(it) }
|
||||
Router.Withdraw.startActivity(mActivity)
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,16 +1,23 @@
|
|||
package com.gamedog.vididin.core.login.login
|
||||
|
||||
import com.ama.core.architecture.util.AndroidUtil
|
||||
import com.ama.core.architecture.util.DateUtil
|
||||
import com.ama.core.architecture.util.DeviceUtil
|
||||
import com.ama.core.architecture.util.SpUtil
|
||||
import com.ama.core.architecture.util.eventbus.NotifyMan
|
||||
import com.gamedog.vididin.VidiConst
|
||||
import com.gamedog.vididin.VididinEvents
|
||||
import com.gamedog.vididin.beans.Account
|
||||
import com.gamedog.vididin.beans.BankInfo
|
||||
import com.gamedog.vididin.main.fragments.task.TaskBean
|
||||
import kotlinx.coroutines.sync.Mutex
|
||||
import kotlinx.coroutines.sync.withLock
|
||||
|
||||
|
||||
object AccountManager {
|
||||
|
||||
private val mutex = Mutex()
|
||||
|
||||
private val mAccount: Account? by lazy {
|
||||
var account = SpUtil.instance().getObject<Account>(SpUtil.KEY_ACCOUNT)
|
||||
if (account == null) {
|
||||
|
|
@ -39,12 +46,14 @@ object AccountManager {
|
|||
return mAccount?.cashCount ?: 0F
|
||||
}
|
||||
|
||||
@Synchronized
|
||||
fun addGold(newGold: Int) {
|
||||
mAccount?.goldCount += newGold
|
||||
saveAccountInfo()
|
||||
NotifyMan.instance().sendEvent(VididinEvents.Event_Account_Gold_Changed, null)
|
||||
}
|
||||
|
||||
@Synchronized
|
||||
fun addCash(newCash: Float) {
|
||||
mAccount?.cashCount += newCash
|
||||
saveAccountInfo()
|
||||
|
|
@ -71,5 +80,30 @@ object AccountManager {
|
|||
VididinEvents.Event_Account_Bank_Info_Changed, NotifyMan.NotifyData(bankAccount))
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Synchronized
|
||||
fun convertGold2Cash(): Boolean {
|
||||
try {
|
||||
val couldCovertCashTotal = mAccount?.goldCount?.div(VidiConst.PER_CASH_COST_GOLD_NUM) ?: 0L
|
||||
if (couldCovertCashTotal > 0) {
|
||||
val costGoldNum = couldCovertCashTotal * VidiConst.PER_CASH_COST_GOLD_NUM
|
||||
mAccount?.goldCount?.let {
|
||||
if (it > costGoldNum) {
|
||||
addGold(-1 * costGoldNum.toInt())
|
||||
addCash(couldCovertCashTotal.toFloat())
|
||||
AndroidUtil.showToast("Has convert $costGoldNum gold to $couldCovertCashTotal cash.")
|
||||
return true
|
||||
}
|
||||
}
|
||||
} else {
|
||||
AndroidUtil.showToast("You don't have enough gold.")
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,14 +1,15 @@
|
|||
package com.gamedog.vididin.main
|
||||
|
||||
import android.app.Activity
|
||||
import android.content.Context
|
||||
import com.ama.core.architecture.util.eventbus.NotifyMan
|
||||
import com.ama.core.architecture.util.setOnClickBatch
|
||||
import com.ama.core.architecture.widget.BindingDialog
|
||||
import com.gamedog.vididin.VididinEvents
|
||||
import com.gamedog.vididin.databinding.DialogBeginnerGiftBinding
|
||||
import com.gamedog.vididin.router.Router
|
||||
|
||||
|
||||
class BeginnerGiftDialog(context: Context) : BindingDialog<DialogBeginnerGiftBinding>(context, DialogBeginnerGiftBinding::inflate) {
|
||||
class BeginnerGiftDialog(activity: Activity) : BindingDialog<DialogBeginnerGiftBinding>(activity, DialogBeginnerGiftBinding::inflate) {
|
||||
|
||||
init {
|
||||
build()
|
||||
|
|
@ -25,7 +26,10 @@ class BeginnerGiftDialog(context: Context) : BindingDialog<DialogBeginnerGiftBin
|
|||
setOnClickBatch(tvAction) {
|
||||
when (this) {
|
||||
tvAction -> {
|
||||
gotoWatchVideo()
|
||||
if (mActivity is MainActivity) {
|
||||
(mActivity as MainActivity).switchTab(1)
|
||||
}
|
||||
NotifyMan.instance().sendEvent(VididinEvents.EVENT_JUMP_2_FIRST_WITHDRAW, null)
|
||||
dismiss()
|
||||
}
|
||||
}
|
||||
|
|
@ -34,7 +38,7 @@ class BeginnerGiftDialog(context: Context) : BindingDialog<DialogBeginnerGiftBin
|
|||
}
|
||||
|
||||
private fun gotoWatchVideo() {
|
||||
ownerActivity?.let { Router.Withdraw.startActivity(it) }
|
||||
Router.Withdraw.startActivity(mActivity)
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,9 @@
|
|||
package com.gamedog.vididin.main
|
||||
|
||||
|
||||
|
||||
import android.content.Intent
|
||||
import android.content.IntentFilter
|
||||
import com.ama.core.common.util.asSafe
|
||||
import androidx.core.view.ViewCompat
|
||||
import androidx.core.view.WindowInsetsCompat
|
||||
|
|
@ -18,9 +21,13 @@ import com.ama.core.architecture.util.bindViewPager2
|
|||
import com.ama.core.architecture.util.setCommonNavigator
|
||||
import com.ama.core.architecture.util.setDataOrAdapter
|
||||
import com.gamedog.vididin.R
|
||||
import com.gamedog.vididin.VidiConst
|
||||
import com.gamedog.vididin.VididinEvents
|
||||
import com.gamedog.vididin.adapter.MainTabsAdapter
|
||||
import com.gamedog.vididin.adapter.MainViewPagerAdapter
|
||||
import com.gamedog.vididin.main.fragments.task.DailySignSuccessDialog
|
||||
import com.gamedog.vididin.main.interfaces.OnTabStyleListener
|
||||
import com.gamedog.vididin.manager.DateChangeReceiver
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
import kotlin.getValue
|
||||
import com.gamedog.vididin.databinding.ActivityMainBinding as ViewBinding
|
||||
|
|
@ -36,6 +43,8 @@ class MainActivity : AppViewsActivity<ViewBinding, UiState, ViewModel>(), OnTabS
|
|||
override val mViewModel: ViewModel by viewModels()
|
||||
private lateinit var navigatorAdapter: MainTabsAdapter
|
||||
private val fragmentStateAdapter by lazy { MainViewPagerAdapter(this) }
|
||||
private lateinit var mDateChangeReceiver: DateChangeReceiver
|
||||
|
||||
|
||||
|
||||
override fun inflateViewBinding(inflater: LayoutInflater) = ViewBinding.inflate(inflater)
|
||||
|
|
@ -54,6 +63,7 @@ class MainActivity : AppViewsActivity<ViewBinding, UiState, ViewModel>(), OnTabS
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
override fun ViewBinding.initViews() {
|
||||
content.foreground.alpha = 0
|
||||
navigatorAdapter = MainTabsAdapter(
|
||||
|
|
@ -71,6 +81,10 @@ class MainActivity : AppViewsActivity<ViewBinding, UiState, ViewModel>(), OnTabS
|
|||
}
|
||||
|
||||
override fun ViewBinding.initListeners() {
|
||||
mDateChangeReceiver = DateChangeReceiver()
|
||||
val filter = IntentFilter(Intent.ACTION_DATE_CHANGED)
|
||||
registerReceiver(mDateChangeReceiver, filter)
|
||||
|
||||
onBackPressedDispatcher.addCallback(this@MainActivity) {
|
||||
if (mViewModel.canBack) {
|
||||
finish()
|
||||
|
|
@ -97,6 +111,19 @@ class MainActivity : AppViewsActivity<ViewBinding, UiState, ViewModel>(), OnTabS
|
|||
onTabIsDarkFont(isBackgroundBright)
|
||||
}
|
||||
}, false)
|
||||
|
||||
registerEvents( { data->
|
||||
when (data?.mEventType) {
|
||||
VididinEvents.Event_AD_TASK_TYPE_Watch_Ad_Earn_Gold-> {
|
||||
DailySignSuccessDialog(this@MainActivity).initData(VidiConst.WATCH_AD_REWARD_GOLD.toInt(), false).show()
|
||||
}
|
||||
|
||||
VididinEvents.EVENT_JUMP_2_VIDEO-> {
|
||||
switchTab(0)
|
||||
}
|
||||
}
|
||||
|
||||
}, VididinEvents.Event_AD_TASK_TYPE_Watch_Ad_Earn_Gold, VididinEvents.EVENT_JUMP_2_VIDEO)
|
||||
}
|
||||
|
||||
override fun ViewBinding.initObservers() {
|
||||
|
|
@ -114,7 +141,20 @@ class MainActivity : AppViewsActivity<ViewBinding, UiState, ViewModel>(), OnTabS
|
|||
super.onResume()
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
super.onDestroy()
|
||||
unregisterReceiver(mDateChangeReceiver)
|
||||
}
|
||||
|
||||
override fun onTabIsDarkFont(isDarkFont: Boolean) {
|
||||
navigatorAdapter.setIsDarkFont(isDarkFont)
|
||||
}
|
||||
|
||||
fun switchTab(itemIndex: Int) {
|
||||
binding.viewPager2.setCurrentItem(itemIndex, false)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -1,14 +1,15 @@
|
|||
package com.gamedog.vididin.main
|
||||
|
||||
import android.content.Context
|
||||
import android.app.Activity
|
||||
import com.ama.core.architecture.util.setOnClickBatch
|
||||
import com.ama.core.architecture.widget.BindingDialog
|
||||
import com.gamedog.vididin.databinding.DialogWatchVideoBinding
|
||||
import com.gamedog.vididin.main.fragments.task.RewardDetail
|
||||
import com.gamedog.vididin.router.Router
|
||||
|
||||
|
||||
class WatchVideoDialog(context: Context) : BindingDialog<DialogWatchVideoBinding>(context, DialogWatchVideoBinding::inflate) {
|
||||
private lateinit var mDataList: List<RewardDetail>
|
||||
class WatchAdDialog(context: Activity, private val mTaskType: Int, private val mGoldNum: Int? = 0,
|
||||
private val mTaskDataJson: String? = "")
|
||||
: BindingDialog<DialogWatchVideoBinding>(context, DialogWatchVideoBinding::inflate) {
|
||||
|
||||
init {
|
||||
build()
|
||||
|
|
@ -29,15 +30,17 @@ class WatchVideoDialog(context: Context) : BindingDialog<DialogWatchVideoBinding
|
|||
}
|
||||
flAction -> {
|
||||
gotoWatchVideo()
|
||||
dismiss()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tvGoldNum.text = "+$mGoldNum"
|
||||
}
|
||||
}
|
||||
|
||||
private fun gotoWatchVideo() {
|
||||
|
||||
Router.WatchAd.startActivity(mActivity, mTaskType, mTaskDataJson)
|
||||
dismiss()
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -15,10 +15,14 @@ import com.ama.core.architecture.appBase.AppViewsFragment
|
|||
import com.ama.core.architecture.appBase.OnFragmentBackgroundListener
|
||||
import com.ama.core.architecture.util.setStatusBarDarkFont
|
||||
import com.ama.core.common.util.asSafe
|
||||
import com.gamedog.vididin.VididinEvents
|
||||
import com.gamedog.vididin.core.login.login.AccountManager
|
||||
import com.gamedog.vididin.main.fragments.home.HomeFragmentStateAdapter
|
||||
import com.gamedog.vididin.main.fragments.home.fragment.HomeItemFragment
|
||||
import com.gamedog.vididin.main.interfaces.OnSwitchTabListener
|
||||
import com.gamedog.vididin.main.interfaces.OnTabStyleListener
|
||||
import com.gamedog.vididin.youtubestatistic.RewardConst
|
||||
import com.gamedog.vididin.youtubestatistic.RewardConst.Companion.Check_Interval_MS
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlin.getValue
|
||||
|
|
@ -31,6 +35,7 @@ import com.gamedog.vididin.main.fragments.home.YoutubeUiState as UiState
|
|||
@AndroidEntryPoint
|
||||
class HomeFragment : AppViewsFragment<ViewBinding, UiState, ViewModel>(), OnSwitchTabListener, OnFragmentBackgroundListener {
|
||||
|
||||
private var mTotalMs: Long = 0L
|
||||
override val mViewModel: ViewModel by viewModels()
|
||||
override var isBackgroundBright: Boolean = true
|
||||
|
||||
|
|
@ -54,15 +59,35 @@ class HomeFragment : AppViewsFragment<ViewBinding, UiState, ViewModel>(), OnSwit
|
|||
viewPager2.setPageTransformer { _, _ -> }
|
||||
viewPager2.offscreenPageLimit = 1
|
||||
viewPager2.adapter = mViewPagerAdapter
|
||||
|
||||
registerEvents({
|
||||
handleWatchTimeTick()
|
||||
}, VididinEvents.Event_HOME_WATCH_Time_TICK,)
|
||||
}
|
||||
|
||||
private fun handleWatchTimeTick() {
|
||||
mTotalMs += Check_Interval_MS
|
||||
|
||||
if (mTotalMs < RewardConst.HOME_WATCH_DURATION) {
|
||||
binding?.dragIconView?.setProgress(mTotalMs * 100/RewardConst.HOME_WATCH_DURATION)
|
||||
} else {
|
||||
mTotalMs = 0L
|
||||
binding?.dragIconView?.setProgress(mTotalMs * 100/ RewardConst.HOME_WATCH_DURATION)
|
||||
AccountManager.addGold(RewardConst.HOME_WATCH_REWARD_NUM)
|
||||
binding?.dragIconView?.showRewardGoldAnim()
|
||||
}
|
||||
}
|
||||
|
||||
override fun ViewBinding.initListeners() {
|
||||
viewPager2.registerOnPageChangeCallback(object : ViewPager2.OnPageChangeCallback() {
|
||||
override fun onPageSelected(position: Int) {
|
||||
super.onPageSelected(position)
|
||||
setHomeTabStyle(mViewPagerAdapter.getFragmentByIndex(position))
|
||||
val curFragment: HomeItemFragment = mViewPagerAdapter.getFragmentByIndex(position) as HomeItemFragment
|
||||
val fragment = mViewPagerAdapter.getFragmentByIndex(position)
|
||||
if (fragment != null) {
|
||||
setHomeTabStyle(fragment)
|
||||
val curFragment: HomeItemFragment = fragment as HomeItemFragment
|
||||
curFragment.loadVideo()
|
||||
}
|
||||
|
||||
// load more
|
||||
if (mViewPagerAdapter.itemCount > 0 && position == mViewPagerAdapter.itemCount - 2) {
|
||||
|
|
@ -92,7 +117,6 @@ class HomeFragment : AppViewsFragment<ViewBinding, UiState, ViewModel>(), OnSwit
|
|||
|
||||
override fun ViewBinding.onUiStateCollect(uiState: UiState) {
|
||||
mViewPagerAdapter.submitList(uiState.playLists)
|
||||
//viewPager2.setDataOrAdapter(uiState.playLists, 1) { mViewPagerAdapter }
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,10 @@
|
|||
package com.gamedog.vididin.main.fragments
|
||||
|
||||
import android.Manifest
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.LinearLayout
|
||||
import androidx.core.view.ViewCompat
|
||||
import androidx.core.view.WindowInsetsCompat
|
||||
import androidx.core.view.updatePadding
|
||||
|
|
@ -9,20 +12,29 @@ import androidx.fragment.app.viewModels
|
|||
import androidx.lifecycle.lifecycleScope
|
||||
import com.ama.core.architecture.appBase.AppViewsFragment
|
||||
import com.ama.core.architecture.appBase.OnFragmentBackgroundListener
|
||||
import com.ama.core.architecture.util.AndroidUtil
|
||||
import com.ama.core.architecture.util.ResUtil
|
||||
import com.ama.core.architecture.util.eventbus.NotifyMan
|
||||
import com.ama.core.architecture.util.permission.PermissionUtil
|
||||
import com.ama.core.architecture.util.setOnClickBatch
|
||||
import com.ama.core.architecture.util.setStatusBarDarkFont
|
||||
import com.gamedog.vididin.R
|
||||
import com.gamedog.vididin.VidiConst
|
||||
import com.gamedog.vididin.VididinEvents
|
||||
import com.gamedog.vididin.core.login.login.AccountManager
|
||||
import com.gamedog.vididin.main.WatchVideoDialog
|
||||
import com.gamedog.vididin.main.MainActivity
|
||||
import com.gamedog.vididin.main.WatchAdDialog
|
||||
import com.gamedog.vididin.main.fragments.task.DailySignDialog
|
||||
import com.gamedog.vididin.main.fragments.task.DailySignSuccessDialog
|
||||
import com.gamedog.vididin.main.fragments.task.TaskBean
|
||||
import com.gamedog.vididin.main.fragments.task.widget.DailyTaskItemView
|
||||
import com.gamedog.vididin.main.interfaces.OnTabClickAgainListener
|
||||
import com.gamedog.vididin.manager.TaskManager
|
||||
import com.gamedog.vididin.manager.taskbeans.BaseTaskState.Companion.STATE_FINISH
|
||||
import com.gamedog.vididin.manager.taskbeans.BaseTaskState.Companion.STATE_ONGOING
|
||||
import com.gamedog.vididin.router.Router
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
import kotlinx.coroutines.Runnable
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlin.getValue
|
||||
import com.gamedog.vididin.databinding.VididinappFeatureMessageFragmentMessageBinding as ViewBinding
|
||||
|
|
@ -34,10 +46,14 @@ import com.gamedog.vididin.main.fragments.home.YoutubeUiState as UiState
|
|||
@AndroidEntryPoint
|
||||
class TasksFragment : AppViewsFragment<ViewBinding, UiState, ViewModel>(), OnTabClickAgainListener, OnFragmentBackgroundListener {
|
||||
|
||||
|
||||
private var mTaskConfig: TaskBean? = null
|
||||
override val mViewModel: ViewModel by viewModels()
|
||||
override var isBackgroundBright: Boolean = true
|
||||
|
||||
private val mDailyWatchVideoViewList = mutableListOf<DailyTaskItemView>()
|
||||
private val mDailyWatchAdViewList = mutableListOf<DailyTaskItemView>()
|
||||
|
||||
|
||||
override fun inflateViewBinding(
|
||||
inflater: LayoutInflater,
|
||||
|
|
@ -56,30 +72,31 @@ class TasksFragment : AppViewsFragment<ViewBinding, UiState, ViewModel>(), OnTab
|
|||
|
||||
override fun ViewBinding.initViews() {
|
||||
with(binding) {
|
||||
setOnClickBatch(ivGotoDailySign, llTaskBenefit, llTaskWatchVideo, llTaskGame, llTaskZerobuy, tvWatchVideo, tvWithdraw) {
|
||||
setOnClickBatch(ivGotoDailySign, llTaskBenefit, llTaskWatchAd, llTaskGame,
|
||||
llTaskZerobuy, tvWatchVideoForConvertGoldToCash, tvWithdraw) {
|
||||
when(this) {
|
||||
ivGotoDailySign->{
|
||||
DailySignDialog(context).show()
|
||||
DailySignDialog(requireActivity()).show()
|
||||
}
|
||||
|
||||
llTaskBenefit->{
|
||||
Router.Benefit.startActivity(requireActivity())
|
||||
}
|
||||
|
||||
llTaskWatchVideo->{
|
||||
WatchVideoDialog(requireContext()).show()
|
||||
llTaskWatchAd->{
|
||||
WatchAdDialog(requireActivity(), VididinEvents.Event_AD_TASK_TYPE_Watch_Ad_Earn_Gold, 200).show()
|
||||
}
|
||||
|
||||
llTaskGame->{
|
||||
|
||||
AndroidUtil.openUrl(VidiConst.URL_GAME)
|
||||
}
|
||||
|
||||
llTaskZerobuy->{
|
||||
Router.ZeroBuy.startActivity(requireActivity())
|
||||
}
|
||||
|
||||
tvWatchVideo->{
|
||||
WatchVideoDialog(requireContext()).show()
|
||||
tvWatchVideoForConvertGoldToCash->{
|
||||
WatchAdDialog(requireActivity(), VididinEvents.Event_AD_TASK_TYPE_Convert_Gold_2_Cash, null).show()
|
||||
}
|
||||
|
||||
tvWithdraw->{
|
||||
|
|
@ -90,51 +107,30 @@ class TasksFragment : AppViewsFragment<ViewBinding, UiState, ViewModel>(), OnTab
|
|||
|
||||
|
||||
|
||||
beginnerTaskWithdraw.initUI(R.mipmap.icon_cash_s, R.string.beginner_withdraw_title, R.string.beginner_withdraw_desc,R.string.resgatar)
|
||||
beginnerTaskWithdraw.setRewardIcon(R.mipmap.icon_cash_s)
|
||||
beginnerTaskWithdraw.setRewardTextStyle(21, R.color.green_39)
|
||||
beginnerTaskWithdraw.setActionFun {
|
||||
gotoWithDraw()
|
||||
with(beginnerTaskWithdraw) {
|
||||
initUI(R.mipmap.icon_cash_s, R.string.beginner_withdraw_title, R.string.resgatar)
|
||||
//setRewardTextStyle(21, R.color.green_39)
|
||||
updateNewBieFirstWithdrawUI()
|
||||
}
|
||||
|
||||
beginnerTaskDiscord.initUI(R.mipmap.icon_dicord, R.string.beginner_discord_title, R.string.beginner_discord_desc,R.string.resgatar)
|
||||
beginnerTaskDiscord.setActionFun {
|
||||
gotoDiscord()
|
||||
|
||||
with(beginnerTaskDiscord) {
|
||||
initUI(R.mipmap.icon_dicord, R.string.beginner_discord_title,R.string.resgatar)
|
||||
updateNewBieDiscordUI()
|
||||
}
|
||||
|
||||
beginnerTaskEnableNotify.initUI(R.mipmap.icon_notify, R.string.beginner_notify_title, R.string.beginner_notify_desc,R.string.Resgatado)
|
||||
beginnerTaskEnableNotify.setActionFun {
|
||||
gotoNotification()
|
||||
with(beginnerTaskEnableNotify) {
|
||||
initUI(R.mipmap.icon_notify, R.string.beginner_notify_title,R.string.Resgatado)
|
||||
updateNewBieNotifyUI()
|
||||
}
|
||||
|
||||
dailyTaskWatch1.initUI(R.mipmap.icon_video_task, R.string.daily_video_task_title, 1, R.string.resgatar)
|
||||
dailyTaskWatch1.setActionFun {
|
||||
gotoWithVideo()
|
||||
}
|
||||
|
||||
dailyTaskWatch5.initUI(R.mipmap.icon_video_task, R.string.daily_video_task_title, 5, R.string.go_and_do)
|
||||
dailyTaskWatch5.setActionFun {
|
||||
gotoWithVideo()
|
||||
}
|
||||
|
||||
dailyTaskWatch10.initUI(R.mipmap.icon_video_task, R.string.daily_video_task_title, 10, R.string.go_and_do)
|
||||
dailyTaskWatch10.setActionFun {
|
||||
gotoWithVideo()
|
||||
}
|
||||
|
||||
dailyTaskWatch20.initUI(R.mipmap.icon_video_task, R.string.daily_video_task_title, 20, R.string.go_and_do)
|
||||
dailyTaskWatch20.setActionFun {
|
||||
gotoWithVideo()
|
||||
}
|
||||
|
||||
dailyTaskWatch30.initUI(R.mipmap.icon_video_task, R.string.daily_video_task_title, 30, R.string.go_and_do)
|
||||
dailyTaskWatch30.setActionFun {
|
||||
gotoWithVideo()
|
||||
}
|
||||
|
||||
addDailySubTasks()
|
||||
|
||||
updateUIGoldTotal()
|
||||
updateUICashTotal()
|
||||
updateDailyWatchVideoUI()
|
||||
updateDailyWatchAdUI()
|
||||
}
|
||||
|
||||
lifecycleScope.launch {
|
||||
|
|
@ -142,6 +138,60 @@ class TasksFragment : AppViewsFragment<ViewBinding, UiState, ViewModel>(), OnTab
|
|||
}
|
||||
}
|
||||
|
||||
private fun addDailySubTasks() {
|
||||
//1. 阶梯广告
|
||||
val dailyWatchAdTask = TaskManager.instance().getDailyAdTask()
|
||||
if (dailyWatchAdTask != null && dailyWatchAdTask.status == "active"
|
||||
&& dailyWatchAdTask.reward_details.isNotEmpty()) {
|
||||
|
||||
dailyWatchAdTask.reward_details.forEachIndexed { index, detail ->
|
||||
val watchTaskItemView = DailyTaskItemView(requireActivity())
|
||||
watchTaskItemView.setActionFun {
|
||||
handleDailyAdButClicked(index)
|
||||
}
|
||||
mDailyWatchAdViewList.add(watchTaskItemView)
|
||||
|
||||
binding?.dailyTasksContainer!!.run {
|
||||
watchTaskItemView.initUI(R.mipmap.icon_ad, R.string.daily_ad_task_title,
|
||||
detail.target_count, detail.value)
|
||||
|
||||
addView(watchTaskItemView, LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT)
|
||||
if (true) {
|
||||
val separateLine = View(requireActivity())
|
||||
separateLine.setBackgroundResource(R.color.gray_f2)
|
||||
addView(separateLine, LinearLayout.LayoutParams.MATCH_PARENT, ResUtil.getPixelSize(R.dimen.dp1))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//2. 阶梯视频
|
||||
val dailyWatchVideoTask = TaskManager.instance().getDailyVideoTask()
|
||||
if (dailyWatchVideoTask != null && dailyWatchVideoTask.status == "active"
|
||||
&& dailyWatchVideoTask.reward_details.isNotEmpty()) {
|
||||
|
||||
dailyWatchVideoTask.reward_details.forEachIndexed {index, detail ->
|
||||
val watchTaskItemView = DailyTaskItemView(requireActivity())
|
||||
watchTaskItemView.setActionFun {
|
||||
handleDailyVideoButClicked(index)
|
||||
}
|
||||
mDailyWatchVideoViewList.add(watchTaskItemView)
|
||||
|
||||
binding?.dailyTasksContainer!!.run {
|
||||
watchTaskItemView.initUI(R.mipmap.icon_video_task, R.string.daily_video_task_title,
|
||||
detail.target_count, detail.value)
|
||||
|
||||
addView(watchTaskItemView, LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT)
|
||||
if (index != dailyWatchVideoTask.reward_details.size - 1) {
|
||||
val separateLine = View(requireActivity())
|
||||
separateLine.setBackgroundResource(R.color.gray_f2)
|
||||
addView(separateLine, LinearLayout.LayoutParams.MATCH_PARENT, ResUtil.getPixelSize(R.dimen.dp1))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun updateUICashTotal() {
|
||||
binding?.tvCashTotal?.text = buildString {
|
||||
append(ResUtil.getString(R.string.cash))
|
||||
|
|
@ -150,6 +200,22 @@ class TasksFragment : AppViewsFragment<ViewBinding, UiState, ViewModel>(), OnTab
|
|||
}
|
||||
}
|
||||
|
||||
private fun updateDailyWatchVideoUI() {
|
||||
val statusBean = TaskManager.instance().dailyWatchVideoStatus().getStatusBean()
|
||||
val subTaskStatusList = statusBean.getSubTaskRewardState()
|
||||
mDailyWatchVideoViewList.forEachIndexed { index, view ->
|
||||
view.updateProgress(statusBean.getTodayWatchedCount(), subTaskStatusList[index].state)
|
||||
}
|
||||
}
|
||||
|
||||
private fun updateDailyWatchAdUI() {
|
||||
val statusBean = TaskManager.instance().dailyWatchAdStatus().getStatusBean()
|
||||
val subTaskStatusList = statusBean.getSubTaskRewardState()
|
||||
mDailyWatchAdViewList.forEachIndexed { index, view ->
|
||||
view.updateProgress(statusBean.getTodayWatchedCount(), subTaskStatusList[index].state)
|
||||
}
|
||||
}
|
||||
|
||||
private fun updateUIGoldTotal() {
|
||||
binding?.tvGoldTotal?.text = AccountManager.getGold().toString()
|
||||
}
|
||||
|
|
@ -168,12 +234,49 @@ class TasksFragment : AppViewsFragment<ViewBinding, UiState, ViewModel>(), OnTab
|
|||
VididinEvents.Event_Account_Cash_Changed -> {
|
||||
updateUICashTotal()
|
||||
}
|
||||
|
||||
VididinEvents.EVENT_DAILY_WATCHED_VIDEO_NUM_CHANGED -> {
|
||||
updateDailyWatchVideoUI()
|
||||
}
|
||||
}, VididinEvents.Event_Sign_State_Changed, VididinEvents.Event_Account_Cash_Changed, VididinEvents.Event_Account_Gold_Changed)
|
||||
|
||||
VididinEvents.EVENT_DAILY_WATCHED_AD_NUM_CHANGED -> {
|
||||
updateDailyWatchAdUI()
|
||||
}
|
||||
|
||||
VididinEvents.EVENT_JUMP_2_FIRST_WITHDRAW -> {
|
||||
binding?.newbieContainer?.postDelayed(object : Runnable {
|
||||
override fun run() {
|
||||
scroll2FirstWithdraw()
|
||||
}
|
||||
},1000)
|
||||
}
|
||||
|
||||
VididinEvents.EVENT_NEWBIE_DISCORD_TASK_CHANGED -> {
|
||||
updateNewBieDiscordUI()
|
||||
}
|
||||
|
||||
VididinEvents.EVENT_NEWBIE_NOTIFY_TASK_CHANGED -> {
|
||||
updateNewBieNotifyUI()
|
||||
}
|
||||
|
||||
VididinEvents.EVENT_NEWBIE_FIRST_WITHDRAW_TASK_CHANGED -> {
|
||||
updateNewBieFirstWithdrawUI()
|
||||
}
|
||||
|
||||
}
|
||||
}, VididinEvents.Event_Sign_State_Changed, VididinEvents.Event_Account_Cash_Changed,
|
||||
VididinEvents.Event_Account_Gold_Changed, VididinEvents.EVENT_DAILY_WATCHED_VIDEO_NUM_CHANGED,
|
||||
VididinEvents.EVENT_DAILY_WATCHED_AD_NUM_CHANGED, VididinEvents.EVENT_JUMP_2_FIRST_WITHDRAW,
|
||||
VididinEvents.EVENT_NEWBIE_DISCORD_TASK_CHANGED, VididinEvents.EVENT_NEWBIE_NOTIFY_TASK_CHANGED,
|
||||
VididinEvents.EVENT_NEWBIE_FIRST_WITHDRAW_TASK_CHANGED,)
|
||||
}
|
||||
|
||||
private fun scroll2FirstWithdraw() {
|
||||
binding?.newbieContainer?.let { binding?.scrollView?.scroll2ChildView(it) }
|
||||
}
|
||||
|
||||
private fun updateDailySignButUI() {
|
||||
val hasFinishAllSignWork = TaskManager.instance().isDailySignAllOperationDone()
|
||||
val hasFinishAllSignWork = TaskManager.instance().dailySignStatus().isDailySignAllOperationDone()
|
||||
|
||||
binding?.ivGotoDailySign?.apply {
|
||||
setText(
|
||||
|
|
@ -187,6 +290,58 @@ class TasksFragment : AppViewsFragment<ViewBinding, UiState, ViewModel>(), OnTab
|
|||
}
|
||||
}
|
||||
|
||||
private fun updateNewBieFirstWithdrawUI() {
|
||||
with(binding?.beginnerTaskWithdraw!!) {
|
||||
setActionFun {
|
||||
gotoWithDraw()
|
||||
}
|
||||
val stateBean = TaskManager.instance().newbieFirstWithdrawStatus().getStatusBean()
|
||||
setTaskStateInfo(
|
||||
stateBean.rewardGoldNum.toString(),
|
||||
if (stateBean.hasClaimReward) R.string.finished else R.string.go_and_do,
|
||||
ResUtil.getString(R.string.beginner_withdraw_desc),
|
||||
stateBean.hasClaimReward
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
private fun updateNewBieDiscordUI() {
|
||||
with(binding?.beginnerTaskDiscord!!) {
|
||||
setActionFun {
|
||||
gotoDiscord()
|
||||
}
|
||||
val stateBean = TaskManager.instance().newbieJoinDiscordStatus().getStatusBean()
|
||||
setTaskStateInfo(
|
||||
stateBean.rewardGoldNum.toString(),
|
||||
if (stateBean.hasClaimReward) R.string.finished else R.string.go_and_do,
|
||||
String.format(ResUtil.getString(R.string.beginner_discord_desc), stateBean.rewardGoldNum),
|
||||
stateBean.hasClaimReward
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
private fun updateNewBieNotifyUI() {
|
||||
with(binding?.beginnerTaskEnableNotify!!) {
|
||||
val isNotifyEnable = AndroidUtil.isNotificationEnabled()
|
||||
val stateBean = TaskManager.instance().newbieEnableNotifyStatus().getStatusBean()
|
||||
setActionFun {
|
||||
if (!isNotifyEnable) {
|
||||
gotoNotification()
|
||||
} else {
|
||||
if (TaskManager.instance().newbieEnableNotifyStatus().claimReward()) {
|
||||
DailySignSuccessDialog(requireActivity()).initData(stateBean.rewardGoldNum, false).show()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
val actionButRes = if (stateBean.hasClaimReward) R.string.Resgatado else (if (isNotifyEnable) R.string.resgatar else R.string.go_and_do)
|
||||
setTaskStateInfo(stateBean.rewardGoldNum.toString(), actionButRes,
|
||||
String.format(ResUtil.getString(R.string.beginner_notify_desc), stateBean.rewardGoldNum), stateBean.hasClaimReward)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
override fun ViewBinding.initObservers() {
|
||||
}
|
||||
|
||||
|
|
@ -211,15 +366,59 @@ class TasksFragment : AppViewsFragment<ViewBinding, UiState, ViewModel>(), OnTab
|
|||
}
|
||||
|
||||
private fun gotoDiscord() {
|
||||
//TODO("Not yet implemented")
|
||||
AndroidUtil.openUrl(VidiConst.URL_DISCORD)
|
||||
}
|
||||
|
||||
private fun gotoNotification() {
|
||||
//TODO("Not yet implemented")
|
||||
PermissionUtil.checkPermission(Manifest.permission.POST_NOTIFICATIONS, object : PermissionUtil.ICallback() {
|
||||
override fun onAllGranted() {
|
||||
AndroidUtil.openAppNotifySettings()
|
||||
}
|
||||
|
||||
private fun gotoWithVideo() {
|
||||
//TODO("Not yet implemented")
|
||||
override fun onPartialGranted() {
|
||||
}
|
||||
|
||||
override fun onAllRejected() {
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
private fun handleDailyVideoButClicked(itemIndex: Int) {
|
||||
val subTaskList = TaskManager.instance().dailyWatchVideoStatus().getStatusBean().getSubTaskRewardState()
|
||||
if (itemIndex >= 0 && itemIndex < subTaskList.size) {
|
||||
val subTaskState = subTaskList[itemIndex]
|
||||
when (subTaskState.state) {
|
||||
STATE_ONGOING -> {
|
||||
val activity = requireActivity()
|
||||
if (activity is MainActivity) {
|
||||
activity.switchTab(0)
|
||||
}
|
||||
}
|
||||
STATE_FINISH -> {
|
||||
if (TaskManager.instance().dailyWatchVideoStatus().claimSubTaskReward(itemIndex)) {
|
||||
DailySignSuccessDialog(requireActivity()).initData(subTaskState.mRewardNum, false).show()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun handleDailyAdButClicked(itemIndex: Int) {
|
||||
val subTaskList = TaskManager.instance().dailyWatchAdStatus().getStatusBean().getSubTaskRewardState()
|
||||
if (itemIndex >= 0 && itemIndex < subTaskList.size) {
|
||||
val subTaskState = subTaskList[itemIndex]
|
||||
when (subTaskState.state) {
|
||||
STATE_ONGOING -> {
|
||||
WatchAdDialog(requireActivity(), VididinEvents.Event_AD_TASK_TYPE_Watch_Ad_Daily, null).show()
|
||||
}
|
||||
STATE_FINISH -> {
|
||||
if (TaskManager.instance().dailyWatchAdStatus().claimSubTaskReward(itemIndex)) {
|
||||
DailySignSuccessDialog(requireActivity()).initData(subTaskState.mRewardNum, false).show()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -12,12 +12,17 @@ import android.view.animation.ScaleAnimation
|
|||
import androidx.annotation.NonNull
|
||||
import androidx.core.view.isVisible
|
||||
import com.ama.core.architecture.appBase.AppViewsEmptyViewModelFragment
|
||||
import com.ama.core.architecture.util.AndroidUtil
|
||||
import com.ama.core.architecture.util.setOnClickBatch
|
||||
import com.ama.core.common.widget.PopMenuIconView
|
||||
import com.gamedog.vididin.R
|
||||
import com.gamedog.vididin.VidiConst
|
||||
import com.gamedog.vididin.VididinEvents
|
||||
import com.gamedog.vididin.beans.YoutubeVideo
|
||||
import com.gamedog.vididin.main.WatchVideoDialog
|
||||
import com.gamedog.vididin.main.WatchAdDialog
|
||||
import com.gamedog.vididin.router.Router
|
||||
import com.gamedog.vididin.widget.MyPlayerControlView
|
||||
import com.gamedog.vididin.youtubestatistic.TickerTimer
|
||||
import com.pierfrancescosoffritti.androidyoutubeplayer.core.player.PlayerConstants
|
||||
import com.pierfrancescosoffritti.androidyoutubeplayer.core.player.YouTubePlayer
|
||||
import com.pierfrancescosoffritti.androidyoutubeplayer.core.player.listeners.AbstractYouTubePlayerListener
|
||||
|
|
@ -32,8 +37,10 @@ class HomeItemFragment : AppViewsEmptyViewModelFragment<ViewBinding>() {
|
|||
private var mPlayer: YouTubePlayer? = null
|
||||
private var mVideoData: YoutubeVideo? = null
|
||||
private var mIsPlaying: Boolean = false
|
||||
private var mIsIntroExpand: Boolean = false
|
||||
private var mCurPlayedSecond: Float = 0F
|
||||
private var mTotalDuration: Float = -1F
|
||||
private var mTotalDuration: Float = 0F
|
||||
private val mTickerTimer = TickerTimer()
|
||||
|
||||
|
||||
override fun inflateViewBinding(
|
||||
|
|
@ -43,10 +50,6 @@ class HomeItemFragment : AppViewsEmptyViewModelFragment<ViewBinding>() {
|
|||
|
||||
|
||||
override fun ViewBinding.initViews() {
|
||||
maskView.setOnClickListener {
|
||||
if (mIsPlaying) mPlayer?.pause() else mPlayer?.play()
|
||||
}
|
||||
|
||||
playIcon.setOnClickListener {
|
||||
if (mIsPlaying) mPlayer?.pause() else mPlayer?.play()
|
||||
}
|
||||
|
|
@ -60,15 +63,29 @@ class HomeItemFragment : AppViewsEmptyViewModelFragment<ViewBinding>() {
|
|||
Router.Benefit.startActivity(requireActivity())
|
||||
},
|
||||
PopMenuIconView.MenuItem(R.mipmap.home_menu_2) {
|
||||
WatchVideoDialog(requireContext()).show()
|
||||
WatchAdDialog(requireActivity(), VididinEvents.Event_AD_TASK_TYPE_Watch_Ad_Earn_Gold, null).show()
|
||||
},
|
||||
PopMenuIconView.MenuItem(R.mipmap.home_menu_3) {
|
||||
|
||||
AndroidUtil.openUrl(VidiConst.URL_GAME)
|
||||
},
|
||||
PopMenuIconView.MenuItem(R.mipmap.home_menu_4) {
|
||||
Router.Benefit.startActivity(requireActivity())
|
||||
}
|
||||
))
|
||||
|
||||
setOnClickBatch(ivIntroExpand, maskView) {
|
||||
when (this) {
|
||||
maskView -> {
|
||||
if (mIsPlaying) mPlayer?.pause() else mPlayer?.play()
|
||||
}
|
||||
|
||||
ivIntroExpand -> {
|
||||
mIsIntroExpand = !mIsIntroExpand
|
||||
tvVideoIntro.maxLines = if (mIsIntroExpand) 8 else 2
|
||||
ivIntroExpand.setImageResource(if (mIsIntroExpand) R.mipmap.arrow_down else R.mipmap.arrow_up)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -126,6 +143,7 @@ class HomeItemFragment : AppViewsEmptyViewModelFragment<ViewBinding>() {
|
|||
override fun onVideoDuration(youTubePlayer: YouTubePlayer, duration: Float) {
|
||||
super.onVideoDuration(youTubePlayer, duration)
|
||||
mTotalDuration = duration
|
||||
mTickerTimer.setVideoInfo(mVideoData!!.id, (1000L * mTotalDuration).toLong())
|
||||
}
|
||||
|
||||
override fun onStateChange(
|
||||
|
|
@ -167,6 +185,8 @@ class HomeItemFragment : AppViewsEmptyViewModelFragment<ViewBinding>() {
|
|||
} else {
|
||||
showPlayIconAnim()
|
||||
}
|
||||
|
||||
if (mIsPlaying) mTickerTimer.start() else mTickerTimer.pause()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
package com.gamedog.vididin.main.fragments.task
|
||||
|
||||
import android.content.Context
|
||||
import android.app.Activity
|
||||
import androidx.core.view.isVisible
|
||||
import com.ama.core.architecture.util.setOnClickBatch
|
||||
import com.ama.core.architecture.widget.BindingDialog
|
||||
|
|
@ -9,7 +9,7 @@ import com.gamedog.vididin.manager.TaskManager
|
|||
import com.gamedog.vididin.widget.DailySignItemView
|
||||
|
||||
|
||||
class DailySignDialog(context: Context) : BindingDialog<DialogDailySignBinding>(context, DialogDailySignBinding::inflate) {
|
||||
class DailySignDialog(context: Activity) : BindingDialog<DialogDailySignBinding>(context, DialogDailySignBinding::inflate) {
|
||||
private var mCurDayIndex: Int = 0
|
||||
private var mConfigList: List<RewardDetail>? = emptyList()
|
||||
private var mSignItemViewList: MutableList<DailySignItemView> = mutableListOf()
|
||||
|
|
@ -56,16 +56,16 @@ class DailySignDialog(context: Context) : BindingDialog<DialogDailySignBinding>(
|
|||
}
|
||||
|
||||
private fun clickedNormalSign() {
|
||||
if (TaskManager.instance().executeDailySign(mCurDayIndex, false, false)) {
|
||||
DailySignSuccessDialog(context).initData(mConfigList?.get(mCurDayIndex)?.value, true).show()
|
||||
if (TaskManager.instance().dailySignStatus().executeDailySign(mCurDayIndex, false, false)) {
|
||||
DailySignSuccessDialog(mActivity).initData(mConfigList?.get(mCurDayIndex)?.value, true).show()
|
||||
updateUI(mCurDayIndex)
|
||||
}
|
||||
}
|
||||
|
||||
private fun clickedAdSingleBut() {
|
||||
startAdTask("signalAd", {
|
||||
if (TaskManager.instance().executeDailySign(mCurDayIndex, false, true)) {
|
||||
DailySignSuccessDialog(context).initData(mConfigList?.get(mCurDayIndex)?.value, false).show()
|
||||
if (TaskManager.instance().dailySignStatus().executeDailySign(mCurDayIndex, false, true)) {
|
||||
DailySignSuccessDialog(mActivity).initData(mConfigList?.get(mCurDayIndex)?.value, false).show()
|
||||
updateUI(mCurDayIndex)
|
||||
}
|
||||
})
|
||||
|
|
@ -73,8 +73,8 @@ class DailySignDialog(context: Context) : BindingDialog<DialogDailySignBinding>(
|
|||
|
||||
private fun clickedAdDoubleBut() {
|
||||
startAdTask("doubleAd", {
|
||||
if (TaskManager.instance().executeDailySign(mCurDayIndex, true, true)) {
|
||||
DailySignSuccessDialog(context).initData((mConfigList?.get(mCurDayIndex)?.value)?.times(
|
||||
if (TaskManager.instance().dailySignStatus().executeDailySign(mCurDayIndex, true, true)) {
|
||||
DailySignSuccessDialog(mActivity).initData((mConfigList?.get(mCurDayIndex)?.value)?.times(
|
||||
2
|
||||
), false).show()
|
||||
updateUI(mCurDayIndex)
|
||||
|
|
@ -83,11 +83,11 @@ class DailySignDialog(context: Context) : BindingDialog<DialogDailySignBinding>(
|
|||
}
|
||||
|
||||
private fun clickedComplementSign() {
|
||||
val firstForgotSignDayIndex = TaskManager.instance().getForgotSignFirstDayIndex()
|
||||
val firstForgotSignDayIndex = TaskManager.instance().dailySignStatus().getForgotSignFirstDayIndex()
|
||||
if (firstForgotSignDayIndex > 0) {
|
||||
startAdTask("complementAd", {
|
||||
if (TaskManager.instance().executeDailySign(firstForgotSignDayIndex, false, false)){
|
||||
DailySignSuccessDialog(context).initData(mConfigList?.get(firstForgotSignDayIndex)?.value, false).show()
|
||||
if (TaskManager.instance().dailySignStatus().executeDailySign(firstForgotSignDayIndex, false, false)){
|
||||
DailySignSuccessDialog(mActivity).initData(mConfigList?.get(firstForgotSignDayIndex)?.value, false).show()
|
||||
updateUI(firstForgotSignDayIndex)
|
||||
}
|
||||
})
|
||||
|
|
@ -120,14 +120,14 @@ class DailySignDialog(context: Context) : BindingDialog<DialogDailySignBinding>(
|
|||
mConfigList?.let {
|
||||
mSignItemViewList.forEachIndexed { index, itemView->
|
||||
itemView.setData(mConfigList!![index],
|
||||
TaskManager.instance().getDailySignStateBean(index))
|
||||
TaskManager.instance().dailySignStatus().getDailySignStateBean(index))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun initSignState() {
|
||||
mCurDayIndex = TaskManager.instance().getCurDayIndexOfDailyCheckIn()
|
||||
mCurDayIndex = TaskManager.instance().dailySignStatus().getCurDayIndexOfDailyCheckIn()
|
||||
mSignItemViewList[mCurDayIndex].setSelectState(true)
|
||||
updateUI(mCurDayIndex)
|
||||
}
|
||||
|
|
@ -140,7 +140,7 @@ class DailySignDialog(context: Context) : BindingDialog<DialogDailySignBinding>(
|
|||
|
||||
|
||||
mBinding.tvSignedTotal.text = buildString {
|
||||
append(TaskManager.instance().getSignDaysTotal())
|
||||
append(TaskManager.instance().dailySignStatus().getSignDaysTotal())
|
||||
append("/7")
|
||||
}
|
||||
mSignItemViewList[signedDayIndex].updateUI()
|
||||
|
|
@ -162,7 +162,7 @@ class DailySignDialog(context: Context) : BindingDialog<DialogDailySignBinding>(
|
|||
mConfigList?.get(mCurDayIndex)?.value
|
||||
}
|
||||
} else {
|
||||
val forgotSignDays = TaskManager.instance().getForgotSignDays()
|
||||
val forgotSignDays = TaskManager.instance().dailySignStatus().getForgotSignDays()
|
||||
if (forgotSignDays > 0) {
|
||||
mBinding.actionNormalTwoButs.isVisible = false
|
||||
mBinding.actionWatchAd.isVisible = false
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
package com.gamedog.vididin.main.fragments.task
|
||||
|
||||
import android.content.Context
|
||||
import android.app.Activity
|
||||
import androidx.core.view.isVisible
|
||||
import com.ama.core.architecture.util.setOnClickBatch
|
||||
import com.ama.core.architecture.widget.BindingDialog
|
||||
import com.gamedog.vididin.databinding.DialogDailySignSuccessBinding as ViewBinding
|
||||
|
||||
|
||||
class DailySignSuccessDialog(context: Context) : BindingDialog<ViewBinding>(context, ViewBinding::inflate) {
|
||||
class DailySignSuccessDialog(activity: Activity) : BindingDialog<ViewBinding>(activity, ViewBinding::inflate) {
|
||||
|
||||
init {
|
||||
build()
|
||||
|
|
|
|||
|
|
@ -6,7 +6,8 @@ data class TaskBean(
|
|||
|
||||
data class TaskModuleConfig(
|
||||
val basic_info: BasicInfo,
|
||||
val task_categories: List<TaskCategory>
|
||||
val task_categories: List<TaskCategory>,
|
||||
val box_task: BoxTaskRoot
|
||||
) {
|
||||
fun getTaskCategoryById(categoryId: String): TaskCategory? {
|
||||
return task_categories.find { it.category_id == categoryId }
|
||||
|
|
@ -54,3 +55,32 @@ data class RewardDetail(
|
|||
val target_count: Int,
|
||||
val value: Int
|
||||
)
|
||||
|
||||
|
||||
|
||||
//----------------------------- 宝箱任务配置 -----------------------------
|
||||
data class BoxSubTask(
|
||||
val task_id: String,
|
||||
val task_name: String,
|
||||
val required_count: Int,
|
||||
val task_type: Int,
|
||||
)
|
||||
|
||||
data class BoxTask(
|
||||
val chest_id: String,
|
||||
val chest_name: String,
|
||||
val duration_days: Int,
|
||||
val reward_type: String,
|
||||
val reward_value: Float,
|
||||
val is_one_time: Boolean,
|
||||
val status: String,
|
||||
val tasks: List<BoxSubTask>,
|
||||
)
|
||||
|
||||
data class BoxTaskRoot(
|
||||
val category_id: String,
|
||||
val category_name: String,
|
||||
val valid_period: String,
|
||||
val display_priority: String,
|
||||
val chests: List<BoxTask>,
|
||||
)
|
||||
|
|
@ -114,7 +114,7 @@ class WeekStatusView @JvmOverloads constructor(
|
|||
override fun onDraw(canvas: Canvas) {
|
||||
super.onDraw(canvas)
|
||||
|
||||
val dayStateList = TaskManager.instance().getDayStateList()
|
||||
val dayStateList = TaskManager.instance().dailySignStatus().getDayStateList()
|
||||
if (dayStateList.isEmpty()) return
|
||||
|
||||
val totalWidth = measuredWidth.toFloat()
|
||||
|
|
@ -140,7 +140,7 @@ class WeekStatusView @JvmOverloads constructor(
|
|||
|
||||
// reward text
|
||||
textPaint.textSize = rewardTextSize
|
||||
val rewardNum = TaskManager.instance().getRewardNumOfDailySign(index)
|
||||
val rewardNum = TaskManager.instance().dailySignStatus().getRewardNumOfDailySign(index)
|
||||
textPaint.color = if (dayStatus.hasSigned) rewardTextSignedColor else rewardTextColor
|
||||
canvas.drawText(rewardNum.toString(), centerX, vertiMagin + dayTextSize + componentGap + 2*circleRadius + componentGap, textPaint)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,10 @@ import android.util.AttributeSet
|
|||
import android.view.LayoutInflater
|
||||
import android.widget.LinearLayout
|
||||
import com.ama.core.architecture.util.setOnClickBatch
|
||||
import com.gamedog.vididin.R
|
||||
import com.gamedog.vididin.VidiConst
|
||||
import com.gamedog.vididin.databinding.BeginnerTaskItemViewBinding
|
||||
import com.gamedog.vididin.main.fragments.task.Task
|
||||
|
||||
|
||||
class BeginnerTaskItemView @JvmOverloads constructor(
|
||||
|
|
@ -31,20 +34,17 @@ class BeginnerTaskItemView @JvmOverloads constructor(
|
|||
}
|
||||
|
||||
|
||||
fun initUI(titleIconRes: Int, titleRes: Int, desRes: Int, actionRes: Int) {
|
||||
fun initUI(titleIconRes: Int, titleRes: Int, actionRes: Int) {
|
||||
mBinding.ivItemIcon.setImageResource(titleIconRes)
|
||||
mBinding.tvItemTitle.setText(titleRes)
|
||||
mBinding.tvAction.setText(actionRes)
|
||||
mBinding.tvItemDescrible.setText(desRes)
|
||||
}
|
||||
|
||||
|
||||
fun setRewardNum(rewardNum: String) {
|
||||
mBinding.tvRewardNum.text = rewardNum
|
||||
}
|
||||
|
||||
fun setRewardIcon(iconRes: Int) {
|
||||
mBinding.ivRewardIcon.setImageResource(iconRes)
|
||||
fun setRewardInfo(taskReward: Task) {
|
||||
val isRewardGold = VidiConst.GOLD_IN_CONFIG == taskReward.reward_type;
|
||||
mBinding.ivRewardIcon.setImageResource(if (isRewardGold) R.mipmap.icon_glod_small else R.mipmap.icon_cash_s)
|
||||
mBinding.tvRewardNum.text = taskReward.reward_value.toString()
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -57,5 +57,20 @@ class BeginnerTaskItemView @JvmOverloads constructor(
|
|||
mBinding.tvRewardNum.setTextColor(color)
|
||||
}
|
||||
|
||||
fun setTaskStateInfo(
|
||||
rewardNum: String,
|
||||
textRes: Int,
|
||||
describleStr: String,
|
||||
hasClaimReward: Boolean
|
||||
) {
|
||||
mBinding.tvRewardNum.text = rewardNum
|
||||
mBinding.tvAction.setText(textRes)
|
||||
mBinding.tvItemDescrible.text = describleStr
|
||||
mBinding.tvAction.isClickable = !hasClaimReward
|
||||
if (hasClaimReward) {
|
||||
mBinding.tvAction.setBackgroundResource(R.drawable.bg_sub_task_disable)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -6,7 +6,11 @@ import android.view.LayoutInflater
|
|||
import android.widget.LinearLayout
|
||||
import com.ama.core.architecture.util.ResUtil
|
||||
import com.ama.core.architecture.util.setOnClickBatch
|
||||
import com.gamedog.vididin.R
|
||||
import com.gamedog.vididin.databinding.DailyTaskItemViewBinding
|
||||
import com.gamedog.vididin.manager.taskbeans.BaseTaskState.Companion.STATE_CLAIMED
|
||||
import com.gamedog.vididin.manager.taskbeans.BaseTaskState.Companion.STATE_FINISH
|
||||
import com.gamedog.vididin.manager.taskbeans.BaseTaskState.Companion.STATE_ONGOING
|
||||
|
||||
|
||||
class DailyTaskItemView @JvmOverloads constructor(
|
||||
|
|
@ -14,8 +18,10 @@ class DailyTaskItemView @JvmOverloads constructor(
|
|||
attrs: AttributeSet? = null,
|
||||
defStyleAttr: Int = 0
|
||||
) : LinearLayout(context, attrs, defStyleAttr) {
|
||||
private var mRewardNum: Int = 0
|
||||
private var mNeedWatchTotal: Int = 0
|
||||
private lateinit var mAction: () -> Unit
|
||||
private lateinit var mBinding: DailyTaskItemViewBinding
|
||||
private var mBinding: DailyTaskItemViewBinding
|
||||
|
||||
|
||||
init {
|
||||
|
|
@ -33,20 +39,49 @@ class DailyTaskItemView @JvmOverloads constructor(
|
|||
|
||||
|
||||
|
||||
fun initUI(titleIconRes: Int, titleRes: Int, videosNum: Int, actionRes: Int) {
|
||||
fun initUI(titleIconRes: Int, titleRes: Int, videosNum: Int, goldReward: Int) {
|
||||
mRewardNum = goldReward
|
||||
mNeedWatchTotal = videosNum
|
||||
|
||||
mBinding.ivItemIcon.setImageResource(titleIconRes)
|
||||
mBinding.tvItemTitle.text = String.format(ResUtil.getString(titleRes), videosNum)
|
||||
mBinding.tvAction.setText(actionRes)
|
||||
mBinding.tvRewardNum.text = "+$goldReward"
|
||||
mBinding.tvItemProgress.text = "(0/$videosNum)"
|
||||
}
|
||||
|
||||
fun setProgressText(progress: Int, progressText: String) {
|
||||
mBinding.tvItemProgress.text = progressText
|
||||
mBinding.itemProgress.setProgress(progress)
|
||||
fun updateProgress(watchedCount: Int, subTaskState: Int) {
|
||||
doUpdateProgress(watchedCount)
|
||||
|
||||
with(mBinding.tvAction) {
|
||||
when(subTaskState) {
|
||||
STATE_ONGOING -> {
|
||||
setText(R.string.go_and_do)
|
||||
setBackgroundResource(R.drawable.bg_sub_task_normal)
|
||||
isClickable = true
|
||||
alpha = 1F
|
||||
}
|
||||
|
||||
fun setRewardInfo(rewardIconRes: Int, rewardNum: Int) {
|
||||
mBinding.tvRewardNum.text = "" + rewardNum
|
||||
mBinding.ivRewardIcon.setImageResource(rewardIconRes)
|
||||
STATE_FINISH -> {
|
||||
setText(R.string.resgatar)
|
||||
setBackgroundResource(R.drawable.bg_sub_task_normal)
|
||||
isClickable = true
|
||||
alpha = 1F
|
||||
}
|
||||
|
||||
STATE_CLAIMED -> {
|
||||
setText(R.string.Resgatado)
|
||||
setBackgroundResource(R.drawable.bg_sub_task_disable)
|
||||
isClickable = false
|
||||
alpha = 0.4F
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun doUpdateProgress(finishNum: Int) {
|
||||
val properShowNumForCurSubTask = if (finishNum > mNeedWatchTotal) mNeedWatchTotal else finishNum
|
||||
mBinding.tvItemProgress.text = "($properShowNumForCurSubTask/$mNeedWatchTotal)"
|
||||
mBinding.itemProgress.setProgress(100*properShowNumForCurSubTask/mNeedWatchTotal)
|
||||
}
|
||||
|
||||
fun setActionFun(action: ()->Unit) {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,13 @@
|
|||
package com.gamedog.vididin.manager
|
||||
|
||||
import android.content.BroadcastReceiver
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
|
||||
class DateChangeReceiver : BroadcastReceiver() {
|
||||
override fun onReceive(context: Context, intent: Intent) {
|
||||
if (intent.action == Intent.ACTION_DATE_CHANGED) {
|
||||
TaskManager.instance().onDateChanged()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,13 +1,21 @@
|
|||
package com.gamedog.vididin.manager
|
||||
|
||||
import com.ama.core.architecture.util.DateUtil
|
||||
|
||||
import com.ama.core.architecture.util.FileUtil
|
||||
import com.ama.core.architecture.util.SpUtil
|
||||
import com.ama.core.architecture.util.eventbus.NotifyMan
|
||||
import com.gamedog.vididin.VidiConst
|
||||
import com.gamedog.vididin.VididinEvents
|
||||
import com.gamedog.vididin.core.login.login.AccountManager
|
||||
import com.gamedog.vididin.main.fragments.task.BoxTaskRoot
|
||||
import com.gamedog.vididin.main.fragments.task.Task
|
||||
import com.gamedog.vididin.main.fragments.task.TaskBean
|
||||
import com.gamedog.vididin.manager.helpers.BoxTaskHelper
|
||||
import com.gamedog.vididin.manager.helpers.DailySignTaskHelper
|
||||
import com.gamedog.vididin.manager.helpers.DailyWatchAdTaskHelper
|
||||
import com.gamedog.vididin.manager.helpers.DailyWatchVideoTaskHelper
|
||||
import com.gamedog.vididin.manager.helpers.NewbieEnableNotifyHelper
|
||||
import com.gamedog.vididin.manager.helpers.NewbieFirstWithdrawHelper
|
||||
import com.gamedog.vididin.manager.helpers.NewbieJoinDiscordHelper
|
||||
import com.google.gson.GsonBuilder
|
||||
import kotlinx.coroutines.sync.Mutex
|
||||
import kotlinx.coroutines.sync.withLock
|
||||
|
|
@ -31,6 +39,24 @@ class TaskManager private constructor() {
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
// 宝箱子任务类型对应
|
||||
const val BOX_SUB_TASK_TYPE_AD = 1
|
||||
const val BOX_SUB_TASK_TYPE_VIDEO = 2
|
||||
const val BOX_SUB_TASK_TYPE_SIGN = 3
|
||||
const val BOX_SUB_TASK_TYPE_ZERO_BUY = 4
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@Volatile
|
||||
private var instance: TaskManager? = null
|
||||
|
||||
|
|
@ -44,26 +70,52 @@ class TaskManager private constructor() {
|
|||
}
|
||||
|
||||
|
||||
private var mCurDayIndexDailySign: Int = 0
|
||||
private val mutex = Mutex()
|
||||
|
||||
|
||||
@Volatile
|
||||
private var initialized = false
|
||||
private var mTaskConfig: TaskBean? = null
|
||||
private var mDailySignData: DailySignBean = DailySignBean()
|
||||
private val mutex = Mutex()
|
||||
private val mGson = GsonBuilder().create()
|
||||
private var mTaskConfig: TaskBean? = null
|
||||
|
||||
|
||||
private val mDailySignTaskHelper by lazy { DailySignTaskHelper() }
|
||||
private val mDailyWatchVideoTaskHelper by lazy { DailyWatchVideoTaskHelper() }
|
||||
private val mDailyWatchAdTaskHelper by lazy { DailyWatchAdTaskHelper() }
|
||||
private val mBoxHelper by lazy { BoxTaskHelper() }
|
||||
private val mNewbieJoinDiscordHelper by lazy { NewbieJoinDiscordHelper() }
|
||||
private val mNewbieEnableNotifyHelper by lazy { NewbieEnableNotifyHelper() }
|
||||
private val mNewbieFirstWithdrawHelper by lazy { NewbieFirstWithdrawHelper() }
|
||||
|
||||
|
||||
|
||||
|
||||
init {
|
||||
loadTaskConfigAsync()
|
||||
|
||||
registerEvents()
|
||||
|
||||
// TODO - remove test code
|
||||
if (true) {
|
||||
generateTestDailySignTestBean()
|
||||
mDailySignTaskHelper.generateTestDailySignTestBean()
|
||||
}
|
||||
}
|
||||
|
||||
private fun registerEvents() {
|
||||
NotifyMan.instance().register(object : NotifyMan.ICallback(true) {
|
||||
override fun onEvent(data: NotifyMan.NotifyData<*>?) {
|
||||
when (data?.mEventType) {
|
||||
VididinEvents.Event_AD_TASK_TYPE_Convert_Gold_2_Cash -> {
|
||||
AccountManager.convertGold2Cash()
|
||||
}
|
||||
|
||||
VididinEvents.Event_AD_TASK_TYPE_Watch_Ad_Earn_Gold -> {
|
||||
AccountManager.addGold(VidiConst.WATCH_AD_REWARD_GOLD)
|
||||
}
|
||||
}
|
||||
}
|
||||
}, VididinEvents.Event_AD_TASK_TYPE_Convert_Gold_2_Cash, VididinEvents.Event_AD_TASK_TYPE_Watch_Ad_Earn_Gold)
|
||||
}
|
||||
|
||||
|
||||
suspend fun getTaskConfig(): TaskBean? = mutex.withLock {
|
||||
if (!initialized) {
|
||||
|
|
@ -77,9 +129,7 @@ class TaskManager private constructor() {
|
|||
mutex.withLock {
|
||||
if (!initialized) {
|
||||
loadTaskConfigFromAsset()
|
||||
loadTaskStatesFromSp()
|
||||
|
||||
initCalculate()
|
||||
initHelpers()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -93,20 +143,54 @@ class TaskManager private constructor() {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
private suspend fun loadTaskStatesFromSp() {
|
||||
return withContext(Dispatchers.IO) {
|
||||
val taskStateBeanInSp = SpUtil.instance().getObject<DailySignBean>(SpUtil.KEY_TASK_BEAN)
|
||||
if (taskStateBeanInSp == null) {
|
||||
SpUtil.instance().putObject(SpUtil.KEY_TASK_BEAN, mDailySignData)
|
||||
} else {
|
||||
mDailySignData = taskStateBeanInSp
|
||||
}
|
||||
}
|
||||
private suspend fun initHelpers() {
|
||||
mDailySignTaskHelper.setConfigDatas(getDailyCheckInTask()!!)
|
||||
mDailyWatchVideoTaskHelper.setConfigDatas(getDailyVideoTask()!!)
|
||||
mDailyWatchAdTaskHelper.setConfigDatas(getDailyAdTask()!!)
|
||||
mNewbieJoinDiscordHelper.setConfigDatas(getNewbieJoinDiscordTask()!!)
|
||||
mNewbieEnableNotifyHelper.setConfigDatas(getNewbieEnableNotifyTask()!!)
|
||||
mNewbieFirstWithdrawHelper.setConfigDatas(getNewbieFirstWithdrawTask()!!)
|
||||
mBoxHelper.setConfigDatas(getBoxTaskConfig()!!)
|
||||
}
|
||||
|
||||
private fun initCalculate() {
|
||||
fun onDateChanged() {
|
||||
mDailySignTaskHelper.onDateChanged()
|
||||
mDailyWatchVideoTaskHelper.onDateChanged()
|
||||
mDailyWatchAdTaskHelper.onDateChanged()
|
||||
mBoxHelper.onDateChanged()
|
||||
mNewbieJoinDiscordHelper.onDateChanged()
|
||||
mNewbieEnableNotifyHelper.onDateChanged()
|
||||
mNewbieFirstWithdrawHelper.onDateChanged()
|
||||
}
|
||||
|
||||
|
||||
//------------------------- Tasks Getter ------------------------------
|
||||
fun dailySignStatus(): DailySignTaskHelper {
|
||||
return mDailySignTaskHelper
|
||||
}
|
||||
|
||||
fun dailyWatchVideoStatus(): DailyWatchVideoTaskHelper {
|
||||
return mDailyWatchVideoTaskHelper
|
||||
}
|
||||
|
||||
fun dailyWatchAdStatus(): DailyWatchAdTaskHelper {
|
||||
return mDailyWatchAdTaskHelper
|
||||
}
|
||||
|
||||
fun boxTaskStatus(): BoxTaskHelper {
|
||||
return mBoxHelper
|
||||
}
|
||||
|
||||
fun newbieJoinDiscordStatus(): NewbieJoinDiscordHelper {
|
||||
return mNewbieJoinDiscordHelper
|
||||
}
|
||||
|
||||
fun newbieEnableNotifyStatus(): NewbieEnableNotifyHelper {
|
||||
return mNewbieEnableNotifyHelper
|
||||
}
|
||||
|
||||
fun newbieFirstWithdrawStatus(): NewbieFirstWithdrawHelper {
|
||||
return mNewbieFirstWithdrawHelper
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -144,126 +228,17 @@ class TaskManager private constructor() {
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//----------------------------- 每日签到 -----------------------------//
|
||||
|
||||
fun getHomeWatchDurationRewardNum(): Int {
|
||||
return 28; // TODO - mTaskConfigBean.xxxx
|
||||
// 宝箱任务
|
||||
fun getBoxTaskConfig(): BoxTaskRoot? {
|
||||
return mTaskConfig?.task_module_config?.box_task
|
||||
}
|
||||
|
||||
|
||||
fun getCurDayIndexOfDailyCheckIn() : Int {
|
||||
var dayIndexOfPeriod = 0
|
||||
|
||||
val periodStartMs = mDailySignData.startMs
|
||||
if (periodStartMs > 0) {
|
||||
dayIndexOfPeriod = DateUtil.getPassedDayNum(periodStartMs, DateUtil.getCurTimeMs())
|
||||
if (dayIndexOfPeriod > 6) {
|
||||
mDailySignData.startMs = DateUtil.getCurTimeMs()
|
||||
SpUtil.instance().putObject(SpUtil.KEY_TASK_BEAN, mDailySignData)
|
||||
}
|
||||
} else {
|
||||
mDailySignData.startMs = DateUtil.getCurTimeMs()
|
||||
SpUtil.instance().putObject(SpUtil.KEY_TASK_BEAN, mDailySignData)
|
||||
}
|
||||
|
||||
mCurDayIndexDailySign = dayIndexOfPeriod
|
||||
return dayIndexOfPeriod
|
||||
}
|
||||
|
||||
fun getDailySignStateBean(dayIndex: Int): DailySignDayInfoBean {
|
||||
return mDailySignData.signStateList[dayIndex]
|
||||
}
|
||||
|
||||
fun executeDailySign(dayIndex: Int, isDoubleReward: Boolean, isByAd: Boolean) : Boolean {
|
||||
val daySignState = mDailySignData.signStateList[dayIndex]
|
||||
|
||||
if (!daySignState.hasSigned || (dayIndex == mCurDayIndexDailySign && !daySignState.hasWatchedAd)) {
|
||||
val dayReward = getDailyCheckInTask()?.reward_details?.get(dayIndex)?.value ?: 0
|
||||
val finalReward = if (isDoubleReward) 2*dayReward else dayReward
|
||||
daySignState.hasRewardedNum += finalReward
|
||||
daySignState.hasSigned = true
|
||||
daySignState.hasWatchedAd = isByAd
|
||||
saveDailySignInfo()
|
||||
AccountManager.addGold(finalReward)
|
||||
notifySignStateChanged(Pair(dayIndex, daySignState))
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
private fun notifySignStateChanged(dataPair: Pair<Int, DailySignDayInfoBean>) {
|
||||
NotifyMan.instance().sendEvent(VididinEvents.Event_Sign_State_Changed, NotifyMan.NotifyData(dataPair))
|
||||
}
|
||||
|
||||
private fun saveDailySignInfo() {
|
||||
SpUtil.instance().putObject(SpUtil.KEY_DAILY_SIGN, mDailySignData)
|
||||
}
|
||||
|
||||
private fun generateTestDailySignTestBean() {
|
||||
mDailySignData = DailySignBean().apply {
|
||||
startMs = DateUtil.getCurTimeMs() - 4 * DateUtil.MS_NUM_ONE_DAY
|
||||
signStateList.clear()
|
||||
signStateList.add(DailySignDayInfoBean(hasSigned = true, hasWatchedAd = true))
|
||||
signStateList.add(DailySignDayInfoBean(hasSigned = false, hasWatchedAd = false))
|
||||
signStateList.add(DailySignDayInfoBean(hasSigned = true, hasWatchedAd = false))
|
||||
signStateList.add(DailySignDayInfoBean(hasSigned = false, hasWatchedAd = false))
|
||||
signStateList.add(DailySignDayInfoBean(hasSigned = false, hasWatchedAd = false))
|
||||
signStateList.add(DailySignDayInfoBean(hasSigned = false, hasWatchedAd = false))
|
||||
signStateList.add(DailySignDayInfoBean(hasSigned = false, hasWatchedAd = false))
|
||||
}
|
||||
|
||||
SpUtil.instance().putObject(SpUtil.KEY_TASK_BEAN, mDailySignData)
|
||||
AccountManager.saveBankAccount(null)
|
||||
}
|
||||
|
||||
fun getForgotSignDays(): Int {
|
||||
var forgotSignDays = 0
|
||||
val curDayIndex = getCurDayIndexOfDailyCheckIn()
|
||||
mDailySignData.signStateList.forEachIndexed { index, item->
|
||||
if (!item.hasSigned && index < curDayIndex) {
|
||||
forgotSignDays++
|
||||
}
|
||||
}
|
||||
return forgotSignDays
|
||||
}
|
||||
|
||||
fun getSignDaysTotal(): Int {
|
||||
var signDays = 0
|
||||
mDailySignData.signStateList.forEachIndexed { index, item->
|
||||
if (item.hasSigned) {
|
||||
signDays++
|
||||
}
|
||||
}
|
||||
return signDays
|
||||
}
|
||||
|
||||
fun getForgotSignFirstDayIndex(): Int {
|
||||
val curDayIndex = getCurDayIndexOfDailyCheckIn()
|
||||
mDailySignData.signStateList.forEachIndexed { index, item->
|
||||
if (!item.hasSigned && index < curDayIndex) {
|
||||
return index
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
fun getDayStateList(): List<DailySignDayInfoBean> {
|
||||
return mDailySignData.signStateList
|
||||
}
|
||||
|
||||
fun getRewardNumOfDailySign(dayIndex: Int) : Int {
|
||||
return getDailyCheckInTask()?.reward_details?.get(dayIndex)?.value ?: 0
|
||||
}
|
||||
|
||||
fun isDailySignAllOperationDone(): Boolean {
|
||||
val curDayState = getDailySignStateBean(mCurDayIndexDailySign)
|
||||
return curDayState.hasSigned && curDayState.hasWatchedAd && getForgotSignFirstDayIndex() <= 0
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,69 @@
|
|||
package com.gamedog.vididin.manager.helpers
|
||||
|
||||
import com.ama.core.architecture.util.DateUtil
|
||||
import com.gamedog.vididin.core.login.login.AccountManager
|
||||
import com.gamedog.vididin.main.fragments.task.Task
|
||||
import com.gamedog.vididin.manager.taskbeans.BaseDailyTaskState
|
||||
import com.gamedog.vididin.manager.taskbeans.BaseTaskState.Companion.STATE_CLAIMED
|
||||
import com.gamedog.vididin.manager.taskbeans.BaseTaskState.Companion.STATE_FINISH
|
||||
import com.gamedog.vididin.manager.taskbeans.BaseTaskState.Companion.STATE_ONGOING
|
||||
import com.gamedog.vididin.manager.taskbeans.TaskStateWatchVideo
|
||||
import com.gamedog.vididin.manager.taskbeans.TaskStateWatchAd
|
||||
|
||||
|
||||
|
||||
abstract class BaseDailyTaskHelper<T : BaseDailyTaskState> : BaseTaskHelper<T, Task>() {
|
||||
|
||||
abstract protected fun notifyEvents()
|
||||
abstract protected fun generateTodayTask()
|
||||
|
||||
fun claimSubTaskReward(subTaskIndex: Int) : Boolean {
|
||||
if (subTaskIndex >= 0 && subTaskIndex < mStateBean.getSubTaskRewardState().size) {
|
||||
try {
|
||||
val subTask = mStateBean.getSubTaskRewardState()[subTaskIndex]
|
||||
if (subTask.state == STATE_FINISH) {
|
||||
AccountManager.addGold(subTask.mRewardNum)
|
||||
subTask.state = STATE_CLAIMED
|
||||
saveState2Sp()
|
||||
notifyEvents()
|
||||
return true
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
override fun onDateChanged() {
|
||||
super.onDateChanged()
|
||||
generateTodayTask()
|
||||
notifyEvents()
|
||||
}
|
||||
|
||||
|
||||
protected fun calculateNewState() {
|
||||
val todayWatchedCount = mStateBean.getTodayWatchedCount()
|
||||
|
||||
mStateBean.getSubTaskRewardState().forEachIndexed { index, subTaskState ->
|
||||
val targetCount = subTaskState.mTargetAdCount
|
||||
when(subTaskState.state) {
|
||||
STATE_ONGOING -> {
|
||||
if (todayWatchedCount >= targetCount) {
|
||||
subTaskState.state = STATE_FINISH
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected fun isTodayStatusBean(stateBean: TaskStateWatchAd): Boolean {
|
||||
return DateUtil.isToday(stateBean.todayMs)
|
||||
}
|
||||
|
||||
protected fun isTodayStatusBean(stateBean: TaskStateWatchVideo): Boolean {
|
||||
return DateUtil.isToday(stateBean.todayMs)
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,54 @@
|
|||
package com.gamedog.vididin.manager.helpers
|
||||
|
||||
import com.ama.core.architecture.util.SpUtil
|
||||
import com.ama.core.architecture.util.eventbus.NotifyMan
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.withContext
|
||||
|
||||
abstract class BaseTaskHelper<T: Any, C: Any> {
|
||||
abstract val mSpKey: String
|
||||
protected lateinit var mStateBean: T
|
||||
protected lateinit var mTaskConfig: C
|
||||
private var mEventCallback: NotifyMan.ICallback? = null
|
||||
|
||||
abstract fun loadTaskFromSp()
|
||||
|
||||
suspend fun setConfigDatas(taskConfig: C) {
|
||||
mTaskConfig = taskConfig
|
||||
|
||||
return withContext(Dispatchers.IO) {
|
||||
loadTaskFromSp()
|
||||
}
|
||||
}
|
||||
|
||||
open fun onDateChanged() {
|
||||
// TODO - sub class override this methods if daily task
|
||||
}
|
||||
|
||||
|
||||
protected fun registerEvents(onEvents: ((NotifyMan.NotifyData<*>?)->Unit), vararg eventTypes: Int) {
|
||||
if (mEventCallback == null) {
|
||||
mEventCallback = object : NotifyMan.ICallback(true) {
|
||||
override fun onEvent(data: NotifyMan.NotifyData<*>?) {
|
||||
onEvents.invoke(data)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
NotifyMan.instance().register(mEventCallback, *eventTypes)
|
||||
}
|
||||
|
||||
protected fun saveState2Sp() {
|
||||
SpUtil.instance().putObject(mSpKey, mStateBean)
|
||||
}
|
||||
|
||||
fun getStatusBean() : T {
|
||||
return mStateBean
|
||||
}
|
||||
|
||||
fun release() {
|
||||
NotifyMan.instance().unregister(mEventCallback)
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,287 @@
|
|||
package com.gamedog.vididin.manager.helpers
|
||||
|
||||
import com.ama.core.architecture.util.DateUtil
|
||||
import com.ama.core.architecture.util.SpUtil
|
||||
import com.ama.core.architecture.util.eventbus.NotifyMan
|
||||
import com.gamedog.vididin.R
|
||||
import com.gamedog.vididin.VididinEvents
|
||||
import com.gamedog.vididin.core.login.login.AccountManager
|
||||
import com.gamedog.vididin.main.fragments.task.BoxTaskRoot
|
||||
import com.gamedog.vididin.manager.TaskManager.Companion.BOX_SUB_TASK_TYPE_ZERO_BUY
|
||||
import com.gamedog.vididin.manager.TaskManager.Companion.BOX_SUB_TASK_TYPE_SIGN
|
||||
import com.gamedog.vididin.manager.TaskManager.Companion.BOX_SUB_TASK_TYPE_AD
|
||||
import com.gamedog.vididin.manager.TaskManager.Companion.BOX_SUB_TASK_TYPE_VIDEO
|
||||
import com.gamedog.vididin.manager.taskbeans.TaskStateBox
|
||||
import com.gamedog.vididin.manager.taskbeans.TaskStateBoxRoot
|
||||
import com.gamedog.vididin.manager.taskbeans.TaskStateBoxSub
|
||||
import com.gamedog.vididin.manager.taskbeans.BaseTaskState.Companion.STATE_FINISH
|
||||
import com.gamedog.vididin.manager.taskbeans.BaseTaskState.Companion.STATE_ONGOING
|
||||
import com.gamedog.vididin.manager.taskbeans.BaseTaskState.Companion.STATE_CLAIMED
|
||||
import com.gamedog.vididin.manager.taskbeans.BaseTaskState.Companion.STATE_EXPIRED
|
||||
|
||||
|
||||
class BoxTaskHelper: BaseTaskHelper<TaskStateBoxRoot, BoxTaskRoot>() {
|
||||
|
||||
override val mSpKey = SpUtil.KEY_TASK_BOX
|
||||
|
||||
init {
|
||||
registerEvents( { eventData->
|
||||
when (eventData?.mEventType) {
|
||||
VididinEvents.Event_Finish_One_Ad -> {
|
||||
handleEvents(BOX_SUB_TASK_TYPE_AD)
|
||||
}
|
||||
|
||||
VididinEvents.Event_Finish_One_Video -> {
|
||||
handleEvents(BOX_SUB_TASK_TYPE_VIDEO)
|
||||
}
|
||||
|
||||
VididinEvents.Event_Finish_One_Sign -> {
|
||||
handleEvents(BOX_SUB_TASK_TYPE_SIGN)
|
||||
}
|
||||
|
||||
VididinEvents.Event_Finish_One_Zerobuy -> {
|
||||
handleEvents(BOX_SUB_TASK_TYPE_ZERO_BUY)
|
||||
}
|
||||
}
|
||||
|
||||
}, VididinEvents.Event_Finish_One_Ad, VididinEvents.Event_Finish_One_Video,
|
||||
VididinEvents.Event_Finish_One_Sign, VididinEvents.Event_Finish_One_Zerobuy)
|
||||
}
|
||||
|
||||
override fun loadTaskFromSp() {
|
||||
val taskStateBeanInSp = SpUtil.instance().getObject<TaskStateBoxRoot>(mSpKey)
|
||||
if (taskStateBeanInSp == null || isBoxRootTaskExpired(taskStateBeanInSp)) {
|
||||
mStateBean = generateStateBeanFromConfig()
|
||||
saveState2Sp()
|
||||
} else {
|
||||
mStateBean = taskStateBeanInSp
|
||||
}
|
||||
}
|
||||
|
||||
private fun generateStateBeanFromConfig(): TaskStateBoxRoot {
|
||||
val boxStateList = mutableListOf<TaskStateBox>()
|
||||
mTaskConfig.chests.forEachIndexed { index, task ->
|
||||
val boxSubTaskStateList = mutableListOf<TaskStateBoxSub>()
|
||||
task.tasks.forEachIndexed { index, task ->
|
||||
boxSubTaskStateList.add(TaskStateBoxSub(task.task_id,
|
||||
task.task_name, task.required_count, task.task_type))
|
||||
}
|
||||
|
||||
boxStateList.add(TaskStateBox(task.chest_id, task.chest_name, task.duration_days,
|
||||
task.reward_type, task.reward_value, task.is_one_time, task.status, boxSubTaskStateList))
|
||||
}
|
||||
|
||||
return TaskStateBoxRoot(DateUtil.getTodayStartTimeMs(), boxStateList)
|
||||
}
|
||||
|
||||
|
||||
@Synchronized
|
||||
private fun handleEvents(taskType: Int) {
|
||||
val currentBoxIndex = getCurrentBoxIndex()
|
||||
if (!isBoxAllFinished(currentBoxIndex)) {
|
||||
getCurrentBoxState()?.tasks?.forEachIndexed { index, subTask->
|
||||
if (taskType == subTask.task_type
|
||||
&& !isBoxSubTaskFinished(currentBoxIndex, index)) {
|
||||
subTask.finishedNum++
|
||||
saveState2Sp()
|
||||
|
||||
notifyEvent()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun notifyEvent() {
|
||||
NotifyMan.instance().sendEvent(VididinEvents.EVENT_BOX_TASK_STATE_CHANGED, null)
|
||||
}
|
||||
|
||||
|
||||
private fun isBoxRootTaskExpired(taskStateBoxRoot: TaskStateBoxRoot): Boolean {
|
||||
var totalDurationDays = 0
|
||||
taskStateBoxRoot.tasks.forEach {
|
||||
totalDurationDays += it.duration_days
|
||||
}
|
||||
return DateUtil.isPeriodExpired(taskStateBoxRoot.startMs, totalDurationDays)
|
||||
}
|
||||
|
||||
private fun isBoxTaskExpired(boxIndex: Int): Boolean {
|
||||
if (boxIndex >= 0 && boxIndex < mStateBean.tasks.size) {
|
||||
val curBoxState = mStateBean.tasks[boxIndex]
|
||||
return DateUtil.isPeriodExpired(mStateBean.startMs, curBoxState.duration_days)
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
private fun isBoxAllTasksFinish(boxIndex: Int) : Boolean {
|
||||
if (boxIndex >= 0 && boxIndex < mStateBean.tasks.size) {
|
||||
val curBoxState = mStateBean.tasks[boxIndex]
|
||||
|
||||
curBoxState.tasks.forEach {
|
||||
if (it.required_count > it.finishedNum) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
fun getCurrentBoxIndex(): Int {
|
||||
val boxRootStartMs = mStateBean.startMs
|
||||
|
||||
mStateBean.tasks.forEachIndexed { index, box ->
|
||||
if (!DateUtil.isPeriodExpired(boxRootStartMs, box.duration_days)) {
|
||||
return index
|
||||
}
|
||||
}
|
||||
return -1
|
||||
}
|
||||
|
||||
fun getCurrentBoxState(): TaskStateBox? {
|
||||
val currentBoxIndex = getCurrentBoxIndex()
|
||||
|
||||
if (currentBoxIndex >= 0 && currentBoxIndex < mStateBean.tasks.size) {
|
||||
return mStateBean.tasks[currentBoxIndex]
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
fun isBoxAllFinished(boxIndex: Int) : Boolean {
|
||||
val stateEnum = getBoxStateEnum(boxIndex)
|
||||
return stateEnum == STATE_FINISH || stateEnum == STATE_CLAIMED
|
||||
}
|
||||
|
||||
fun isBoxSubTaskFinished(boxIndex: Int, subTaskIndex: Int) : Boolean {
|
||||
val subTaskState = mStateBean.tasks[boxIndex].tasks[subTaskIndex]
|
||||
return subTaskState.finishedNum >= subTaskState.required_count
|
||||
}
|
||||
|
||||
fun getBoxStateEnum(boxIndex: Int): Int {
|
||||
if (boxIndex >= 0 && boxIndex < mStateBean.tasks.size) {
|
||||
val curBoxState = mStateBean.tasks[boxIndex]
|
||||
|
||||
if (curBoxState.hasClaimedReward) {
|
||||
return STATE_CLAIMED
|
||||
} else {
|
||||
if (isBoxAllTasksFinish(boxIndex)) {
|
||||
return STATE_FINISH
|
||||
} else {
|
||||
if (isBoxTaskExpired(boxIndex)) {
|
||||
return STATE_EXPIRED
|
||||
} else {
|
||||
return STATE_ONGOING
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return -1
|
||||
}
|
||||
|
||||
fun getCouldClaimCashNum(): Float {
|
||||
var waitClaimCashNum = 0F
|
||||
mStateBean.tasks.forEachIndexed { index, box ->
|
||||
if (getBoxStateEnum(index) == STATE_FINISH) {
|
||||
waitClaimCashNum += box.reward_value
|
||||
}
|
||||
}
|
||||
return waitClaimCashNum
|
||||
}
|
||||
|
||||
fun getSubTaskHintStrRes(boxIndex: Int, subTaskIndex: Int): Int {
|
||||
when (boxIndex) {
|
||||
0-> {
|
||||
when (subTaskIndex) {
|
||||
0-> {
|
||||
return R.string.box_subtask_hint_1_1
|
||||
}
|
||||
|
||||
1-> {
|
||||
return R.string.box_subtask_hint_1_2
|
||||
}
|
||||
|
||||
2-> {
|
||||
return R.string.box_subtask_hint_1_3
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
1-> {
|
||||
when (subTaskIndex) {
|
||||
0-> {
|
||||
return R.string.box_subtask_hint_2_1
|
||||
}
|
||||
|
||||
1-> {
|
||||
return R.string.box_subtask_hint_2_2
|
||||
}
|
||||
|
||||
2-> {
|
||||
return R.string.box_subtask_hint_2_3
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
2-> {
|
||||
when (subTaskIndex) {
|
||||
0-> {
|
||||
return R.string.box_subtask_hint_3_1
|
||||
}
|
||||
|
||||
1-> {
|
||||
return R.string.box_subtask_hint_3_2
|
||||
}
|
||||
|
||||
2-> {
|
||||
return R.string.box_subtask_hint_3_3
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
fun getCurrentBoxTotalProgress(): Int {
|
||||
val currentBoxIndex = getCurrentBoxIndex()
|
||||
val boxList = mStateBean.tasks
|
||||
if (currentBoxIndex >= 0 && currentBoxIndex < boxList.size) {
|
||||
var totalFinished = 0
|
||||
var totalRequired = 0
|
||||
val currentBox = boxList[currentBoxIndex]
|
||||
|
||||
currentBox.tasks.forEach {
|
||||
totalFinished += it.finishedNum
|
||||
totalRequired += it.required_count
|
||||
}
|
||||
|
||||
if (totalRequired > 0) {
|
||||
val totalProgress = (100 * totalFinished) / totalRequired
|
||||
return if (totalProgress > 100) 100 else totalProgress
|
||||
}
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
fun executeClaimCash(): Boolean {
|
||||
try {
|
||||
val couldClaimCashNum = getCouldClaimCashNum()
|
||||
if (couldClaimCashNum > 0F) {
|
||||
AccountManager.addCash(couldClaimCashNum)
|
||||
mStateBean.tasks.forEachIndexed { index, box ->
|
||||
if (getBoxStateEnum(index) == STATE_FINISH) {
|
||||
box.hasClaimedReward = true
|
||||
}
|
||||
}
|
||||
saveState2Sp()
|
||||
notifyEvent()
|
||||
return true
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,135 @@
|
|||
package com.gamedog.vididin.manager.helpers
|
||||
|
||||
import com.ama.core.architecture.util.DateUtil
|
||||
import com.ama.core.architecture.util.SpUtil
|
||||
import com.ama.core.architecture.util.eventbus.NotifyMan
|
||||
import com.gamedog.vididin.VididinEvents
|
||||
import com.gamedog.vididin.core.login.login.AccountManager
|
||||
import com.gamedog.vididin.main.fragments.task.Task
|
||||
import com.gamedog.vididin.manager.taskbeans.TaskDailySignBean
|
||||
import com.gamedog.vididin.manager.taskbeans.DailySignDayInfoBean
|
||||
|
||||
|
||||
class DailySignTaskHelper : BaseTaskHelper<TaskDailySignBean, Task>() {
|
||||
private var mCurDayIndexDailySign: Int = 0
|
||||
override val mSpKey = SpUtil.KEY_TASK_BEAN
|
||||
|
||||
|
||||
override fun loadTaskFromSp() {
|
||||
val taskStateBeanInSp = SpUtil.instance().getObject<TaskDailySignBean>(mSpKey)
|
||||
if (taskStateBeanInSp == null) {
|
||||
mStateBean = TaskDailySignBean()
|
||||
saveState2Sp()
|
||||
} else {
|
||||
mStateBean = taskStateBeanInSp
|
||||
}
|
||||
}
|
||||
|
||||
fun getCurDayIndexOfDailyCheckIn() : Int {
|
||||
var dayIndexOfPeriod = 0
|
||||
|
||||
val periodStartMs = mStateBean.startDurationMs
|
||||
if (periodStartMs > 0) {
|
||||
dayIndexOfPeriod = DateUtil.getPassedDayNum(periodStartMs, DateUtil.getCurTimeMs())
|
||||
if (dayIndexOfPeriod > 6) {
|
||||
mStateBean?.startDurationMs = DateUtil.getCurTimeMs()
|
||||
saveState2Sp()
|
||||
}
|
||||
} else {
|
||||
mStateBean?.startDurationMs = DateUtil.getCurTimeMs()
|
||||
saveState2Sp()
|
||||
}
|
||||
|
||||
mCurDayIndexDailySign = dayIndexOfPeriod
|
||||
return dayIndexOfPeriod
|
||||
}
|
||||
|
||||
fun getDailySignStateBean(dayIndex: Int): DailySignDayInfoBean {
|
||||
return mStateBean.signStateList[dayIndex]
|
||||
}
|
||||
|
||||
fun executeDailySign(dayIndex: Int, isDoubleReward: Boolean, isByAd: Boolean) : Boolean {
|
||||
val daySignState = mStateBean.signStateList[dayIndex]
|
||||
|
||||
if (!daySignState.hasSigned || (dayIndex == mCurDayIndexDailySign && !daySignState.hasWatchedAd)) {
|
||||
val dayReward = getRewardNumOfDailySign(dayIndex)
|
||||
val finalReward = if (isDoubleReward) 2*dayReward else dayReward
|
||||
daySignState.hasRewardedNum += finalReward
|
||||
daySignState.hasSigned = true
|
||||
daySignState.hasWatchedAd = isByAd
|
||||
saveState2Sp()
|
||||
AccountManager.addGold(finalReward)
|
||||
notifySignStateChanged(Pair(dayIndex, daySignState))
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
private fun notifySignStateChanged(dataPair: Pair<Int, DailySignDayInfoBean>) {
|
||||
NotifyMan.instance().sendEvent(VididinEvents.Event_Sign_State_Changed, NotifyMan.NotifyData(dataPair))
|
||||
NotifyMan.instance().sendEvent(VididinEvents.Event_Finish_One_Sign, null)
|
||||
}
|
||||
|
||||
fun generateTestDailySignTestBean() {
|
||||
mStateBean = TaskDailySignBean().apply {
|
||||
startDurationMs = DateUtil.getCurTimeMs() - 4 * DateUtil.MS_NUM_ONE_DAY
|
||||
signStateList.clear()
|
||||
signStateList.add(DailySignDayInfoBean(hasSigned = true, hasWatchedAd = true))
|
||||
signStateList.add(DailySignDayInfoBean(hasSigned = false, hasWatchedAd = false))
|
||||
signStateList.add(DailySignDayInfoBean(hasSigned = true, hasWatchedAd = false))
|
||||
signStateList.add(DailySignDayInfoBean(hasSigned = false, hasWatchedAd = false))
|
||||
signStateList.add(DailySignDayInfoBean(hasSigned = false, hasWatchedAd = false))
|
||||
signStateList.add(DailySignDayInfoBean(hasSigned = false, hasWatchedAd = false))
|
||||
signStateList.add(DailySignDayInfoBean(hasSigned = false, hasWatchedAd = false))
|
||||
}
|
||||
|
||||
saveState2Sp()
|
||||
AccountManager.saveBankAccount(null)
|
||||
}
|
||||
|
||||
fun getForgotSignDays(): Int {
|
||||
var forgotSignDays = 0
|
||||
val curDayIndex = getCurDayIndexOfDailyCheckIn()
|
||||
mStateBean.signStateList.forEachIndexed { index, item->
|
||||
if (!item.hasSigned && index < curDayIndex) {
|
||||
forgotSignDays++
|
||||
}
|
||||
}
|
||||
return forgotSignDays
|
||||
}
|
||||
|
||||
fun getSignDaysTotal(): Int {
|
||||
var signDays = 0
|
||||
mStateBean.signStateList.forEachIndexed { index, item->
|
||||
if (item.hasSigned) {
|
||||
signDays++
|
||||
}
|
||||
}
|
||||
return signDays
|
||||
}
|
||||
|
||||
fun getForgotSignFirstDayIndex(): Int {
|
||||
val curDayIndex = getCurDayIndexOfDailyCheckIn()
|
||||
mStateBean.signStateList.forEachIndexed { index, item->
|
||||
if (!item.hasSigned && index < curDayIndex) {
|
||||
return index
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
fun getDayStateList(): List<DailySignDayInfoBean> {
|
||||
return mStateBean.signStateList
|
||||
}
|
||||
|
||||
fun getRewardNumOfDailySign(dayIndex: Int) : Int {
|
||||
return mTaskConfig.reward_details[dayIndex].value
|
||||
}
|
||||
|
||||
fun isDailySignAllOperationDone(): Boolean {
|
||||
val curDayState = getDailySignStateBean(mCurDayIndexDailySign)
|
||||
return curDayState.hasSigned && curDayState.hasWatchedAd && getForgotSignFirstDayIndex() <= 0
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,53 @@
|
|||
package com.gamedog.vididin.manager.helpers
|
||||
|
||||
import com.ama.core.architecture.util.DateUtil
|
||||
import com.ama.core.architecture.util.SpUtil
|
||||
import com.ama.core.architecture.util.eventbus.NotifyMan
|
||||
import com.gamedog.vididin.VididinEvents
|
||||
import com.gamedog.vididin.manager.taskbeans.TaskStateWatchAd
|
||||
|
||||
|
||||
class DailyWatchAdTaskHelper : BaseDailyTaskHelper<TaskStateWatchAd>() {
|
||||
|
||||
override val mSpKey = SpUtil.KEY_DAILY_WATCH_AD_FOR_GOLD
|
||||
|
||||
|
||||
init {
|
||||
registerEvents( { eventData->
|
||||
val watchedAdNum: Int = eventData?.mData as Int
|
||||
handleOneAdWatched(watchedAdNum)
|
||||
}, VididinEvents.Event_Finish_One_Ad)
|
||||
}
|
||||
|
||||
override fun loadTaskFromSp() {
|
||||
val spStateBean = SpUtil.instance().getObject<TaskStateWatchAd>(mSpKey)
|
||||
if (spStateBean == null || !isTodayStatusBean(spStateBean)) {
|
||||
generateTodayTask()
|
||||
} else {
|
||||
mStateBean = spStateBean
|
||||
notifyEvents()
|
||||
}
|
||||
}
|
||||
|
||||
override fun generateTodayTask() {
|
||||
mStateBean = TaskStateWatchAd(DateUtil.getCurTimeMs())
|
||||
mStateBean.initSubTaskRewardList(mTaskConfig.reward_details)
|
||||
saveState2Sp()
|
||||
}
|
||||
|
||||
override fun notifyEvents() {
|
||||
NotifyMan.instance().sendEvent(VididinEvents.EVENT_DAILY_WATCHED_AD_NUM_CHANGED, null)
|
||||
}
|
||||
|
||||
private fun handleOneAdWatched(newAdWatchedNum: Int) {
|
||||
mStateBean.run {
|
||||
if (!isAllTaskFinish()) {
|
||||
addWatchedCount(newAdWatchedNum)
|
||||
calculateNewState()
|
||||
saveState2Sp()
|
||||
notifyEvents()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,58 @@
|
|||
package com.gamedog.vididin.manager.helpers
|
||||
|
||||
|
||||
import com.ama.core.architecture.util.DateUtil
|
||||
import com.ama.core.architecture.util.SpUtil
|
||||
import com.ama.core.architecture.util.eventbus.NotifyMan
|
||||
import com.gamedog.vididin.VididinEvents
|
||||
import com.gamedog.vididin.manager.taskbeans.TaskStateWatchAd
|
||||
import com.gamedog.vididin.manager.taskbeans.TaskStateWatchVideo
|
||||
|
||||
|
||||
class DailyWatchVideoTaskHelper : BaseDailyTaskHelper<TaskStateWatchVideo>() {
|
||||
|
||||
override val mSpKey = SpUtil.KEY_DAILY_WATCH_VIDEO
|
||||
|
||||
|
||||
init {
|
||||
registerEvents( { eventData->
|
||||
val dataPair: Pair<String, Long> = eventData?.mData as Pair<String, Long>
|
||||
handleOneVideoWatched(dataPair)
|
||||
}, VididinEvents.Event_Finish_One_Video)
|
||||
}
|
||||
|
||||
override fun loadTaskFromSp() {
|
||||
val spStateBean = SpUtil.instance().getObject<TaskStateWatchVideo>(mSpKey)
|
||||
if (spStateBean == null || !isTodayStatusBean(spStateBean)) {
|
||||
generateTodayTask()
|
||||
} else {
|
||||
mStateBean = spStateBean
|
||||
notifyEvents()
|
||||
}
|
||||
}
|
||||
|
||||
override fun generateTodayTask() {
|
||||
mStateBean = TaskStateWatchVideo(DateUtil.getCurTimeMs())
|
||||
mStateBean.initSubTaskRewardList(mTaskConfig.reward_details)
|
||||
saveState2Sp()
|
||||
}
|
||||
|
||||
override fun notifyEvents() {
|
||||
NotifyMan.instance().sendEvent(VididinEvents.EVENT_DAILY_WATCHED_VIDEO_NUM_CHANGED, null)
|
||||
}
|
||||
|
||||
|
||||
private fun handleOneVideoWatched(dataPair: Pair<String, Long>) {
|
||||
mStateBean.run {
|
||||
if (!isAllTaskFinish()) {
|
||||
if (addWatchedVideoInfo(dataPair)) {
|
||||
calculateNewState()
|
||||
saveState2Sp()
|
||||
notifyEvents()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
package com.gamedog.vididin.manager.helpers
|
||||
|
||||
|
||||
import com.ama.core.architecture.util.SpUtil
|
||||
import com.ama.core.architecture.util.eventbus.NotifyMan
|
||||
import com.gamedog.vididin.VididinEvents
|
||||
import com.gamedog.vididin.core.login.login.AccountManager
|
||||
import com.gamedog.vididin.main.fragments.task.Task
|
||||
import com.gamedog.vididin.manager.taskbeans.TaskStateNewBieEnableNotify
|
||||
|
||||
class NewbieEnableNotifyHelper: BaseTaskHelper<TaskStateNewBieEnableNotify, Task>() {
|
||||
|
||||
override val mSpKey = SpUtil.KEY_NEWBIE_ENABLE_NOTIFY
|
||||
|
||||
|
||||
override fun loadTaskFromSp() {
|
||||
val taskStateBeanInSp = SpUtil.instance().getObject<TaskStateNewBieEnableNotify>(mSpKey)
|
||||
if (taskStateBeanInSp == null) {
|
||||
mStateBean = generateStateBeanFromConfig()
|
||||
saveState2Sp()
|
||||
} else {
|
||||
mStateBean = taskStateBeanInSp
|
||||
}
|
||||
}
|
||||
|
||||
private fun generateStateBeanFromConfig(): TaskStateNewBieEnableNotify {
|
||||
return TaskStateNewBieEnableNotify(mTaskConfig.reward_value)
|
||||
}
|
||||
|
||||
fun claimReward() : Boolean {
|
||||
if (!mStateBean.hasClaimReward) {
|
||||
AccountManager.addGold(mStateBean.rewardGoldNum)
|
||||
mStateBean.hasClaimReward = true
|
||||
saveState2Sp()
|
||||
notifyStateChangeEvent()
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
private fun notifyStateChangeEvent() {
|
||||
NotifyMan.instance().sendEvent(VididinEvents.EVENT_NEWBIE_NOTIFY_TASK_CHANGED, null)
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
package com.gamedog.vididin.manager.helpers
|
||||
|
||||
import com.ama.core.architecture.util.SpUtil
|
||||
import com.ama.core.architecture.util.eventbus.NotifyMan
|
||||
import com.gamedog.vididin.VididinEvents
|
||||
import com.gamedog.vididin.core.login.login.AccountManager
|
||||
import com.gamedog.vididin.main.fragments.task.Task
|
||||
import com.gamedog.vididin.manager.taskbeans.TaskStateNewBieFirstWithDraw
|
||||
|
||||
class NewbieFirstWithdrawHelper: BaseTaskHelper<TaskStateNewBieFirstWithDraw, Task>() {
|
||||
|
||||
override val mSpKey = SpUtil.KEY_NEWBIE_FIRST_WITHDRAW
|
||||
|
||||
override fun loadTaskFromSp() {
|
||||
val taskStateBeanInSp = SpUtil.instance().getObject<TaskStateNewBieFirstWithDraw>(mSpKey)
|
||||
if (taskStateBeanInSp == null) {
|
||||
mStateBean = generateStateBeanFromConfig()
|
||||
saveState2Sp()
|
||||
} else {
|
||||
mStateBean = taskStateBeanInSp
|
||||
}
|
||||
}
|
||||
|
||||
private fun generateStateBeanFromConfig(): TaskStateNewBieFirstWithDraw {
|
||||
return TaskStateNewBieFirstWithDraw(mTaskConfig.reward_value)
|
||||
}
|
||||
|
||||
fun claimReward(): Boolean {
|
||||
if (!mStateBean.hasClaimReward) {
|
||||
AccountManager.addGold(mStateBean.rewardGoldNum)
|
||||
mStateBean.hasClaimReward = true
|
||||
saveState2Sp()
|
||||
notifyStateChangeEvent()
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
private fun notifyStateChangeEvent() {
|
||||
NotifyMan.instance().sendEvent(VididinEvents.EVENT_NEWBIE_FIRST_WITHDRAW_TASK_CHANGED, null)
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
package com.gamedog.vididin.manager.helpers
|
||||
|
||||
import com.ama.core.architecture.util.SpUtil
|
||||
import com.ama.core.architecture.util.eventbus.NotifyMan
|
||||
import com.gamedog.vididin.VididinEvents
|
||||
import com.gamedog.vididin.core.login.login.AccountManager
|
||||
import com.gamedog.vididin.main.fragments.task.Task
|
||||
import com.gamedog.vididin.manager.taskbeans.TaskStateNewBieJoinDiscord
|
||||
|
||||
class NewbieJoinDiscordHelper: BaseTaskHelper<TaskStateNewBieJoinDiscord, Task>() {
|
||||
|
||||
override val mSpKey = SpUtil.KEY_NEWBIE_JOIN_DISCORD
|
||||
|
||||
override fun loadTaskFromSp() {
|
||||
val taskStateBeanInSp = SpUtil.instance().getObject<TaskStateNewBieJoinDiscord>(mSpKey)
|
||||
if (taskStateBeanInSp == null) {
|
||||
mStateBean = generateStateBeanFromConfig()
|
||||
saveState2Sp()
|
||||
} else {
|
||||
mStateBean = taskStateBeanInSp
|
||||
}
|
||||
}
|
||||
|
||||
private fun generateStateBeanFromConfig(): TaskStateNewBieJoinDiscord {
|
||||
return TaskStateNewBieJoinDiscord(mTaskConfig.reward_value)
|
||||
}
|
||||
|
||||
fun claimReward() : Boolean {
|
||||
if (!mStateBean.hasClaimReward) {
|
||||
AccountManager.addGold(mStateBean.rewardGoldNum)
|
||||
mStateBean.hasClaimReward = true
|
||||
saveState2Sp()
|
||||
notifyStateChangeEvent()
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
private fun notifyStateChangeEvent() {
|
||||
NotifyMan.instance().sendEvent(VididinEvents.EVENT_NEWBIE_DISCORD_TASK_CHANGED, null)
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
package com.gamedog.vididin.manager.taskbeans
|
||||
|
||||
import com.gamedog.vididin.main.fragments.task.RewardDetail
|
||||
import com.gamedog.vididin.manager.taskbeans.BaseTaskState.Companion.STATE_ONGOING
|
||||
import kotlinx.serialization.Serializable
|
||||
import kotlin.collections.forEach
|
||||
|
||||
|
||||
@Serializable
|
||||
abstract class BaseDailyTaskState : BaseTaskState() {
|
||||
protected val mSubTaskRewardState: MutableList<SubDailyTaskBean> = mutableListOf()
|
||||
|
||||
abstract fun getTodayWatchedCount(): Int
|
||||
abstract fun addWatchedCount(newWatchedNum: Int)
|
||||
abstract fun addWatchedVideoInfo(dataPair: Pair<String, Long>): Boolean
|
||||
|
||||
|
||||
fun getSubTaskRewardState(): List<SubDailyTaskBean> {
|
||||
return mSubTaskRewardState
|
||||
}
|
||||
|
||||
fun isAllTaskFinish(): Boolean {
|
||||
return mSubTaskRewardState.all { it.state >= STATE_CLAIMED }
|
||||
}
|
||||
|
||||
fun initSubTaskRewardList(subTasks: List<RewardDetail>) {
|
||||
mSubTaskRewardState.clear()
|
||||
|
||||
subTasks.forEach {
|
||||
mSubTaskRewardState.add(SubDailyTaskBean(it.value, it.target_count, STATE_ONGOING))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
data class SubDailyTaskBean(
|
||||
val mRewardNum: Int,
|
||||
val mTargetAdCount: Int,
|
||||
var state: Int = STATE_ONGOING,)
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
package com.gamedog.vididin.manager.taskbeans
|
||||
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
|
||||
@Serializable
|
||||
abstract class BaseTaskState {
|
||||
companion object {
|
||||
const val STATE_ONGOING = 0
|
||||
const val STATE_FINISH = 1
|
||||
const val STATE_CLAIMED = 2
|
||||
const val STATE_EXPIRED = 3
|
||||
}
|
||||
}
|
||||
|
|
@ -1,22 +1,12 @@
|
|||
package com.gamedog.vididin.manager
|
||||
package com.gamedog.vididin.manager.taskbeans
|
||||
|
||||
import java.io.Serializable
|
||||
|
||||
|
||||
|
||||
|
||||
data class DailySignBean(
|
||||
var startMs: Long = 0,
|
||||
data class TaskDailySignBean(
|
||||
var startDurationMs: Long = 0,
|
||||
val signStateList: MutableList<DailySignDayInfoBean> = mutableListOf()
|
||||
|
||||
): Serializable {
|
||||
companion object{
|
||||
const val SIGN_STATE_ENABLE = 1
|
||||
const val SIGN_STATE_DISABLE = 2
|
||||
const val SIGN_STATE_DONE = 3
|
||||
const val SIGN_STATE_FORGOT = 4
|
||||
}
|
||||
|
||||
): BaseTaskState() {
|
||||
init {
|
||||
signStateList.add(DailySignDayInfoBean())
|
||||
signStateList.add(DailySignDayInfoBean())
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
package com.gamedog.vididin.manager.taskbeans
|
||||
|
||||
import java.io.Serializable
|
||||
|
||||
|
||||
|
||||
|
||||
data class TaskStateBoxRoot(
|
||||
val startMs: Long = 0,
|
||||
val tasks: List<TaskStateBox>
|
||||
): Serializable
|
||||
|
||||
data class TaskStateBox(
|
||||
val chest_id: String,
|
||||
val chest_name: String,
|
||||
val duration_days: Int,
|
||||
val reward_type: String,
|
||||
val reward_value: Float,
|
||||
val is_one_time: Boolean,
|
||||
val status: String,
|
||||
val tasks: List<TaskStateBoxSub>,
|
||||
|
||||
// new added
|
||||
var hasClaimedReward: Boolean = false,
|
||||
): Serializable
|
||||
|
||||
data class TaskStateBoxSub(
|
||||
val task_id: String,
|
||||
val task_name: String,
|
||||
val required_count: Int,
|
||||
val task_type: Int, // This added by self for decide which task should be execute, detail see: #TaskManager.companion
|
||||
|
||||
// new added
|
||||
var finishedNum: Int = 0,
|
||||
): Serializable
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
package com.gamedog.vididin.manager.taskbeans
|
||||
|
||||
import java.io.Serializable
|
||||
|
||||
|
||||
|
||||
|
||||
data class TaskStateNewBieEnableNotify(
|
||||
var rewardGoldNum: Int,
|
||||
var hasClaimReward: Boolean = false,
|
||||
): Serializable {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
package com.gamedog.vididin.manager.taskbeans
|
||||
|
||||
import java.io.Serializable
|
||||
|
||||
|
||||
|
||||
|
||||
data class TaskStateNewBieFirstWithDraw(
|
||||
var rewardGoldNum: Int,
|
||||
var hasClaimReward: Boolean = false,
|
||||
): Serializable {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
package com.gamedog.vididin.manager.taskbeans
|
||||
|
||||
import java.io.Serializable
|
||||
|
||||
|
||||
|
||||
|
||||
data class TaskStateNewBieJoinDiscord(
|
||||
var rewardGoldNum: Int,
|
||||
var hasClaimReward: Boolean = false,
|
||||
): Serializable {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
package com.gamedog.vididin.manager.taskbeans
|
||||
|
||||
|
||||
|
||||
|
||||
data class TaskStateWatchAd(
|
||||
var todayMs: Long = 0,
|
||||
): BaseDailyTaskState() {
|
||||
private var mWatchAdCount: Int = 0
|
||||
|
||||
|
||||
|
||||
override fun addWatchedCount(newWatchedNum: Int) {
|
||||
if (newWatchedNum > 0) {
|
||||
mWatchAdCount += newWatchedNum
|
||||
}
|
||||
}
|
||||
|
||||
override fun addWatchedVideoInfo(dataPair: Pair<String, Long>): Boolean {
|
||||
return false
|
||||
}
|
||||
|
||||
override fun getTodayWatchedCount(): Int {
|
||||
return mWatchAdCount
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
package com.gamedog.vididin.manager.taskbeans
|
||||
|
||||
|
||||
import java.util.concurrent.ConcurrentHashMap
|
||||
|
||||
|
||||
data class TaskStateWatchVideo(
|
||||
var todayMs: Long = 0,
|
||||
): BaseDailyTaskState() {
|
||||
|
||||
private val mWatchedMap = ConcurrentHashMap<String, Long>()
|
||||
|
||||
override fun addWatchedVideoInfo(dataPair: Pair<String, Long>): Boolean {
|
||||
if (!mWatchedMap.contains(dataPair.first)) {
|
||||
mWatchedMap.put(dataPair.first, dataPair.second)
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
override fun addWatchedCount(newWatchedNum: Int) {
|
||||
|
||||
}
|
||||
|
||||
override fun getTodayWatchedCount(): Int {
|
||||
return mWatchedMap.size
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -39,7 +39,11 @@ object Router : RouterContract {
|
|||
get() = routerEntryPoint.feedbackRouter()
|
||||
override val WithdrawRecord: IRouterWithdrawRecord
|
||||
get() = routerEntryPoint.withdrawRecordRouter()
|
||||
|
||||
override val Splash: IRouterSplash
|
||||
get() = routerEntryPoint.splashRouter()
|
||||
|
||||
override val WatchAd: IRouterWatchAd
|
||||
get() = routerEntryPoint.watchAdRouter()
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -27,5 +27,7 @@ interface RouterContract {
|
|||
val Feedback: IRouterFeedback
|
||||
val WithdrawRecord: IRouterWithdrawRecord
|
||||
val Splash: IRouterSplash
|
||||
val WatchAd: IRouterWatchAd
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -5,6 +5,7 @@ import com.gamedog.vididin.features.feedback.FeedbackActivity
|
|||
import com.gamedog.vididin.features.privacy.PrivacyActivity
|
||||
import com.gamedog.vididin.features.splash.SplashActivity
|
||||
import com.gamedog.vididin.features.version.VersionActivity
|
||||
import com.gamedog.vididin.features.watchad.WatchAdActivity
|
||||
import com.gamedog.vididin.features.withdrawrecord.WithdrawRecordActivity
|
||||
|
||||
|
||||
|
|
@ -38,3 +39,9 @@ class DefaultVersionRouter: IRouterVersion {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
class DefaultWatchAdRouter: IRouterWatchAd {
|
||||
override fun startActivity(activity: Activity, taskType: Int, taskDataJson: String?) {
|
||||
WatchAdActivity.Companion.startActivity(activity, taskType, taskDataJson)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,4 +23,8 @@ interface IRouterSplash {
|
|||
fun startActivity(activity: Activity)
|
||||
}
|
||||
|
||||
interface IRouterWatchAd {
|
||||
fun startActivity(activity: Activity, taskType: Int, taskDataJson: String?)
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import com.ama.core.architecture.util.ResUtil
|
|||
import com.gamedog.vididin.R
|
||||
import com.gamedog.vididin.databinding.DailySignItemBinding
|
||||
import com.gamedog.vididin.main.fragments.task.RewardDetail
|
||||
import com.gamedog.vididin.manager.DailySignDayInfoBean
|
||||
import com.gamedog.vididin.manager.taskbeans.DailySignDayInfoBean
|
||||
import kotlin.run
|
||||
|
||||
class DailySignItemView @JvmOverloads constructor(
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@ import android.view.LayoutInflater
|
|||
import android.widget.LinearLayout
|
||||
import androidx.core.view.isVisible
|
||||
import com.gamedog.vididin.databinding.LayoutDragIconViewBinding
|
||||
import com.gamedog.vididin.manager.TaskManager
|
||||
|
||||
class HomeDragIconView @JvmOverloads constructor(
|
||||
context: Context,
|
||||
|
|
@ -24,45 +23,36 @@ class HomeDragIconView @JvmOverloads constructor(
|
|||
init {
|
||||
mBinding = LayoutDragIconViewBinding.inflate(LayoutInflater.from(context), this, true)
|
||||
mBinding.run {
|
||||
progressBar.setProgressListener { progress->
|
||||
if (progress >= 100) {
|
||||
tvGoldNum.text = buildString {
|
||||
append("+")
|
||||
append(TaskManager.instance().getHomeWatchDurationRewardNum())
|
||||
}
|
||||
|
||||
executeGoldNumAnim()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private fun executeGoldNumAnim() {
|
||||
fun showRewardGoldAnim() {
|
||||
val animView = mBinding.llGoldRoot
|
||||
|
||||
val alphaAnimator = ObjectAnimator.ofFloat(
|
||||
animView,
|
||||
"alpha",
|
||||
0.5f, 1.0f, 0.5f
|
||||
0.5f, 1.0f
|
||||
).apply {
|
||||
duration = 500
|
||||
duration = 1500
|
||||
}
|
||||
|
||||
val scaleXAnimator = ObjectAnimator.ofFloat(
|
||||
animView,
|
||||
"scaleX",
|
||||
0.5f, 1.0f, 0.5f
|
||||
0.5f, 1.1f, 1F
|
||||
).apply {
|
||||
duration = 500
|
||||
duration = 1500
|
||||
}
|
||||
|
||||
val scaleYAnimator = ObjectAnimator.ofFloat(
|
||||
animView,
|
||||
"scaleY",
|
||||
0.5f, 1.0f, 0.5f
|
||||
0.5f, 1.1f, 1F
|
||||
).apply {
|
||||
duration = 500
|
||||
duration = 1500
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -70,13 +60,15 @@ class HomeDragIconView @JvmOverloads constructor(
|
|||
animatorSet.playTogether(alphaAnimator, scaleXAnimator, scaleYAnimator)
|
||||
animatorSet.addListener(object : Animator.AnimatorListener {
|
||||
override fun onAnimationCancel(animation: Animator) {
|
||||
animView.isVisible = false
|
||||
mBinding.progressBar.setProgress(0)
|
||||
postDelayed({
|
||||
animView.visibility = INVISIBLE
|
||||
}, 1000)
|
||||
}
|
||||
|
||||
override fun onAnimationEnd(animation: Animator) {
|
||||
animView.isVisible = false
|
||||
mBinding.progressBar.setProgress(0)
|
||||
postDelayed({
|
||||
animView.visibility = INVISIBLE
|
||||
}, 1000)
|
||||
}
|
||||
|
||||
override fun onAnimationRepeat(animation: Animator) {
|
||||
|
|
@ -84,12 +76,18 @@ class HomeDragIconView @JvmOverloads constructor(
|
|||
}
|
||||
|
||||
override fun onAnimationStart(animation: Animator) {
|
||||
|
||||
animView.isVisible = true
|
||||
}
|
||||
})
|
||||
animatorSet.start()
|
||||
}
|
||||
|
||||
|
||||
|
||||
fun setProgress(progress: Long) {
|
||||
mBinding.progressBar.setProgress(progress.toInt())
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,10 @@
|
|||
package com.gamedog.vididin.youtubestatistic
|
||||
|
||||
class RewardConst {
|
||||
companion object {
|
||||
const val HOME_WATCH_DURATION = 5 * 1000L
|
||||
const val HOME_WATCH_REWARD_NUM = 28
|
||||
const val FINISH_RATIO = 0.05F // TODO - temp value, should be 0.8F
|
||||
const val Check_Interval_MS = 50L
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,200 @@
|
|||
package com.gamedog.vididin.youtubestatistic
|
||||
|
||||
import android.os.Handler
|
||||
import android.os.Looper
|
||||
import com.ama.core.architecture.util.eventbus.NotifyMan
|
||||
import com.gamedog.vididin.VididinEvents
|
||||
import com.gamedog.vididin.youtubestatistic.RewardConst.Companion.Check_Interval_MS
|
||||
|
||||
|
||||
class TickerTimer() {
|
||||
|
||||
private var mTotalMs = 0L
|
||||
private var mHasFinishCurVideo = false
|
||||
private var mVideoId: String? = null
|
||||
private var mVideoDurationMs: Long = 0
|
||||
|
||||
|
||||
private val mCountHandler: Handler by lazy {
|
||||
Handler(Looper.getMainLooper())
|
||||
}
|
||||
private val mCounterRunnable by lazy {
|
||||
object : Runnable {
|
||||
override fun run() {
|
||||
if (isRunning) {
|
||||
handleNewTick()
|
||||
mCountHandler.postDelayed(this, Check_Interval_MS)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Volatile
|
||||
private var isRunning = false
|
||||
|
||||
|
||||
|
||||
fun setVideoInfo(videoId: String, videoDurationMs: Long) {
|
||||
mVideoId = videoId
|
||||
mVideoDurationMs = videoDurationMs
|
||||
}
|
||||
|
||||
fun start() {
|
||||
isRunning = true
|
||||
mCountHandler.postDelayed(mCounterRunnable, Check_Interval_MS)
|
||||
}
|
||||
|
||||
|
||||
private fun handleNewTick() {
|
||||
NotifyMan.instance().sendEvent(VididinEvents.Event_HOME_WATCH_Time_TICK, null)
|
||||
|
||||
if (!mHasFinishCurVideo && mVideoDurationMs > 0L) {
|
||||
mTotalMs += Check_Interval_MS
|
||||
if (mTotalMs >= RewardConst.FINISH_RATIO * mVideoDurationMs) {
|
||||
mHasFinishCurVideo = true
|
||||
NotifyMan.instance().sendEvent(VididinEvents.Event_Finish_One_Video,
|
||||
NotifyMan.NotifyData(Pair(mVideoId, System.currentTimeMillis())))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun pause() {
|
||||
if (!isRunning) return
|
||||
isRunning = false
|
||||
mCountHandler.removeCallbacks(mCounterRunnable)
|
||||
}
|
||||
|
||||
|
||||
fun release() {
|
||||
isRunning = false
|
||||
mCounterRunnable.let { mCountHandler.removeCallbacks(it) }
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*private var mStartMs = 0L
|
||||
private var mTotalMs = 0L
|
||||
private var mHasFinishCurVideo = false
|
||||
private var mVideoId: String? = null
|
||||
private var mVideoDurationMs: Long = 0
|
||||
|
||||
|
||||
private val mCountHandler: Handler by lazy {
|
||||
Handler(Looper.getMainLooper())
|
||||
}
|
||||
private val mCounterRunnable by lazy {
|
||||
object : Runnable {
|
||||
override fun run() {
|
||||
if (isRunning) {
|
||||
if (mVideoDurationMs > 0L && mStartMs <= 0) {
|
||||
mStartMs = SystemClock.elapsedRealtime()
|
||||
}
|
||||
|
||||
handleNewTick()
|
||||
mCountHandler.postDelayed(this, Check_Interval_MS)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Volatile
|
||||
private var isRunning = false
|
||||
|
||||
|
||||
|
||||
fun setVideoInfo(videoId: String, videoDurationMs: Long) {
|
||||
mVideoId = videoId
|
||||
mVideoDurationMs = videoDurationMs
|
||||
}
|
||||
|
||||
fun start() {
|
||||
isRunning = true
|
||||
if (mVideoDurationMs > 0L && mStartMs <= 0) {
|
||||
mStartMs = SystemClock.elapsedRealtime()
|
||||
}
|
||||
mCountHandler.postDelayed(mCounterRunnable, Check_Interval_MS)
|
||||
}
|
||||
|
||||
|
||||
private fun handleNewTick() {
|
||||
NotifyMan.instance().sendEvent(VididinEvents.Event_HOME_WATCH_Time_TICK, null)
|
||||
|
||||
if (!mHasFinishCurVideo && mStartMs > 0L && mVideoDurationMs > 0L) {
|
||||
mTotalMs += (SystemClock.elapsedRealtime() - mStartMs)
|
||||
if (mTotalMs >= RewardConst.FINISH_RATIO * mVideoDurationMs) {
|
||||
mHasFinishCurVideo = true
|
||||
NotifyMan.instance().sendEvent(VididinEvents.Event_Finish_Video,
|
||||
NotifyMan.NotifyData(Pair(mVideoId, System.currentTimeMillis())))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun pause() {
|
||||
if (!isRunning) return
|
||||
isRunning = false
|
||||
mCountHandler.removeCallbacks(mCounterRunnable)
|
||||
mStartMs = 0L
|
||||
}
|
||||
|
||||
|
||||
fun release() {
|
||||
isRunning = false
|
||||
mCounterRunnable.let { mCountHandler.removeCallbacks(it) }
|
||||
}*/
|
||||
|
||||
/*
|
||||
private val mHandlerThread = HandlerThread("HomeCountTimeThread")
|
||||
private val mCountHandler: Handler by lazy {
|
||||
Handler(mHandlerThread.looper)
|
||||
}
|
||||
private val mCounterRunnable by lazy {
|
||||
object : Runnable {
|
||||
override fun run() {
|
||||
if (isRunning) {
|
||||
handleNewTick()
|
||||
mCountHandler.postDelayed(this, Notify_Interval_MS)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Volatile
|
||||
private var isRunning = false
|
||||
|
||||
|
||||
|
||||
|
||||
companion object {
|
||||
const val HOME_WATCH_DURATION = 5 * 1000L
|
||||
const val Notify_Interval_MS = 50L
|
||||
}
|
||||
|
||||
init {
|
||||
mHandlerThread.start()
|
||||
}
|
||||
|
||||
|
||||
@Synchronized
|
||||
fun start() {
|
||||
isRunning = true
|
||||
mCountHandler.postDelayed(mCounterRunnable, Notify_Interval_MS)
|
||||
}
|
||||
|
||||
|
||||
private fun handleNewTick() {
|
||||
NotifyMan.instance().sendEvent(VididinEvents.Event_HOME_WATCH_Time_TICK, null)
|
||||
}
|
||||
|
||||
fun pause() {
|
||||
if (!isRunning) return
|
||||
isRunning = false
|
||||
}
|
||||
|
||||
|
||||
fun release() {
|
||||
isRunning = false
|
||||
mCounterRunnable.let { mCountHandler.removeCallbacks(it) }
|
||||
mHandlerThread.quitSafely()
|
||||
}*/
|
||||
}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape android:shape="rectangle"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="#ff938a84" />
|
||||
<corners android:topLeftRadius="42dp" android:topRightRadius="42dp" android:bottomLeftRadius="42dp" android:bottomRightRadius="42dp" />
|
||||
</shape>
|
||||
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape android:shape="rectangle"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<gradient android:type="linear" android:useLevel="true" android:startColor="#ffff2a2a"
|
||||
android:endColor="#ffff862f" android:angle="90" />
|
||||
<corners android:topLeftRadius="45dp" android:topRightRadius="45dp"
|
||||
android:bottomLeftRadius="45dp" android:bottomRightRadius="45dp" />
|
||||
</shape>
|
||||
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape android:shape="rectangle"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<stroke android:width="2dp" android:color="#ff436af9" />
|
||||
<corners android:topLeftRadius="42dp" android:topRightRadius="42dp" android:bottomLeftRadius="42dp" android:bottomRightRadius="42dp" />
|
||||
</shape>
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape android:shape="rectangle"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<stroke android:width="2dp" android:color="#ff333333" />
|
||||
<corners android:topLeftRadius="42dp" android:topRightRadius="42dp" android:bottomLeftRadius="42dp" android:bottomRightRadius="42dp" />
|
||||
</shape>
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape android:shape="rectangle"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="#ff333333" />
|
||||
<corners android:topLeftRadius="42dp" android:topRightRadius="42dp" android:bottomLeftRadius="42dp" android:bottomRightRadius="42dp" />
|
||||
</shape>
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape android:shape="rectangle"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="#33666666" />
|
||||
<corners android:topLeftRadius="23dp" android:topRightRadius="23dp" android:bottomLeftRadius="23dp" android:bottomRightRadius="23dp" />
|
||||
</shape>
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape android:shape="rectangle"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="#33666666" />
|
||||
<corners android:topLeftRadius="15dp" android:topRightRadius="15dp" android:bottomLeftRadius="15dp" android:bottomRightRadius="15dp" />
|
||||
</shape>
|
||||
|
||||
|
||||
|
|
@ -103,26 +103,33 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/iv_subtask_1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@mipmap/benefit_item_expired"/>
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/tv_expired_cash_num"
|
||||
android:id="@+id/tv_subtask_1_reward"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="6dp"
|
||||
android:layout_gravity="center_horizontal|bottom"
|
||||
android:textSize="12sp"
|
||||
android:textColor="@color/white"
|
||||
android:text="@string/cash01"/>
|
||||
android:text="@string/cash"
|
||||
android:drawableStart="@mipmap/icon_cash_s"
|
||||
android:drawablePadding="3dp"
|
||||
android:gravity="center_vertical"
|
||||
/>
|
||||
</FrameLayout>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/tv_subtask_1_state"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="6dp"
|
||||
android:textSize="12sp"
|
||||
android:textColor="@color/gray_60"
|
||||
android:textStyle="bold"
|
||||
android:text="@string/expired"/>
|
||||
</LinearLayout>
|
||||
|
||||
|
|
@ -137,25 +144,32 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/iv_subtask_2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@mipmap/benefit_item_ongoing"/>
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/tv_ongoing_cash_num"
|
||||
android:src="@mipmap/benefit_item_finished"/>
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/tv_subtask_2_reward"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="6dp"
|
||||
android:layout_gravity="center_horizontal|bottom"
|
||||
android:layout_marginBottom="3dp"
|
||||
android:src="@mipmap/icon_check_mark"/>
|
||||
android:textSize="12sp"
|
||||
android:textColor="@color/white"
|
||||
android:drawableStart="@mipmap/icon_check_mark"
|
||||
android:gravity="center_vertical"
|
||||
/>
|
||||
</FrameLayout>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/tv_subtask_2_state"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="6dp"
|
||||
android:textSize="12sp"
|
||||
android:textColor="@color/green_39"
|
||||
android:text="@string/onging"/>
|
||||
android:textStyle="bold"
|
||||
android:text="@string/finished"/>
|
||||
</LinearLayout>
|
||||
|
||||
<!--items-3-->
|
||||
|
|
@ -169,32 +183,41 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/iv_subtask_3"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@mipmap/benefit_item_waitting"/>
|
||||
android:src="@mipmap/benefit_item_ongoing"/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/tv_waiting_cash_num"
|
||||
android:id="@+id/tv_subtask_3_reward"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="6dp"
|
||||
android:layout_gravity="center_horizontal|bottom"
|
||||
android:textSize="12sp"
|
||||
android:textColor="@color/white"
|
||||
android:text="@string/cash01"/>
|
||||
android:text="@string/cash"
|
||||
android:drawableStart="@mipmap/icon_cash_s"
|
||||
android:drawablePadding="3dp"
|
||||
android:gravity="center_vertical"
|
||||
/>
|
||||
</FrameLayout>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/tv_subtask_3_state"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="6dp"
|
||||
android:textSize="12sp"
|
||||
android:textColor="@color/red_5c"
|
||||
android:text="@string/waitting"/>
|
||||
android:textStyle="bold"
|
||||
android:text="@string/ongoing"/>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/tv_resgatar"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="25dp"
|
||||
|
|
@ -217,18 +240,36 @@
|
|||
android:padding="15dp"
|
||||
android:orientation="vertical"
|
||||
android:layout_marginHorizontal="15dp">
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:paddingVertical="15dp"
|
||||
android:paddingHorizontal="5dp"
|
||||
android:textSize="15sp"
|
||||
android:background="@drawable/bg_benefit_tasks_top"
|
||||
android:gravity="center"
|
||||
android:layout_gravity="bottom|center_horizontal"
|
||||
android:orientation="horizontal">
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="15sp"
|
||||
android:textStyle="bold"
|
||||
android:gravity="center_vertical"
|
||||
android:textColor="@color/black_33"
|
||||
android:text="@string/benefit_task_top_hint"/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/tv_hint_reward_num"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="15sp"
|
||||
android:textStyle="bold"
|
||||
android:layout_marginStart="5dp"
|
||||
android:gravity="center_vertical"
|
||||
android:textColor="@color/red_5c"
|
||||
android:text="@string/cash"/>
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
|
|
@ -266,47 +307,11 @@
|
|||
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_sub_task_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="20dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="@color/gray_f2"
|
||||
/>
|
||||
<com.gamedog.vididin.features.benefit.widget.BenefitTaskItemView
|
||||
android:id="@+id/task_item_1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginVertical="20dp"
|
||||
/>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="@color/gray_f2"
|
||||
/>
|
||||
<com.gamedog.vididin.features.benefit.widget.BenefitTaskItemView
|
||||
android:id="@+id/task_item_2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginVertical="20dp"
|
||||
/>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="@color/gray_f2"
|
||||
/>
|
||||
<com.gamedog.vididin.features.benefit.widget.BenefitTaskItemView
|
||||
android:id="@+id/task_item_3"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginVertical="20dp"
|
||||
/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:background="@color/white"
|
||||
android:id="@+id/content_root" >
|
||||
|
||||
<com.ama.core.architecture.widget.CustomTitleBar
|
||||
|
|
@ -11,201 +12,18 @@
|
|||
android:layout_height="wrap_content"
|
||||
/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="15dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/tv_date_win"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="15dp"
|
||||
android:textSize="12sp"
|
||||
android:textColor="@color/gray6"
|
||||
android:text="2025/10/31"
|
||||
/>
|
||||
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:background="@drawable/bg_records_win"
|
||||
android:layout_marginTop="5dp"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingVertical="5dp"
|
||||
>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/iv_left_win"
|
||||
android:layout_width="45dp"
|
||||
android:layout_height="45dp"
|
||||
android:src="@mipmap/record_win"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginLeft="15dp"
|
||||
/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:layout_marginHorizontal="10dp"
|
||||
android:layout_toRightOf="@+id/iv_left_win"
|
||||
android:layout_toLeftOf="@+id/ll_right_win"
|
||||
android:layout_centerVertical="true"
|
||||
>
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/tv_title_win"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="15sp"
|
||||
android:textColor="@color/white"
|
||||
android:text="@string/record_win_item_title"
|
||||
/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/tv_desc_win"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dp"
|
||||
android:textSize="14sp"
|
||||
android:textColor="@color/white_alpha_99"
|
||||
android:text="@string/record_win_item_desc"
|
||||
/>
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_right_win"
|
||||
android:layout_width="75dp"
|
||||
android:layout_height="75dp"
|
||||
android:orientation="vertical"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginRight="5dp"
|
||||
android:background="@mipmap/bg_record_win_rgiht"
|
||||
android:paddingHorizontal="6dp"
|
||||
android:gravity="center_horizontal"
|
||||
>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/tv_win_right_top"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:textStyle="bold"
|
||||
android:textSize="15sp"
|
||||
android:textColor="@color/yellow_00"
|
||||
android:text="Ganhar"
|
||||
/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/tv_win_right_bottom"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="11dp"
|
||||
android:textSize="10sp"
|
||||
android:textColor="@color/green_54"
|
||||
android:text="Ver detalhes"
|
||||
/>
|
||||
</LinearLayout>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/tv_date_lost"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="15dp"
|
||||
android:textSize="12sp"
|
||||
android:textColor="@color/gray6"
|
||||
android:text="2025/10/31"
|
||||
/>
|
||||
|
||||
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:background="@drawable/bg_records_lost"
|
||||
android:layout_marginTop="5dp"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingVertical="5dp"
|
||||
>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/iv_left_lost"
|
||||
android:layout_width="45dp"
|
||||
android:layout_height="45dp"
|
||||
android:src="@mipmap/record_lost"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginLeft="15dp"
|
||||
/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:layout_marginHorizontal="10dp"
|
||||
android:layout_toRightOf="@+id/iv_left_lost"
|
||||
android:layout_toLeftOf="@+id/ll_right_lost"
|
||||
android:layout_centerVertical="true"
|
||||
>
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/tv_title_lost"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="15sp"
|
||||
android:textColor="@color/white"
|
||||
android:text="@string/record_lost_item_title"
|
||||
/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/tv_desc_lost"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dp"
|
||||
android:textSize="14sp"
|
||||
android:textColor="@color/white_alpha_99"
|
||||
android:text="@string/record_lost_item_desc"
|
||||
/>
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/ll_right_lost"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginEnd="5dp"
|
||||
android:background="@mipmap/bg_record_lost_rgiht"
|
||||
android:paddingHorizontal="6dp"
|
||||
android:gravity="center"
|
||||
>
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/tv_lost_right_top"
|
||||
android:layout_width="75dp"
|
||||
android:layout_height="75dp"
|
||||
android:textStyle="bold"
|
||||
android:gravity="center"
|
||||
android:layout_gravity="center"
|
||||
android:textSize="15sp"
|
||||
android:textColor="@color/gray9"
|
||||
android:text="@string/not_win"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_marginHorizontal="15dp" >
|
||||
<WebView
|
||||
android:id="@+id/web_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
/>
|
||||
</FrameLayout>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -13,194 +13,32 @@
|
|||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="15dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_marginTop="50dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/tv_date_win"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="15dp"
|
||||
android:textSize="12sp"
|
||||
android:textColor="@color/gray6"
|
||||
android:text="2025/10/31"
|
||||
/>
|
||||
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:background="@drawable/bg_records_win"
|
||||
android:layout_marginTop="5dp"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingVertical="5dp"
|
||||
>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/iv_left_win"
|
||||
android:layout_width="45dp"
|
||||
android:layout_height="45dp"
|
||||
android:src="@mipmap/record_win"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginLeft="15dp"
|
||||
/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:layout_marginHorizontal="10dp"
|
||||
android:layout_toRightOf="@+id/iv_left_win"
|
||||
android:layout_toLeftOf="@+id/ll_right_win"
|
||||
android:layout_centerVertical="true"
|
||||
>
|
||||
android:layout_marginHorizontal="15dp">
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/tv_title_win"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="15sp"
|
||||
android:textColor="@color/white"
|
||||
android:text="@string/record_win_item_title"
|
||||
/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/tv_desc_win"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dp"
|
||||
android:textSize="14sp"
|
||||
android:textColor="@color/white_alpha_99"
|
||||
android:text="@string/record_win_item_desc"
|
||||
/>
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_right_win"
|
||||
android:layout_width="75dp"
|
||||
android:layout_height="75dp"
|
||||
android:orientation="vertical"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginRight="5dp"
|
||||
android:background="@mipmap/bg_record_win_rgiht"
|
||||
android:paddingHorizontal="6dp"
|
||||
android:gravity="center_horizontal"
|
||||
>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/tv_win_right_top"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:textStyle="bold"
|
||||
android:textSize="15sp"
|
||||
android:textColor="@color/yellow_00"
|
||||
android:text="Ganhar"
|
||||
/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/tv_win_right_bottom"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="11dp"
|
||||
android:textSize="10sp"
|
||||
android:textColor="@color/green_54"
|
||||
android:text="Ver detalhes"
|
||||
/>
|
||||
</LinearLayout>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/tv_date_lost"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="15dp"
|
||||
android:textSize="12sp"
|
||||
android:textColor="@color/gray6"
|
||||
android:text="2025/10/31"
|
||||
/>
|
||||
|
||||
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:background="@drawable/bg_records_lost"
|
||||
android:layout_marginTop="5dp"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingVertical="5dp"
|
||||
>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/iv_left_lost"
|
||||
android:layout_width="45dp"
|
||||
android:layout_height="45dp"
|
||||
android:src="@mipmap/record_lost"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginLeft="15dp"
|
||||
/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:layout_marginHorizontal="10dp"
|
||||
android:layout_toRightOf="@+id/iv_left_lost"
|
||||
android:layout_toLeftOf="@+id/ll_right_lost"
|
||||
android:layout_centerVertical="true"
|
||||
>
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/tv_title_lost"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="15sp"
|
||||
android:textColor="@color/white"
|
||||
android:text="@string/record_lost_item_title"
|
||||
android:text="@string/cur_version"
|
||||
/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/tv_desc_lost"
|
||||
android:id="@+id/tv_version"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dp"
|
||||
android:textSize="14sp"
|
||||
android:textColor="@color/white_alpha_99"
|
||||
android:text="@string/record_lost_item_desc"
|
||||
/>
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/ll_right_lost"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginEnd="5dp"
|
||||
android:background="@mipmap/bg_record_lost_rgiht"
|
||||
android:paddingHorizontal="6dp"
|
||||
android:gravity="center"
|
||||
>
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/tv_lost_right_top"
|
||||
android:layout_width="75dp"
|
||||
android:layout_height="75dp"
|
||||
android:textSize="13sp"
|
||||
android:textStyle="bold"
|
||||
android:gravity="center"
|
||||
android:layout_gravity="center"
|
||||
android:textSize="15sp"
|
||||
android:textColor="@color/gray9"
|
||||
android:text="@string/not_win"
|
||||
android:textColor="@color/black"
|
||||
/>
|
||||
</FrameLayout>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,33 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/tv_date_win"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@mipmap/bg_record_win_rgiht"
|
||||
/>
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/content_root"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/tv_ad_counter"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:textSize="18sp"
|
||||
android:textColor="@color/white"
|
||||
android:text="ad showing"
|
||||
/>
|
||||
</FrameLayout>
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
|
||||
|
|
@ -1,13 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
android:layout_height="wrap_content" >
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
|
@ -15,17 +11,26 @@
|
|||
android:scaleType="centerCrop"
|
||||
/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/content_root"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
<com.ama.core.architecture.widget.CustomTitleBar
|
||||
android:id="@+id/titlebar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
/>
|
||||
|
||||
<androidx.core.widget.NestedScrollView
|
||||
android:id="@+id/content_root"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
|
@ -92,8 +97,114 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical"
|
||||
android:gravity="center_horizontal"
|
||||
android:background="@mipmap/zero_bg_item">
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="4.5dp"
|
||||
android:textColor="@color/red_1b"
|
||||
android:textSize="15sp"
|
||||
android:text="@string/zero_buy_title"
|
||||
/>
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="7.5dp">
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@mipmap/zero_bg_item_sub1"
|
||||
/>
|
||||
</FrameLayout>
|
||||
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="4.5dp"
|
||||
android:textColor="@color/gray9"
|
||||
android:textSize="10sp"
|
||||
android:text="@string/sorte"
|
||||
/>
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="0.5dp"
|
||||
android:orientation="horizontal">
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="4.5dp"
|
||||
android:textColor="@color/red_28"
|
||||
android:textSize="13sp"
|
||||
android:textStyle="bold"
|
||||
android:text="0"
|
||||
/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="4.5dp"
|
||||
android:textColor="@color/gray3"
|
||||
android:textSize="13sp"
|
||||
android:textStyle="bold"
|
||||
android:text="/10"
|
||||
/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="4.5dp"
|
||||
android:textColor="@color/gray3"
|
||||
android:layout_marginStart="5dp"
|
||||
android:textSize="13sp"
|
||||
android:text="@string/pessoas"
|
||||
/>
|
||||
</LinearLayout>
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dp">
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@mipmap/zero_bg_but"
|
||||
/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:gravity="center"
|
||||
android:layout_gravity="center_horizontal">
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/white"
|
||||
android:layout_marginStart="5dp"
|
||||
android:textSize="14sp"
|
||||
android:text="@string/participar"
|
||||
/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/white"
|
||||
android:layout_marginStart="5dp"
|
||||
android:gravity="center_vertical"
|
||||
android:textSize="10sp"
|
||||
android:text="0"
|
||||
android:drawableStart="@mipmap/icon_gold_ss"
|
||||
android:drawablePadding="3dp"
|
||||
/>
|
||||
|
||||
</LinearLayout>
|
||||
</FrameLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
|
|
@ -141,16 +252,81 @@
|
|||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<!--参加者-->
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="20dp"
|
||||
android:padding="15dp"
|
||||
android:layout_marginHorizontal="16dp"
|
||||
android:background="@drawable/bg_zero_buy_bottom">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="4.5dp"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="12sp"
|
||||
android:text="@string/participar_member"
|
||||
/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="4.5dp"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="12sp"
|
||||
android:text="@string/participar_member_2"
|
||||
/>
|
||||
</LinearLayout>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
|
||||
<!--提示信息-->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:layout_marginTop="30dp"
|
||||
android:gravity="center"
|
||||
android:padding="15dp"
|
||||
android:background="@drawable/bg_zero_buy_bottom_hint">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/red_9c"
|
||||
android:textSize="12sp"
|
||||
android:text="@string/zero_buy_hint_title"
|
||||
/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/red_9c"
|
||||
android:layout_marginTop="20dp"
|
||||
android:textSize="10sp"
|
||||
android:text="@string/zero_buy_hint_content"
|
||||
/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</FrameLayout>
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
</FrameLayout>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@
|
|||
android:textSize="14sp"
|
||||
android:textStyle="bold"
|
||||
android:textColor="@color/gray6"
|
||||
android:text="(1/5)"
|
||||
android:text="(0/5)"
|
||||
/>
|
||||
</LinearLayout>
|
||||
|
||||
|
|
@ -112,11 +112,11 @@
|
|||
android:layout_alignParentRight="true"
|
||||
android:layout_marginLeft="9dp"
|
||||
android:gravity="center"
|
||||
android:background="@drawable/vididinapp_feature_message_bg_task_fazer"
|
||||
android:background="@drawable/bg_sub_task_normal"
|
||||
android:textSize="14sp"
|
||||
android:textStyle="bold"
|
||||
android:textColor="@color/white"
|
||||
android:text="@string/resgatar"
|
||||
android:text="@string/go_and_do"
|
||||
/>
|
||||
</RelativeLayout>
|
||||
</LinearLayout>
|
||||
|
|
|
|||
|
|
@ -54,12 +54,12 @@
|
|||
/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/tv_gold_num"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="28sp"
|
||||
android:textStyle="bold"
|
||||
android:textColor="@color/red_5c"
|
||||
android:text="+100"
|
||||
android:layout_gravity="bottom|center"
|
||||
android:layout_marginBottom="110dp"
|
||||
/>
|
||||
|
|
|
|||
|
|
@ -1,76 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/iv_close"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:layout_gravity="end"
|
||||
android:src="@mipmap/icon_close_with_circle"
|
||||
android:layout_marginEnd="30dp"
|
||||
/>
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:padding="15dp"
|
||||
android:layout_marginTop="60dp"
|
||||
android:clipChildren="false"
|
||||
android:gravity="center_horizontal"
|
||||
android:background="@drawable/bg_benefit_top_white"
|
||||
>
|
||||
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/tv_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:textSize="18sp"
|
||||
android:textColor="@color/black_28"
|
||||
android:text="@string/zero_buy_rule_dialog_title"
|
||||
/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/tv_desc"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="15dp"
|
||||
android:textSize="14sp"
|
||||
android:textColor="@color/gray6"
|
||||
android:text="@string/zero_buy_rule_dialog_descript"
|
||||
/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/tv_rules_1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:textSize="14sp"
|
||||
android:textColor="@color/gray9"
|
||||
android:text="@string/zero_buy_rule_dialog_rule"
|
||||
/>
|
||||
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/tv_confirm"
|
||||
android:layout_width="240dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:background="@drawable/bg_but_zero_buy_dialog"
|
||||
android:textSize="18sp"
|
||||
android:textColor="@color/white"
|
||||
android:text="@string/understood"
|
||||
android:gravity="center"
|
||||
/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</FrameLayout>
|
||||
|
|
@ -1,8 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="270dp"
|
||||
android:layout_height="wrap_content"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:clipChildren="false">
|
||||
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
|
|
@ -13,64 +14,104 @@
|
|||
android:layout_gravity="end"
|
||||
android:src="@mipmap/icon_close_with_circle"
|
||||
android:layout_marginEnd="30dp"
|
||||
android:layout_marginTop="10dp"
|
||||
/>
|
||||
|
||||
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="60dp"
|
||||
>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:src="@drawable/bg_benefit_top_white"
|
||||
android:layout_marginTop="30dp"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintDimensionRatio="h, 900:1026"
|
||||
/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="0dp"
|
||||
android:src="@mipmap/icon_withdraw_fail"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:padding="15dp"
|
||||
android:layout_marginTop="60dp"
|
||||
android:clipChildren="false"
|
||||
android:gravity="center_horizontal"
|
||||
android:background="@drawable/bg_benefit_top_white"
|
||||
>
|
||||
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:layout_marginTop="90dp"
|
||||
android:layout_marginHorizontal="30dp">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/tv_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:textSize="18sp"
|
||||
android:textColor="@color/black_28"
|
||||
android:text="@string/zero_buy_rule_dialog_title"
|
||||
android:textStyle="bold"
|
||||
android:textColor="@color/gray3"
|
||||
android:text="@string/withdraw_fail_title"
|
||||
/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/tv_desc"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="15dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:textSize="14sp"
|
||||
android:textStyle="bold"
|
||||
android:textColor="@color/gray6"
|
||||
android:text="@string/zero_buy_rule_dialog_descript"
|
||||
android:text="@string/withdraw_fail_desc"
|
||||
/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/tv_rules_1"
|
||||
android:layout_width="wrap_content"
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:textSize="14sp"
|
||||
android:textColor="@color/gray9"
|
||||
android:text="@string/zero_buy_rule_dialog_rule"
|
||||
/>
|
||||
|
||||
android:orientation="horizontal"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:layout_marginHorizontal="30dp"
|
||||
android:layout_marginBottom="40dp" >
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/tv_confirm"
|
||||
android:layout_width="240dp"
|
||||
android:id="@+id/tv_action_feedback"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:background="@drawable/bg_but_zero_buy_dialog"
|
||||
android:textSize="18sp"
|
||||
android:textColor="@color/white"
|
||||
android:text="@string/understood"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:background="@drawable/bg_withdraw_failed_but_left"
|
||||
android:textSize="18sp"
|
||||
android:textColor="@color/gray3"
|
||||
android:text="@string/feedback"
|
||||
/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/tv_action_confirm"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_marginStart="20dp"
|
||||
android:background="@drawable/bg_withdraw_failed_but_right"
|
||||
android:textSize="18sp"
|
||||
android:gravity="center"
|
||||
android:textColor="@color/white"
|
||||
android:text="@string/confirm"
|
||||
/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</FrameLayout>
|
||||
|
|
@ -0,0 +1,257 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="300dp"
|
||||
android:layout_height="wrap_content"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:clipChildren="false">
|
||||
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/iv_close"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:layout_gravity="end"
|
||||
android:src="@mipmap/icon_close_with_circle"
|
||||
android:layout_marginEnd="30dp"
|
||||
android:layout_marginTop="10dp"
|
||||
/>
|
||||
|
||||
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="60dp"
|
||||
>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:src="@mipmap/bg_withdraw_info_confirm_dialog"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintDimensionRatio="h, 900:1026"
|
||||
/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:layout_marginTop="40dp"
|
||||
android:layout_marginHorizontal="30dp">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="15sp"
|
||||
android:textStyle="bold"
|
||||
android:textColor="@color/gray3"
|
||||
android:text="@string/withdraw_confirm_bank_name_title"
|
||||
/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/tv_bank_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:textSize="14sp"
|
||||
android:textColor="@color/green_ad"
|
||||
android:drawableStart="@mipmap/pix_small"
|
||||
/>
|
||||
</RelativeLayout>
|
||||
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="26dp">
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="15sp"
|
||||
android:textStyle="bold"
|
||||
android:textColor="@color/gray3"
|
||||
android:text="@string/withdraw_confirm_auth_type"
|
||||
/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/tv_auth_type"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:textSize="14sp"
|
||||
android:textColor="@color/gray6"
|
||||
android:text="@string/cpf"
|
||||
/>
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="26dp">
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="15sp"
|
||||
android:textStyle="bold"
|
||||
android:textColor="@color/gray3"
|
||||
android:text="@string/withdraw_confirm_bank_account"
|
||||
/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/tv_cpf_account"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:textSize="14sp"
|
||||
android:textColor="@color/green_39"
|
||||
android:text=""
|
||||
/>
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="26dp">
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="15sp"
|
||||
android:textStyle="bold"
|
||||
android:textColor="@color/gray3"
|
||||
android:text="@string/withdraw_confirm_cash_num"
|
||||
/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/tv_cash_num"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:textSize="14sp"
|
||||
android:textColor="@color/green_39"
|
||||
android:text="@string/cash"
|
||||
/>
|
||||
</RelativeLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:layout_marginHorizontal="30dp"
|
||||
android:layout_marginBottom="40dp" >
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/tv_action_alter"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_weight="1"
|
||||
android:paddingHorizontal="14dp"
|
||||
android:gravity="center"
|
||||
android:background="@drawable/bg_withdraw_confirm_but_left"
|
||||
android:textSize="18sp"
|
||||
android:textColor="@color/blue_f9"
|
||||
android:text="@string/alter"
|
||||
/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/tv_action_apply"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_marginStart="20dp"
|
||||
android:background="@drawable/bg_but_zero_buy_dialog"
|
||||
android:textSize="18sp"
|
||||
android:gravity="center"
|
||||
android:textColor="@color/white"
|
||||
android:text="@string/apply"
|
||||
/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@mipmap/withdraw_info_confirm_title"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginTop="50dp"
|
||||
/>
|
||||
|
||||
|
||||
|
||||
<!--
|
||||
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:padding="15dp"
|
||||
android:layout_marginTop="60dp"
|
||||
android:clipChildren="false"
|
||||
android:gravity="center_horizontal"
|
||||
android:background="@drawable/bg_benefit_top_white"
|
||||
>
|
||||
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/tv_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:textSize="18sp"
|
||||
android:textColor="@color/black_28"
|
||||
android:text="@string/zero_buy_rule_dialog_title"
|
||||
/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/tv_desc"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="15dp"
|
||||
android:textSize="14sp"
|
||||
android:textColor="@color/gray6"
|
||||
android:text="@string/zero_buy_rule_dialog_descript"
|
||||
/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/tv_rules_1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:textSize="14sp"
|
||||
android:textColor="@color/gray9"
|
||||
android:text="@string/zero_buy_rule_dialog_rule"
|
||||
/>
|
||||
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/tv_confirm"
|
||||
android:layout_width="240dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:background="@drawable/bg_but_zero_buy_dialog"
|
||||
android:textSize="18sp"
|
||||
android:textColor="@color/white"
|
||||
android:text="@string/understood"
|
||||
android:gravity="center"
|
||||
/>
|
||||
|
||||
</LinearLayout>
|
||||
-->
|
||||
|
||||
</FrameLayout>
|
||||
|
|
@ -1,76 +1,95 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:gravity="center_horizontal"
|
||||
android:clipChildren="false"
|
||||
android:background="@mipmap/bg_withdrarw_sucess">
|
||||
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="20dp"
|
||||
android:textSize="40sp"
|
||||
android:textColor="@color/yellow_00"
|
||||
android:text="@string/success"
|
||||
/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@mipmap/icon_withdraw_success"
|
||||
/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical|top"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginTop="15dp"
|
||||
android:orientation="horizontal">
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="30sp"
|
||||
android:textStyle="bold"
|
||||
android:textColor="@color/green_2c"
|
||||
android:text="@string/cash"
|
||||
android:drawableStart="@mipmap/icon_cash"
|
||||
/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/tv_cash_num"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="5dp"
|
||||
android:textSize="30sp"
|
||||
android:textStyle="bold"
|
||||
android:textColor="@color/green_2c"
|
||||
/>
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="20dp"
|
||||
android:textSize="14sp"
|
||||
android:textColor="@color/white"
|
||||
android:text="@string/withdraw_success_hint"
|
||||
/>
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/fl_action"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="50dp"
|
||||
android:layout_marginTop="50dp"
|
||||
android:background="@mipmap/bg_but_green" >
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:padding="8dp"
|
||||
android:textSize="18sp"
|
||||
android:textColor="@color/white"
|
||||
android:text="@string/confirm"
|
||||
/>
|
||||
</FrameLayout>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/iv_close"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="50dp"
|
||||
android:orientation="vertical"
|
||||
android:layout_gravity="end"
|
||||
android:layout_gravity="bottom|center"
|
||||
android:src="@mipmap/icon_close_with_circle"
|
||||
android:layout_marginEnd="30dp"
|
||||
/>
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:padding="15dp"
|
||||
android:layout_marginTop="60dp"
|
||||
android:clipChildren="false"
|
||||
android:gravity="center_horizontal"
|
||||
android:background="@drawable/bg_benefit_top_white"
|
||||
>
|
||||
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/tv_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:textSize="18sp"
|
||||
android:textColor="@color/black_28"
|
||||
android:text="@string/zero_buy_rule_dialog_title"
|
||||
/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/tv_desc"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="15dp"
|
||||
android:textSize="14sp"
|
||||
android:textColor="@color/gray6"
|
||||
android:text="@string/zero_buy_rule_dialog_descript"
|
||||
/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/tv_rules_1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:textSize="14sp"
|
||||
android:textColor="@color/gray9"
|
||||
android:text="@string/zero_buy_rule_dialog_rule"
|
||||
/>
|
||||
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/tv_confirm"
|
||||
android:layout_width="240dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:background="@drawable/bg_but_zero_buy_dialog"
|
||||
android:textSize="18sp"
|
||||
android:textColor="@color/white"
|
||||
android:text="@string/understood"
|
||||
android:gravity="center"
|
||||
/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</FrameLayout>
|
||||
|
|
@ -0,0 +1,149 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="270dp"
|
||||
android:layout_height="wrap_content"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:clipChildren="false">
|
||||
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/iv_close"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:layout_gravity="end"
|
||||
android:src="@mipmap/icon_close_with_circle"
|
||||
android:layout_marginEnd="30dp"
|
||||
android:layout_marginTop="10dp"
|
||||
/>
|
||||
|
||||
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="60dp"
|
||||
>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:src="@mipmap/withdraw_watch_ad_bg"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintDimensionRatio="h, 810:1209"
|
||||
/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:gravity="center_horizontal"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:layout_marginTop="20dp"
|
||||
android:layout_marginHorizontal="30dp">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@mipmap/withdraw_info_confirm_title"
|
||||
/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="20dp"
|
||||
android:textSize="15sp"
|
||||
android:textColor="@color/white"
|
||||
android:text="@string/withdraw_ad_hint"
|
||||
/>
|
||||
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@mipmap/withdraw_watch_ad_cahs_bg"
|
||||
android:layout_marginTop="20dp"
|
||||
/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical|top"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginTop="30dp"
|
||||
android:orientation="horizontal">
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="30sp"
|
||||
android:textColor="@color/green_2c"
|
||||
android:text="@string/cash"
|
||||
android:drawableStart="@mipmap/icon_cash"
|
||||
/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/tv_cash_num"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="5dp"
|
||||
android:textSize="30sp"
|
||||
android:textColor="@color/green_2c"
|
||||
/>
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
|
||||
<com.ama.core.architecture.widget.CustomProgressBar
|
||||
android:id="@+id/progress_bar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="12dp"
|
||||
android:layout_marginHorizontal="40dp"
|
||||
android:layout_gravity="bottom"
|
||||
android:layout_marginBottom="20dp"
|
||||
/>
|
||||
</FrameLayout>
|
||||
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/tv_hint"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="5dp"
|
||||
android:layout_marginTop="30dp"
|
||||
android:padding="8dp"
|
||||
android:textSize="14sp"
|
||||
android:textColor="@color/gray3"
|
||||
android:text="@string/withdraw_watch_ad_hint"
|
||||
android:background="@mipmap/withdraw_watch_ad_hint_bg"
|
||||
/>
|
||||
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/fl_action"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="50dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:background="@mipmap/bg_but_green" >
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:padding="8dp"
|
||||
android:textSize="18sp"
|
||||
android:textColor="@color/white"
|
||||
android:text="@string/withdraw_watch_ad_action"
|
||||
android:drawableStart="@mipmap/task_video"
|
||||
android:drawablePadding="5dp"
|
||||
/>
|
||||
</FrameLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</FrameLayout>
|
||||
|
|
@ -6,13 +6,13 @@
|
|||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:orientation="vertical"
|
||||
android:gravity="center_horizontal"
|
||||
android:paddingVertical="7dp"
|
||||
tools:ignore="ResourceName">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_horizontal"
|
||||
android:padding="8dp"
|
||||
android:orientation="vertical">
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_gold_root"
|
||||
|
|
@ -20,7 +20,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:gravity="center_vertical"
|
||||
android:visibility="gone"
|
||||
android:visibility="invisible"
|
||||
>
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
|
|
@ -50,7 +50,7 @@
|
|||
app:backgroundColor="@color/progress_background"
|
||||
app:progressWidth="2dp"
|
||||
app:centerIcon="@mipmap/home_envelope"
|
||||
app:currentProgress="35"
|
||||
app:currentProgress="0"
|
||||
app:maxProgress="100"
|
||||
/>
|
||||
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@
|
|||
android:orientation="vertical"/>
|
||||
|
||||
<com.gamedog.vididin.widget.HomeDragIconView
|
||||
android:id="@+id/drag_icon_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="40dp"
|
||||
|
|
|
|||
|
|
@ -42,25 +42,36 @@
|
|||
android:id="@+id/tv_video_from"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:singleLine="true"
|
||||
android:text="From"
|
||||
android:textSize="15sp"
|
||||
android:textColor="@color/white" />
|
||||
|
||||
<androidx.core.widget.NestedScrollView
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="100dp"
|
||||
android:layout_marginTop="10dp"
|
||||
>
|
||||
|
||||
android:layout_height="wrap_content">
|
||||
<TextView
|
||||
android:id="@+id/tv_video_intro"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dp"
|
||||
android:text="introduce"
|
||||
android:clickable="false"
|
||||
android:maxLines="2"
|
||||
android:layout_marginEnd="45dp"
|
||||
android:textSize="15sp"
|
||||
android:textColor="@color/white_al80" />
|
||||
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/iv_intro_expand"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:paddingHorizontal="10dp"
|
||||
android:paddingVertical="5dp"
|
||||
android:layout_gravity="right|bottom"
|
||||
android:src="@mipmap/arrow_up"
|
||||
/>
|
||||
</FrameLayout>
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<com.ama.core.architecture.widget.MyScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/scroll_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#666666"
|
||||
|
|
@ -79,8 +80,8 @@
|
|||
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/tv_watch_video"
|
||||
android:layout_width="wrap_content"
|
||||
android:id="@+id/tv_watch_video_for_convert_gold_to_cash"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginLeft="8dp"
|
||||
|
|
@ -144,7 +145,7 @@
|
|||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/tv_withdraw"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textStyle="bold"
|
||||
android:textSize="15sp"
|
||||
|
|
@ -201,6 +202,7 @@
|
|||
/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/tv_box_task_state"
|
||||
android:layout_width="58dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
|
|
@ -222,7 +224,7 @@
|
|||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_task_watch_video"
|
||||
android:id="@+id/ll_task_watch_ad"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
|
|
@ -235,13 +237,16 @@
|
|||
/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:layout_width="58dp"
|
||||
android:id="@+id/tv_ad_watch_reward_num"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:layout_marginTop="-18dp"
|
||||
android:text="3 dias"
|
||||
android:layout_marginTop="-20dp"
|
||||
android:text="200"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="10sp"
|
||||
android:drawablePadding="3dp"
|
||||
android:drawableStart="@mipmap/home_gold"
|
||||
/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
|
|
@ -269,6 +274,7 @@
|
|||
/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/tv_game_task_state"
|
||||
android:layout_width="58dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
|
|
@ -304,6 +310,7 @@
|
|||
/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/tv_zero_buy_state"
|
||||
android:layout_width="58dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
|
|
@ -405,6 +412,7 @@
|
|||
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/newbie_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="20dp"
|
||||
|
|
@ -473,66 +481,13 @@
|
|||
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/daily_tasks_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="20dp"
|
||||
android:paddingHorizontal="15dp"
|
||||
android:background="@drawable/vididinapp_feature_message_bg_task_login"
|
||||
android:orientation="vertical">
|
||||
<com.gamedog.vididin.main.fragments.task.widget.DailyTaskItemView
|
||||
android:id="@+id/daily_task_watch_1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
/>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="@color/gray_f2"
|
||||
/>
|
||||
|
||||
<com.gamedog.vididin.main.fragments.task.widget.DailyTaskItemView
|
||||
android:id="@+id/daily_task_watch_5"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
/>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="@color/gray_f2"
|
||||
/>
|
||||
|
||||
<com.gamedog.vididin.main.fragments.task.widget.DailyTaskItemView
|
||||
android:id="@+id/daily_task_watch_10"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
/>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="@color/gray_f2"
|
||||
/>
|
||||
|
||||
<com.gamedog.vididin.main.fragments.task.widget.DailyTaskItemView
|
||||
android:id="@+id/daily_task_watch_20"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
/>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="@color/gray_f2"
|
||||
/>
|
||||
|
||||
<com.gamedog.vididin.main.fragments.task.widget.DailyTaskItemView
|
||||
android:id="@+id/daily_task_watch_30"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
|
@ -541,4 +496,4 @@
|
|||
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
</com.ama.core.architecture.widget.MyScrollView>
|
||||
|
After Width: | Height: | Size: 1.7 KiB |
|
After Width: | Height: | Size: 1.6 KiB |
|
After Width: | Height: | Size: 19 KiB |
|
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 21 KiB |
|
Before Width: | Height: | Size: 21 KiB |
|
After Width: | Height: | Size: 252 KiB |
|
After Width: | Height: | Size: 161 KiB |