新手,日常任务 子view
This commit is contained in:
parent
615784f8fb
commit
1fd647baff
|
|
@ -9,7 +9,6 @@ import androidx.fragment.app.viewModels
|
||||||
import androidx.lifecycle.lifecycleScope
|
import androidx.lifecycle.lifecycleScope
|
||||||
import com.ama.core.architecture.appBase.AppViewsFragment
|
import com.ama.core.architecture.appBase.AppViewsFragment
|
||||||
import com.ama.core.architecture.appBase.OnFragmentBackgroundListener
|
import com.ama.core.architecture.appBase.OnFragmentBackgroundListener
|
||||||
import com.ama.core.architecture.util.SpUtil
|
|
||||||
import com.ama.core.architecture.util.setOnClickBatch
|
import com.ama.core.architecture.util.setOnClickBatch
|
||||||
import com.ama.core.architecture.util.setStatusBarDarkFont
|
import com.ama.core.architecture.util.setStatusBarDarkFont
|
||||||
import com.gamedog.vididin.main.fragments.task.DailySignDialog
|
import com.gamedog.vididin.main.fragments.task.DailySignDialog
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,39 @@
|
||||||
|
package com.gamedog.vididin.main.fragments.task.widget
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import android.util.AttributeSet
|
||||||
|
import android.view.LayoutInflater
|
||||||
|
import android.widget.LinearLayout
|
||||||
|
import com.gamedog.vididin.databinding.BeginnerTaskItemViewBinding
|
||||||
|
|
||||||
|
|
||||||
|
class BeginnerTaskItemView @JvmOverloads constructor(
|
||||||
|
context: Context,
|
||||||
|
attrs: AttributeSet? = null,
|
||||||
|
defStyleAttr: Int = 0
|
||||||
|
) : LinearLayout(context, attrs, defStyleAttr) {
|
||||||
|
private lateinit var mBinding: BeginnerTaskItemViewBinding
|
||||||
|
|
||||||
|
|
||||||
|
init {
|
||||||
|
mBinding = BeginnerTaskItemViewBinding.inflate(LayoutInflater.from(context), this, true)
|
||||||
|
mBinding.run {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
fun initUI(titleIconRes: Int, titleRes: Int, actionRes: Int) {
|
||||||
|
mBinding.ivItemIcon.setImageResource(titleIconRes)
|
||||||
|
mBinding.tvItemTitle.setText(titleRes)
|
||||||
|
mBinding.tvAction.setText(actionRes)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
fun setRewardInfo(rewardIconRes: Int, rewardNum: Int) {
|
||||||
|
mBinding.tvRewardNum.text = "" + rewardNum
|
||||||
|
mBinding.ivRewardIcon.setImageResource(rewardIconRes)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,44 @@
|
||||||
|
package com.gamedog.vididin.main.fragments.task.widget
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import android.util.AttributeSet
|
||||||
|
import android.view.LayoutInflater
|
||||||
|
import android.widget.LinearLayout
|
||||||
|
import com.gamedog.vididin.databinding.DailyTaskItemViewBinding
|
||||||
|
|
||||||
|
|
||||||
|
class DailyTaskItemView @JvmOverloads constructor(
|
||||||
|
context: Context,
|
||||||
|
attrs: AttributeSet? = null,
|
||||||
|
defStyleAttr: Int = 0
|
||||||
|
) : LinearLayout(context, attrs, defStyleAttr) {
|
||||||
|
private lateinit var mBinding: DailyTaskItemViewBinding
|
||||||
|
|
||||||
|
|
||||||
|
init {
|
||||||
|
mBinding = DailyTaskItemViewBinding.inflate(LayoutInflater.from(context), this, true)
|
||||||
|
mBinding.run {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
fun initUI(titleIconRes: Int, titleRes: Int, actionRes: Int) {
|
||||||
|
mBinding.ivItemIcon.setImageResource(titleIconRes)
|
||||||
|
mBinding.tvItemTitle.setText(titleRes)
|
||||||
|
mBinding.tvAction.setText(actionRes)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun setProgressText(progress: Int, progressText: String) {
|
||||||
|
mBinding.tvItemProgress.text = progressText
|
||||||
|
mBinding.itemProgress.setProgress(progress)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun setRewardInfo(rewardIconRes: Int, rewardNum: Int) {
|
||||||
|
mBinding.tvRewardNum.text = "" + rewardNum
|
||||||
|
mBinding.ivRewardIcon.setImageResource(rewardIconRes)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,111 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical"
|
||||||
|
>
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="2dp"
|
||||||
|
android:background="@color/gray_f2"
|
||||||
|
android:layout_marginTop="1dp"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:layout_marginVertical="20dp" >
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:gravity="center_vertical" >
|
||||||
|
|
||||||
|
<androidx.appcompat.widget.AppCompatImageView
|
||||||
|
android:id="@+id/iv_item_icon"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:src="@mipmap/temp"/>
|
||||||
|
|
||||||
|
<androidx.appcompat.widget.AppCompatTextView
|
||||||
|
android:id="@+id/tv_item_title"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginLeft="9dp"
|
||||||
|
android:textSize="15sp"
|
||||||
|
android:textStyle="bold"
|
||||||
|
android:textColor="@color/gray3"
|
||||||
|
android:text="title"
|
||||||
|
/>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
|
<androidx.appcompat.widget.AppCompatTextView
|
||||||
|
android:id="@+id/tv_item_describle"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="6dp"
|
||||||
|
android:textSize="14sp"
|
||||||
|
android:textStyle="bold"
|
||||||
|
android:textColor="@color/gray9"
|
||||||
|
android:text="descrip"
|
||||||
|
/>
|
||||||
|
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="10dp" >
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:gravity="center_vertical" >
|
||||||
|
|
||||||
|
<androidx.appcompat.widget.AppCompatImageView
|
||||||
|
android:id="@+id/iv_reward_icon"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_centerInParent="true"
|
||||||
|
android:src="@mipmap/temp"/>
|
||||||
|
|
||||||
|
<androidx.appcompat.widget.AppCompatTextView
|
||||||
|
android:id="@+id/tv_reward_num"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginLeft="9dp"
|
||||||
|
android:textSize="16sp"
|
||||||
|
android:textStyle="bold"
|
||||||
|
android:textColor="@color/red_0b"
|
||||||
|
android:text="+10443"
|
||||||
|
/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
|
<androidx.appcompat.widget.AppCompatTextView
|
||||||
|
android:id="@+id/tv_action"
|
||||||
|
android:layout_width="90dp"
|
||||||
|
android:layout_height="30dp"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
|
android:layout_alignParentRight="true"
|
||||||
|
android:layout_marginLeft="9dp"
|
||||||
|
android:gravity="center"
|
||||||
|
android:background="@drawable/vididinapp_feature_message_bg_task_fazer"
|
||||||
|
android:textSize="14sp"
|
||||||
|
android:textStyle="bold"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:text="@string/resgatar"
|
||||||
|
/>
|
||||||
|
</RelativeLayout>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
@ -0,0 +1,134 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical"
|
||||||
|
>
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="2dp"
|
||||||
|
android:background="@color/gray_f2"
|
||||||
|
android:layout_marginTop="1dp"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:layout_marginVertical="20dp" >
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:gravity="center_vertical" >
|
||||||
|
|
||||||
|
<androidx.appcompat.widget.AppCompatImageView
|
||||||
|
android:id="@+id/iv_item_icon"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:src="@mipmap/temp"/>
|
||||||
|
|
||||||
|
<androidx.appcompat.widget.AppCompatTextView
|
||||||
|
android:id="@+id/tv_item_title"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginLeft="9dp"
|
||||||
|
android:textSize="15sp"
|
||||||
|
android:textStyle="bold"
|
||||||
|
android:textColor="@color/gray3"
|
||||||
|
android:text="title"
|
||||||
|
/>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:gravity="center_vertical" >
|
||||||
|
<androidx.appcompat.widget.AppCompatTextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="6dp"
|
||||||
|
android:textSize="14sp"
|
||||||
|
android:textStyle="bold"
|
||||||
|
android:textColor="@color/gray6"
|
||||||
|
android:text="@string/progress"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<com.ama.core.architecture.widget.CustomProgressBar
|
||||||
|
android:id="@+id/item_progress"
|
||||||
|
android:layout_width="60dp"
|
||||||
|
android:layout_height="5dp"
|
||||||
|
android:layout_marginHorizontal="5dp"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<androidx.appcompat.widget.AppCompatTextView
|
||||||
|
android:id="@+id/tv_item_progress"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="6dp"
|
||||||
|
android:textSize="14sp"
|
||||||
|
android:textStyle="bold"
|
||||||
|
android:textColor="@color/gray6"
|
||||||
|
android:text="(1/5)"
|
||||||
|
/>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="10dp" >
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:gravity="center_vertical" >
|
||||||
|
|
||||||
|
<androidx.appcompat.widget.AppCompatImageView
|
||||||
|
android:id="@+id/iv_reward_icon"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_centerInParent="true"
|
||||||
|
android:src="@mipmap/temp"/>
|
||||||
|
|
||||||
|
<androidx.appcompat.widget.AppCompatTextView
|
||||||
|
android:id="@+id/tv_reward_num"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginLeft="9dp"
|
||||||
|
android:textSize="16sp"
|
||||||
|
android:textStyle="bold"
|
||||||
|
android:textColor="@color/red_0b"
|
||||||
|
android:text="+10443"
|
||||||
|
/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
|
<androidx.appcompat.widget.AppCompatTextView
|
||||||
|
android:id="@+id/tv_action"
|
||||||
|
android:layout_width="90dp"
|
||||||
|
android:layout_height="30dp"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
|
android:layout_alignParentRight="true"
|
||||||
|
android:layout_marginLeft="9dp"
|
||||||
|
android:gravity="center"
|
||||||
|
android:background="@drawable/vididinapp_feature_message_bg_task_fazer"
|
||||||
|
android:textSize="14sp"
|
||||||
|
android:textStyle="bold"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:text="@string/resgatar"
|
||||||
|
/>
|
||||||
|
</RelativeLayout>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
@ -69,6 +69,7 @@
|
||||||
<color name="graybe">#ffbebebe</color>
|
<color name="graybe">#ffbebebe</color>
|
||||||
<color name="red_0b">#FFFF740B</color>
|
<color name="red_0b">#FFFF740B</color>
|
||||||
<color name="red_2f">#FFFF862F</color>
|
<color name="red_2f">#FFFF862F</color>
|
||||||
|
<color name="gray_f2">#fff2f2f2</color>
|
||||||
|
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|
@ -17,4 +17,5 @@
|
||||||
<string name="resgatar">Resgatar</string>
|
<string name="resgatar">Resgatar</string>
|
||||||
<string name="assistir">Assistir</string>
|
<string name="assistir">Assistir</string>
|
||||||
<string name="day">Dia</string>
|
<string name="day">Dia</string>
|
||||||
|
<string name="progress">Progresso:</string>
|
||||||
</resources>
|
</resources>
|
||||||
Loading…
Reference in New Issue