Commit d093214f by 范玉宾

fix when modify meditation time off to 00:05 UI flush

parent 442e1f0d
...@@ -58,13 +58,12 @@ dependencies { ...@@ -58,13 +58,12 @@ dependencies {
androidTestImplementation 'androidx.test.ext:junit:1.1.2' androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0' androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
implementation 'com.wx.wheelview:wheelview:1.3.3' implementation 'com.github.weidongjian:androidWheelView:1.0.0'
// solve build problem // solve build problem
// cannot access 'androidx.lifecycle.hasdefaultviewmodelproviderfactory' // cannot access 'androidx.lifecycle.hasdefaultviewmodelproviderfactory'
// Comment out when compiling // Comment out when compiling
// implementation "androidx.lifecycle:lifecycle-extensions:2.2.0" implementation "androidx.lifecycle:lifecycle-extensions:2.2.0"
implementation "com.alibaba:arouter-api:$arouter_api" implementation "com.alibaba:arouter-api:$arouter_api"
// 注意此处的依赖方式:kotlin中使用和java中使用方式有不同 // 注意此处的依赖方式:kotlin中使用和java中使用方式有不同
......
package com.yidianling.muse;
import android.content.Context;
import android.graphics.Color;
import com.wx.wheelview.adapter.ArrayWheelAdapter;
import com.wx.wheelview.widget.WheelView;
import java.util.ArrayList;
import java.util.List;
public class MeditationWheelViewUtil {
private List<String> hours = new ArrayList<>();
private List<String> minutes = new ArrayList<>();
public void initWheelView(Context context, WheelView wheelViewH, int selectionH, WheelView wheelViewM, int selectionM) {
createHours();
createMinutes();
wheelViewH.setWheelAdapter(new ArrayWheelAdapter(context));
wheelViewH.setWheelData(hours);
WheelView.WheelViewStyle style = new WheelView.WheelViewStyle();
style.textColor = Color.parseColor("#80FFFFFF");
style.selectedTextColor = Color.parseColor("#FFFFFF");
style.textSize = 30;
style.backgroundColor = Color.parseColor("#00000000");
style.selectedTextSize = 32;
style.selectedTextZoom = 1.2f;
wheelViewH.setStyle(style);
wheelViewH.setExtraText("小时", Color.parseColor("#FFFFFFFF"), 50, 120);
wheelViewH.setSelection(selectionH);
wheelViewM.setWheelAdapter(new ArrayWheelAdapter(context));
wheelViewM.setWheelData(minutes);
wheelViewM.setStyle(style);
wheelViewM.setExtraText("分钟", Color.parseColor("#FFFFFFFF"), 50, 120);
wheelViewM.setSelection(selectionM);
}
public void minuteRule(WheelView wh,WheelView wm){
wh.setOnWheelItemSelectedListener((position, o) -> {
if (position == 0 && wh.getCurrentPosition()==0){
wm.setSelection(1);
}
});
wm.setOnWheelItemSelectedListener((position, o) -> {
if (position == 0 && wh.getCurrentPosition()==0){
wm.setSelection(1);
}
});
}
private void createHours() {
for (int i = 0; i < 24; i++) {
hours.add("" + i);
}
}
private void createMinutes() {
for (int i = 0; i < 60; i += 5) {
if (i < 10) {
minutes.add("0" + i);
} else {
minutes.add("" + i);
}
}
}
}
...@@ -7,7 +7,6 @@ import com.ydl.ydlcommon.base.BaseActivity ...@@ -7,7 +7,6 @@ import com.ydl.ydlcommon.base.BaseActivity
import com.ydl.ydlcommon.bean.StatusBarOptions import com.ydl.ydlcommon.bean.StatusBarOptions
import com.ydl.ydlcommon.utils.StatusBarUtils import com.ydl.ydlcommon.utils.StatusBarUtils
import com.ydl.ydlcommon.utils.remind.ToastHelper import com.ydl.ydlcommon.utils.remind.ToastHelper
import com.yidianling.muse.MeditationWheelViewUtil
import com.yidianling.muse.R import com.yidianling.muse.R
import kotlinx.android.synthetic.main.activity_play_meditation_time_off.* import kotlinx.android.synthetic.main.activity_play_meditation_time_off.*
...@@ -26,18 +25,18 @@ class MeditationTimeOffActivity : BaseActivity() { ...@@ -26,18 +25,18 @@ class MeditationTimeOffActivity : BaseActivity() {
tv_save_setting?.setOnClickListener { tv_save_setting?.setOnClickListener {
ToastHelper.show("保存设置") ToastHelper.show("保存设置")
val hour = wheel_view_hour.selectionItem val hour = wheel_hour.selectedItem
val minute = wheel_view_minute.selectionItem val minute = wheel_minute.selectedItem
val selectedHour = wheel_view_hour.currentPosition val selectedHour = wheel_hour.selectedItem
val selectedMinute = wheel_view_minute.currentPosition val selectedMinute = wheel_minute.selectedItem
SPUtils.getInstance().put("SELECT_H",selectedHour) SPUtils.getInstance().put("SELECT_H",selectedHour)
SPUtils.getInstance().put("SELECT_M",selectedMinute) SPUtils.getInstance().put("SELECT_M",selectedMinute)
val intent = Intent() val intent = Intent()
if (hour is String && minute is String){ if (hour is Int && minute is Int){
val minute = (hour.toInt()*60).plus(minute.toInt()) val minute = (hour *60).plus(minute*5)
intent.putExtra("TIME_OFF_MINUTE", minute) intent.putExtra("TIME_OFF_MINUTE", minute)
} }
setResult(RESULT_OK, intent) setResult(RESULT_OK, intent)
...@@ -61,9 +60,29 @@ class MeditationTimeOffActivity : BaseActivity() { ...@@ -61,9 +60,29 @@ class MeditationTimeOffActivity : BaseActivity() {
private fun initWheel() { private fun initWheel() {
val selectionH = SPUtils.getInstance().getInt("SELECT_H",0) val selectionH = SPUtils.getInstance().getInt("SELECT_H",0)
val selectionM = SPUtils.getInstance().getInt("SELECT_M",1) val selectionM = SPUtils.getInstance().getInt("SELECT_M",1)
MeditationWheelViewUtil().initWheelView(this, wheel_view_hour,selectionH, wheel_view_minute,selectionM)
MeditationWheelViewUtil().minuteRule(wheel_view_hour,wheel_view_minute) createHours()
createMinutes()
wheel_hour.setItems(hours)
wheel_minute.setItems(minutes)
wheel_hour.setInitPosition(selectionH)
wheel_minute.setInitPosition(selectionM)
wheel_hour.setListener { index ->
if (index == 0 && wheel_minute.selectedItem == 0) {
wheel_minute.setCurrentPosition(1)
}
}
wheel_minute.setListener { index ->
if (index == 0 && wheel_hour.selectedItem == 0) {
wheel_minute.setCurrentPosition(1)
}
}
} }
override fun getStatusViewOptions(): StatusBarOptions { override fun getStatusViewOptions(): StatusBarOptions {
...@@ -78,4 +97,25 @@ class MeditationTimeOffActivity : BaseActivity() { ...@@ -78,4 +97,25 @@ class MeditationTimeOffActivity : BaseActivity() {
return R.layout.activity_play_meditation_time_off return R.layout.activity_play_meditation_time_off
} }
private var hours = mutableListOf<String>()
private var minutes = mutableListOf<String>()
private fun createHours() {
for (i in 0..23) {
hours.add("" + i)
}
}
private fun createMinutes() {
var i = 0
while (i < 60) {
if (i < 10) {
minutes.add("0$i")
} else {
minutes.add("" + i)
}
i += 5
}
}
} }
\ No newline at end of file
package com.yidianling.muse.activity package com.yidianling.muse.activity
import android.content.Intent import android.content.Intent
import android.graphics.Color
import android.media.MediaPlayer import android.media.MediaPlayer
import android.os.Build
import android.os.Bundle import android.os.Bundle
import android.view.View import android.view.View
import android.view.WindowManager
import android.widget.SeekBar import android.widget.SeekBar
import com.alibaba.android.arouter.facade.annotation.Route import com.alibaba.android.arouter.facade.annotation.Route
import com.bumptech.glide.Glide import com.bumptech.glide.Glide
import com.google.gson.Gson import com.google.gson.Gson
import com.ydl.ydlcommon.base.BaseActivity import com.ydl.ydlcommon.base.BaseActivity
import com.ydl.ydlcommon.bean.StatusBarOptions import com.ydl.ydlcommon.bean.StatusBarOptions
import com.ydl.ydlcommon.data.http.RxUtils import com.ydl.ydlcommon.data.http.RxUtils.resultData
import com.ydl.ydlcommon.data.http.ThrowableConsumer import com.ydl.ydlcommon.data.http.ThrowableConsumer
import com.ydl.ydlcommon.utils.StatusBarUtils.Companion.setTransparentForImageView import com.ydl.ydlcommon.utils.StatusBarUtils.Companion.setTransparentForImageView
import com.ydl.ydlcommon.utils.StatusBarUtils.Companion.statusBarLightMode import com.ydl.ydlcommon.utils.StatusBarUtils.Companion.statusBarLightMode
import com.ydl.ydlcommon.utils.remind.ToastHelper import com.ydl.ydlcommon.utils.remind.ToastHelper.Companion.show
import com.yidianling.home.http.MuseHttp import com.yidianling.home.http.MuseHttp
import com.yidianling.muse.R import com.yidianling.muse.R
import com.yidianling.muse.helper.MediaPlayerManager import com.yidianling.muse.helper.MediaPlayerManager
...@@ -31,6 +34,7 @@ import kotlinx.android.synthetic.main.activity_play_meditation.* ...@@ -31,6 +34,7 @@ import kotlinx.android.synthetic.main.activity_play_meditation.*
import kotlinx.android.synthetic.main.player_control_view.* import kotlinx.android.synthetic.main.player_control_view.*
import java.util.* import java.util.*
import java.util.concurrent.TimeUnit import java.util.concurrent.TimeUnit
import kotlin.math.roundToInt
@Route(path = "/muse/play") @Route(path = "/muse/play")
...@@ -57,6 +61,8 @@ class PlayMeditationActivity : BaseActivity() { ...@@ -57,6 +61,8 @@ class PlayMeditationActivity : BaseActivity() {
private var mTimer = Timer() private var mTimer = Timer()
private var mMediaPlayer: MediaPlayer? = null private var mMediaPlayer: MediaPlayer? = null
private var posted = false
private var duration = 0 private var duration = 0
private var isSeekbarChanging = false private var isSeekbarChanging = false
...@@ -74,13 +80,22 @@ class PlayMeditationActivity : BaseActivity() { ...@@ -74,13 +80,22 @@ class PlayMeditationActivity : BaseActivity() {
meditationType = intent?.getIntExtra("MEDITATION_TYPE", 0) ?: 0 meditationType = intent?.getIntExtra("MEDITATION_TYPE", 0) ?: 0
initView() initView()
getData() getData()
} }
override fun initDataAndEvent() { override fun initDataAndEvent() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
val window = window
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
window.statusBarColor = Color.TRANSPARENT
window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS)
window.decorView.systemUiVisibility = (View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
or View.SYSTEM_UI_FLAG_LAYOUT_STABLE)
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS)
} else {
window.addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS)
}
}
} }
...@@ -94,8 +109,8 @@ class PlayMeditationActivity : BaseActivity() { ...@@ -94,8 +109,8 @@ class PlayMeditationActivity : BaseActivity() {
meditionType = meditationType, meditionType = meditationType,
meditationId = meditationId meditationId = meditationId
) )
.compose(RxUtils.applySchedulers()) .subscribeOn(Schedulers.io())
.map { it } .observeOn(AndroidSchedulers.mainThread())
.subscribe(Consumer { .subscribe(Consumer {
if (it.code.equals("200") && it.data != null) { if (it.code.equals("200") && it.data != null) {
...@@ -127,12 +142,11 @@ class PlayMeditationActivity : BaseActivity() { ...@@ -127,12 +142,11 @@ class PlayMeditationActivity : BaseActivity() {
initMediaPlayer(mediaUrl) initMediaPlayer(mediaUrl)
} }
}, object : ThrowableConsumer() { }, object : ThrowableConsumer() {
override fun accept(msg: String) { override fun accept(msg: String) {
show(msg)
} }
}) })
} else if (meditationType == 1) { } else if (meditationType == 1) {
...@@ -140,9 +154,7 @@ class PlayMeditationActivity : BaseActivity() { ...@@ -140,9 +154,7 @@ class PlayMeditationActivity : BaseActivity() {
meditionType = 1, meditionType = 1,
mediaId = 1, meditationId = 1 mediaId = 1, meditationId = 1
) )
.compose(RxUtils.applySchedulers()) .observeOn(AndroidSchedulers.mainThread())
.map { it }
.filter { true }
.subscribe(Consumer { .subscribe(Consumer {
if (it.code.equals("200") && it.data != null) { if (it.code.equals("200") && it.data != null) {
...@@ -175,7 +187,7 @@ class PlayMeditationActivity : BaseActivity() { ...@@ -175,7 +187,7 @@ class PlayMeditationActivity : BaseActivity() {
}, object : ThrowableConsumer() { }, object : ThrowableConsumer() {
override fun accept(msg: String) { override fun accept(msg: String) {
show(msg)
} }
}) })
} }
...@@ -218,16 +230,32 @@ class PlayMeditationActivity : BaseActivity() { ...@@ -218,16 +230,32 @@ class PlayMeditationActivity : BaseActivity() {
} }
iv_collect.setOnClickListener { iv_collect.setOnClickListener {
collected = !collected
if (collected) {
ToastHelper.show("收藏成功!")
iv_collect.setImageResource(R.drawable.icon_meditation_collected)
} else {
ToastHelper.show("取消收藏!")
iv_collect.setImageResource(R.drawable.icon_play_meditation_collect)
}
}
MuseHttp.getInstance().collectMeditation(meditationId = meditationId,
status = if(collected) 0 else 1)
.compose(resultData())
.observeOn(AndroidSchedulers.mainThread())
.subscribe ({ result ->
if (result!=null && result.code == "200"){
collected = !collected
if (collected) {
show("收藏成功!")
iv_collect.setImageResource(R.drawable.icon_meditation_collected)
} else {
show("取消收藏!")
iv_collect.setImageResource(R.drawable.icon_play_meditation_collect)
}
}else{
show("操作失败!")
}
},{
object : ThrowableConsumer() {
override fun accept(msg: String) {
show(msg)
}
}
})
}
} }
override fun layoutResId(): Int { override fun layoutResId(): Int {
...@@ -247,7 +275,7 @@ class PlayMeditationActivity : BaseActivity() { ...@@ -247,7 +275,7 @@ class PlayMeditationActivity : BaseActivity() {
if (quitDialog != null && quitDialog?.isAdded == false) { if (quitDialog != null && quitDialog?.isAdded == false) {
quitDialog?.setListener(object : QuitMeditationDialog.ClickListener { quitDialog?.setListener(object : QuitMeditationDialog.ClickListener {
override fun quit() { override fun quit() {
ToastHelper.show("结束练习") show("结束练习")
finish() finish()
} }
}) })
...@@ -262,14 +290,12 @@ class PlayMeditationActivity : BaseActivity() { ...@@ -262,14 +290,12 @@ class PlayMeditationActivity : BaseActivity() {
iv_share.setOnClickListener { iv_share.setOnClickListener {
if (shareDialog == null) { if (shareDialog == null) {
shareDialog = ShareMeditationDialog shareDialog = ShareMeditationDialog
.newInstance( .newInstance(shareImageUrl = "")
shareImageUrl = bgUrl,
shareContent = "老铁,我是你要分享的内容"
)
} }
if (shareDialog != null && shareDialog?.isAdded == false) { if (shareDialog != null && shareDialog?.isAdded == false) {
shareDialog?.show(supportFragmentManager, ShareMeditationDialog.TAG) shareDialog?.show(supportFragmentManager, ShareMeditationDialog.TAG)
} }
} }
iv_time_off.setOnClickListener { iv_time_off.setOnClickListener {
...@@ -289,6 +315,31 @@ class PlayMeditationActivity : BaseActivity() { ...@@ -289,6 +315,31 @@ class PlayMeditationActivity : BaseActivity() {
exo_play.setOnClickListener { exo_play.setOnClickListener {
if (isPlaying) { if (isPlaying) {
MediaPlayerManager.getInstance(this).pause() MediaPlayerManager.getInstance(this).pause()
if (posted){
return@setOnClickListener
}
MuseHttp.getInstance().postMeditationPlayRecord(meditationId = meditationId.toInt(),
playTime = (seekbar_play_progress.progress / 1000.00).roundToInt()
).compose(resultData())
.observeOn(AndroidSchedulers.mainThread())
.subscribe({
if (it.code!=null && it.code == "200"){
posted = true
}else{
}
},{
object :ThrowableConsumer(){
override fun accept(msg: String) {
show(msg)
}
}
})
} else { } else {
val duration = mMediaPlayer?.duration val duration = mMediaPlayer?.duration
...@@ -485,7 +536,7 @@ class PlayMeditationActivity : BaseActivity() { ...@@ -485,7 +536,7 @@ class PlayMeditationActivity : BaseActivity() {
} }
override fun onComplete() { override fun onComplete() {
ToastHelper.show("倒计时结束,停止播放吧!") show("倒计时结束,停止播放吧!")
if (mMediaPlayer?.isPlaying == true){ if (mMediaPlayer?.isPlaying == true){
mMediaPlayer?.stop() mMediaPlayer?.stop()
exo_play.setImageResource(R.drawable.icon_pause_meditation) exo_play.setImageResource(R.drawable.icon_pause_meditation)
...@@ -524,6 +575,4 @@ class PlayMeditationActivity : BaseActivity() { ...@@ -524,6 +575,4 @@ class PlayMeditationActivity : BaseActivity() {
const val request_code = 0x0001 const val request_code = 0x0001
} }
} }
\ No newline at end of file
package com.yidianling.muse.bean
data class CollectResultModule(
val status:Int
)
package com.yidianling.muse.bean
import com.ydl.ydlcommon.data.http.BaseCommand
class MeditationCollectRequestModule(
val meditationId:Long,
val status:Int
):BaseCommand() {
}
\ No newline at end of file
package com.yidianling.muse.bean
data class CollectResultModule(
val code:String,
val data:String?=null,
val msg:String?=null,
val err_msg:String?=null
)
data class MeditationCollectRequestModule(
val meditationId: Long,
val status: Int
)
data class MeditationPlayRecordRequestModule(
val meditationId:Int,
val playTime:Int
)
data class MeditationPlayRecordResponseModule(
val code: String,
val data: String? = null,
val msg: String? = null,
val err_msg: String? = null
)
data class MeditationShareRequestModule(
val meditationId:Int
)
data class MeditationShareResponseModule(
val code: String,
val msg: String?,
val data:MeditationShareUrl?=null,
val err_msg: String? = null
)
data class MeditationShareUrl(
val poster: String?
)
\ No newline at end of file
...@@ -4,10 +4,7 @@ import com.ydl.ydlcommon.data.http.BaseAPIResponse ...@@ -4,10 +4,7 @@ import com.ydl.ydlcommon.data.http.BaseAPIResponse
import com.ydl.ydlcommon.data.http.BaseResponse import com.ydl.ydlcommon.data.http.BaseResponse
import com.ydl.ydlcommon.data.http.RxUtils import com.ydl.ydlcommon.data.http.RxUtils
import com.ydl.ydlnet.YDLHttpUtils import com.ydl.ydlnet.YDLHttpUtils
import com.yidianling.muse.bean.CollectResultModule import com.yidianling.muse.bean.*
import com.yidianling.muse.bean.MeditationCollectRequestModule
import com.yidianling.muse.bean.MeditationPlayModuleBean
import com.yidianling.muse.bean.MuseModuleBean
import io.reactivex.Observable import io.reactivex.Observable
/** /**
...@@ -70,4 +67,14 @@ class MuseHttp { ...@@ -70,4 +67,14 @@ class MuseHttp {
return RxUtils.mapObservable(params).flatMap { getMusePagerApi().collectMeditation(it) } return RxUtils.mapObservable(params).flatMap { getMusePagerApi().collectMeditation(it) }
} }
fun postMeditationPlayRecord(meditationId:Int,playTime:Int): Observable<BaseResponse<MeditationPlayRecordResponseModule>> {
val params = MeditationPlayRecordRequestModule(meditationId, playTime)
return RxUtils.mapObservable(params).flatMap { getMusePagerApi().meditationPlayRecord(it) }
}
fun getShareMeditationUrl(meditationId:Int): Observable<BaseResponse<MeditationShareResponseModule>> {
val params = MeditationShareRequestModule(meditationId)
return RxUtils.mapObservable(params).flatMap { getMusePagerApi().shareMeditationInfo(it) }
}
} }
\ No newline at end of file
...@@ -4,9 +4,7 @@ import com.ydl.ydlcommon.base.config.YDL_DOMAIN ...@@ -4,9 +4,7 @@ import com.ydl.ydlcommon.base.config.YDL_DOMAIN
import com.ydl.ydlcommon.base.config.YDL_DOMAIN_JAVA import com.ydl.ydlcommon.base.config.YDL_DOMAIN_JAVA
import com.ydl.ydlcommon.data.http.BaseAPIResponse import com.ydl.ydlcommon.data.http.BaseAPIResponse
import com.ydl.ydlcommon.data.http.BaseResponse import com.ydl.ydlcommon.data.http.BaseResponse
import com.yidianling.muse.bean.CollectResultModule import com.yidianling.muse.bean.*
import com.yidianling.muse.bean.MeditationPlayModuleBean
import com.yidianling.muse.bean.MuseModuleBean
import io.reactivex.Observable import io.reactivex.Observable
import retrofit2.http.* import retrofit2.http.*
...@@ -47,11 +45,30 @@ interface MusePagerApi { ...@@ -47,11 +45,30 @@ interface MusePagerApi {
): Observable<BaseAPIResponse<MeditationPlayModuleBean>> ): Observable<BaseAPIResponse<MeditationPlayModuleBean>>
/** /**
* 声音播放详情页 * 收藏和取消收藏
*/ */
@FormUrlEncoded
@POST("cms/meditation/collect") @POST("cms/meditation/collect")
@Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA)
fun collectMeditation(@FieldMap params: Map<String, String> fun collectMeditation(@FieldMap params: Map<String, String>
): Observable<BaseResponse<CollectResultModule>> ): Observable<BaseResponse<CollectResultModule>>
/**
* 冥想播放记录
*/
@FormUrlEncoded
@POST("cms/meditation/playRecord")
@Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA)
fun meditationPlayRecord(@FieldMap params: Map<String, String>
): Observable<BaseResponse<MeditationPlayRecordResponseModule>>
/**
* 生成分享海报
*/
@FormUrlEncoded
@POST("cms/meditation/share")
@Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA)
fun shareMeditationInfo(@FieldMap params: Map<String, String>
): Observable<BaseResponse<MeditationShareResponseModule>>
} }
\ No newline at end of file
...@@ -62,7 +62,6 @@ class ShareMeditationDialog : DialogFragment() { ...@@ -62,7 +62,6 @@ class ShareMeditationDialog : DialogFragment() {
val imageUrl = "http://static.ydlcdn.com/v1/images/logo320.png" val imageUrl = "http://static.ydlcdn.com/v1/images/logo320.png"
val shareImageUrl = arguments?.getString(KEY_SHARE_IMAGE_URL) val shareImageUrl = arguments?.getString(KEY_SHARE_IMAGE_URL)
val shareContent = arguments?.getString(KEY_SHARE_CONTENT)
ivSharePicture = view?.findViewById(R.id.iv_share_picture) ivSharePicture = view?.findViewById(R.id.iv_share_picture)
...@@ -73,7 +72,6 @@ class ShareMeditationDialog : DialogFragment() { ...@@ -73,7 +72,6 @@ class ShareMeditationDialog : DialogFragment() {
.load(shareImageUrl) .load(shareImageUrl)
.into(ivSharePicture!!) .into(ivSharePicture!!)
} }
tvShareContent?.text = shareContent
llWeChat = view?.findViewById(R.id.ll_wechat_friend) llWeChat = view?.findViewById(R.id.ll_wechat_friend)
llCircleOfFriends = view?.findViewById(R.id.ll_wechat_circle_of_friends) llCircleOfFriends = view?.findViewById(R.id.ll_wechat_circle_of_friends)
...@@ -144,12 +142,10 @@ class ShareMeditationDialog : DialogFragment() { ...@@ -144,12 +142,10 @@ class ShareMeditationDialog : DialogFragment() {
const val TAG = "ShareMeditationDialog" const val TAG = "ShareMeditationDialog"
private const val KEY_SHARE_IMAGE_URL = "key_share_image_url" private const val KEY_SHARE_IMAGE_URL = "key_share_image_url"
private const val KEY_SHARE_CONTENT = "key_share_content"
fun newInstance(shareImageUrl: String, shareContent: String): ShareMeditationDialog { fun newInstance(shareImageUrl: String): ShareMeditationDialog {
val args = Bundle() val args = Bundle()
args.putString(KEY_SHARE_IMAGE_URL, shareImageUrl) args.putString(KEY_SHARE_IMAGE_URL, shareImageUrl)
args.putString(KEY_SHARE_CONTENT, shareContent)
val fragment = ShareMeditationDialog() val fragment = ShareMeditationDialog()
fragment.arguments = args fragment.arguments = args
return fragment return fragment
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
tools:background="@color/_8c"> android:background="@color/_8c">
<ImageView <ImageView
android:id="@+id/iv_bg" android:id="@+id/iv_bg"
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
android:layout_width="104dp" android:layout_width="104dp"
android:layout_height="36dp" android:layout_height="36dp"
android:layout_marginStart="16dp" android:layout_marginStart="16dp"
android:layout_marginTop="55dp" android:layout_marginTop="25dp"
android:background="@drawable/bg_meditation_play_top" android:background="@drawable/bg_meditation_play_top"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"> app:layout_constraintTop_toTopOf="parent">
...@@ -100,7 +100,10 @@ ...@@ -100,7 +100,10 @@
app:layout_constraintTop_toBottomOf="@id/tv_title" app:layout_constraintTop_toBottomOf="@id/tv_title"
tools:text="舒缓安神舒缓安神舒缓安神舒缓安神舒缓安神舒缓安神舒缓安神舒缓安神" /> tools:text="舒缓安神舒缓安神舒缓安神舒缓安神舒缓安神舒缓安神舒缓安神舒缓安神" />
<include layout="@layout/player_control_view" /> <include
android:id="@+id/player_control_layout"
android:visibility="gone"
layout="@layout/player_control_view" />
<androidx.constraintlayout.widget.Guideline <androidx.constraintlayout.widget.Guideline
android:id="@+id/guide_line" android:id="@+id/guide_line"
......
...@@ -32,9 +32,11 @@ ...@@ -32,9 +32,11 @@
app:layout_constraintTop_toBottomOf="@id/iv_close" /> app:layout_constraintTop_toBottomOf="@id/iv_close" />
<LinearLayout <LinearLayout
android:visibility="gone"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="horizontal" android:orientation="horizontal"
android:gravity="center_vertical"
android:layout_marginHorizontal="72dp" android:layout_marginHorizontal="72dp"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
...@@ -45,18 +47,67 @@ ...@@ -45,18 +47,67 @@
android:id="@+id/wheel_view_hour" android:id="@+id/wheel_view_hour"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_weight="1" android:layout_weight="1"
android:layout_margin="1dp"
android:layout_height="wrap_content" /> android:layout_height="wrap_content" />
<com.wx.wheelview.widget.WheelView <com.wx.wheelview.widget.WheelView
android:id="@+id/wheel_view_minute" android:id="@+id/wheel_view_minute"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_weight="1" android:layout_weight="1"
android:layout_margin="1dp"
android:layout_height="wrap_content" /> android:layout_height="wrap_content" />
</LinearLayout> </LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="center"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent">
<com.weigan.loopview.LoopView
android:id="@+id/wheel_hour"
android:layout_width="50dp"
android:layout_height="240dp"
app:awv_itemsVisibleCount="4"
app:awv_textsize="36"
app:awv_dividerTextColor="0x00FFFFFF"
app:awv_isLoop="false"
app:awv_outerTextColor="0x66FFFFFF"
app:awv_centerTextColor="@color/white" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:text="小时"
android:textColor="@color/white"
android:textSize="18sp"/>
<com.weigan.loopview.LoopView
android:id="@+id/wheel_minute"
android:layout_width="50dp"
android:layout_height="240dp"
android:layout_marginStart="60dp"
app:awv_itemsVisibleCount="4"
app:awv_textsize="36"
app:awv_dividerTextColor="0x00FFFFFF"
app:awv_isLoop="false"
app:awv_outerTextColor="0x66FFFFFF"
app:awv_centerTextColor="@color/white"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:text="分钟"
android:textColor="@color/white"
android:textSize="18sp"/>
</LinearLayout>
<TextView <TextView
android:id="@+id/tv_cancel_time_off" android:id="@+id/tv_cancel_time_off"
android:layout_width="match_parent" android:layout_width="match_parent"
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" <androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/csl_root_layout" android:id="@+id/csl_root_layout"
...@@ -77,6 +78,7 @@ ...@@ -77,6 +78,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:orientation="vertical" android:orientation="vertical"
android:visibility="gone"
app:layout_constraintEnd_toStartOf="@id/ll_qq_zone" app:layout_constraintEnd_toStartOf="@id/ll_qq_zone"
app:layout_constraintHorizontal_weight="1" app:layout_constraintHorizontal_weight="1"
app:layout_constraintStart_toEndOf="@id/ll_wechat_circle_of_friends" app:layout_constraintStart_toEndOf="@id/ll_wechat_circle_of_friends"
...@@ -164,13 +166,14 @@ ...@@ -164,13 +166,14 @@
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout <androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/csl_layout_top" android:id="@+id/csl_layout_top"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginHorizontal="20dp" android:layout_marginHorizontal="20dp"
android:layout_marginBottom="20dp" android:layout_marginBottom="20dp"
android:background="@drawable/bg_share_play_meditation_bottom" android:background="@drawable/bg_share_play_meditation_bottom"
android:paddingBottom="18dp" android:paddingBottom="18dp"
android:visibility="gone"
app:layout_constraintBottom_toTopOf="@id/csl_share_layout" app:layout_constraintBottom_toTopOf="@id/csl_share_layout"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"> app:layout_constraintStart_toStartOf="parent">
...@@ -184,7 +187,8 @@ ...@@ -184,7 +187,8 @@
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
tools:src="@drawable/muse_muse_icon_playing" /> tools:src="@drawable/muse_muse_icon_playing"
android:visibility="invisible"/>
<TextView <TextView
android:id="@+id/tv_share_content" android:id="@+id/tv_share_content"
...@@ -192,6 +196,7 @@ ...@@ -192,6 +196,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginHorizontal="24dp" android:layout_marginHorizontal="24dp"
android:layout_marginTop="18dp" android:layout_marginTop="18dp"
android:visibility="invisible"
tools:text='" 你一定要站在自己所热爱的世界里闪闪发光 "' tools:text='" 你一定要站在自己所热爱的世界里闪闪发光 "'
android:textColor="#FF282E3F" android:textColor="#FF282E3F"
android:textSize="18sp" android:textSize="18sp"
...@@ -208,6 +213,7 @@ ...@@ -208,6 +213,7 @@
android:layout_marginTop="44dp" android:layout_marginTop="44dp"
android:scaleType="centerCrop" android:scaleType="centerCrop"
android:src="@drawable/muse_muse_icon_playing" android:src="@drawable/muse_muse_icon_playing"
android:visibility="invisible"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tv_share_content" /> app:layout_constraintTop_toBottomOf="@id/tv_share_content" />
...@@ -221,6 +227,7 @@ ...@@ -221,6 +227,7 @@
android:textColor="#FF282E3F" android:textColor="#FF282E3F"
android:textSize="18sp" android:textSize="18sp"
android:textStyle="bold" android:textStyle="bold"
android:visibility="invisible"
app:layout_constraintStart_toEndOf="@id/iv_share_logo" app:layout_constraintStart_toEndOf="@id/iv_share_logo"
app:layout_constraintTop_toTopOf="@id/iv_share_logo" /> app:layout_constraintTop_toTopOf="@id/iv_share_logo" />
...@@ -232,16 +239,17 @@ ...@@ -232,16 +239,17 @@
android:text="温暖而有力的爱着你" android:text="温暖而有力的爱着你"
android:textColor="#FF999999" android:textColor="#FF999999"
android:textSize="14sp" android:textSize="14sp"
android:visibility="invisible"
app:layout_constraintBottom_toBottomOf="@id/iv_share_logo" app:layout_constraintBottom_toBottomOf="@id/iv_share_logo"
app:layout_constraintStart_toEndOf="@id/iv_share_logo" /> app:layout_constraintStart_toEndOf="@id/iv_share_logo" />
<ImageView <ImageView
android:id="@+id/iv_share_qr_code" android:id="@+id/iv_share_qr_code"
android:layout_width="48dp" android:layout_width="48dp"
android:layout_height="48dp" android:layout_height="48dp"
android:layout_marginEnd="16dp" android:layout_marginEnd="16dp"
android:scaleType="centerCrop" android:scaleType="centerCrop"
android:visibility="invisible"
android:src="@drawable/muse_muse_icon_playing" android:src="@drawable/muse_muse_icon_playing"
app:layout_constraintBottom_toBottomOf="@id/iv_share_logo" app:layout_constraintBottom_toBottomOf="@id/iv_share_logo"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment