app/src/main/AndroidManifest.xml
@@ -47,11 +47,11 @@ android:launchMode="singleTask" /> <activity android:name=".ui.SplashActivity" android:screenOrientation="landscape"> <!-- <intent-filter>--> <!-- <action android:name="android.intent.action.MAIN" />--> <intent-filter> <action android:name="android.intent.action.MAIN" /> <!-- <category android:name="android.intent.category.LAUNCHER" />--> <!-- </intent-filter>--> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <activity android:name=".wxapi.WXEntryActivity" @@ -233,11 +233,11 @@ <activity android:name=".ui.worldcup.RefereeWorldListActivity" android:label="社区世界杯"/> <activity android:name=".ui.worldcup.StartWorldActivity" /> <activity android:name=".ui.home.WeekSelectActivity" android:label="第一年学习周目选择"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <!-- <intent-filter>--> <!-- <action android:name="android.intent.action.MAIN" />--> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> <!-- <category android:name="android.intent.category.LAUNCHER" />--> <!-- </intent-filter>--> </activity> <activity android:name=".ui.home.ScheduleActivity" /> <activity android:name=".ui.shop.ExchangeActivity" android:label="立即兑换"/> @@ -249,7 +249,13 @@ <activity android:name=".ui.home.ListenActivity" android:label="自主学习1-听音选图" android:launchMode="singleTask"/> <activity android:name=".ui.home.ChooseVoiceActivity" android:label="自主学习2-看图选音" android:launchMode="singleTask"/> <activity android:name=".ui.home.IncludeActivity" android:label="自主学习3-归纳排除" android:launchMode="singleTask"/> <activity android:name=".ui.home.QAActivity" android:label="自主学习4-有问有答" android:launchMode="singleTask"/> <activity android:name=".ui.home.ResultActivity" /> <activity android:name=".ui.home.LookImgActivity" android:label="自主学故事1-看图配音" android:launchMode="singleTask"/> <activity android:name=".ui.home.RememberFinishActivity" android:label="自主故事2—框架记忆"/> <activity android:name=".ui.home.ListenStoryActivity" android:label="自主故事2—框架记忆" /> <activity android:name=".ui.home.MemoryActivity" android:label="自主游戏1—超级记忆" /> <activity android:name=".ui.home.SuperListenActivity" android:label="自主游戏1—超级听力" /> <meta-data android:name="com.amap.api.v2.apikey" app/src/main/java/com/dollearn/student/dialog/CountdownDialog.kt
New file @@ -0,0 +1,58 @@ package com.dollearn.student.dialog import android.content.DialogInterface import android.os.Bundle import android.os.CountDownTimer import android.view.Gravity import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import androidx.fragment.app.DialogFragment import cn.sinata.xldutils.utils.screenWidth import com.dollearn.student.R import com.dollearn.student.utils.interfaces.StringCallback import kotlinx.android.synthetic.main.dialog_countdown.* import org.jetbrains.anko.wrapContent class CountdownDialog: DialogFragment() { override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? = inflater.inflate(R.layout.dialog_countdown,container,false) override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setStyle(STYLE_NO_FRAME, R.style.FadeDialog) } private var countDownTimer:CountDownTimer? = null var callback:StringCallback? = null override fun onActivityCreated(savedInstanceState: Bundle?) { super.onActivityCreated(savedInstanceState) dialog?.window?.setLayout((screenWidth()*0.45).toInt(), wrapContent) dialog?.window?.setGravity(Gravity.CENTER) dialog?.setCanceledOnTouchOutside(false) } override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) countDownTimer = object :CountDownTimer(5000,1000){ override fun onTick(millisUntilFinished: Long) { tv_timer.text = (millisUntilFinished/1000+1).toString() } override fun onFinish() { dismissAllowingStateLoss() } }.start() tv_ok.setOnClickListener { dismissAllowingStateLoss() } } override fun onDismiss(dialog: DialogInterface) { super.onDismiss(dialog) countDownTimer?.cancel() callback?.onResult("") } } app/src/main/java/com/dollearn/student/dialog/DifficultyDialog.kt
New file @@ -0,0 +1,55 @@ package com.dollearn.student.dialog import android.os.Bundle import android.view.Gravity import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import androidx.fragment.app.DialogFragment import cn.sinata.xldutils.utils.screenWidth import com.dollearn.student.R import kotlinx.android.synthetic.main.dialog_diff.* import org.jetbrains.anko.wrapContent class DifficultyDialog: DialogFragment() { override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? = inflater.inflate(R.layout.dialog_diff,container,false) override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setStyle(STYLE_NO_FRAME, R.style.FadeDialog) } override fun onActivityCreated(savedInstanceState: Bundle?) { super.onActivityCreated(savedInstanceState) dialog?.window?.setLayout((screenWidth()*0.45).toInt(), wrapContent) dialog?.window?.setGravity(Gravity.CENTER) dialog?.setCanceledOnTouchOutside(false) } override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) tv_cancel.setOnClickListener { callback?.onCancel() dismiss() } tv_ok.setOnClickListener { callback?.onOk(if (rb_0.isChecked) 0 else if (rb_1.isChecked) 1 else 2) } } interface OnClickCallback{ fun onOk(d:Int) fun onCancel() } private var callback:OnClickCallback? = null fun setCallback(callback:OnClickCallback){ this.callback = callback } } app/src/main/java/com/dollearn/student/network/ApiService.kt
@@ -654,6 +654,12 @@ @POST(Apis.completeLearning) fun completeLearning(@Body body: String): Flowable<ResultData<Any>> @POST(Apis.completeStory) fun completeStory(@Body body: String): Flowable<ResultData<Any>> @POST(Apis.gameAchievement) fun gameAchievement(@Body body: String): Flowable<ResultData<Any>> @GET(Apis.teamSchedule) fun teamSchedule(@Query("day") day:Int,@Query("type") type:Int,@Query("week") week:Int): Flowable<ResultData<ProgressBean>> @@ -699,6 +705,18 @@ @GET(Apis.pictureMateVoice) fun pictureMateVoice(@Query("day")day:Int,@Query("quarter")quarter:Int,@Query("week")week:Int): Flowable<ResultData<SubjectBean>> @GET(Apis.lookPictureDbu) fun lookPictureDbu(@Query("quarter")quarter:Int,@Query("week")week:Int): Flowable<ResultData<StoryBean>> @GET(Apis.gameHearing) fun gameHearing(@Query("quarter")quarter:Int,@Query("week")week:Int,@Query("difficulty")difficulty:Int): Flowable<ResultData<GameBean>> @GET(Apis.gameMemory) fun gameMemory(@Query("quarter")quarter:Int,@Query("week")week:Int): Flowable<ResultData<MemoryBean>> @GET(Apis.frameworkMemory) fun frameworkMemory(@Query("quarter")quarter:Int,@Query("week")week:Int): Flowable<ResultData<StoryBean>> @GET(Apis.redeemNow) fun redeemNow(@Query("goodId")goodId:String): Flowable<ResultData<GoodsOrder>> app/src/main/java/com/dollearn/student/network/Apis.kt
@@ -47,14 +47,12 @@ const val weekList = "study/base/study/weekList" const val studySchedule = "study/base/study/studySchedule" const val queryBanner = "other/base/banner/queryBannerList" const val querySearchCourseList = "api/app/course/querySearchCourseList" const val addStudent = "account/api/startCource/addData" const val commitEditStu = "account/api/startCource/commitEditStu" const val listOfStu = "account/api/startCource/listOfStu" const val queryAvailableCouponList = "activity/api/coupon/queryAvailableCouponList" /** * 学习 @@ -68,6 +66,14 @@ const val teamSchedule = "study/base/study/teamSchedule" const val completeLearning = "study/base/study/completeLearning" const val lookPictureDbu = "study/base/study/lookPictureDbu" const val frameworkMemory = "study/base/study/frameworkMemory" const val completeStory = "study/base/study/completeStory" const val gameHearing = "study/base/study/gameHearing" const val gameMemory = "study/base/study/gameMemory" const val gameAchievement = "study/base/study/gameAchievement" /** * 商城 app/src/main/java/com/dollearn/student/network/HttpManager.kt
@@ -793,6 +793,20 @@ } /** * 完成学习 */ fun completeStory(rate: Int,type: Int,storyId:String): Flowable<ResultData<Any>> { return request().completeStory(Gson().toJson(ReqFinishStory(rate,storyId, type))) } /** * 完成游戏 */ fun gameAchievement(rate: Int,difficulty: Int,gameId:String,gameName:String,useTime:Int): Flowable<ResultData<Any>> { return request().gameAchievement(Gson().toJson(ReqFinishGame(rate,difficulty,gameId,gameName, useTime))) } /** * 回复进度 */ fun teamSchedule(day: Int,week: Int,type: Int): Flowable<ResultData<ProgressBean>> { @@ -985,6 +999,41 @@ } /** * 看图配音 */ fun lookPictureDbu(season: Int,week: Int): Flowable<ResultData<StoryBean>> { return request().lookPictureDbu(season,week) } /** * 超级听力 */ fun gameHearing(season: Int,week: Int,difficulty:Int): Flowable<ResultData<GameBean>> { return request().gameHearing(season,week,difficulty) } /** * 记忆 */ fun gameMemory(season: Int,week: Int): Flowable<ResultData<MemoryBean>> { return request().gameMemory(season,week) } /** * 记忆 */ fun frameworkMemory(season: Int,week: Int): Flowable<ResultData<StoryBean>> { return request().frameworkMemory(season,week) } /** * 又问又答 */ fun questionsAndAnswers(season: Int,week: Int,day: Int): Flowable<ResultData<SubjectBean>> { return request().questionsAndAnswers(day,season,week) } /** * 立即兑换 */ fun redeemNow(id:String): Flowable<ResultData<GoodsOrder>> { app/src/main/java/com/dollearn/student/network/entity/GameBean.kt
@@ -1,15 +1,18 @@ package com.dollearn.student.network.entity data class GameBean( val cash: Double, val gameId: Int, val id: Int, val img: String, val integral: Int, val gameType: Int, //游戏类型(1=普通游戏,2=世界杯) val name: String, val video: String?, val intro: String?, val otherId: Int, val playCoin: Double ) val subjectList: List<Subject>, val data:GameBeanData ) data class GameBeanData( val answerCount: Int, val answerIntegral: Int, val answerTime: Int, val count: Int, val id: String, val integral: String, val studyId: Int, val time: String, val week: Int ) app/src/main/java/com/dollearn/student/network/entity/GoodsDetail.kt
@@ -26,6 +26,5 @@ val provinceCode: String, val recipient: String, val recipientPhone: String, val updateBy: String, val updateTime: String ):Parcelable app/src/main/java/com/dollearn/student/network/entity/GoodsOrder.kt
@@ -9,5 +9,5 @@ val good: Goods, val goodTypes: List<GoodsType>?, val orderNumber: String, val recipient: Recipient val recipient: Recipient? ):Parcelable app/src/main/java/com/dollearn/student/network/entity/MemoryBean.kt
New file @@ -0,0 +1,50 @@ package com.dollearn.student.network.entity import android.os.Parcelable import kotlinx.android.parcel.Parcelize @Parcelize data class MemoryBean( val `data`: MemoryData, val photoList: List<Photo>, val voiceList: List<Voice> ):Parcelable @Parcelize data class MemoryData( val answerCount: Int, val answerIntegral: Int, val answerRate: String, val answerTime: Int, val count: Int, val createBy: String, val createTime: String, val disabled: Boolean, val id: Int, val integral: String, val rate: String, val studyId: Int, val time: String, val updateBy: String, val updateTime: String, val week: Int ):Parcelable @Parcelize data class Photo( val id: Int, val photo: String ):Parcelable @Parcelize data class Voice( val id: Int, val voice: String ):Parcelable data class Card( val id: Int, val type: Int, //1:图片 2:音频 val url: String, var isBack:Boolean = true ) app/src/main/java/com/dollearn/student/network/entity/ReqFinishGame.kt
New file @@ -0,0 +1,9 @@ package com.dollearn.student.network.entity data class ReqFinishGame( val accuracy: Int, val difficulty: Int, val gameId: String, val gameName: String, val useTime: Int ) app/src/main/java/com/dollearn/student/network/entity/ReqFinishStory.kt
New file @@ -0,0 +1,7 @@ package com.dollearn.student.network.entity data class ReqFinishStory( val accuracy: Int, val storyId: String, val type: Int ) app/src/main/java/com/dollearn/student/network/entity/StoryBean.kt
New file @@ -0,0 +1,31 @@ package com.dollearn.student.network.entity import android.os.Parcelable import kotlinx.android.parcel.Parcelize @Parcelize data class StoryBean( val `data`: StoryBeanData, val storyList: List<Story> ):Parcelable @Parcelize data class StoryBeanData( val id: String, val integral: Int ):Parcelable @Parcelize data class Story( val correct: String, val english: String, val error: String?, val id: String, val img: String, val name: String, val state: Int, val isQuestion: Int, val type: String, var completed:Boolean = false, //已作答 var listend:Boolean = false //已听音 归纳排除题需要 ):Parcelable app/src/main/java/com/dollearn/student/network/entity/SubjectBean.kt
@@ -24,7 +24,9 @@ val img: String, val name: String, val state: Int, val isQuestion: Int, val type: String, var right:Boolean = false, //回答正确 var completed:Boolean = false, //已作答 var listend:Boolean = false //已听音 归纳排除题需要 ):Parcelable app/src/main/java/com/dollearn/student/ui/home/ChooseVoiceFragment.kt
@@ -24,7 +24,6 @@ private val TAG = "Choose=======》" private var handler:Handler? = null private val list = 1 private val PLAY_VOICE = 1 private val TO_NEXT = 10 app/src/main/java/com/dollearn/student/ui/home/DailyFragment.kt
@@ -52,8 +52,8 @@ } cl_4.clickDelay { showDialog("加载题目...") HttpManager.induceExclude(season, week, day).requestByF(this){_,data-> // startActivityForResult<IncludeActivity>(1,"data" to data,"day" to day,"week" to week,"season" to season) HttpManager.questionsAndAnswers(season, week, day).requestByF(this){_,data-> startActivityForResult<QAActivity>(1,"data" to data,"day" to day,"week" to week,"season" to season) } } cl_5.clickDelay { app/src/main/java/com/dollearn/student/ui/home/ListenStoryActivity.kt
New file @@ -0,0 +1,150 @@ package com.dollearn.student.ui.home import android.annotation.SuppressLint import android.os.Handler import android.os.Looper import android.os.Message import android.view.ViewGroup import androidx.core.os.bundleOf import androidx.fragment.app.Fragment import androidx.fragment.app.FragmentPagerAdapter import androidx.viewpager.widget.ViewPager import cn.sinata.xldutils.gone import com.dollearn.student.R import com.dollearn.student.dialog.TipDialog import com.dollearn.student.network.HttpManager import com.dollearn.student.network.entity.StoryBean import com.dollearn.student.network.request import com.dollearn.student.ui.TransparentStatusBarActivity import kotlinx.android.synthetic.main.activity_listen_stroy.* import org.jetbrains.anko.startActivity class ListenStoryActivity:TransparentStatusBarActivity() { override fun setContentView() = R.layout.activity_listen_stroy private val day by lazy { intent.getIntExtra("day",0) } private val week by lazy { intent.getIntExtra("week",0) } private val season by lazy { intent.getIntExtra("season",0) } val data by lazy { intent.getParcelableExtra<StoryBean>("data") } val fragments = arrayListOf<Fragment>() var totalCount = 0 //总答题次数 var rightCount = 0 //正确答题次数 var time = 0 //学习秒数 private var handler:Handler? = null override fun initClick() { tv_last.setOnClickListener { (fragments[view_pager.currentItem] as RememberFragment).stopVoice() (fragments[view_pager.currentItem-1] as RememberFragment).recover() view_pager.setCurrentItem(view_pager.currentItem-1,true) if (view_pager.currentItem == 0) tv_last.gone() tv_exit.text = "退出" } tv_next.setOnClickListener { (fragments[view_pager.currentItem] as RememberFragment).stopVoice() (fragments[view_pager.currentItem+1] as RememberFragment).recover() view_pager.setCurrentItem(view_pager.currentItem+1,true) if (view_pager.currentItem == fragments.lastIndex){ tv_next.gone() tv_exit.text = "完成" } } tv_exit.setOnClickListener { if (tv_exit.text == "退出") onBackPressed() else{ (fragments[view_pager.currentItem] as RememberFragment).stopVoice() handler?.removeMessages(0) startActivity<RememberFinishActivity>("score" to data!!.data.integral) finish() } } } override fun initView() { data?.apply { tv_progress.text = "已完成:1/${storyList.size}" storyList.forEachIndexed { index, subject -> fragments.add(RememberFragment.getInstance(index)) } view_pager.adapter = @SuppressLint("WrongConstant") object : FragmentPagerAdapter(supportFragmentManager,0) { override fun getItem(p0: Int): Fragment { return fragments[p0] } override fun getCount(): Int { return fragments.size } override fun destroyItem(container: ViewGroup, position: Int, `object`: Any) { } } view_pager.offscreenPageLimit = fragments.size view_pager.addOnPageChangeListener(object :ViewPager.OnPageChangeListener{ override fun onPageScrolled( position: Int, positionOffset: Float, positionOffsetPixels: Int ) { } override fun onPageSelected(position: Int) { tv_progress.text = "已完成:${position+1}/${storyList.size}" } override fun onPageScrollStateChanged(state: Int) { } }) } // recover() handler= object :Handler(Looper.myLooper()!!){ override fun handleMessage(msg: Message) { super.handleMessage(msg) if (msg.what == 0){ time++ handler?.sendEmptyMessageDelayed(0,1000L) } } } handler?.sendEmptyMessageDelayed(0,1000L) } private fun recover(){ HttpManager.teamSchedule(day,week,3).request(this){_,data-> view_pager.setCurrentItem(data?.topicIds?.size?:0,false) totalCount = data?.answerNumber?:0 rightCount = data?.correctNumber?:0 } } override fun onBackPressed() { val tipDialog = TipDialog() tipDialog.arguments = bundleOf("msg" to "未完成全部答题,确认退出吗?") tipDialog.setCallback(object :TipDialog.OnClickCallback{ override fun onOk() { finish() } override fun onCancel() { } }) tipDialog.show(supportFragmentManager,"exit") } override fun onDestroy() { super.onDestroy() handler?.removeMessages(0) handler = null } } app/src/main/java/com/dollearn/student/ui/home/LookImgActivity.kt
New file @@ -0,0 +1,145 @@ package com.dollearn.student.ui.home import android.annotation.SuppressLint import android.os.Handler import android.os.Looper import android.os.Message import android.view.ViewGroup import androidx.core.os.bundleOf import androidx.fragment.app.Fragment import androidx.fragment.app.FragmentPagerAdapter import androidx.viewpager.widget.ViewPager import cn.sinata.xldutils.gone import cn.sinata.xldutils.visible import com.dollearn.student.R import com.dollearn.student.dialog.TipDialog import com.dollearn.student.network.HttpManager import com.dollearn.student.network.entity.StoryBean import com.dollearn.student.network.entity.SubjectBean import com.dollearn.student.network.request import com.dollearn.student.ui.TransparentStatusBarActivity import kotlinx.android.synthetic.main.activity_listen.* class LookImgActivity:TransparentStatusBarActivity() { override fun setContentView() = R.layout.activity_listen private val day by lazy { intent.getIntExtra("day",0) } private val week by lazy { intent.getIntExtra("week",0) } private val season by lazy { intent.getIntExtra("season",0) } val data by lazy { intent.getParcelableExtra<StoryBean>("data") } val fragments = arrayListOf<Fragment>() var totalCount = 0 //总答题次数 var rightCount = 0 //正确答题次数 var time = 0 //学习秒数 private var handler:Handler? = null override fun initClick() { tv_last.setOnClickListener { (fragments[view_pager.currentItem-1] as LookImgFragment).recover() view_pager.setCurrentItem(view_pager.currentItem-1,true) if (view_pager.currentItem == 0) tv_last.gone() } tv_exit.setOnClickListener { onBackPressed() } } fun next(){ if (view_pager.currentItem == fragments.lastIndex){ handler?.removeMessages(0) ResultActivity.startResult(this,day,week,season,8,totalCount,rightCount,data!!.data.integral,time,data!!.data.id) finish() }else{ (fragments[view_pager.currentItem+1] as LookImgFragment).recover() view_pager.setCurrentItem(view_pager.currentItem+1,true) tv_last.visible() } } override fun initView() { data?.apply { tv_progress.text = "已完成:1/${storyList.size}" storyList.forEachIndexed { index, subject -> fragments.add(LookImgFragment.getInstance(index)) } view_pager.adapter = @SuppressLint("WrongConstant") object : FragmentPagerAdapter(supportFragmentManager,0) { override fun getItem(p0: Int): Fragment { return fragments[p0] } override fun getCount(): Int { return fragments.size } override fun destroyItem(container: ViewGroup, position: Int, `object`: Any) { } } view_pager.offscreenPageLimit = fragments.size view_pager.addOnPageChangeListener(object :ViewPager.OnPageChangeListener{ override fun onPageScrolled( position: Int, positionOffset: Float, positionOffsetPixels: Int ) { } override fun onPageSelected(position: Int) { tv_progress.text = "已完成:${position+1}/${storyList.size}" } override fun onPageScrollStateChanged(state: Int) { } }) } // recover() handler= object :Handler(Looper.myLooper()!!){ override fun handleMessage(msg: Message) { super.handleMessage(msg) if (msg.what == 0){ time++ handler?.sendEmptyMessageDelayed(0,1000L) } } } handler?.sendEmptyMessageDelayed(0,1000L) } private fun recover(){ HttpManager.teamSchedule(day,week,3).request(this){_,data-> view_pager.setCurrentItem(data?.topicIds?.size?:0,false) totalCount = data?.answerNumber?:0 rightCount = data?.correctNumber?:0 } } override fun onBackPressed() { val tipDialog = TipDialog() tipDialog.arguments = bundleOf("msg" to "未完成全部答题,确认退出吗?") tipDialog.setCallback(object :TipDialog.OnClickCallback{ override fun onOk() { finish() } override fun onCancel() { } }) tipDialog.show(supportFragmentManager,"exit") } override fun onDestroy() { super.onDestroy() handler?.removeMessages(0) handler = null } } app/src/main/java/com/dollearn/student/ui/home/LookImgFragment.kt
New file @@ -0,0 +1,240 @@ package com.dollearn.student.ui.home import android.os.Handler import android.os.Looper import android.os.Message import android.util.Log import androidx.core.os.bundleOf import cn.sinata.xldutils.fragment.BaseFragment import cn.sinata.xldutils.gone import cn.sinata.xldutils.visible import com.dollearn.student.R import com.dollearn.student.utils.AudioUtils import com.dollearn.student.utils.extention.clickDelay import kotlinx.android.synthetic.main.fragmetn_look_img.* class LookImgFragment:BaseFragment(), AudioUtils.OnAudioStatusUpdateListener { override fun contentViewId() = R.layout.fragmetn_look_img private val TAG = "Choose=======》" private var handler:Handler? = null private val index by lazy { arguments?.getInt("index")?:0 } private val data by lazy { (requireActivity() as LookImgActivity).data } private val act by lazy { (requireActivity() as LookImgActivity) } private val voiceList = arrayListOf<String>() private val PLAY_VOICE = 1 private val TO_NEXT = 10 private val player by lazy { AudioUtils() } private var voiceIndex = -1 //点击播放的声音序号 0-2取值 private var playing = false //播放中,不能有任何操作 override fun onFirstVisibleToUser() { player.setOnAudioStatusUpdateListener(this) player.stopPlayMusic() handler = object : Handler(Looper.getMainLooper()){ override fun handleMessage(msg: Message) { super.handleMessage(msg) when(msg.what){ PLAY_VOICE->{ if (voiceIndex<voiceList.size) player.startPlayMusic(requireContext(),voiceList[voiceIndex]) } TO_NEXT->{ if (isAdded&&!playing) (requireActivity() as LookImgActivity).next() } } } } data?.storyList?.get(index)?.apply { iv_1.setImageURI(img) voiceList.add(correct) voiceList.addAll(error!!.split(",")) voiceList.shuffle() } recover() setOnClick() } private fun setOnClick() { cl_voice1.clickDelay { if (playing) return@clickDelay voiceIndex = 0 handler?.sendEmptyMessage(PLAY_VOICE) } cl_voice2.clickDelay { if (playing) return@clickDelay voiceIndex = 1 handler?.sendEmptyMessage(PLAY_VOICE) } cl_voice3.clickDelay { if (playing) return@clickDelay voiceIndex = 2 handler?.sendEmptyMessage(PLAY_VOICE) } rl_check_1.clickDelay { if (playing) return@clickDelay dot_1.visible() act.totalCount++ if (voiceList[0] == data!!.storyList[index].correct){ act.rightCount++ data!!.storyList[index].completed = true motion.transitionToEnd() cl_voice1.callOnClick() }else{ iv_error_1.visible() dot_1.postDelayed({ iv_error_1.gone() dot_1.gone() },2000) } } rl_check_2.clickDelay { if (playing) return@clickDelay dot_2.visible() act.totalCount++ if (voiceList[1] == data!!.storyList[index].correct){ act.rightCount++ data!!.storyList[index].completed = true motion.transitionToEnd() cl_voice2.callOnClick() }else{ iv_error_2.visible() dot_1.postDelayed({ dot_2.gone() iv_error_2.gone() },2000) } } rl_check_3.clickDelay { if (playing) return@clickDelay dot_3.visible() act.totalCount++ if (voiceList[2] == data!!.storyList[index].correct){ data!!.storyList[index].completed = true act.rightCount++ motion.transitionToEnd() cl_voice3.callOnClick() }else{ iv_error_3.visible() dot_1.postDelayed({ iv_error_3.gone() dot_3.gone() },2000) } } } /** * 重置 */ fun recover() { voiceList.shuffle() rl_check_1.gone() rl_check_2.gone() rl_check_3.gone() dot_1.gone() dot_2.gone() dot_3.gone() //设置动画飞行路径 3对1 val rightVoiceIndex = voiceList.indexOf(data!!.storyList[index].correct) var start = 0 var end = 0 when(rightVoiceIndex){ 0->{ start = R.id.start_1 end = R.id.end_1 } 1->{ start = R.id.start_2 end = R.id.end_2 } 2->{ start = R.id.start_3 end = R.id.end_3 } } motion.progress = 0f motion.setTransition(start,end) data!!.storyList[index].completed = false } companion object{ /** * @param index 题组号 */ fun getInstance(index:Int):LookImgFragment{ val listenFragment = LookImgFragment() listenFragment.arguments = bundleOf("index" to index) return listenFragment } } override fun onUpdate(db: Double, time: Long) { } override fun onStop(filePath: String?) { } override fun onStartPlay() { playing = true if (voiceIndex == 0){ iv1_1.gone() iv2_1.gone() iv_playing_1.visible() } if (voiceIndex == 1){ iv1_2.gone() iv2_2.gone() iv_playing_2.visible() } if (voiceIndex == 2){ iv1_3.gone() iv2_3.gone() iv_playing_3.visible() } } override fun onFinishPlay() { playing = false if (voiceIndex == 0){ rl_check_1.visible() iv1_1.visible() iv2_1.visible() iv_playing_1.gone() } if (voiceIndex == 1){ rl_check_2.visible() iv1_2.visible() iv2_2.visible() iv_playing_2.gone() } if (voiceIndex == 2){ rl_check_3.visible() iv1_3.visible() iv2_3.visible() iv_playing_3.gone() } if (data!!.storyList[index].completed){ //本题已答对 Log.e(TAG,"选对答案后的播放结束3秒后进入下一图") handler?.sendEmptyMessageDelayed(TO_NEXT,3000) } } } app/src/main/java/com/dollearn/student/ui/home/MatchFragment.kt
@@ -16,7 +16,7 @@ import org.jetbrains.anko.imageResource //todo 1.首次播放播放中图标不显示 2.选择正确后不能再选择 3.选择正确后处理语音条位置 //todo 2.选择正确后不能再选择 3.选择正确后处理语音条位置 class MatchFragment : BaseFragment(), AudioUtils.OnAudioStatusUpdateListener { override fun contentViewId() = R.layout.fragment_match @@ -51,7 +51,7 @@ } TO_NEXT->{ if (isAdded&&!playing){ (requireActivity() as IncludeActivity).next() (requireActivity() as MatchActivity).next() } } } @@ -70,6 +70,10 @@ } private fun initClick() { cover_3.setOnClickListener { } cover_2.setOnClickListener { } cover_1.setOnClickListener { } cover_4.setOnClickListener { } voiceViews.forEachIndexed { index, constraintLayout -> constraintLayout.clickDelay { if (!playing){ @@ -81,6 +85,7 @@ } cl_1.clickDelay { val voiceIndex = voiceIndex if (playing||voiceIndex == -1) //未播放或者正在播放,不可点击 return@clickDelay if (data!!.subjectList[group][0].completed) //已作答不可点击 @@ -111,6 +116,38 @@ end = R.id.end_4_1 } } voiceViews[voiceIndex].callOnClick() motion.setTransitionListener(object :MotionLayout.TransitionListener{ override fun onTransitionStarted(p0: MotionLayout?, p1: Int, p2: Int) { } override fun onTransitionChange( p0: MotionLayout?, p1: Int, p2: Int, p3: Float ) { } override fun onTransitionCompleted(p0: MotionLayout?, p1: Int) { cl_voice_end_1.visible() when(voiceIndex){ 0->cover_1.visible() 1->cover_2.visible() 2->cover_3.visible() 3->cover_4.visible() } } override fun onTransitionTrigger( p0: MotionLayout?, p1: Int, p2: Boolean, p3: Float ) { } }) motion.setTransition(start,end) motion.transitionToEnd() }else{ @@ -120,6 +157,8 @@ } cl_2.clickDelay { val voiceIndex = voiceIndex if (playing||voiceIndex == -1) //未播放或者正在播放,不可点击 return@clickDelay if (data!!.subjectList[group][1].completed) //已作答不可点击 @@ -150,6 +189,39 @@ end = R.id.end_4_2 } } voiceViews[voiceIndex].callOnClick() motion.setTransitionListener(object :MotionLayout.TransitionListener{ override fun onTransitionStarted(p0: MotionLayout?, p1: Int, p2: Int) { } override fun onTransitionChange( p0: MotionLayout?, p1: Int, p2: Int, p3: Float ) { } override fun onTransitionCompleted(p0: MotionLayout?, p1: Int) { cl_voice_end_2.visible() when(voiceIndex){ 0->cover_1.visible() 1->cover_2.visible() 2->cover_3.visible() 3->cover_4.visible() } } override fun onTransitionTrigger( p0: MotionLayout?, p1: Int, p2: Boolean, p3: Float ) { } }) motion.setTransition(start,end) motion.transitionToEnd() }else{ @@ -159,6 +231,8 @@ } cl_3.clickDelay { val voiceIndex = voiceIndex if (playing||voiceIndex == -1) //未播放或者正在播放,不可点击 return@clickDelay if (data!!.subjectList[group][2].completed) //已作答不可点击 @@ -189,6 +263,39 @@ end = R.id.end_4_3 } } voiceViews[voiceIndex].callOnClick() motion.setTransitionListener(object :MotionLayout.TransitionListener{ override fun onTransitionStarted(p0: MotionLayout?, p1: Int, p2: Int) { } override fun onTransitionChange( p0: MotionLayout?, p1: Int, p2: Int, p3: Float ) { } override fun onTransitionCompleted(p0: MotionLayout?, p1: Int) { cl_voice_end_3.visible() when(voiceIndex){ 0->cover_1.visible() 1->cover_2.visible() 2->cover_3.visible() 3->cover_4.visible() } } override fun onTransitionTrigger( p0: MotionLayout?, p1: Int, p2: Boolean, p3: Float ) { } }) motion.setTransition(start,end) motion.transitionToEnd() }else{ @@ -198,6 +305,7 @@ } cl_4.clickDelay { val voiceIndex = voiceIndex if (playing||voiceIndex == -1) //未播放或者正在播放,不可点击 return@clickDelay if (data!!.subjectList[group][3].completed) //已作答不可点击 @@ -228,12 +336,65 @@ end = R.id.end_4_4 } } voiceViews[voiceIndex].callOnClick() motion.setTransitionListener(object :MotionLayout.TransitionListener{ override fun onTransitionStarted(p0: MotionLayout?, p1: Int, p2: Int) { } override fun onTransitionChange( p0: MotionLayout?, p1: Int, p2: Int, p3: Float ) { } override fun onTransitionCompleted(p0: MotionLayout?, p1: Int) { cl_voice_end_4.visible() when(voiceIndex){ 0->cover_1.visible() 1->cover_2.visible() 2->cover_3.visible() 3->cover_4.visible() } } override fun onTransitionTrigger( p0: MotionLayout?, p1: Int, p2: Boolean, p3: Float ) { } }) motion.setTransition(start,end) motion.transitionToEnd() }else{ result_4.imageResource = R.mipmap.zhifushibai } showResultAnim(cl_4) } cl_voice_end_1.setOnClickListener { voiceIndex = 4 player.startPlayMusic(requireContext(),data!!.subjectList[group][0].correct) } cl_voice_end_2.setOnClickListener { voiceIndex = 5 player.startPlayMusic(requireContext(),data!!.subjectList[group][1].correct) } cl_voice_end_3.setOnClickListener { voiceIndex = 6 player.startPlayMusic(requireContext(),data!!.subjectList[group][2].correct) } cl_voice_end_4.setOnClickListener { voiceIndex = 7 player.startPlayMusic(requireContext(),data!!.subjectList[group][3].correct) } } @@ -265,7 +426,15 @@ it.completed = false it.listend = false } cover_1.gone() cover_2.gone() cover_3.gone() cover_4.gone() tv_name.text ="" cl_voice_end_1.gone() cl_voice_end_2.gone() cl_voice_end_3.gone() cl_voice_end_4.gone() } companion object{ @@ -289,11 +458,13 @@ override fun onStartPlay() { playing = true val list = data!!.subjectList[group] tv_name.text = list[list.map { it.correct }.indexOf(voiceList[voiceIndex])].name if (voiceIndex in 0..3) tv_name.text = list[list.map { it.correct }.indexOf(voiceList[voiceIndex])].name when(voiceIndex){ 0->{ iv1_1.gone() iv2_1.gone() iv_playing_1.visible() iv_playing_1.visible() } 1->{ @@ -313,13 +484,32 @@ iv_playing_4.visible() } 4->{ iv1_1_end.gone() iv2_1_end.gone() iv_playing_1_end.visible() } 5->{ iv1_2_end.gone() iv2_2_end.gone() iv_playing_2_end.visible() } 6->{ iv1_3_end.gone() iv2_3_end.gone() iv_playing_3_end.visible() } 7->{ iv1_4_end.gone() iv2_4_end.gone() iv_playing_4_end.visible() } } } override fun onFinishPlay() { playing = false val subject = data!!.subjectList[group][voiceIndex] subject.listend = true when(voiceIndex){ 0->{ iv1_1.visible() @@ -341,7 +531,29 @@ iv2_4.visible() iv_playing_4.gone() } 4->{ iv1_1_end.visible() iv2_1_end.visible() iv_playing_1_end.gone() } 5->{ iv1_2_end.visible() iv2_2_end.visible() iv_playing_2_end.gone() } 6->{ iv1_3_end.visible() iv2_3_end.visible() iv_playing_3_end.gone() } 7->{ iv1_4_end.visible() iv2_4_end.visible() iv_playing_4_end.gone() } } if (data!!.subjectList[group].filter { it.completed }.size == 4){ //全部答对 handler?.sendEmptyMessage(TO_NEXT) } } } app/src/main/java/com/dollearn/student/ui/home/MemoryActivity.kt
New file @@ -0,0 +1,50 @@ package com.dollearn.student.ui.home import android.os.CountDownTimer import androidx.core.os.bundleOf import androidx.recyclerview.widget.GridLayoutManager import com.dollearn.student.R import com.dollearn.student.dialog.TipDialog import com.dollearn.student.network.entity.Card import com.dollearn.student.network.entity.MemoryBean import com.dollearn.student.ui.TransparentStatusBarActivity import com.dollearn.student.ui.home.adapter.CardAdapter import kotlinx.android.synthetic.main.activity_memory.* class MemoryActivity : TransparentStatusBarActivity() { override fun setContentView() = R.layout.activity_memory private val data by lazy { intent.getParcelableExtra<MemoryBean>("data")!! } private val list = arrayListOf<Card>() private val adapter = CardAdapter(list) private val TIME = 600*1000L private var timer:CountDownTimer? = null override fun initClick() { } override fun initView() { rv_list.layoutManager = GridLayoutManager(this,5) rv_list.adapter = adapter list.addAll(data.photoList.map { Card(it.id,1,it.photo) }) list.addAll(data.voiceList.map { Card(it.id,2,it.voice) }) list.shuffle() adapter.notifyDataSetChanged() timer = object :CountDownTimer(TIME,1000){ override fun onTick(millisUntilFinished: Long) { } override fun onFinish() { val tipDialog = TipDialog() tipDialog.arguments = bundleOf("msg" to "答题时间已结束,停止作答!") } } } } app/src/main/java/com/dollearn/student/ui/home/QAActivity.kt
New file @@ -0,0 +1,151 @@ package com.dollearn.student.ui.home import android.annotation.SuppressLint import android.os.Handler import android.os.Looper import android.os.Message import android.view.ViewGroup import androidx.core.os.bundleOf import androidx.fragment.app.Fragment import androidx.fragment.app.FragmentPagerAdapter import androidx.viewpager.widget.ViewPager import cn.sinata.xldutils.gone import cn.sinata.xldutils.visible import com.dollearn.student.R import com.dollearn.student.dialog.TipDialog import com.dollearn.student.network.HttpManager import com.dollearn.student.network.entity.SubjectBean import com.dollearn.student.network.request import com.dollearn.student.ui.TransparentStatusBarActivity import kotlinx.android.synthetic.main.activity_listen.* class QAActivity:TransparentStatusBarActivity() { override fun setContentView() = R.layout.activity_listen private val day by lazy { intent.getIntExtra("day",0) } private val week by lazy { intent.getIntExtra("week",0) } private val season by lazy { intent.getIntExtra("season",0) } val data by lazy { intent.getParcelableExtra<SubjectBean>("data") } val fragments = arrayListOf<Fragment>() var totalCount = 0 //总答题次数 var rightCount = 0 //正确答题次数 var time = 0 //学习秒数 private var handler:Handler? = null override fun initClick() { tv_last.setOnClickListener { (fragments[view_pager.currentItem-1] as QAFragment).recover() view_pager.setCurrentItem(view_pager.currentItem-1,true) if (view_pager.currentItem == 0) tv_last.gone() } tv_exit.setOnClickListener { onBackPressed() } } fun next(){ if (view_pager.currentItem == fragments.lastIndex){ handler?.removeMessages(0) ResultActivity.startResult(this,day,week,season,4,totalCount,rightCount,data!!.data.integral,time,data!!.data.id) finish() }else{ (fragments[view_pager.currentItem+1] as QAFragment).recover() view_pager.setCurrentItem(view_pager.currentItem+1,true) tv_last.visible() } } override fun initView() { data?.apply { tv_progress.text = "已完成:1/${subjectList.size}" subjectList.forEachIndexed { index, subject -> fragments.add(QAFragment.getInstance(index)) } view_pager.adapter = @SuppressLint("WrongConstant") object : FragmentPagerAdapter(supportFragmentManager,0) { override fun getItem(p0: Int): Fragment { return fragments[p0] } override fun getCount(): Int { return fragments.size } override fun destroyItem(container: ViewGroup, position: Int, `object`: Any) { } } view_pager.offscreenPageLimit = fragments.size view_pager.addOnPageChangeListener(object :ViewPager.OnPageChangeListener{ override fun onPageScrolled( position: Int, positionOffset: Float, positionOffsetPixels: Int ) { } override fun onPageSelected(position: Int) { tv_progress.text = "已完成:${position+1}/${subjectList.size}" } override fun onPageScrollStateChanged(state: Int) { } }) } recover() handler= object :Handler(Looper.myLooper()!!){ override fun handleMessage(msg: Message) { super.handleMessage(msg) if (msg.what == 0){ time++ handler?.sendEmptyMessageDelayed(0,1000L) } } } handler?.sendEmptyMessageDelayed(0,1000L) } private fun recover(){ HttpManager.teamSchedule(day,week,4).request(this,false){_,data-> view_pager.setCurrentItem(data?.topicIds?.size?:0,false) totalCount = data?.answerNumber?:0 rightCount = data?.correctNumber?:0 } } override fun onBackPressed() { val tipDialog = TipDialog() tipDialog.arguments = bundleOf("msg" to "未完成全部答题,确认退出吗?") tipDialog.setCallback(object :TipDialog.OnClickCallback{ override fun onOk() { if (view_pager.currentItem == 0) finish() else{ val list = (data?.subjectList?: arrayListOf()).flatMap { it }.subList(0,view_pager.currentItem) HttpManager.exitLearning(totalCount,rightCount,day,week,4,data?.data?.id?:"", list.joinToString(",") { it.id }).request(this@QAActivity){ _, _-> finish() } } } override fun onCancel() { } }) tipDialog.show(supportFragmentManager,"exit") } override fun onDestroy() { super.onDestroy() handler?.removeMessages(0) handler = null } } app/src/main/java/com/dollearn/student/ui/home/QAFragment.kt
New file @@ -0,0 +1,284 @@ package com.dollearn.student.ui.home import android.animation.Animator import android.animation.ObjectAnimator import android.animation.PropertyValuesHolder import android.animation.ValueAnimator import android.os.Handler import android.os.Looper import android.os.Message import android.util.Log import android.view.View import android.view.animation.LinearInterpolator import androidx.constraintlayout.widget.ConstraintLayout import androidx.core.os.bundleOf import cn.sinata.xldutils.fragment.BaseFragment import cn.sinata.xldutils.gone import cn.sinata.xldutils.invisible import cn.sinata.xldutils.visible import com.dollearn.student.R import com.dollearn.student.utils.AudioUtils import com.dollearn.student.utils.extention.clickDelay import kotlinx.android.synthetic.main.fragment_q_a.* import org.jetbrains.anko.support.v4.dip class QAFragment:BaseFragment(), AudioUtils.OnAudioStatusUpdateListener { override fun contentViewId() = R.layout.fragment_q_a private val TAG = "QA=======》" private var handler: Handler? = null private val PLAY_VOICE = 1 private val TO_NEXT = 2 private val player by lazy { AudioUtils() } private val group by lazy { arguments?.getInt("group")?:0 } private val data by lazy { (requireActivity() as QAActivity).data } private val list by lazy { //题组内图片 data!!.subjectList[group] } private val act by lazy { requireActivity() as QAActivity } private val voiceViews by lazy { arrayListOf(cl_voice_1,cl_voice_2,cl_voice_3,cl_voice_4) } //语音蓝条 private val v1Views by lazy { arrayListOf(iv1_1,iv1_2,iv1_3,iv1_4,iv1_answer_1,iv1_answer_2,iv1_answer_3) } private val v2Views by lazy { arrayListOf(iv2_1,iv2_2,iv2_3,iv2_4,iv2_answer_1,iv2_answer_2,iv2_answer_3) } private val v3Views by lazy { arrayListOf(iv3_1,iv3_2,iv3_3,iv3_4) } private val playingViews by lazy { arrayListOf(iv_playing_1,iv_playing_2,iv_playing_3,iv_playing_4,iv_playing_answer_1,iv_playing_answer_2,iv_playing_answer_3) } private var voiceIndex = -1 //点击播放的声音序号 0-3取值 private var questionIndex = -1 //当前题号 private var playing = false private var layoutChanged = false private var answerList = arrayListOf<String>() //右侧答案语音 override fun onFirstVisibleToUser() { player.setOnAudioStatusUpdateListener(this) player.stopPlayMusic() handler = object : Handler(Looper.getMainLooper()){ override fun handleMessage(msg: Message) { super.handleMessage(msg) when(msg.what){ PLAY_VOICE->{ if (voiceIndex in 0..3) player.startPlayMusic(requireContext(),list[voiceIndex].correct) else player.startPlayMusic(requireContext(),answerList[voiceIndex-4]) } TO_NEXT->{ if (isAdded&&!playing){ (requireActivity() as QAActivity).next() } } } } } iv_1.setImageURI(list[0].img) iv_2.setImageURI(list[1].img) iv_3.setImageURI(list[2].img) iv_4.setImageURI(list[3].img) showVoiceUi() rl_check_1.clickDelay { if (list[questionIndex].completed) //已作答 return@clickDelay act.totalCount++ if (list[questionIndex].correct == answerList[0]){ act.rightCount++ Log.e(TAG,"选择正确") transAnimation(cl_answer_1,voiceViews[questionIndex]) list[questionIndex].completed = true }else{ dot_1.visible() iv_error_1.visible() dot_1.postDelayed({ dot_1.gone() iv_error_1.gone() },500) } } rl_check_2.clickDelay { if (list[questionIndex].completed) //已作答 return@clickDelay act.totalCount++ if (list[questionIndex].correct == answerList[1]){ act.rightCount++ Log.e(TAG,"选择正确") transAnimation(cl_answer_2,voiceViews[questionIndex]) list[questionIndex].completed = true }else{ dot_2.visible() iv_error_2.visible() dot_2.postDelayed({ dot_2.gone() iv_error_2.gone() },500) } } rl_check_3.clickDelay { if (list[questionIndex].completed) //已作答 return@clickDelay act.totalCount++ if (list[questionIndex].correct == answerList[2]){ act.rightCount++ Log.e(TAG,"选择正确") transAnimation(cl_answer_3,voiceViews[questionIndex]) list[questionIndex].completed = true }else{ dot_3.visible() iv_error_3.visible() dot_3.postDelayed({ dot_3.gone() iv_error_3.gone() },500) } } } fun recover(){ } private fun showVoiceUi(){ list.forEachIndexed { index, subject -> if (subject.isQuestion == 1){ v3Views[index].setImageResource(R.mipmap.voice_question) voiceViews[index].visible() }else{ v3Views[index].setImageResource(R.mipmap.voice_answer) voiceViews[index].invisible() } voiceViews[index].clickDelay { voiceIndex = index handler?.sendEmptyMessage(PLAY_VOICE) } } } private fun showAnswerView(position:Int){ if (!layoutChanged){ //布局未改变,执行属性动画 val anim = ValueAnimator.ofInt(dip(120)) anim.duration = 500 anim.addUpdateListener { val i = it.animatedValue as Int val layoutParams = center.layoutParams as ConstraintLayout.LayoutParams layoutParams.marginEnd = i center.layoutParams = layoutParams } anim.start() layoutChanged = true } questionIndex = position rl_check_1.visible() rl_check_2.visible() rl_check_3.visible() cl_answer_1.visible() cl_answer_2.visible() cl_answer_3.visible() answerList.add(list[position].correct) answerList.addAll(list[position].error?.split(",")?: arrayListOf()) answerList.shuffle() cl_answer_1.setOnClickListener { voiceIndex = 4 handler?.sendEmptyMessage(PLAY_VOICE) } cl_answer_2.setOnClickListener { voiceIndex = 5 handler?.sendEmptyMessage(PLAY_VOICE) } cl_answer_3.setOnClickListener { voiceIndex = 6 handler?.sendEmptyMessage(PLAY_VOICE) } } private fun transAnimation(v:View,endView: View){ val offx = endView.left - v.left val offy = endView.top - v.top val x = PropertyValuesHolder.ofFloat("translationX",0f,offx.toFloat()) val y = PropertyValuesHolder.ofFloat("translationY",0f,offy.toFloat()) val animator = ObjectAnimator.ofPropertyValuesHolder(v, x, y) animator.duration = 1000 animator.interpolator = LinearInterpolator() animator.start() animator.addListener(object :Animator.AnimatorListener{ override fun onAnimationStart(animation: Animator?) { } override fun onAnimationEnd(animation: Animator?) { endView.visible() v.translationX = 0f v.translationY = 0f rl_check_1.gone() rl_check_2.gone() rl_check_3.gone() cl_answer_1.gone() cl_answer_2.gone() cl_answer_3.gone() } override fun onAnimationCancel(animation: Animator?) { } override fun onAnimationRepeat(animation: Animator?) { } }) } companion object{ /** * @param group 题组号 * @param index 组内序号 */ fun getInstance(group: Int):QAFragment{ val listenFragment = QAFragment() listenFragment.arguments = bundleOf("group" to group) return listenFragment } } override fun onUpdate(db: Double, time: Long) { } override fun onStop(filePath: String?) { } override fun onStartPlay() { playing = true v1Views[voiceIndex].gone() v2Views[voiceIndex].gone() playingViews[voiceIndex].visible() if (voiceIndex == 0&&!list[1].completed){ showAnswerView(1) } if (voiceIndex == 1&&!list[0].completed){ showAnswerView(0) } if (voiceIndex == 2&&!list[3].completed){ showAnswerView(3) } if (voiceIndex == 3&&!list[2].completed){ showAnswerView(2) } } override fun onFinishPlay() { playing = false v1Views[voiceIndex].visible() v2Views[voiceIndex].visible() playingViews[voiceIndex].gone() } } app/src/main/java/com/dollearn/student/ui/home/RememberFinishActivity.kt
New file @@ -0,0 +1,23 @@ package com.dollearn.student.ui.home import com.dollearn.student.MainActivity import com.dollearn.student.R import com.dollearn.student.ui.TransparentStatusBarActivity import kotlinx.android.synthetic.main.activity_finish_remember.* import org.jetbrains.anko.startActivity class RememberFinishActivity:TransparentStatusBarActivity() { override fun setContentView() = R.layout.activity_finish_remember private val score by lazy { intent.getIntExtra("score",0) } override fun initClick() { tv_back.setOnClickListener { startActivity<MainActivity>() } } override fun initView() { tv_tip.text = "恭喜你,已听完全部故事!获得${score}积分!" } } app/src/main/java/com/dollearn/student/ui/home/RememberFragment.kt
New file @@ -0,0 +1,106 @@ package com.dollearn.student.ui.home import android.os.Handler import android.os.Looper import android.os.Message import android.util.Log import androidx.core.os.bundleOf import cn.sinata.xldutils.fragment.BaseFragment import cn.sinata.xldutils.gone import cn.sinata.xldutils.visible import com.dollearn.student.R import com.dollearn.student.utils.AudioUtils import com.dollearn.student.utils.extention.clickDelay import kotlinx.android.synthetic.main.fragmetn_remember.* class RememberFragment:BaseFragment(), AudioUtils.OnAudioStatusUpdateListener { override fun contentViewId() = R.layout.fragmetn_remember var handler:Handler? = null private val index by lazy { arguments?.getInt("index")?:0 } private val data by lazy { (requireActivity() as ListenStoryActivity).data } private val PLAY_VOICE = 1 val player by lazy { AudioUtils() } var playing = false //播放中,不能有任何操作 override fun onFirstVisibleToUser() { player.setOnAudioStatusUpdateListener(this) player.stopPlayMusic() handler = object : Handler(Looper.getMainLooper()){ override fun handleMessage(msg: Message) { super.handleMessage(msg) when(msg.what){ PLAY_VOICE->{ if (!playing&&isAdded) player.startPlayMusic(requireContext(),data!!.storyList[index].correct) } } } } data?.storyList?.get(index)?.apply { iv_1.setImageURI(img) } recover() setOnClick() } private fun setOnClick() { cl_voice.clickDelay { if (playing) return@clickDelay handler?.sendEmptyMessage(PLAY_VOICE) } } /** * 重置 */ fun recover() { handler?.sendEmptyMessageDelayed(PLAY_VOICE,2000) } /** * 翻页调用 */ fun stopVoice(){ handler?.removeMessages(PLAY_VOICE) player.stopPlayMusic() } companion object{ /** * @param index 题组号 */ fun getInstance(index:Int):RememberFragment{ val listenFragment = RememberFragment() listenFragment.arguments = bundleOf("index" to index) return listenFragment } } override fun onUpdate(db: Double, time: Long) { } override fun onStop(filePath: String?) { } override fun onStartPlay() { playing = true iv1.gone() iv2.gone() iv_playing.visible() } override fun onFinishPlay() { playing = false iv1.visible() iv2.visible() iv_playing.gone() } } app/src/main/java/com/dollearn/student/ui/home/ResultActivity.kt
@@ -1,6 +1,8 @@ package com.dollearn.student.ui.home import android.content.Context import cn.sinata.xldutils.gone import cn.sinata.xldutils.visible import com.dollearn.student.MainActivity import com.dollearn.student.R import com.dollearn.student.network.HttpManager @@ -27,8 +29,14 @@ private val score by lazy { intent.getIntExtra("score",0) } private val time by lazy { intent.getIntExtra("time",0) } private val difficulty by lazy { intent.getIntExtra("difficulty",0) } //游戏难度 override fun initClick() { tv_last.setOnClickListener { startActivity<MainActivity>() } tv_back.setOnClickListener { startActivity<MainActivity>() } @@ -45,14 +53,33 @@ tv_fault.text = "${total-right}次" val rate = (right * 100) / total tv_rate.text = "正确率:$rate%" HttpManager.completeLearning(rate,time,day,week,season,type,id?:"").request(this){_,data-> when(type){ 6->{ title = "超级听力" tv_back.visible() tv_last.gone() tv_exit.gone() HttpManager.gameAchievement(rate,difficulty,id?:"","超级听力",time).request(this){_,data-> } } 8->{ tv_back.visible() tv_last.gone() tv_exit.gone() HttpManager.completeStory(rate,type,id?:"").request(this){_,data-> } } else->{ HttpManager.completeLearning(rate,time,day,week,season,type,id?:"").request(this){_,data-> } } } } companion object{ fun startResult(context:Context,day:Int,week:Int,season:Int,type:Int,total:Int,right:Int,score:Int,time:Int,id:String){ context.startActivity<ResultActivity>("day" to day,"week" to week,"season" to season,"type" to type,"total" to total,"right" to right,"score" to score,"time" to time,"id" to id) fun startResult(context:Context,day:Int,week:Int,season:Int,type:Int,total:Int,right:Int,score:Int,time:Int,id:String,difficulty:Int? = null){ context.startActivity<ResultActivity>("day" to day,"week" to week,"season" to season,"type" to type,"total" to total,"right" to right,"score" to score, "time" to time,"id" to id,"difficulty" to difficulty) } } } app/src/main/java/com/dollearn/student/ui/home/SuperListenActivity.kt
New file @@ -0,0 +1,210 @@ package com.dollearn.student.ui.home import android.os.Handler import android.os.Looper import android.os.Message import android.util.Log import android.view.View import androidx.recyclerview.widget.GridLayoutManager import cn.sinata.xldutils.gone import cn.sinata.xldutils.utils.myToast import cn.sinata.xldutils.visible import com.dollearn.student.R import com.dollearn.student.dialog.CountdownDialog import com.dollearn.student.dialog.DifficultyDialog import com.dollearn.student.network.HttpManager import com.dollearn.student.network.entity.GameBean import com.dollearn.student.network.entity.Subject import com.dollearn.student.network.request import com.dollearn.student.ui.TransparentStatusBarActivity import com.dollearn.student.ui.home.adapter.GameAdapter import com.dollearn.student.utils.AudioUtils import com.dollearn.student.utils.interfaces.StringCallback import kotlinx.android.synthetic.main.activity_super_listen.* import kotlinx.android.synthetic.main.fragmetn_look_img.* class SuperListenActivity : TransparentStatusBarActivity(), AudioUtils.OnAudioStatusUpdateListener { override fun setContentView() = R.layout.activity_super_listen private val week by lazy { intent.getIntExtra("week",0) } private val season by lazy { intent.getIntExtra("season",0) } private var data:GameBean? = null private var index = 0 private var handler:Handler? = null private var difficulty = 0 //难度 private val TAG = "Listen====>" private val list = arrayListOf<Subject>() private val adapter = GameAdapter(list) private val PLAY_VOICE = 1 private val COUNT_DOWN = 2 private val STUDY_TIME = 3 private val player by lazy { AudioUtils() } private val voiceList = arrayListOf<String>() //声音按顺序播放 private var TIME = 10 //每题答题时间 private var countTime = 10 //倒计时计数 var totalCount = 0 //总答题次数 var rightCount = 0 //正确答题次数 var time = 0 //学习秒数 override fun initClick() { adapter.setOnItemClickListener { view, position -> Log.e(TAG,"点击图片:${list[position].name}") Log.e(TAG,"音频position:${index}") Log.e(TAG,"音频路径:${voiceList[index]}") val subject = data!!.subjectList[data!!.subjectList.map { it.correct }.indexOf(voiceList[index])] //当前音频对应题目 Log.e(TAG,"正确答案:${subject.name}") totalCount++ handler?.removeMessages(COUNT_DOWN) //选择答案后,停止倒计时 if (list[position].id == subject.id){ rightCount++ subject.completed = true subject.right = true handler?.sendEmptyMessage(PLAY_VOICE) adapter.notifyItemChanged(position) }else{ subject.completed = true subject.right = false index++ startGame() } } tv_exit.setOnClickListener { if (tv_exit.text == "提交"){ ResultActivity.startResult(this,0,0,0,6,totalCount,rightCount,list.filter { it.right }.sumBy { 1 },time,data!!.data.id) finish() }else finish() } } override fun initView() { tv_sort.postDelayed({ val difficultyDialog = DifficultyDialog() difficultyDialog.setCallback(object :DifficultyDialog.OnClickCallback{ override fun onOk(d: Int) { difficulty = d HttpManager.gameHearing(season,week,difficulty).request(this@SuperListenActivity){_,data-> difficultyDialog.dismissAllowingStateLoss() this@SuperListenActivity.data = data refreshUi() } } override fun onCancel() { finish() } }) difficultyDialog.show(supportFragmentManager,"dif") },500) player.setOnAudioStatusUpdateListener(this) player.stopPlayMusic() handler = object : Handler(Looper.getMainLooper()){ override fun handleMessage(msg: Message) { super.handleMessage(msg) when(msg.what){ STUDY_TIME->{ time++ sendEmptyMessageDelayed(STUDY_TIME,1000) } PLAY_VOICE->{ if (index<voiceList.size) player.startPlayMusic(this@SuperListenActivity,voiceList[index]) } COUNT_DOWN->{ countTime -- tv_tip.text = "请在${countTime}s内选择答案!" if ( countTime == 0){ index++ startGame() }else{ sendEmptyMessageDelayed(COUNT_DOWN,1000) } } } } } } private fun refreshUi() { rv_list.layoutManager = GridLayoutManager(this,5) list.clear() list.addAll(data?.subjectList?: arrayListOf()) voiceList.clear() voiceList.addAll(list.map { it.correct }) //声音顺序 Log.e(TAG,"声音顺序:${voiceList.joinToString(",,,") { it }}") list.shuffle() //图片随机顺序 rv_list.adapter = adapter Log.e(TAG,"图片打乱后顺序:${list.joinToString(",,,") { it.name }}") val countdownDialog = CountdownDialog() countdownDialog.callback = object :StringCallback{ override fun onResult(rst: String) { index = 0 startGame() } } countdownDialog.show(supportFragmentManager,"timer") } private fun startGame() { if (index < voiceList.size){ Log.e(TAG,"开始答题:index=${index}") tv_sort.text = (index+1).toString() handler?.removeMessages(COUNT_DOWN) countTime = TIME //重置答题时间 tv_tip.text = "准备听题" handler?.sendEmptyMessageDelayed(PLAY_VOICE,3000) }else{ tv_sort.visibility = View.INVISIBLE tv_tip.text = "" tv_end.text = "已完成全部问题" tv_exit.text = "提交" handler?.removeMessages(STUDY_TIME) } } override fun onUpdate(db: Double, time: Long) { } override fun onStop(filePath: String?) { } override fun onStartPlay() { if (!data!!.subjectList[data!!.subjectList.map { it.correct }.indexOf(voiceList[index])].completed){//首次播放 tv_tip.text = "请在${countTime}s内选择答案!" handler?.sendEmptyMessageDelayed(COUNT_DOWN,1000) } iv1.gone() iv2.gone() iv_playing.visible() } override fun onFinishPlay() { iv1.visible() iv2.visible() iv_playing.gone() if (data!!.subjectList[data!!.subjectList.map { it.correct }.indexOf(voiceList[index])].completed){ //当前题目已作答,3秒后进入下一题 index++ startGame() } } } app/src/main/java/com/dollearn/student/ui/home/WeekendFragment.kt
@@ -3,7 +3,10 @@ import androidx.core.os.bundleOf import cn.sinata.xldutils.fragment.BaseFragment import com.dollearn.student.R import com.dollearn.student.network.HttpManager import com.dollearn.student.network.requestByF import kotlinx.android.synthetic.main.fragment_weekend.* import org.jetbrains.anko.support.v4.startActivity class WeekendFragment : BaseFragment() { override fun contentViewId() = R.layout.fragment_weekend @@ -14,11 +17,37 @@ private val week by lazy { (requireActivity() as ScheduleActivity).week } private val season by lazy { (requireActivity() as ScheduleActivity).season } override fun onFirstVisibleToUser() { if (day == 7){ tv_name_1.text = "自主故事1—看图配音" tv_name_2.text = "自主故事2—框架记忆" cl_1.setOnClickListener { showDialog("加载题目...") HttpManager.lookPictureDbu(season, week).requestByF(this){_,data-> startActivity<LookImgActivity>("data" to data,"week" to week,"season" to season) } } cl_2.setOnClickListener { showDialog("加载题目...") HttpManager.frameworkMemory(season, week).requestByF(this){_,data-> startActivity<ListenStoryActivity>("data" to data,"week" to week,"season" to season) } } } if (day == 6){ cl_1.setOnClickListener { startActivity<SuperListenActivity>("week" to week,"season" to season) } cl_2.setOnClickListener { showDialog("加载题目...") HttpManager.gameMemory(season, week).requestByF(this){_,data-> startActivity<MemoryActivity>("data" to data,"week" to week,"season" to season) } } } } app/src/main/java/com/dollearn/student/ui/home/adapter/CardAdapter.kt
New file @@ -0,0 +1,51 @@ package com.dollearn.student.ui.home.adapter import android.view.View import cn.sinata.xldutils.adapter.HFRecyclerAdapter import cn.sinata.xldutils.adapter.util.ViewHolder import cn.sinata.xldutils.gone import cn.sinata.xldutils.visible import com.dollearn.student.R import com.dollearn.student.network.entity.Card import com.dollearn.student.utils.ViewAnimUtils import kotlinx.android.synthetic.main.fragment_q_a.* import java.util.ArrayList class CardAdapter(list: ArrayList<Card>):HFRecyclerAdapter<Card>(list, R.layout.item_card) { override fun onBind(holder: ViewHolder, position: Int, data: Card) { val frame = holder.bind<View>(R.id.frame) val back = holder.bind<View>(R.id.back) val front = holder.bind<View>(R.id.front) frame.setOnClickListener { flip(position,frame,back, front) } if (data.isBack){ back.visible() front.gone() }else{ back.gone() front.visible() } } private fun flip(position: Int,parent:View,back: View,front: View){ var direction = 1 if (back.isShown) { direction = -1 } ViewAnimUtils.flip(parent, 300, direction) parent.postDelayed({ mData[position].isBack = direction != -1 switchViewVisibility(back, front) },300) } private fun switchViewVisibility(back:View,front:View) { if (back.isShown) { back.visibility = View.GONE front.visibility = View.VISIBLE } else { back.visibility = View.VISIBLE front.visibility = View.GONE } } } app/src/main/java/com/dollearn/student/ui/home/adapter/GameAdapter.kt
New file @@ -0,0 +1,22 @@ package com.dollearn.student.ui.home.adapter import android.view.View import cn.sinata.xldutils.adapter.HFRecyclerAdapter import cn.sinata.xldutils.adapter.util.ViewHolder import com.dollearn.student.R import com.dollearn.student.network.entity.Subject import com.dollearn.student.ui.home.SuperListenActivity import com.dollearn.student.utils.extention.clickDelay import com.facebook.drawee.view.SimpleDraweeView import java.util.ArrayList class GameAdapter(list: ArrayList<Subject>):HFRecyclerAdapter<Subject>(list, R.layout.item_game_1) { override fun onBind(holder: ViewHolder, position: Int, data: Subject) { holder.bind<SimpleDraweeView>(R.id.iv_img).setImageURI(data.img) val view = holder.bind<View>(R.id.cl_voice_end_1) view.visibility = if (data.right) View.VISIBLE else View.GONE view.clickDelay { // (context as SuperListenActivity) } } } app/src/main/java/com/dollearn/student/ui/shop/ExchangeActivity.kt
@@ -96,11 +96,11 @@ tv_goods_count.text = "1" tv_total_score.text = good.integral.toString() tv_score.text = good.integral.toString() if (recipient.id.isNullOrEmpty()){ if (recipient?.id.isNullOrEmpty()){ tv_empty.visible() }else{ tv_address.text = recipient.province+recipient.city+recipient.address tv_user.text = "%s | %s".format(recipient.recipient,recipient.recipientPhone) tv_address.text = recipient?.province+recipient?.city+recipient?.address tv_user.text = "%s | %s".format(recipient?.recipient,recipient?.recipientPhone) } } } app/src/main/java/com/dollearn/student/utils/ViewAnimUtils.java
New file @@ -0,0 +1,47 @@ package com.dollearn.student.utils; import android.animation.AnimatorSet; import android.animation.ObjectAnimator; import android.view.View; /** * @author payge view动画工具类 */ public class ViewAnimUtils { /** * 水平翻转 * @param view target * @param duration time * @param direction 只能传1或-1,1为从左开始翻转,-1位从右开始翻转 * @return 动画集合 */ public static AnimatorSet flip(View view, int duration, int direction) { if (direction != 1 && direction != -1) direction = 1; view.setCameraDistance(16000*view.getResources().getDisplayMetrics().density); AnimatorSet animSet = new AnimatorSet(); ObjectAnimator rotationY = new ObjectAnimator(); rotationY.setDuration(duration).setPropertyName("rotationY"); rotationY.setFloatValues(0, -90*direction); ObjectAnimator _rotationY = new ObjectAnimator(); _rotationY.setDuration(duration).setPropertyName("rotationY"); _rotationY.setFloatValues(90*direction, 0); _rotationY.setStartDelay(duration); ObjectAnimator scale = new ObjectAnimator(); scale.setDuration(duration).setPropertyName("scaleY"); scale.setFloatValues(1, 0.94f); ObjectAnimator _scale = new ObjectAnimator(); _scale.setDuration(duration).setPropertyName("scaleY"); _scale.setFloatValues(0.94f, 1); _scale.setStartDelay(duration); animSet.setTarget(view); rotationY.setTarget(view); _rotationY.setTarget(view); scale.setTarget(view); _scale.setTarget(view); animSet.playTogether(rotationY, _rotationY, scale, _scale); animSet.start(); return animSet; } } app/src/main/res/drawable/bg_yellow_circle.xml
New file @@ -0,0 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android"> <solid android:color="#FBCF0F"/> <corners android:radius="20dp"/> </shape> app/src/main/res/layout/activity_finish_remember.xml
New file @@ -0,0 +1,46 @@ <?xml version="1.0" encoding="utf-8"?> <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent" xmlns:tools="http://schemas.android.com/tools"> <androidx.constraintlayout.widget.ConstraintLayout android:layout_width="match_parent" android:layout_height="match_parent" android:background="@drawable/bg_white_8dp" android:layout_marginTop="26dp" android:layout_marginBottom="100dp" android:layout_marginHorizontal="230dp"> <TextView android:id="@+id/tv_tip" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="26dp" android:drawableTop="@mipmap/successs" android:drawablePadding="27dp" android:gravity="center" android:text="恭喜你,已听完全部故事!获得200积分!" android:textStyle="bold" android:textSize="18sp" android:textColor="@color/textColor" app:layout_constraintTop_toTopOf="parent" /> <TextView app:layout_constraintTop_toBottomOf="@id/tv_tip" android:id="@+id/tv_back" android:layout_marginTop="110dp" style="@style/style_btn_cancel" android:layout_width="wrap_content" android:paddingHorizontal="34dp" app:layout_constraintStart_toStartOf="parent" app:layout_constraintEnd_toEndOf="parent" android:layout_height="wrap_content" android:text="返回主页" /> </androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout> app/src/main/res/layout/activity_listen_stroy.xml
New file @@ -0,0 +1,75 @@ <?xml version="1.0" encoding="utf-8"?> <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" xmlns:app="http://schemas.android.com/apk/res-auto"> <TextView android:id="@+id/tv_last" android:layout_width="124dp" android:layout_height="wrap_content" android:textSize="14sp" android:textColor="@color/colorPrimary" android:background="@drawable/bg_blue_line_4dp" android:text="上一题" android:paddingVertical="10dp" android:visibility="gone" android:gravity="center" app:layout_constraintStart_toStartOf="parent" app:layout_constraintHorizontal_chainStyle="packed" app:layout_constraintEnd_toStartOf="@id/tv_progress" app:layout_constraintBottom_toBottomOf="parent" android:layout_marginBottom="12dp" android:textStyle="bold" /> <TextView android:layout_width="155dp" android:layout_height="wrap_content" android:id="@+id/tv_progress" app:layout_constraintStart_toEndOf="@id/tv_last" app:layout_constraintEnd_toStartOf="@id/tv_next" app:layout_constraintBaseline_toBaselineOf="@id/tv_exit" android:gravity="center" android:textStyle="bold" android:textSize="14sp" android:textColor="@color/textColor" android:text="0/0"/> <TextView android:id="@+id/tv_next" android:layout_width="124dp" android:layout_height="wrap_content" android:textSize="14sp" android:textColor="@color/colorPrimary" android:background="@drawable/bg_blue_line_4dp" android:text="下一题" android:paddingVertical="10dp" android:gravity="center" app:layout_constraintStart_toEndOf="@id/tv_progress" app:layout_constraintEnd_toStartOf="@id/tv_exit" app:layout_constraintBottom_toBottomOf="parent" android:layout_marginBottom="12dp" android:textStyle="bold" /> <TextView android:id="@+id/tv_exit" android:layout_width="124dp" android:layout_height="wrap_content" android:textSize="14sp" android:textColor="@color/white" android:background="@drawable/bg_blue_4dp" android:text="退出" android:paddingVertical="10dp" android:layout_marginStart="30dp" app:layout_goneMarginStart="0dp" android:gravity="center" app:layout_constraintStart_toEndOf="@id/tv_next" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintBottom_toBottomOf="parent" android:layout_marginBottom="12dp" android:textStyle="bold" /> <com.dollearn.student.views.NoScrollViewPager android:layout_width="match_parent" android:layout_height="0dp" android:id="@+id/view_pager" app:layout_constraintTop_toTopOf="parent" app:layout_constraintBottom_toTopOf="@id/tv_exit"/> </androidx.constraintlayout.widget.ConstraintLayout> app/src/main/res/layout/activity_memory.xml
New file @@ -0,0 +1,58 @@ <?xml version="1.0" encoding="utf-8"?> <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent" app:layoutDescription="@xml/activity_memory_scene"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/tv_1" app:layout_constraintStart_toStartOf="parent" android:layout_marginStart="40dp" android:textSize="14sp" android:textColor="@color/textColor" app:layout_constraintTop_toTopOf="@id/timer" app:layout_constraintBottom_toBottomOf="@id/timer" android:textStyle="bold" android:text="答题剩余时间:"/> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/timer" app:layout_constraintStart_toEndOf="@id/tv_1" android:textSize="36sp" android:textColor="@color/colorRed" android:text="0s" android:fontFamily="@font/impact_regular" app:layout_constraintTop_toTopOf="parent" android:layout_marginTop="30dp"/> <TextView android:id="@+id/tv_exit" android:layout_width="124dp" android:layout_height="wrap_content" android:textSize="14sp" android:textColor="@color/white" android:background="@drawable/bg_blue_4dp" android:text="退出" android:paddingVertical="10dp" app:layout_goneMarginStart="0dp" android:gravity="center" app:layout_constraintStart_toStartOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintBottom_toBottomOf="parent" android:layout_marginBottom="25dp" android:textStyle="bold" /> <androidx.recyclerview.widget.RecyclerView android:layout_width="match_parent" android:layout_height="0dp" android:id="@+id/rv_list" android:layout_marginHorizontal="30dp" app:layout_constraintTop_toTopOf="parent" app:layout_constraintBottom_toTopOf="@id/tv_exit" android:layout_marginTop="100dp"/> </androidx.constraintlayout.widget.ConstraintLayout> app/src/main/res/layout/activity_result.xml
@@ -43,6 +43,22 @@ app:layout_constraintBottom_toBottomOf="parent" android:layout_marginBottom="12dp" android:textStyle="bold" /> <TextView android:id="@+id/tv_back" android:layout_width="124dp" android:layout_height="wrap_content" android:textSize="14sp" android:textColor="@color/colorPrimary" android:background="@drawable/bg_blue_line_4dp" android:text="返回主页" android:visibility="invisible" android:paddingVertical="10dp" app:layout_constraintStart_toStartOf="parent" app:layout_constraintEnd_toEndOf="parent" android:gravity="center" app:layout_constraintBottom_toBottomOf="parent" android:layout_marginBottom="12dp" android:textStyle="bold" /> <androidx.constraintlayout.widget.ConstraintLayout android:layout_width="match_parent" android:layout_height="0dp" app/src/main/res/layout/activity_super_listen.xml
New file @@ -0,0 +1,110 @@ <?xml version="1.0" encoding="utf-8"?> <androidx.constraintlayout.motion.widget.MotionLayout 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="match_parent" app:layoutDescription="@xml/activity_memory_scene"> <TextView android:layout_width="32dp" android:layout_height="32dp" android:id="@+id/tv_sort" app:layout_constraintTop_toTopOf="parent" app:layout_constraintStart_toStartOf="parent" android:layout_marginStart="40dp" android:layout_marginTop="39dp" android:textColor="@color/white" android:text="1" android:gravity="center" android:textSize="16sp" android:textStyle="bold" android:background="@drawable/bg_yellow_circle"/> <androidx.constraintlayout.widget.ConstraintLayout android:layout_width="159dp" android:layout_height="52dp" app:layout_constraintStart_toEndOf="@id/tv_sort" app:layout_constraintTop_toTopOf="@id/tv_sort" app:layout_constraintBottom_toBottomOf="@id/tv_sort" android:layout_marginStart="12dp" android:elevation="2dp" android:id="@+id/cl_voice" android:background="@drawable/bg_blue_8dp"> <ImageView android:id="@+id/iv1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@mipmap/yuyin" app:layout_constraintTop_toTopOf="parent" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintStart_toStartOf="parent" android:layout_marginStart="25dp"/> <ImageView android:id="@+id/iv2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@mipmap/play" app:layout_constraintTop_toTopOf="parent" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" android:layout_marginEnd="23dp"/> <ImageView android:id="@+id/iv_playing" android:layout_width="wrap_content" android:layout_height="wrap_content" android:visibility="gone" android:src="@mipmap/bofangzhong" app:layout_constraintTop_toTopOf="parent" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" /> </androidx.constraintlayout.widget.ConstraintLayout> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" app:layout_constraintBaseline_toBaselineOf="@id/tv_sort" app:layout_constraintStart_toEndOf="@id/tv_sort" android:layout_marginStart="194dp" android:textColor="@color/colorRed" android:id="@+id/tv_tip" android:textSize="14sp" android:textStyle="bold" android:text="准备听题"/> <TextView android:layout_width="match_parent" android:layout_height="wrap_content" app:layout_constraintBaseline_toBaselineOf="@id/tv_sort" android:textColor="@color/colorRed" android:id="@+id/tv_end" android:gravity="center" android:textSize="16sp" android:textStyle="bold" android:text=""/> <TextView android:id="@+id/tv_exit" android:layout_width="124dp" android:layout_height="wrap_content" android:textSize="14sp" android:textColor="@color/white" android:background="@drawable/bg_blue_4dp" android:text="退出" android:paddingVertical="10dp" app:layout_goneMarginStart="0dp" android:gravity="center" app:layout_constraintStart_toStartOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintBottom_toBottomOf="parent" android:layout_marginBottom="25dp" android:textStyle="bold" /> <androidx.recyclerview.widget.RecyclerView android:layout_width="match_parent" android:layout_height="0dp" android:id="@+id/rv_list" android:layout_marginHorizontal="30dp" app:layout_constraintTop_toTopOf="parent" app:layout_constraintBottom_toTopOf="@id/tv_exit" android:layout_marginTop="100dp"/> </androidx.constraintlayout.motion.widget.MotionLayout> app/src/main/res/layout/dialog_countdown.xml
New file @@ -0,0 +1,75 @@ <?xml version="1.0" encoding="utf-8"?> <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="wrap_content" android:paddingBottom="20dp" android:background="@drawable/bg_white_10dp"> <TextView android:id="@+id/tv_title" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="32dp" android:layout_marginEnd="14dp" android:gravity="center" android:text="提示" android:textColor="@color/textColor" android:textSize="18sp" android:textStyle="bold" app:layout_constraintTop_toTopOf="parent" /> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintTop_toTopOf="parent" android:padding="10dp" android:visibility="gone" android:layout_marginEnd="6dp" android:layout_marginTop="9dp" android:id="@+id/iv_close"/> <TextView android:id="@+id/tv_msg" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginStart="47dp" android:layout_marginTop="17dp" android:layout_marginEnd="14dp" app:layout_constraintStart_toStartOf="parent" android:gravity="center" android:text="游戏将在倒计时结束后开始,请注意听题!" android:textColor="@color/textColor" android:textStyle="bold" android:textSize="16sp" app:layout_constraintTop_toBottomOf="@id/tv_title" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/tv_timer" app:layout_constraintTop_toBottomOf="@id/tv_msg" android:layout_marginTop="5dp" app:layout_constraintStart_toStartOf="parent" app:layout_constraintEnd_toEndOf="parent" android:textColor="@color/colorPrimary" android:textSize="60sp" android:fontFamily="@font/impact_regular" android:text="5"/> <TextView android:id="@+id/tv_ok" android:layout_width="219dp" android:layout_height="40dp" android:gravity="center" android:text="立即开始" android:textColor="@color/white" android:textSize="15sp" android:textStyle="bold" android:layout_marginTop="10dp" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" android:background="@drawable/bg_btn_dialog_ok" app:layout_constraintTop_toBottomOf="@id/tv_timer"/> </androidx.constraintlayout.widget.ConstraintLayout> app/src/main/res/layout/dialog_diff.xml
New file @@ -0,0 +1,115 @@ <?xml version="1.0" encoding="utf-8"?> <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="wrap_content" android:paddingBottom="20dp" android:background="@drawable/bg_white_10dp"> <TextView android:id="@+id/tv_title" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="32dp" android:layout_marginEnd="14dp" android:gravity="center" android:text="提示" android:textColor="@color/textColor" android:textSize="18sp" android:textStyle="bold" app:layout_constraintTop_toTopOf="parent" /> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintTop_toTopOf="parent" android:padding="10dp" android:visibility="gone" android:layout_marginEnd="6dp" android:layout_marginTop="9dp" android:id="@+id/iv_close"/> <TextView android:id="@+id/tv_msg" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginStart="47dp" android:layout_marginTop="43dp" android:layout_marginEnd="14dp" app:layout_constraintStart_toStartOf="parent" android:gravity="center" android:text="请选择难度:" android:textColor="@color/textColor" android:textStyle="bold" android:textSize="16sp" app:layout_constraintTop_toBottomOf="@id/tv_title" /> <RadioGroup android:layout_width="0dp" android:layout_height="wrap_content" android:orientation="horizontal" android:id="@+id/rg_diff" app:layout_constraintTop_toTopOf="@id/tv_msg" app:layout_constraintBottom_toBottomOf="@id/tv_msg" app:layout_constraintStart_toEndOf="@id/tv_msg" android:layout_marginEnd="40dp" android:layout_marginStart="8dp" app:layout_constraintEnd_toEndOf="parent"> <RadioButton android:id="@+id/rb_0" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:checked="true" android:button="@drawable/selector_check_radio" android:text="入门级"/> <RadioButton android:id="@+id/rb_1" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:button="@drawable/selector_check_radio" android:text="中级"/> <RadioButton android:id="@+id/rb_2" android:layout_width="0dp" android:layout_height="wrap_content" android:button="@drawable/selector_check_radio" android:layout_weight="1" android:text="高级"/> </RadioGroup> <TextView android:id="@+id/tv_cancel" android:layout_width="0dp" android:layout_height="40dp" android:gravity="center" android:text="关闭" android:textColor="@color/colorPrimary" android:textSize="15sp" app:layout_constraintEnd_toStartOf="@id/tv_ok" app:layout_constraintStart_toStartOf="parent" android:textStyle="bold" android:layout_marginStart="90dp" android:layout_marginEnd="10dp" android:background="@drawable/bg_blue_line_4dp" app:layout_constraintTop_toTopOf="@id/tv_ok" /> <TextView android:id="@+id/tv_ok" android:layout_width="0dp" android:layout_height="40dp" android:gravity="center" android:text="确认" android:textColor="@color/white" android:textSize="15sp" android:layout_marginStart="10dp" android:layout_marginEnd="90dp" android:textStyle="bold" android:layout_marginTop="65dp" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toEndOf="@id/tv_cancel" android:background="@drawable/bg_btn_dialog_ok" app:layout_constraintTop_toBottomOf="@id/tv_msg"/> </androidx.constraintlayout.widget.ConstraintLayout> app/src/main/res/layout/dialog_rule.xml
@@ -65,12 +65,12 @@ android:layout_height="wrap_content" android:layout_weight="1" android:gravity="center" android:background="@drawable/bg_btn_dialog_cancel" android:background="@drawable/bg_blue_line_4dp" android:paddingTop="12dp" android:paddingBottom="12dp" android:text="不同意并退出" android:layout_marginEnd="10dp" android:textColor="@color/white" android:textColor="@color/colorPrimary" android:textSize="14sp" /> app/src/main/res/layout/dialog_tip.xml
@@ -48,14 +48,14 @@ android:layout_height="40dp" android:gravity="center" android:text="否" android:textColor="@color/white" android:textColor="@color/colorPrimary" android:textSize="15sp" app:layout_constraintEnd_toStartOf="@id/tv_ok" app:layout_constraintStart_toStartOf="parent" android:textStyle="bold" android:layout_marginStart="90dp" android:layout_marginEnd="10dp" android:background="@drawable/bg_btn_dialog_cancel" android:background="@drawable/bg_blue_line_4dp" app:layout_constraintTop_toTopOf="@id/tv_ok" /> app/src/main/res/layout/fragment_match.xml
@@ -51,7 +51,6 @@ android:layout_width="0dp" android:layout_height="0dp" android:padding="4dp" android:elevation="2dp" app:layout_constraintDimensionRatio="333:259" android:layout_marginTop="104dp" app:layout_constraintHorizontal_chainStyle="packed" @@ -79,12 +78,59 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/result_1"/> </androidx.constraintlayout.motion.widget.MotionLayout> <androidx.constraintlayout.widget.ConstraintLayout android:layout_width="0dp" android:layout_height="40dp" app:layout_constraintStart_toStartOf="@id/cl_1" app:layout_constraintEnd_toEndOf="@id/cl_1" app:layout_constraintTop_toTopOf="@id/cl_1" android:layout_margin="4dp" android:id="@+id/cl_voice_end_1_1"> <androidx.constraintlayout.widget.ConstraintLayout android:layout_width="match_parent" android:id="@+id/cl_voice_end_1" android:background="@drawable/bg_blue_8dp" android:visibility="gone" android:layout_height="match_parent"> <ImageView android:id="@+id/iv1_1_end" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@mipmap/yuyin" app:layout_constraintTop_toTopOf="parent" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintStart_toStartOf="parent" android:layout_marginStart="25dp"/> <ImageView android:id="@+id/iv2_1_end" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@mipmap/play" app:layout_constraintTop_toTopOf="parent" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" android:layout_marginEnd="23dp"/> <ImageView android:id="@+id/iv_playing_1_end" android:layout_width="wrap_content" android:layout_height="wrap_content" android:visibility="gone" android:src="@mipmap/bofangzhong" app:layout_constraintTop_toTopOf="parent" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" /> </androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout> <androidx.constraintlayout.motion.widget.MotionLayout android:id="@+id/cl_2" android:layout_width="0dp" android:layout_height="0dp" android:elevation="2dp" app:layout_constraintDimensionRatio="333:259" android:padding="4dp" app:layoutDescription="@xml/fragment_listen_scene_result_2" @@ -110,12 +156,59 @@ android:layout_height="wrap_content" android:id="@+id/result_2"/> </androidx.constraintlayout.motion.widget.MotionLayout> <androidx.constraintlayout.widget.ConstraintLayout android:layout_width="0dp" android:layout_height="40dp" app:layout_constraintStart_toStartOf="@id/cl_2" app:layout_constraintEnd_toEndOf="@id/cl_2" app:layout_constraintTop_toTopOf="@id/cl_2" android:layout_margin="4dp" android:id="@+id/cl_voice_end_2_1"> <androidx.constraintlayout.widget.ConstraintLayout android:layout_width="match_parent" android:id="@+id/cl_voice_end_2" android:background="@drawable/bg_blue_8dp" android:visibility="gone" android:layout_height="match_parent"> <ImageView android:id="@+id/iv1_2_end" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@mipmap/yuyin" app:layout_constraintTop_toTopOf="parent" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintStart_toStartOf="parent" android:layout_marginStart="25dp"/> <ImageView android:id="@+id/iv2_2_end" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@mipmap/play" app:layout_constraintTop_toTopOf="parent" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" android:layout_marginEnd="23dp"/> <ImageView android:id="@+id/iv_playing_2_end" android:layout_width="wrap_content" android:layout_height="wrap_content" android:visibility="gone" android:src="@mipmap/bofangzhong" app:layout_constraintTop_toTopOf="parent" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" /> </androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout> <androidx.constraintlayout.motion.widget.MotionLayout android:id="@+id/cl_3" android:layout_width="0dp" android:layout_height="0dp" android:padding="4dp" android:elevation="2dp" app:layoutDescription="@xml/fragment_listen_scene_result_3" app:layout_constraintStart_toStartOf="@id/cl_1" app:layout_constraintEnd_toEndOf="@id/cl_1" @@ -144,12 +237,61 @@ app:layout_constraintBottom_toBottomOf="@id/iv_3" android:id="@+id/result_3" /> </androidx.constraintlayout.motion.widget.MotionLayout> <androidx.constraintlayout.widget.ConstraintLayout android:layout_width="0dp" android:layout_height="40dp" app:layout_constraintStart_toStartOf="@id/cl_3" app:layout_constraintEnd_toEndOf="@id/cl_3" app:layout_constraintTop_toTopOf="@id/cl_3" android:layout_margin="4dp" android:id="@+id/cl_voice_end_3_1"> <androidx.constraintlayout.widget.ConstraintLayout android:layout_width="match_parent" android:id="@+id/cl_voice_end_3" android:background="@drawable/bg_blue_8dp" android:visibility="gone" android:layout_height="match_parent"> <ImageView android:id="@+id/iv1_3_end" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@mipmap/yuyin" app:layout_constraintTop_toTopOf="parent" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintStart_toStartOf="parent" android:layout_marginStart="25dp"/> <ImageView android:id="@+id/iv2_3_end" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@mipmap/play" app:layout_constraintTop_toTopOf="parent" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" android:layout_marginEnd="23dp"/> <ImageView android:id="@+id/iv_playing_3_end" android:layout_width="wrap_content" android:layout_height="wrap_content" android:visibility="gone" android:src="@mipmap/bofangzhong" app:layout_constraintTop_toTopOf="parent" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" /> </androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout> <androidx.constraintlayout.motion.widget.MotionLayout android:id="@+id/cl_4" android:layout_width="0dp" android:layout_height="0dp" android:elevation="2dp" android:padding="4dp" app:layout_constraintStart_toStartOf="@id/cl_2" app:layout_constraintEnd_toEndOf="@id/cl_2" @@ -173,13 +315,62 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/result_4" /> </androidx.constraintlayout.motion.widget.MotionLayout> <androidx.constraintlayout.widget.ConstraintLayout android:layout_width="0dp" android:layout_height="40dp" app:layout_constraintStart_toStartOf="@id/cl_4" app:layout_constraintEnd_toEndOf="@id/cl_4" app:layout_constraintTop_toTopOf="@id/cl_4" android:layout_margin="4dp" android:id="@+id/cl_voice_end_4_1"> <androidx.constraintlayout.widget.ConstraintLayout android:layout_width="match_parent" android:id="@+id/cl_voice_end_4" android:background="@drawable/bg_blue_8dp" android:visibility="gone" android:layout_height="match_parent"> <ImageView android:id="@+id/iv1_4_end" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@mipmap/yuyin" app:layout_constraintTop_toTopOf="parent" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintStart_toStartOf="parent" android:layout_marginStart="25dp"/> <ImageView android:id="@+id/iv2_4_end" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@mipmap/play" app:layout_constraintTop_toTopOf="parent" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" android:layout_marginEnd="23dp"/> <ImageView android:id="@+id/iv_playing_4_end" android:layout_width="wrap_content" android:layout_height="wrap_content" android:visibility="gone" android:src="@mipmap/bofangzhong" app:layout_constraintTop_toTopOf="parent" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" /> </androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout> <androidx.constraintlayout.widget.ConstraintLayout android:layout_width="159dp" android:layout_height="52dp" app:layout_constraintTop_toTopOf="parent" android:elevation="2dp" android:id="@+id/cl_voice_1" app:layout_constraintStart_toStartOf="@id/line1" app:layout_constraintEnd_toEndOf="@id/line1" @@ -207,8 +398,8 @@ android:id="@+id/iv_playing_1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:visibility="gone" android:src="@mipmap/bofangzhong" android:visibility="invisible" app:layout_constraintTop_toTopOf="parent" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" @@ -218,7 +409,6 @@ android:layout_width="159dp" android:layout_height="52dp" app:layout_constraintTop_toTopOf="parent" android:elevation="2dp" android:id="@+id/cl_voice_2" app:layout_constraintStart_toStartOf="@id/line2" app:layout_constraintEnd_toEndOf="@id/line2" @@ -257,7 +447,7 @@ android:layout_width="159dp" android:layout_height="52dp" app:layout_constraintTop_toTopOf="parent" android:elevation="2dp" android:id="@+id/cl_voice_3" app:layout_constraintStart_toStartOf="@id/line3" app:layout_constraintEnd_toEndOf="@id/line3" @@ -296,7 +486,7 @@ android:layout_width="159dp" android:layout_height="52dp" app:layout_constraintTop_toTopOf="parent" android:elevation="2dp" android:id="@+id/cl_voice_4" app:layout_constraintStart_toStartOf="@id/line4" app:layout_constraintEnd_toEndOf="@id/line4" @@ -331,5 +521,64 @@ app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" /> </androidx.constraintlayout.widget.ConstraintLayout> <LinearLayout android:id="@+id/ll_2" android:layout_width="159dp" android:layout_marginTop="15dp" app:layout_constraintStart_toStartOf="@id/line2" app:layout_constraintEnd_toStartOf="@id/line2" app:layout_constraintTop_toTopOf="parent" android:layout_height="52dp"> <View android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/cover_2" android:visibility="gone" android:background="@color/page_bg"/> </LinearLayout> <LinearLayout android:id="@+id/ll_3" android:layout_width="159dp" android:layout_marginTop="15dp" app:layout_constraintStart_toStartOf="@id/line3" app:layout_constraintEnd_toStartOf="@id/line3" app:layout_constraintTop_toTopOf="parent" android:layout_height="52dp"> <View android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/cover_3" android:visibility="gone" android:background="@color/page_bg"/> </LinearLayout> <LinearLayout android:id="@+id/ll_4" android:layout_width="159dp" android:layout_marginTop="15dp" app:layout_constraintStart_toStartOf="@id/line4" app:layout_constraintEnd_toStartOf="@id/line4" app:layout_constraintTop_toTopOf="parent" android:layout_height="52dp"> <View android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/cover_4" android:visibility="gone" android:background="@color/page_bg"/> </LinearLayout> <LinearLayout android:id="@+id/ll_1" android:layout_width="159dp" android:layout_marginTop="15dp" app:layout_constraintStart_toStartOf="@id/line1" app:layout_constraintEnd_toStartOf="@id/line1" app:layout_constraintTop_toTopOf="parent" android:layout_height="52dp"> <View android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/cover_1" android:visibility="gone" android:background="@color/page_bg"/> </LinearLayout> </androidx.constraintlayout.motion.widget.MotionLayout> app/src/main/res/layout/fragment_q_a.xml
New file @@ -0,0 +1,574 @@ <?xml version="1.0" encoding="utf-8"?> <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/motion"> <View android:id="@+id/center" android:layout_width="1px" android:layout_height="wrap_content" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" /> <androidx.constraintlayout.widget.ConstraintLayout android:id="@+id/cl_voice_1" android:layout_width="159dp" android:layout_height="52dp" android:layout_marginTop="24dp" android:background="@drawable/bg_blue_8dp" app:layout_constraintStart_toStartOf="@id/cl_1" app:layout_constraintTop_toTopOf="parent"> <ImageView android:id="@+id/iv1_1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@mipmap/yuyin" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" /> <ImageView android:id="@+id/iv2_1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginEnd="20dp" android:src="@mipmap/play" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintTop_toTopOf="parent" /> <ImageView android:id="@+id/iv3_1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginStart="20dp" android:src="@mipmap/voice_answer" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" /> <ImageView android:id="@+id/iv_playing_1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@mipmap/bofangzhong" android:visibility="gone" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" /> </androidx.constraintlayout.widget.ConstraintLayout> <androidx.constraintlayout.widget.ConstraintLayout android:id="@+id/cl_1" android:layout_width="0dp" android:layout_height="0dp" android:layout_marginTop="96dp" android:layout_marginEnd="30dp" android:layout_marginBottom="8dp" android:background="@drawable/bg_white_8dp" android:padding="4dp" app:layout_constraintBottom_toTopOf="@id/cl_voice_3" app:layout_constraintDimensionRatio="333:259" app:layout_constraintEnd_toStartOf="@id/center" app:layout_constraintTop_toTopOf="parent" app:layout_constraintVertical_chainStyle="packed"> <com.facebook.drawee.view.SimpleDraweeView android:id="@+id/iv_1" android:layout_width="match_parent" android:layout_height="match_parent" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintTop_toTopOf="parent" /> </androidx.constraintlayout.widget.ConstraintLayout> <androidx.constraintlayout.widget.ConstraintLayout android:id="@+id/cl_voice_3" android:layout_width="159dp" android:layout_height="52dp" android:layout_marginTop="8dp" android:background="@drawable/bg_blue_8dp" app:layout_constraintBottom_toTopOf="@id/cl_3" app:layout_constraintStart_toStartOf="@id/cl_3" app:layout_constraintTop_toBottomOf="@id/cl_1"> <ImageView android:id="@+id/iv1_3" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@mipmap/yuyin" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" /> <ImageView android:id="@+id/iv2_3" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginEnd="20dp" android:src="@mipmap/play" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintTop_toTopOf="parent" /> <ImageView android:id="@+id/iv3_3" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginStart="20dp" android:src="@mipmap/voice_answer" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" /> <ImageView android:id="@+id/iv_playing_3" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@mipmap/bofangzhong" android:visibility="gone" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" /> </androidx.constraintlayout.widget.ConstraintLayout> <androidx.constraintlayout.widget.ConstraintLayout android:id="@+id/cl_3" android:layout_width="0dp" android:layout_height="0dp" android:layout_marginTop="10dp" android:layout_marginEnd="11dp" android:layout_marginBottom="8dp" android:background="@drawable/bg_white_8dp" android:padding="4dp" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintDimensionRatio="333:259" app:layout_constraintStart_toStartOf="@id/cl_1" app:layout_constraintTop_toBottomOf="@id/cl_voice_3"> <com.facebook.drawee.view.SimpleDraweeView android:id="@+id/iv_3" android:layout_width="match_parent" android:layout_height="match_parent" app:actualImageScaleType="centerCrop" /> </androidx.constraintlayout.widget.ConstraintLayout> <androidx.constraintlayout.widget.ConstraintLayout android:id="@+id/cl_voice_2" android:layout_width="159dp" android:layout_height="52dp" android:layout_marginTop="24dp" android:background="@drawable/bg_blue_8dp" app:layout_constraintStart_toStartOf="@id/cl_2" app:layout_constraintTop_toTopOf="parent"> <ImageView android:id="@+id/iv1_2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@mipmap/yuyin" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" /> <ImageView android:id="@+id/iv2_2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginEnd="20dp" android:src="@mipmap/play" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintTop_toTopOf="parent" /> <ImageView android:id="@+id/iv3_2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginStart="20dp" android:src="@mipmap/voice_answer" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" /> <ImageView android:id="@+id/iv_playing_2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@mipmap/bofangzhong" android:visibility="gone" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" /> </androidx.constraintlayout.widget.ConstraintLayout> <androidx.constraintlayout.widget.ConstraintLayout android:id="@+id/cl_2" android:layout_width="0dp" android:layout_height="0dp" android:layout_marginStart="30dp" android:background="@drawable/bg_white_8dp" android:padding="4dp" app:layout_constraintBottom_toBottomOf="@id/cl_1" app:layout_constraintDimensionRatio="333:259" app:layout_constraintStart_toEndOf="@id/center" app:layout_constraintTop_toTopOf="@id/cl_1"> <com.facebook.drawee.view.SimpleDraweeView android:id="@+id/iv_2" android:layout_width="match_parent" android:layout_height="match_parent" app:actualImageScaleType="centerCrop" /> </androidx.constraintlayout.widget.ConstraintLayout> <androidx.constraintlayout.widget.ConstraintLayout android:id="@+id/cl_4" android:layout_width="0dp" android:layout_height="0dp" android:layout_marginStart="30dp" android:background="@drawable/bg_white_8dp" android:padding="4dp" app:layout_constraintBottom_toBottomOf="@id/cl_3" app:layout_constraintDimensionRatio="333:259" app:layout_constraintStart_toEndOf="@id/center" app:layout_constraintTop_toTopOf="@id/cl_3"> <com.facebook.drawee.view.SimpleDraweeView android:id="@+id/iv_4" android:layout_width="match_parent" android:layout_height="match_parent" app:actualImageScaleType="centerCrop" /> </androidx.constraintlayout.widget.ConstraintLayout> <androidx.constraintlayout.widget.ConstraintLayout android:id="@+id/cl_voice_4" android:layout_width="159dp" android:layout_height="52dp" android:background="@drawable/bg_blue_8dp" app:layout_constraintStart_toStartOf="@id/cl_4" app:layout_constraintTop_toTopOf="@id/cl_voice_3"> <ImageView android:id="@+id/iv1_4" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@mipmap/yuyin" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" /> <ImageView android:id="@+id/iv2_4" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginEnd="20dp" android:src="@mipmap/play" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintTop_toTopOf="parent" /> <ImageView android:id="@+id/iv3_4" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginStart="20dp" android:src="@mipmap/voice_answer" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" /> <ImageView android:id="@+id/iv_playing_4" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@mipmap/bofangzhong" android:visibility="gone" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" /> </androidx.constraintlayout.widget.ConstraintLayout> <View android:id="@+id/position_2" android:layout_width="159dp" android:layout_height="52dp" android:layout_marginEnd="72dp" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintTop_toTopOf="parent" /> <View android:id="@+id/position_1" android:layout_width="159dp" android:layout_height="52dp" android:layout_marginEnd="72dp" android:layout_marginBottom="40dp" app:layout_constraintBottom_toTopOf="@id/position_2" app:layout_constraintEnd_toEndOf="parent" /> <View android:id="@+id/position_3" android:layout_width="159dp" android:layout_height="52dp" android:layout_marginTop="40dp" android:layout_marginEnd="72dp" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintTop_toBottomOf="@id/position_2" /> <androidx.constraintlayout.widget.ConstraintLayout android:id="@+id/cl_answer_1" android:layout_width="159dp" android:layout_height="52dp" android:background="@drawable/bg_blue_8dp" android:visibility="gone" app:layout_constraintStart_toStartOf="@id/position_1" app:layout_constraintTop_toTopOf="@id/position_1"> <ImageView android:id="@+id/iv1_answer_1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@mipmap/yuyin" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" /> <ImageView android:id="@+id/iv2_answer_1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginStart="20dp" android:src="@mipmap/voice_answer" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" /> <ImageView android:id="@+id/iv_playing_answer_1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@mipmap/bofangzhong" android:visibility="gone" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" /> <ImageView android:layout_width="32dp" android:layout_height="32dp" android:src="@mipmap/zhifushibai" app:layout_constraintTop_toTopOf="parent" app:layout_constraintBottom_toBottomOf="parent" android:layout_marginEnd="8dp" app:layout_constraintEnd_toEndOf="parent" android:visibility="gone" android:id="@+id/iv_error_1"/> </androidx.constraintlayout.widget.ConstraintLayout> <androidx.constraintlayout.widget.ConstraintLayout android:id="@+id/cl_answer_2" android:layout_width="159dp" android:layout_height="52dp" android:background="@drawable/bg_blue_8dp" android:visibility="gone" app:layout_constraintStart_toStartOf="@id/position_2" app:layout_constraintTop_toTopOf="@id/position_2"> <ImageView android:id="@+id/iv1_answer_2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@mipmap/yuyin" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" /> <ImageView android:id="@+id/iv2_answer_2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginStart="20dp" android:src="@mipmap/voice_answer" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" /> <ImageView android:id="@+id/iv_playing_answer_2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@mipmap/bofangzhong" android:visibility="gone" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" /> <ImageView android:layout_width="32dp" android:layout_height="32dp" android:src="@mipmap/zhifushibai" app:layout_constraintTop_toTopOf="parent" app:layout_constraintBottom_toBottomOf="parent" android:layout_marginEnd="8dp" app:layout_constraintEnd_toEndOf="parent" android:visibility="gone" android:id="@+id/iv_error_2"/> </androidx.constraintlayout.widget.ConstraintLayout> <androidx.constraintlayout.widget.ConstraintLayout android:id="@+id/cl_answer_3" android:layout_width="159dp" android:layout_height="52dp" android:background="@drawable/bg_blue_8dp" android:visibility="gone" app:layout_constraintStart_toStartOf="@id/position_3" app:layout_constraintTop_toTopOf="@id/position_3"> <ImageView android:id="@+id/iv1_answer_3" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@mipmap/yuyin" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" /> <ImageView android:id="@+id/iv2_answer_3" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginStart="20dp" android:src="@mipmap/voice_answer" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" /> <ImageView android:id="@+id/iv_playing_answer_3" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@mipmap/bofangzhong" android:visibility="gone" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" /> <ImageView android:layout_width="32dp" android:layout_height="32dp" android:src="@mipmap/zhifushibai" app:layout_constraintTop_toTopOf="parent" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" android:visibility="gone" android:layout_marginEnd="8dp" android:id="@+id/iv_error_3"/> </androidx.constraintlayout.widget.ConstraintLayout> <RelativeLayout android:id="@+id/rl_p_1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginStart="10dp" app:layout_constraintStart_toEndOf="@id/position_1" app:layout_constraintTop_toTopOf="@id/position_1"> <RelativeLayout android:id="@+id/rl_check_1" android:layout_width="52dp" android:layout_height="52dp" android:background="@drawable/bg_blue_line_8dp" android:visibility="gone"> <View android:id="@+id/dot_1" android:layout_width="18dp" android:layout_height="18dp" android:layout_centerInParent="true" android:background="@drawable/bg_blue_20dp" android:visibility="gone" /> </RelativeLayout> </RelativeLayout> <RelativeLayout android:id="@+id/rl_p_2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginStart="10dp" app:layout_constraintStart_toEndOf="@id/position_2" app:layout_constraintTop_toTopOf="@id/position_2"> <RelativeLayout android:id="@+id/rl_check_2" android:layout_width="52dp" android:layout_height="52dp" android:background="@drawable/bg_blue_line_8dp" android:visibility="gone"> <View android:id="@+id/dot_2" android:layout_width="18dp" android:layout_height="18dp" android:layout_centerInParent="true" android:background="@drawable/bg_blue_20dp" android:visibility="gone" /> </RelativeLayout> </RelativeLayout> <RelativeLayout android:id="@+id/rl_p_3" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginStart="10dp" app:layout_constraintStart_toEndOf="@id/position_3" app:layout_constraintTop_toTopOf="@id/position_3"> <RelativeLayout android:id="@+id/rl_check_3" android:layout_width="52dp" android:layout_height="52dp" android:background="@drawable/bg_blue_line_8dp" android:visibility="gone"> <View android:id="@+id/dot_3" android:layout_width="18dp" android:layout_height="18dp" android:layout_centerInParent="true" android:background="@drawable/bg_blue_20dp" android:visibility="gone" /> </RelativeLayout> </RelativeLayout> </androidx.constraintlayout.widget.ConstraintLayout> app/src/main/res/layout/fragmetn_look_img.xml
New file @@ -0,0 +1,300 @@ <?xml version="1.0" encoding="utf-8"?> <androidx.constraintlayout.motion.widget.MotionLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/motion" app:layoutDescription="@xml/scene_fragment_look" xmlns:app="http://schemas.android.com/apk/res-auto"> <androidx.constraintlayout.widget.ConstraintLayout android:id="@+id/cl_1" android:layout_width="0dp" android:layout_height="0dp" android:padding="4dp" android:elevation="2dp" app:layout_constraintDimensionRatio="6:4" app:layout_constraintTop_toBottomOf="@id/rl_1" android:layout_marginTop="40dp" app:layout_constraintBottom_toBottomOf="parent" android:layout_marginBottom="100dp" android:background="@drawable/bg_white_8dp" app:layout_constraintStart_toStartOf="parent" app:layout_constraintEnd_toEndOf="parent" android:layout_marginEnd="10dp"> <com.facebook.drawee.view.SimpleDraweeView android:layout_width="match_parent" android:id="@+id/iv_1" app:actualImageScaleType="centerCrop" android:layout_height="match_parent"/> </androidx.constraintlayout.widget.ConstraintLayout> <RelativeLayout android:id="@+id/rl_2" android:layout_width="159dp" android:layout_height="52dp" app:layout_constraintStart_toStartOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintTop_toTopOf="parent" android:layout_marginTop="24dp" android:background="@drawable/bg_blue_8dp"> <ImageView android:id="@+id/iv_s_2" android:layout_width="32dp" android:layout_height="32dp" android:src="@mipmap/successs" android:layout_centerInParent="true"/> </RelativeLayout> <androidx.constraintlayout.widget.ConstraintLayout android:layout_width="159dp" android:layout_height="52dp" app:layout_constraintStart_toStartOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintTop_toTopOf="parent" android:layout_marginTop="24dp" android:elevation="2dp" android:id="@+id/cl_voice2" android:background="@drawable/bg_blue_8dp"> <ImageView android:id="@+id/iv1_2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@mipmap/yuyin" app:layout_constraintTop_toTopOf="parent" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintStart_toStartOf="parent" android:layout_marginStart="25dp"/> <ImageView android:id="@+id/iv2_2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@mipmap/play" app:layout_constraintTop_toTopOf="parent" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" android:layout_marginEnd="23dp"/> <ImageView android:id="@+id/iv_playing_2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:visibility="gone" android:src="@mipmap/bofangzhong" app:layout_constraintTop_toTopOf="parent" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" /> <ImageView android:layout_width="32dp" android:layout_height="32dp" android:src="@mipmap/zhifushibai" app:layout_constraintTop_toTopOf="parent" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintEnd_toEndOf="parent" android:visibility="gone" android:id="@+id/iv_error_2"/> </androidx.constraintlayout.widget.ConstraintLayout> <RelativeLayout android:id="@+id/rl_1" android:layout_width="159dp" android:layout_height="52dp" app:layout_constraintStart_toStartOf="parent" app:layout_constraintEnd_toStartOf="@id/rl_2" app:layout_constraintTop_toTopOf="parent" android:layout_marginTop="24dp" android:background="@drawable/bg_blue_8dp"> <ImageView android:id="@+id/iv_s_1" android:layout_width="32dp" android:layout_height="32dp" android:src="@mipmap/successs" android:layout_centerInParent="true"/> </RelativeLayout> <androidx.constraintlayout.widget.ConstraintLayout android:layout_width="159dp" android:layout_height="52dp" app:layout_constraintStart_toStartOf="@id/rl_1" app:layout_constraintTop_toTopOf="parent" android:layout_marginTop="24dp" android:elevation="2dp" android:id="@+id/cl_voice1" android:background="@drawable/bg_blue_8dp"> <ImageView android:id="@+id/iv1_1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@mipmap/yuyin" app:layout_constraintTop_toTopOf="parent" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintStart_toStartOf="parent" android:layout_marginStart="25dp"/> <ImageView android:id="@+id/iv2_1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@mipmap/play" app:layout_constraintTop_toTopOf="parent" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" android:layout_marginEnd="23dp"/> <ImageView android:id="@+id/iv_playing_1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:visibility="gone" android:src="@mipmap/bofangzhong" app:layout_constraintTop_toTopOf="parent" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" /> <ImageView android:layout_width="32dp" android:layout_height="32dp" android:src="@mipmap/zhifushibai" app:layout_constraintTop_toTopOf="parent" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintEnd_toEndOf="parent" android:visibility="gone" android:id="@+id/iv_error_1"/> </androidx.constraintlayout.widget.ConstraintLayout> <RelativeLayout android:id="@+id/rl_3" android:layout_width="159dp" android:layout_height="52dp" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toEndOf="@id/rl_2" app:layout_constraintTop_toTopOf="parent" android:layout_marginTop="24dp" android:background="@drawable/bg_blue_8dp"> <ImageView android:id="@+id/iv_s_3" android:layout_width="32dp" android:layout_height="32dp" android:src="@mipmap/successs" android:layout_centerInParent="true"/> </RelativeLayout> <androidx.constraintlayout.widget.ConstraintLayout android:layout_width="159dp" android:layout_height="52dp" app:layout_constraintTop_toTopOf="parent" android:layout_marginTop="24dp" app:layout_constraintStart_toStartOf="@id/rl_3" android:elevation="2dp" android:id="@+id/cl_voice3" android:background="@drawable/bg_blue_8dp"> <ImageView android:id="@+id/iv1_3" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@mipmap/yuyin" app:layout_constraintTop_toTopOf="parent" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintStart_toStartOf="parent" android:layout_marginStart="25dp"/> <ImageView android:id="@+id/iv2_3" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@mipmap/play" app:layout_constraintTop_toTopOf="parent" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" android:layout_marginEnd="23dp"/> <ImageView android:id="@+id/iv_playing_3" android:layout_width="wrap_content" android:layout_height="wrap_content" android:visibility="gone" android:src="@mipmap/bofangzhong" app:layout_constraintTop_toTopOf="parent" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" /> <ImageView android:layout_width="32dp" android:layout_height="32dp" android:src="@mipmap/zhifushibai" app:layout_constraintTop_toTopOf="parent" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintEnd_toEndOf="parent" android:visibility="gone" android:id="@+id/iv_error_3"/> </androidx.constraintlayout.widget.ConstraintLayout> <RelativeLayout android:id="@+id/rl_p_1" android:layout_width="wrap_content" android:layout_height="wrap_content" app:layout_constraintTop_toTopOf="@id/rl_1" android:layout_marginStart="10dp" app:layout_constraintStart_toEndOf="@id/rl_1"> <RelativeLayout android:layout_width="52dp" android:layout_height="52dp" android:background="@drawable/bg_blue_line_8dp" android:visibility="gone" android:id="@+id/rl_check_1"> <View android:layout_width="18dp" android:layout_height="18dp" android:id="@+id/dot_1" android:visibility="gone" android:layout_centerInParent="true" android:background="@drawable/bg_blue_20dp"/> </RelativeLayout> </RelativeLayout> <RelativeLayout android:id="@+id/rl_p_2" android:layout_width="wrap_content" android:layout_height="wrap_content" app:layout_constraintTop_toTopOf="@id/rl_2" android:layout_marginStart="10dp" app:layout_constraintStart_toEndOf="@id/rl_2"> <RelativeLayout android:layout_width="52dp" android:layout_height="52dp" android:background="@drawable/bg_blue_line_8dp" android:visibility="gone" android:id="@+id/rl_check_2"> <View android:layout_width="18dp" android:layout_height="18dp" android:id="@+id/dot_2" android:visibility="gone" android:layout_centerInParent="true" android:background="@drawable/bg_blue_20dp"/> </RelativeLayout> </RelativeLayout> <RelativeLayout android:id="@+id/rl_p_3" android:layout_width="wrap_content" android:layout_height="wrap_content" app:layout_constraintTop_toTopOf="@id/rl_3" android:layout_marginStart="10dp" app:layout_constraintStart_toEndOf="@id/rl_3"> <RelativeLayout android:layout_width="52dp" android:layout_height="52dp" android:background="@drawable/bg_blue_line_8dp" android:visibility="gone" android:id="@+id/rl_check_3"> <View android:layout_width="18dp" android:layout_height="18dp" android:id="@+id/dot_3" android:visibility="gone" android:layout_centerInParent="true" android:background="@drawable/bg_blue_20dp"/> </RelativeLayout> </RelativeLayout> </androidx.constraintlayout.motion.widget.MotionLayout> app/src/main/res/layout/fragmetn_remember.xml
New file @@ -0,0 +1,70 @@ <?xml version="1.0" encoding="utf-8"?> <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" xmlns:app="http://schemas.android.com/apk/res-auto"> <androidx.constraintlayout.widget.ConstraintLayout android:layout_width="159dp" android:layout_height="52dp" app:layout_constraintTop_toTopOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintEnd_toEndOf="parent" android:layout_marginTop="24dp" android:elevation="2dp" android:id="@+id/cl_voice" android:background="@drawable/bg_blue_8dp"> <ImageView android:id="@+id/iv1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@mipmap/yuyin" app:layout_constraintTop_toTopOf="parent" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintStart_toStartOf="parent" android:layout_marginStart="25dp"/> <ImageView android:id="@+id/iv2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@mipmap/play" app:layout_constraintTop_toTopOf="parent" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" android:layout_marginEnd="23dp"/> <ImageView android:id="@+id/iv_playing" android:layout_width="wrap_content" android:layout_height="wrap_content" android:visibility="gone" android:src="@mipmap/bofangzhong" app:layout_constraintTop_toTopOf="parent" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" /> </androidx.constraintlayout.widget.ConstraintLayout> <androidx.constraintlayout.widget.ConstraintLayout android:id="@+id/cl_1" android:layout_width="0dp" android:layout_height="0dp" android:padding="4dp" android:elevation="2dp" app:layout_constraintDimensionRatio="6:4" app:layout_constraintTop_toBottomOf="@id/cl_voice" android:layout_marginTop="40dp" app:layout_constraintBottom_toBottomOf="parent" android:layout_marginBottom="100dp" android:background="@drawable/bg_white_8dp" app:layout_constraintStart_toStartOf="parent" app:layout_constraintEnd_toEndOf="parent" android:layout_marginEnd="10dp"> <com.facebook.drawee.view.SimpleDraweeView android:layout_width="match_parent" android:id="@+id/iv_1" app:actualImageScaleType="centerCrop" android:layout_height="match_parent"/> </androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout> app/src/main/res/layout/item_card.xml
New file @@ -0,0 +1,76 @@ <?xml version="1.0" encoding="utf-8"?> <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" xmlns:app="http://schemas.android.com/apk/res-auto"> <FrameLayout android:id="@+id/frame" android:layout_width="match_parent" android:layout_height="0dp" app:layout_constraintDimensionRatio="3:2" android:layout_marginHorizontal="9dp" android:layout_marginVertical="8dp" app:layout_constraintTop_toTopOf="parent" app:layout_constraintBottom_toBottomOf="parent"> <androidx.constraintlayout.widget.ConstraintLayout android:id="@+id/front" android:layout_width="match_parent" android:layout_height="match_parent"> <RelativeLayout android:layout_width="match_parent" android:layout_height="match_parent" android:background="@drawable/bg_blue_8dp" android:id="@+id/rl_voice"> <androidx.constraintlayout.widget.ConstraintLayout android:layout_width="159dp" android:layout_height="52dp" android:id="@+id/cl_voice" android:layout_centerInParent="true" android:background="@drawable/bg_white_8dp"> <ImageView android:id="@+id/iv1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@mipmap/yuyin" app:layout_constraintTop_toTopOf="parent" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintStart_toStartOf="parent" android:layout_marginStart="25dp"/> <ImageView android:id="@+id/iv2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@mipmap/play" app:layout_constraintTop_toTopOf="parent" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" android:layout_marginEnd="23dp"/> <ImageView android:id="@+id/iv_playing" android:layout_width="wrap_content" android:layout_height="wrap_content" android:visibility="gone" android:src="@mipmap/bofangzhong" app:layout_constraintTop_toTopOf="parent" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" /> </androidx.constraintlayout.widget.ConstraintLayout> </RelativeLayout> <com.facebook.drawee.view.SimpleDraweeView android:layout_width="match_parent" android:layout_height="match_parent" android:visibility="gone" android:id="@+id/iv_img" app:roundedCornerRadius="8dp" app:actualImageScaleType="centerCrop"/> </androidx.constraintlayout.widget.ConstraintLayout> <ImageView android:id="@+id/back" android:layout_width="match_parent" android:layout_height="match_parent" android:src="@mipmap/bg_card_back" android:visibility="gone"/> </FrameLayout> </androidx.constraintlayout.widget.ConstraintLayout> app/src/main/res/layout/item_game_1.xml
New file @@ -0,0 +1,90 @@ <?xml version="1.0" encoding="utf-8"?> <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" xmlns:app="http://schemas.android.com/apk/res-auto"> <androidx.constraintlayout.motion.widget.MotionLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/motion" android:layout_marginHorizontal="3dp" app:layout_constraintTop_toTopOf="parent" app:layout_constraintBottom_toBottomOf="parent" android:layout_marginBottom="16dp" android:padding="4dp" android:background="@drawable/bg_white_8dp" app:layoutDescription="@xml/item_game_1_scene"> <View android:layout_width="match_parent" android:layout_height="40dp" android:background="@color/page_bg" android:id="@+id/top_1" app:layout_constraintTop_toTopOf="parent"/> <com.facebook.drawee.view.SimpleDraweeView android:layout_width="match_parent" android:layout_height="0dp" app:layout_constraintTop_toBottomOf="@id/top_1" android:id="@+id/iv_img" app:actualImageScaleType="centerCrop" app:layout_constraintDimensionRatio="3:2"/> <ImageView android:id="@+id/iv_full" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@mipmap/quanping" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintBottom_toBottomOf="parent" android:padding="8dp"/> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/result_1"/> </androidx.constraintlayout.motion.widget.MotionLayout> <androidx.constraintlayout.widget.ConstraintLayout android:layout_width="0dp" android:layout_height="40dp" app:layout_constraintStart_toStartOf="@id/motion" app:layout_constraintEnd_toEndOf="@id/motion" app:layout_constraintTop_toTopOf="@id/motion" android:layout_margin="4dp" android:id="@+id/cl_voice_end"> <androidx.constraintlayout.widget.ConstraintLayout android:layout_width="match_parent" android:id="@+id/cl_voice_end_1" android:background="@drawable/bg_blue_8dp" android:visibility="gone" android:layout_height="match_parent"> <ImageView android:id="@+id/iv1_1_end" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@mipmap/yuyin" app:layout_constraintTop_toTopOf="parent" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintStart_toStartOf="parent" android:layout_marginStart="25dp"/> <ImageView android:id="@+id/iv2_1_end" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@mipmap/play" app:layout_constraintTop_toTopOf="parent" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" android:layout_marginEnd="23dp"/> <ImageView android:id="@+id/iv_playing_1_end" android:layout_width="wrap_content" android:layout_height="wrap_content" android:visibility="gone" android:src="@mipmap/bofangzhong" app:layout_constraintTop_toTopOf="parent" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" /> </androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout> app/src/main/res/mipmap-xxhdpi/bg_card_back.png
app/src/main/res/mipmap-xxhdpi/ic_launcher.pngapp/src/main/res/mipmap-xxhdpi/voice_answer.png
app/src/main/res/mipmap-xxhdpi/voice_question.png
app/src/main/res/xml/activity_memory_scene.xml
New file @@ -0,0 +1,19 @@ <?xml version="1.0" encoding="utf-8"?> <MotionScene xmlns:android="http://schemas.android.com/apk/res/android" xmlns:motion="http://schemas.android.com/apk/res-auto"> <Transition motion:constraintSetEnd="@+id/end" motion:constraintSetStart="@id/start" motion:duration="1000"> <KeyFrameSet> </KeyFrameSet> </Transition> <ConstraintSet android:id="@+id/start"> </ConstraintSet> <ConstraintSet android:id="@+id/end"> </ConstraintSet> </MotionScene> app/src/main/res/xml/item_game_1_scene.xml
New file @@ -0,0 +1,63 @@ <?xml version="1.0" encoding="utf-8"?> <MotionScene xmlns:android="http://schemas.android.com/apk/res/android" xmlns:motion="http://schemas.android.com/apk/res-auto"> <Transition motion:constraintSetEnd="@+id/end" motion:constraintSetStart="@id/start" motion:duration="2000"> <KeyFrameSet> <KeyAttribute motion:framePosition="10" android:alpha="1" motion:motionTarget="@id/result_1"/> <KeyAttribute motion:framePosition="80" android:alpha="1" motion:motionTarget="@id/result_1"/> <KeyAttribute motion:framePosition="20" android:scaleX="0.9" android:scaleY="0.9" motion:motionTarget="@id/result_1"/> <KeyAttribute motion:framePosition="25" android:scaleX="1.1" android:scaleY="1.1" motion:motionTarget="@id/result_1"/> <KeyAttribute motion:framePosition="30" android:scaleX="0.9" android:scaleY="0.9" motion:motionTarget="@id/result_1"/> <KeyAttribute motion:framePosition="35" android:scaleX="1.1" android:scaleY="1.1" motion:motionTarget="@id/result_1"/> <KeyAttribute motion:framePosition="40" android:scaleX="1.0" android:scaleY="1.0" motion:motionTarget="@id/result_1"/> </KeyFrameSet> </Transition> <ConstraintSet android:id="@+id/start"> <Constraint android:id="@+id/result_1" android:alpha="0" motion:layout_constraintStart_toStartOf="@+id/iv_img" motion:layout_constraintEnd_toEndOf="@+id/iv_img" motion:layout_constraintTop_toTopOf="@+id/iv_img" motion:layout_constraintBottom_toBottomOf="@+id/iv_img" android:layout_width="50dp" android:layout_height="50dp"/> </ConstraintSet> <ConstraintSet android:id="@+id/end"> <Constraint android:id="@+id/result_1" android:alpha="1" motion:layout_constraintStart_toStartOf="@+id/iv_img" motion:layout_constraintEnd_toEndOf="@+id/iv_img" motion:layout_constraintTop_toTopOf="@+id/iv_img" motion:layout_constraintBottom_toBottomOf="@+id/iv_img" android:layout_width="50dp" android:layout_height="50dp"/> </ConstraintSet> </MotionScene> app/src/main/res/xml/scene_fragment_look.xml
New file @@ -0,0 +1,78 @@ <?xml version="1.0" encoding="utf-8"?> <MotionScene xmlns:android="http://schemas.android.com/apk/res/android" xmlns:motion="http://schemas.android.com/apk/res-auto"> <Transition motion:constraintSetEnd="@+id/end" motion:constraintSetStart="@id/start" motion:duration="2000"> <KeyFrameSet> </KeyFrameSet> </Transition> <ConstraintSet android:id="@+id/start_1"> <Constraint android:id="@+id/cl_voice1" motion:layout_constraintStart_toStartOf="@+id/rl_1" motion:layout_constraintTop_toTopOf="parent" android:layout_width="159dp" android:layout_marginTop="24dp" android:layout_height="52dp"/> </ConstraintSet> <ConstraintSet android:id="@+id/start_2"> <Constraint android:id="@+id/cl_voice2" motion:layout_constraintStart_toStartOf="@+id/rl_2" motion:layout_constraintTop_toTopOf="parent" android:layout_width="159dp" android:layout_marginTop="24dp" android:layout_height="52dp"/> </ConstraintSet> <ConstraintSet android:id="@+id/start_3"> <Constraint android:id="@+id/cl_voice3" motion:layout_constraintStart_toStartOf="@+id/rl_3" motion:layout_constraintTop_toTopOf="parent" android:layout_width="159dp" android:layout_marginTop="24dp" android:layout_height="52dp"/> </ConstraintSet> <ConstraintSet android:id="@+id/end_1"> <Constraint android:id="@+id/cl_voice1" motion:layout_constraintStart_toStartOf="@+id/cl_1" motion:layout_constraintEnd_toEndOf="@+id/cl_1" motion:layout_constraintTop_toTopOf="@+id/cl_1" android:layout_marginTop="4dp" android:layout_marginStart="4dp" android:layout_marginEnd="4dp" android:layout_width="0dp" android:layout_height="40dp"/> </ConstraintSet> <ConstraintSet android:id="@+id/end_2"> <Constraint android:id="@+id/cl_voice2" motion:layout_constraintStart_toStartOf="@+id/cl_1" motion:layout_constraintEnd_toEndOf="@+id/cl_1" motion:layout_constraintTop_toTopOf="@+id/cl_1" android:layout_marginTop="4dp" android:layout_marginStart="4dp" android:layout_marginEnd="4dp" android:layout_width="0dp" android:layout_height="40dp"/> </ConstraintSet> <ConstraintSet android:id="@+id/end_3"> <Constraint android:id="@+id/cl_voice3" motion:layout_constraintStart_toStartOf="@+id/cl_1" motion:layout_constraintEnd_toEndOf="@+id/cl_1" motion:layout_constraintTop_toTopOf="@+id/cl_1" android:layout_marginTop="4dp" android:layout_marginStart="4dp" android:layout_marginEnd="4dp" android:layout_width="0dp" android:layout_height="40dp"/> </ConstraintSet> </MotionScene>