Commit 64f8035d by 徐健

FM模块拆分

parent 6ea6a37d
...@@ -4,7 +4,7 @@ apply plugin: 'kotlin-android' ...@@ -4,7 +4,7 @@ apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions' apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt' apply plugin: 'kotlin-kapt'
apply plugin: 'trace-point' //apply plugin: 'trace-point'
kapt { kapt {
arguments { arguments {
...@@ -167,9 +167,8 @@ dependencies { ...@@ -167,9 +167,8 @@ dependencies {
if (rootProject.ext.dev_mode) { if (rootProject.ext.dev_mode) {
//开发模式 //开发模式
api project(':m-consultant')
api project(':m-user') api project(':m-user')
api project(':m-muse') api project(':m-fm')
api (project(':ydl-platform')){ api (project(':ydl-platform')){
transitive = true transitive = true
} }
...@@ -180,7 +179,7 @@ dependencies { ...@@ -180,7 +179,7 @@ dependencies {
api 'com.ydl:m-user-module-ydl:0.0.6' api 'com.ydl:m-user-module-ydl:0.0.6'
api rootProject.ext.dependencies["ydl-webview"] api rootProject.ext.dependencies["ydl-webview"]
api rootProject.ext.dependencies["ydl-m-user-api"] api rootProject.ext.dependencies["ydl-m-user-api"]
api rootProject.ext.dependencies["ydl-m-muse-api"] api rootProject.ext.dependencies["ydl-m-fm-api"]
api(rootProject.ext.dependencies["ydl-platform"]) { api(rootProject.ext.dependencies["ydl-platform"]) {
transitive = true transitive = true
} }
...@@ -191,20 +190,20 @@ dependencies { ...@@ -191,20 +190,20 @@ dependencies {
kapt 'com.alibaba:arouter-compiler:1.2.2' kapt 'com.alibaba:arouter-compiler:1.2.2'
} }
noTracePoint { //noTracePoint {
outputModifyFile = false // outputModifyFile = false
targetPackages = ['com.cxzapp.yidianling', // targetPackages = ['com.cxzapp.yidianling',
'com.yidianling.consultant', // 'com.yidianling.consultant',
'com.yidianling.course', // 'com.yidianling.course',
'com.yidianling.dynamic', // 'com.yidianling.dynamic',
'com.ydl.home_module', // 'com.ydl.home_module',
'com.yidianling.fm', // 'com.yidianling.fm',
'com.yidianling.im', // 'com.yidianling.im',
'com.yidianling.avchatkit', // 'com.yidianling.avchatkit',
'com.yidianling.uikit', // 'com.yidianling.uikit',
'com.yidianling.phonecall', // 'com.yidianling.phonecall',
'com.yidianling.tests', // 'com.yidianling.tests',
'com.yidianling.user', // 'com.yidianling.user',
'com.yidianling.ydlcommon', // 'com.yidianling.ydlcommon',
] // ]
} //}
...@@ -22,7 +22,6 @@ import com.ydl.ydl_router.manager.YDLRouterParams ...@@ -22,7 +22,6 @@ import com.ydl.ydl_router.manager.YDLRouterParams
import com.ydl.ydlcommon.mvp.lce.BaseLceActivity import com.ydl.ydlcommon.mvp.lce.BaseLceActivity
import com.ydl.ydlcommon.router.IYDLRouterConstant import com.ydl.ydlcommon.router.IYDLRouterConstant
import com.yidianling.common.tools.ToastUtil import com.yidianling.common.tools.ToastUtil
import com.yidianling.consultant.ExpertSearchActivity.Companion.HOT_SEARCH_DOCTOR_NAME
import kotlinx.android.synthetic.main.activity_main.* import kotlinx.android.synthetic.main.activity_main.*
/** /**
...@@ -64,15 +63,15 @@ class MainActivity : BaseLceActivity<DemoContract.View, DemoContract.Presenter>( ...@@ -64,15 +63,15 @@ class MainActivity : BaseLceActivity<DemoContract.View, DemoContract.Presenter>(
.withBoolean("isFromGuide", true) .withBoolean("isFromGuide", true)
.navigation() .navigation()
} }
bt_to_consultant.setOnClickListener { // bt_to_consultant.setOnClickListener {
ARouter.getInstance() // ARouter.getInstance()
.build("/consult/hot_search") // .build("/consult/hot_search")
.withString( // .withString(
HOT_SEARCH_DOCTOR_NAME, // HOT_SEARCH_DOCTOR_NAME,
this.resources?.getString(R.string.platform_search_hint) // this.resources?.getString(R.string.platform_search_hint)
) // )
.navigation() // .navigation()
} // }
bt_to_music.setOnClickListener { bt_to_music.setOnClickListener {
startActivity(Intent(this, MusicPlayActivity::class.java)) startActivity(Intent(this, MusicPlayActivity::class.java))
} }
...@@ -97,6 +96,10 @@ class MainActivity : BaseLceActivity<DemoContract.View, DemoContract.Presenter>( ...@@ -97,6 +96,10 @@ class MainActivity : BaseLceActivity<DemoContract.View, DemoContract.Presenter>(
" }]\n" + " }]\n" +
" }")) " }"))
} }
bt_to_fm.setOnClickListener {
YDLRouterManager.router(IYDLRouterConstant.ROUTER_FM_LIST)
}
} }
......
...@@ -154,7 +154,7 @@ public class PlayFragment extends Fragment implements View.OnClickListener, ...@@ -154,7 +154,7 @@ public class PlayFragment extends Fragment implements View.OnClickListener,
break; break;
case R.id.iv_play: case R.id.iv_play:
play(); play();
if(PlayerFloatHelper.Companion.isShow(getActivity())) { if(!PlayerFloatHelper.Companion.isShow(getActivity())) {
PlayerFloatHelper.Companion.show(getActivity(), PlayTypeEnum.PLAY_TYPE_FM,new HashMap<>()); PlayerFloatHelper.Companion.show(getActivity(), PlayTypeEnum.PLAY_TYPE_FM,new HashMap<>());
}else { }else {
PlayerFloatHelper.Companion.showIfPlaying(getActivity()); PlayerFloatHelper.Companion.showIfPlaying(getActivity());
......
...@@ -108,6 +108,20 @@ ...@@ -108,6 +108,20 @@
android:text="Jump to 冥想" /> android:text="Jump to 冥想" />
</LinearLayout> </LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<Button
android:id="@+id/bt_to_fm"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="30dp"
android:layout_marginTop="10dp"
android:text="Jump to FM" />
</LinearLayout>
</LinearLayout> </LinearLayout>
......
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: 'kotlin-android-extensions'
kapt {
arguments {
arg("AROUTER_MODULE_NAME", project.getName())
}
}
android {
compileSdkVersion rootProject.ext.android["compileSdkVersion"]
buildToolsVersion rootProject.ext.android["buildToolsVersion"]
defaultConfig {
minSdkVersion rootProject.ext.android["minSdkVersion"]
targetSdkVersion rootProject.ext.android["targetSdkVersion"]
versionCode 1
versionName "1.0"
multiDexEnabled true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
flavorDimensions "versionCode"
}
lintOptions {
abortOnError false
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
//Flavor 信息
publishNonDefault true
productFlavors {
ydl {}
xlzx {}
}
compileOptions {
sourceCompatibility 1.8
targetCompatibility 1.8
}
}
dependencies {
api fileTree(dir: 'libs', include: ['*.jar', '*.aar'])
implementation 'com.android.support:appcompat-v7:26.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation "com.alibaba:arouter-api:$arouter_api"
// 注意此处的依赖方式:kotlin中使用和java中使用方式有不同
kapt "com.alibaba:arouter-compiler:$arouter_compiler"
if (rootProject.ext.dev_mode){
//开发时使用
api project(":ydl-platform")
api project(':m-user')
implementation project(':ydl-media')
implementation modularPublication('com.ydl:m-user-api')
} else {
//发布时使用
api rootProject.ext.dependencies["ydl-m-user-api"]
api(rootProject.ext.dependencies["ydl-platform"]) {
transitive = true
}
}
}
modular {
//模块包名
packageName "com.yidianling.fm"
// 模块发布需要的参数
publish {
modules {
xlzx {
groupId = "com.ydl"
artifactId = "m-fm-module-xlzx"
// 上报的 心理咨询 业务模块 aar 包的版本号
version = "0.0.1"
}
ydl{
groupId = "com.ydl"
artifactId = "m-fm-module-ydl"
// 上报的 壹点灵 业务模块 aar 包的版本号
version = "0.0.1"
}
}
api {
// 壹点灵/心理咨询 业务模块 API层 jar包的发布信息
groupId = "com.ydl"
artifactId = "m-fm-api"
//开发时注释掉版本号,发布api时打开
//version = "0.0.1"
// API 层打包时需要引入的依赖
apiDependencies {
implementation "com.google.code.gson:gson:2.8.2"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.alibaba:arouter-api:1.4.1'
}
}
}
}
\ No newline at end of file
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
package com.ydl.ydl_fm;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.ydl.ydl_fm.test", appContext.getPackageName());
}
}
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.yidianling.fm">
<application>
<activity android:name=".FMActivity"
android:label="电台页面"
android:screenOrientation="portrait"/>
<activity android:name=".FMDetailActivity"
android:label="电台详情页面"
android:launchMode="singleTask"
android:screenOrientation="portrait"/>
</application>
</manifest>
package com.yidianling.fm;
import android.graphics.Color;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;
import android.widget.PopupWindow;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.ydl.media.view.PlayTypeEnum;
import com.ydl.media.view.PlayerFloatHelper;
import com.ydl.ydlcommon.adapter.FragmentWithTabPagerAdapter;
import com.ydl.ydlcommon.base.BaseActivity;
import com.ydl.ydlcommon.utils.PopUtils;
import com.ydl.ydlcommon.view.SlidingTabLayout;
import com.ydl.ydlcommon.view.TitleBar;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
/**
* 电台
* Created by softrice on 15/12/11.
*/
@Route(path = "/fm/list")
public class FMActivity extends BaseActivity {
private TitleBar tb_title;
private SlidingTabLayout stl_tab;
private ViewPager vp_content;
private List<String> titleList = new ArrayList<>();
private List<Fragment> fragmentList = new ArrayList<>();
private PopupWindow popupWindow;
@Override
protected int layoutResId() {
return R.layout.activity_fm;
}
@Override
protected void initDataAndEvent() {
tb_title = findViewById(R.id.tb_title);
stl_tab = findViewById(R.id.stl_tab);
vp_content = findViewById(R.id.vp_content);
initTags();
tb_title.setRightImageListener(v -> popupWindow = PopUtils.showMoreItem(FMActivity.this,
tb_title.getRootView(),
0,
0));
tb_title.setRightImageIfShouldSee();
}
@Override
public void onBackPressed() {
if (popupWindow != null && popupWindow.isShowing()) {
popupWindow.dismiss();
return;
}
super.onBackPressed();
}
/**
* 初始化tab
*/
private void initTags() {
titleList.add("全部");
titleList.add("我喜欢的");
for (int i = 0; i < 2; i++) {
fragmentList.add(new FMListViewFragment().setTagId(i));
}
FragmentWithTabPagerAdapter adapter = new FragmentWithTabPagerAdapter(getSupportFragmentManager(), titleList, fragmentList);
stl_tab.setBackgroundColor(Color.WHITE);
vp_content.setAdapter(adapter);
stl_tab.setIsDoubleTab(true);
stl_tab.setSelectedIndicatorColors(0xFF1da1f2);
stl_tab.setDividerColors(Color.TRANSPARENT);
stl_tab.setViewPager(vp_content);
vp_content.setCurrentItem(0);
}
@Override
protected void onResume() {
super.onResume();
/* if (FMOut.INSTANCE.isHansUnread()) {
tb_title.setImage_right(getResources().getDrawable(R.drawable.more12r));
} else {
tb_title.setImage_right(getResources().getDrawable(R.drawable.more12x));
}*/
}
@Override
protected void onPause() {
super.onPause();
}
}
package com.yidianling.fm;
import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import com.ydl.ydlcommon.adapter.CommonAdapter;
import com.yidianling.fm.response.FM;
/**
* Created by softrice on 15/12/11.
*/
public class FMListAdapter extends CommonAdapter<FM> {
private Context context;
public FMListAdapter(Context context) {
this.context = context;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
if(convertView == null){
convertView = new FMListItemView(context);
}
((FMListItemView)convertView).setData(mDataList.get(position));
return convertView;
}
}
package com.yidianling.fm;
import android.content.Context;
import android.text.TextUtils;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.ydl.ydl_image.module.GlideApp;
import com.yidianling.fm.response.FM;
/**
* fm列表项
* Created by softrice on 15/12/11.
*/
public class FMListItemView extends LinearLayout {
// @BindView(R.id.sdv_head)
private ImageView sdv_head;
// @BindView(R.id.tv_title)
private TextView tv_title;
// @BindView(R.id.tv_anchor)
private TextView tv_anchor;
// @BindView(R.id.tv_listen_num)
private TextView tv_listen_num;
public FMListItemView(Context context) {
super(context);
inflate(context, R.layout.ui_fm_list_item, this);
sdv_head = findViewById(R.id.sdv_head);
tv_title = findViewById(R.id.tv_title);
tv_anchor = findViewById(R.id.tv_anchor);
tv_listen_num = findViewById(R.id.tv_listen_num);
}
public void setData(FM fm) {
if (!TextUtils.isEmpty(fm.getImageUrl())) {
GlideApp.with(getContext())
.load(fm.getImageUrl())
.placeholder(R.drawable.default_img)
.into(sdv_head);
}
tv_title.setText(fm.getName());
tv_anchor.setText("主播:" + fm.getAuthor());
tv_listen_num.setText("收听:" + fm.getHits());
}
}
package com.yidianling.fm
import com.yidianling.fm.http.FMHttp
import com.yidianling.fm.http.FMHttpImpl
/**
* @author : Zhangwenchao
* @e-mail : zhangwch@yidianling.com
* @time : 2018/5/15
*/
object FmDataManager {
fun getHttp(): FMHttp = FMHttpImpl.getInstance()
}
\ No newline at end of file
package com.yidianling.fm;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.RectF;
import android.graphics.Typeface;
import android.util.AttributeSet;
import android.view.View;
public class RoundProgressBar extends View {
private Paint paint;
private int roundColor;
private int roundProgressColor;
private int textColor;
private float textSize;
private float roundWidth;
private int max;
private int progress;
private boolean textIsDisplayable;
private int style;
public static final int STROKE = 0;
public static final int FILL = 1;
public RoundProgressBar(Context context) {
this(context, null);
}
public RoundProgressBar(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
public RoundProgressBar(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
paint = new Paint();
TypedArray mTypedArray = context.obtainStyledAttributes(attrs,
R.styleable.RoundProgressBar);
roundColor = mTypedArray.getColor(
R.styleable.RoundProgressBar_roundColor, 0x558B8B8B);
roundProgressColor = mTypedArray.getColor(
R.styleable.RoundProgressBar_roundProgressColor, 0xFF91E300);
textColor = mTypedArray.getColor(
R.styleable.RoundProgressBar_textColor, Color.GREEN);
textSize = mTypedArray.getDimension(
R.styleable.RoundProgressBar_textSize, 15);
roundWidth = mTypedArray.getDimension(
R.styleable.RoundProgressBar_roundWidth, 5);
max = mTypedArray.getInteger(R.styleable.RoundProgressBar_round_progress_bar_max_num, 100);
textIsDisplayable = mTypedArray.getBoolean(
R.styleable.RoundProgressBar_textIsDisplayable, true);
style = mTypedArray.getInt(R.styleable.RoundProgressBar_style, 0);
mTypedArray.recycle();
}
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
int centre = getWidth() / 2;
int radius = (int) (centre - roundWidth / 2);
canvas.save();
canvas.rotate(-90, centre, centre);
paint.setColor(roundColor);
paint.setStyle(Paint.Style.STROKE);
paint.setStrokeWidth(roundWidth);
paint.setAntiAlias(true);
canvas.drawCircle(centre, centre, radius, paint);
paint.setStrokeWidth(0);
paint.setColor(textColor);
paint.setTextSize(textSize);
paint.setTypeface(Typeface.DEFAULT_BOLD);
int percent = (int) (((float) progress / (float) max) * 100);
float textWidth = paint.measureText(percent + "%");
if (textIsDisplayable && percent != 0 && style == STROKE) {
canvas.drawText(percent + "%", centre - textWidth / 2, centre
+ textSize / 2, paint);
}
paint.setStrokeWidth(roundWidth);
paint.setColor(roundProgressColor);
RectF oval = new RectF(centre - radius, centre - radius, centre
+ radius, centre + radius);
switch (style) {
case STROKE: {
paint.setStyle(Paint.Style.STROKE);
canvas.drawArc(oval, 0, 360 * progress / max, false, paint);
break;
}
case FILL: {
paint.setStyle(Paint.Style.FILL_AND_STROKE);
if (progress != 0)
canvas.drawArc(oval, 0, 360 * progress / max, true, paint);
break;
}
}
canvas.restore();
}
public synchronized int getMax() {
return max;
}
public synchronized void setMax(int max) {
if (max < 0) {
throw new IllegalArgumentException("max not less than 0");
}
this.max = max;
}
public synchronized int getProgress() {
return progress;
}
public synchronized void setProgress(int progress) {
if (progress < 0) {
throw new IllegalArgumentException("progress not less than 0");
}
if (progress > max) {
progress = max;
}
if (progress <= max) {
this.progress = progress;
postInvalidate();
}
}
public int getCricleColor() {
return roundColor;
}
public void setCricleColor(int cricleColor) {
this.roundColor = cricleColor;
}
public int getCricleProgressColor() {
return roundProgressColor;
}
public void setCricleProgressColor(int cricleProgressColor) {
this.roundProgressColor = cricleProgressColor;
}
public int getTextColor() {
return textColor;
}
public void setTextColor(int textColor) {
this.textColor = textColor;
}
public float getTextSize() {
return textSize;
}
public void setTextSize(float textSize) {
this.textSize = textSize;
}
public float getRoundWidth() {
return roundWidth;
}
public void setRoundWidth(float roundWidth) {
this.roundWidth = roundWidth;
}
}
package com.yidianling.fm.http
import com.ydl.ydlcommon.base.config.YDL_DOMAIN
import com.ydl.ydlcommon.base.config.YDL_DOMAIN_JAVA
import com.ydl.ydlcommon.data.http.BaseAPIResponse
import com.ydl.ydlcommon.data.http.BaseResponse
import com.yidianling.fm.response.FMDetail
import com.yidianling.fm.response.FMList
import com.yidianling.fm.response.FavFM
import io.reactivex.Observable
import retrofit2.http.*
/**
* author : Zhangwenchao
* e-mail : zhangwch@yidianling.com
* time : 2018/03/05
*/
interface FMApi {
@Headers( YDL_DOMAIN + YDL_DOMAIN_JAVA)
//获得收藏电台
@GET("fm/list/my")
fun getFavFMs(@QueryMap params: Map<String, String>): Observable<BaseAPIResponse<FMList>>
@Headers( YDL_DOMAIN+ YDL_DOMAIN_JAVA)
//全部电台
@GET("fm/list/all")
fun getAllFMs(@QueryMap params: Map<String, String>): Observable<BaseAPIResponse<FMList>>
//电台详情
@FormUrlEncoded
@POST("fm/detail")
fun fmDetail(@FieldMap params: Map<String, String>): Observable<BaseResponse<FMDetail>>
//收藏电台
@FormUrlEncoded
@POST("favorite/like")
fun favFM(@FieldMap params: Map<String, String>): Observable<BaseResponse<FavFM>>
}
\ No newline at end of file
package com.yidianling.fm.http
import com.ydl.ydlcommon.data.http.BaseAPIResponse
import com.ydl.ydlcommon.data.http.BaseResponse
import com.yidianling.fm.param.DetailParam
import com.yidianling.fm.param.FMParam
import com.yidianling.fm.param.FavParam
import com.yidianling.fm.response.FMDetail
import com.yidianling.fm.response.FMList
import com.yidianling.fm.response.FavFM
import io.reactivex.Observable
/**
* author : Zhangwenchao
* e-mail : zhangwch@yidianling.com
* time : 2018/03/05
*/
interface FMHttp {
fun getFavFMs(fmParam: FMParam): Observable<BaseAPIResponse<FMList>>
fun getAllFMs(fmParam: FMParam): Observable<BaseAPIResponse<FMList>>
fun fmDetail(param: DetailParam): Observable<BaseResponse<FMDetail>>
fun favFM(param: FavParam): Observable<BaseResponse<FavFM>>
}
\ No newline at end of file
package com.yidianling.fm.http
import com.ydl.ydlcommon.data.http.*
import com.ydl.ydlnet.YDLHttpUtils
import com.yidianling.fm.param.DetailParam
import com.yidianling.fm.param.FMParam
import com.yidianling.fm.param.FavParam
import com.yidianling.fm.response.FMDetail
import com.yidianling.fm.response.FMList
import com.yidianling.fm.response.FavFM
import io.reactivex.Observable
import java.util.ArrayList
import java.util.HashMap
/**
* author : Zhangwenchao
* e-mail : zhangwch@yidianling.com
* time : 2018/03/05
*/
class FMHttpImpl private constructor() : FMHttp {
companion object {
fun getInstance(): FMHttpImpl {
return Holder.INSTANCE
}
fun clearFMApi() {
Holder.INSTANCE.fmApi = null
}
}
private var fmApi: FMApi? = null
private fun getFMApi(): FMApi {
if (fmApi == null) {
fmApi = YDLHttpUtils.obtainApi(FMApi::class.java)
}
return fmApi!!
}
override fun getFavFMs(fmParam: FMParam): Observable<BaseAPIResponse<FMList>> {
return RxUtils.mapObservable(fmParam).flatMap { getFMApi().getFavFMs(it) }
}
override fun getAllFMs(fmParam: FMParam): Observable<BaseAPIResponse<FMList>> {
return RxUtils.mapObservable(fmParam).flatMap { getFMApi().getAllFMs(it) }
}
override fun fmDetail(param: DetailParam): Observable<BaseResponse<FMDetail>> {
return RxUtils.mapObservable(param)
.flatMap { getFMApi().fmDetail(it) }
}
override fun favFM(param: FavParam): Observable<BaseResponse<FavFM>> {
return RxUtils.mapObservable(param)
.flatMap { getFMApi().favFM(it) }
}
private object Holder {
val INSTANCE = FMHttpImpl()
}
}
\ No newline at end of file
package com.yidianling.fm.param
/**
* author : Zhangwenchao
* e-mail : zhangwch@yidianling.com
* time : 2018/03/06
*/
data class DetailParam(val id: Int)
\ No newline at end of file
package com.yidianling.fm.param;
import com.ydl.ydlcommon.data.http.BaseCommand;
public class FMParam extends BaseCommand {
public String page;
public String perPageRows;
public FMParam(String page, String perPageRows) {
this.page = page;
this.perPageRows = perPageRows;
}
}
\ No newline at end of file
package com.yidianling.fm.param
/**
* author : Zhangwenchao
* e-mail : zhangwch@yidianling.com
* time : 2018/03/06
*/
data class FavParam internal constructor(val id: Int, val type: Int) {
constructor(id: Int): this(id, 1)
}
\ No newline at end of file
package com.yidianling.fm.response
/**
* author : Zhangwenchao
* e-mail : zhangwch@yidianling.com
* time : 2018/03/05
*/
data class FM(val id: Int,
val name: String?,
val author: String?,
val imageUrl: String?,
val hits: String?)
\ No newline at end of file
package com.yidianling.fm.response
/**
* author : Zhangwenchao
* e-mail : zhangwch@yidianling.com
* time : 2018/03/06
*/
data class FMDetail(val next_id: Int,
val id: Int,
val title: String,
val author: String,
val image_url: String,
val fm_url: String,
val share_url: String,
val hits: Int,
val count_favorite: String,
val is_favorite: Int,
val time: Int)
package com.yidianling.fm.response
data class FMList(
val list:List<FM>
)
\ No newline at end of file
package com.yidianling.fm.response
/**
* author : Zhangwenchao
* e-mail : zhangwch@yidianling.com
* time : 2018/03/06
*/
data class FavFM(val id: Int, val status: Int)
\ No newline at end of file
package com.yidianling.fm.router
import android.app.Activity
import android.content.Intent
import com.ydl.ydlcommon.modular.ModularServiceManager
import com.yidianling.router.RouterManager
import com.yidianling.user.api.service.IUserService
/**
* author : Zhangwenchao
* e-mail : zhangwch@yidianling.com
* time : 2018/04/25
*/
object FMIn {
fun isLogin(): Boolean {
return ModularServiceManager.provide(IUserService::class.java).isLogin()
// return RouterManager.getUserRouter()?.isLogin()?:false
}
fun mainIntent(activity: Activity): Intent? {
//todo xujian 跳转到MainActivity 待修改
return RouterManager.getAppRouter()?.mainIntent(activity)
}
fun loginWayIntent(activity: Activity): Intent? {
return ModularServiceManager.provide(IUserService::class.java).loginWayIntent(activity)
}
/**
* FM分享到心事动态
*/
fun publisFmToTrend(activity: Activity, url: String, cover: String, title: String) : Intent?{
//todo xujian 待修改
return RouterManager.getDynamicRouter()?.publishFmToTrend(activity,url,cover,title)
}
}
\ No newline at end of file
package com.yidianling.fm.router
import android.app.Activity
import android.content.Intent
import com.ydl.media.audio.AudioPlayer
import com.ydl.media.view.PlayerFloatHelper
import com.yidianling.fm.FMDetailActivity
import com.yidianling.router.fm.IFMRouter
class FmRouterImp : IFMRouter{
override fun fmDetailIntent(activity: Activity, id: Int): Intent {
return FMDetailActivity.newIntent(activity, id)
}
override fun fmDetailIntent(activity: Activity, id: Int, isSplash: Boolean): Intent {
return FMDetailActivity.newIntent(activity, id, isSplash)
}
override fun getFmId(): Int {
return PlayerFloatHelper.getFmId()
}
override fun closePlayer() {
if (AudioPlayer.get().isPlaying) {
AudioPlayer.get().stopPlayer()
}
}
override fun isPlaying(): Boolean {
return AudioPlayer.get().isPlaying
}
override fun pause(){
AudioPlayer.get().pausePlayer()
}
override fun replay() {}
}
\ No newline at end of file
package com.yidianling.fm.api.service
import com.alibaba.android.arouter.facade.template.IProvider
/**
* Created by xj on 2019/11/4.
*/
interface IFMService: IProvider{
}
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<size
android:width="24dp"
android:height="24dp" />
<solid android:color="@color/white" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:top="6.5dp"
android:bottom="6.5dp">
<shape
android:shape="oval">
<size
android:width="7dp"
android:height="7dp" />
<stroke android:color="@color/white" android:width="1dp"/>
<solid android:color="@color/google_green" />
</shape>
</item>
<item>
<shape
android:shape="oval">
<size
android:width="7dp"
android:height="20dp" />
<solid android:color="@color/transparent"/>
</shape>
</item>
</layer-list>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/nim_picker_preview_pressed" android:state_pressed="true"></item>
<item android:drawable="@drawable/nim_picker_preview_disable" android:state_enabled="false"></item>
<item android:drawable="@drawable/nim_picker_preview_normal"></item>
</selector>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@android:id/background">
<shape>
<size android:height="1dp" />
<solid android:color="#80FFFFFF"></solid>
</shape>
</item>
<item android:id="@android:id/progress">
<clip>
<shape>
<size android:height="1dp" />
<solid android:color="@color/platform_color_FFFFFF"></solid>
</shape>
</clip>
</item>
</layer-list>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval"
android:useLevel="false">
<solid android:color="#EE394F5A" />
<size
android:width="20dp"
android:height="20dp" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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:orientation="vertical">
<com.ydl.ydlcommon.view.TitleBar
android:id="@+id/tb_title"
android:layout_width="match_parent"
android:layout_height="@dimen/title_bar_height"
app:pa_left_start_icon="@drawable/platform_toolbar_back"
app:pa_title_text="心灵电台" />
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.ydl.ydlcommon.view.SlidingTabLayout
android:id="@+id/stl_tab"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white" />
</FrameLayout>
<ImageView
android:layout_width="match_parent"
android:layout_height="@dimen/divide_line_stroke_width"
android:background="@color/divide_color" />
<android.support.v4.view.ViewPager
android:id="@+id/vp_content"
android:layout_width="match_parent"
android:layout_height="0px"
android:layout_weight="1" />
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/ll_root"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/fm_play_in"
android:fitsSystemWindows="true"
android:orientation="vertical">
<com.ydl.ydlcommon.view.TitleBar
android:id="@+id/tb_title"
android:layout_width="match_parent"
android:layout_height="@dimen/title_bar_height"
android:background="@color/transparent"
app:pa_left_start_icon="@drawable/fm_back"
app:pa_right_start_icon="@drawable/fm_item"
app:pa_title_bar_text_color="@color/white"
app:pa_title_text="心灵电台" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="74dp"
android:gravity="center_vertical"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.yidianling.fm.widget.FMSurfaceView
android:id="@+id/fmSurfaceView"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<LinearLayout
android:id="@+id/ll_last_time"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical">
<android.support.v7.widget.CardView
android:id="@+id/fm_card"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:cardElevation="0dp">
<ImageView
android:id="@+id/fm_img"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/fm_hint_img"
android:scaleType="centerCrop"/>
</android.support.v7.widget.CardView>
</LinearLayout>
<ProgressBar
android:id="@+id/circle_progress"
style="?android:attr/progressBarStyleLarge"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_centerInParent="true"
android:background="@drawable/shape_circle_black_bg"
android:visibility="gone"/>
<ImageView
android:id="@+id/refresh_icon"
android:layout_width="@dimen/platform_dp_25"
android:layout_height="@dimen/platform_dp_25"
android:src="@drawable/heart_refresh"
android:layout_centerInParent="true"
android:visibility="gone"/>
</RelativeLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/ll_bottom"
android:layout_width="match_parent"
android:layout_height="120dp"
android:layout_alignParentBottom="true"
android:gravity="center_vertical">
<ImageView
android:id="@+id/iv_love"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="@dimen/platform_dp_19"
android:scaleType="fitCenter"
android:src="@drawable/fm_love_n_2" />
<ImageView
android:id="@+id/iv_last"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="@dimen/platform_dp_36"
android:src="@drawable/fm_last_2" />
<ImageView
android:id="@+id/iv_play"
android:layout_width="0dp"
android:layout_weight="2"
android:layout_height="60dp"
android:layout_centerInParent="true"
android:src="@drawable/fm_play_2"/>
<ImageView
android:id="@+id/iv_next"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="36dp"
android:src="@drawable/fm_next_2" />
<ImageView
android:id="@+id/iv_share"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="19dp"
android:src="@drawable/fm_share_2" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_above="@+id/ll_bottom"
android:gravity="center"
android:layout_marginBottom="39dp">
<TextView
android:id="@+id/tv_fm_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:textColor="@color/platform_color_FFFFFF"
android:textSize="@dimen/platform_dp_16"
android:visibility="gone"/>
<TextView
android:id="@+id/tv_anchor"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="主播:"
android:textColor="@color/platform_color_FFFFFF"
android:textSize="@dimen/platform_dp_12"
android:layout_marginTop="@dimen/platform_dp_4"
android:layout_marginBottom="@dimen/platform_dp_10"
android:visibility="gone"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="center"
android:layout_marginTop="@dimen/platform_dp_6">
<ImageView
android:id="@+id/tv_listen_icon"
android:layout_width="@dimen/platform_dp_15"
android:layout_height="@dimen/platform_dp_12"
android:src="@drawable/fm_listen_2"
android:layout_marginRight="@dimen/platform_dp_5"
android:visibility="gone"/>
<TextView
android:id="@+id/tv_listen"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="0"
android:textStyle="bold"
android:textColor="@color/platform_color_FFFFFF"
android:textSize="13dp"
android:layout_marginRight="@dimen/platform_dp_19"
android:visibility="gone" />
<ImageView
android:id="@+id/tv_like_icon"
android:layout_width="@dimen/platform_dp_16"
android:layout_height="@dimen/platform_dp_13"
android:src="@drawable/fm_like_2"
android:layout_marginTop="0.5dp"
android:layout_marginRight="@dimen/platform_dp_5"
android:visibility="gone"/>
<TextView
android:id="@+id/tv_like"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="0"
android:textStyle="bold"
android:textColor="@color/platform_color_FFFFFF"
android:textSize="13dp"
android:visibility="gone"/>
</LinearLayout>
</LinearLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="@+id/ll_bottom"
android:layout_marginBottom="-12dp"
android:orientation="vertical">
<TextView
android:id="@+id/tv_currentTime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginBottom="@dimen/platform_dp_7"
android:layout_marginLeft="@dimen/platform_dp_25"
android:layout_weight="1"
android:text=""
android:textColor="#FFFFFF"
android:textSize="@dimen/dp_10" />
<TextView
android:id="@+id/tv_allTime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginBottom="@dimen/platform_dp_7"
android:layout_marginRight="@dimen/platform_dp_25"
android:layout_weight="1"
android:text=""
android:textColor="#FFFFFF"
android:textSize="@dimen/dp_10" />
<SeekBar
android:id="@+id/fm_progress"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/tv_currentTime"
android:layout_marginLeft="@dimen/platform_dp_25"
android:layout_marginRight="@dimen/platform_dp_25"
android:maxHeight="1dp"
android:minHeight="1dp"
android:paddingStart="4dp"
android:paddingEnd="4dp"
android:progressDrawable="@drawable/seekbar_fm_drag"
android:thumb="@drawable/dot_seekbar_fm" />
</RelativeLayout>
</RelativeLayout>
\ No newline at end of file
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<in.srain.cube.views.ptr.PtrFrameLayout
android:id="@+id/store_house_ptr_frame"
android:layout_width="match_parent"
android:layout_height="match_parent">
<in.srain.cube.views.loadmore.LoadMoreListViewContainer
android:id="@+id/load_more_list_view_container"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ListView
android:id="@+id/lv_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:divider="@color/divide_color"
android:dividerHeight="@dimen/divide_line_stroke_width" />
<com.ydl.ydlcommon.ui.LogoLoadingView
android:id="@+id/v_loading"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
<LinearLayout
android:id="@+id/ll_empty"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/empty_video" />
<TextView
android:id="@+id/ll_empty_txt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/default_dis_size_huge"
android:text="还没有喜欢的电台内容"
android:textColor="#D6D6D6" />
</LinearLayout>
</in.srain.cube.views.loadmore.LoadMoreListViewContainer>
</in.srain.cube.views.ptr.PtrFrameLayout>
</FrameLayout>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white"
android:padding="@dimen/default_dis_size">
<ImageView
android:id="@+id/sdv_head"
android:layout_width="112dp"
android:layout_height="70dp"
android:layout_centerVertical="true"
android:contentDescription="@null"
android:scaleType="centerCrop" />
<TextView
android:id="@+id/tv_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toLeftOf="@+id/iv_next"
android:layout_toRightOf="@+id/sdv_head"
android:padding="@dimen/default_dis_size_small"
android:text=""
android:textSize="@dimen/default_text_size_big" />
<TextView
android:id="@+id/tv_anchor"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/tv_title"
android:layout_toRightOf="@+id/sdv_head"
android:drawablePadding="@dimen/default_dis_size_micro"
android:padding="@dimen/default_dis_size_small"
android:text="主播:"
android:textColor="@color/default_text_color_hint" />
<TextView
android:id="@+id/tv_listen_num"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/tv_title"
android:layout_toLeftOf="@+id/iv_next"
android:layout_toRightOf="@+id/tv_anchor"
android:drawablePadding="@dimen/default_dis_size_micro"
android:padding="@dimen/default_dis_size_small"
android:text="收听:0"
android:textColor="@color/default_text_color_hint" />
<ImageView
android:id="@+id/iv_next"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:src="@drawable/msg_next" />
</RelativeLayout>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal"
android:padding="15dp">
<ImageView
android:id="@+id/iv_head"
android:layout_width="60dp"
android:layout_height="60dp"
android:contentDescription="@string/platform_header"
android:src="@drawable/default_img" />
<TextView
android:id="@+id/tv_title"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginLeft="12dp"
android:layout_marginRight="12dp"
android:layout_weight="1"
android:background="?android:attr/selectableItemBackground"
android:ellipsize="end"
android:gravity="center_vertical"
android:maxLines="2"
android:textColor="@color/default_text_color"
android:textSize="14sp"
tools:text="课课程名称课程名称课程名称课程名称课程名称课" />
<ImageButton
android:id="@+id/btn_pause_play"
style="@android:style/Widget.Holo.Button.Borderless.Small"
android:layout_width="48dp"
android:layout_height="48dp"
android:contentDescription="@string/platform_pause_play"
android:scaleType="centerInside"
android:src="@drawable/ic_pause_24dp" />
<ImageButton
android:id="@+id/btn_close"
style="@android:style/Widget.Holo.Button.Borderless.Small"
android:layout_width="48dp"
android:layout_height="48dp"
android:contentDescription="@string/platform_close"
android:scaleType="centerInside"
android:src="@drawable/ic_close_24dp" />
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!--RoundProgressBar-->
<declare-styleable name="RoundProgressBar">
<attr name="roundColor" format="color" />
<attr name="roundProgressColor" format="color" />
<attr name="roundWidth" format="dimension"></attr>
<attr name="textColor" format="color" />
<attr name="textSize" format="dimension" />
<attr name="round_progress_bar_max_num" format="integer"></attr>
<attr name="textIsDisplayable" format="boolean"></attr>
<attr name="style">
<enum name="STROKE" value="0"></enum>
<enum name="FILL" value="1"></enum>
</attr>
</declare-styleable>
</resources>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="divide_color">#EDEDED</color>
</resources>
\ No newline at end of file
<resources>
<string name="app_name">FM</string>
</resources>
package com.ydl.ydl_muse; package com.ydl.ydl_fm;
import org.junit.Test; import org.junit.Test;
......
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="google_green">#2ca94f</color>
</resources>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="google_green">#1da1f2</color>
</resources>
\ No newline at end of file
package com.ydl.ydl_muse; package com.ydl.ydl_fm;
import android.content.Context; import android.content.Context;
import android.support.test.InstrumentationRegistry; import android.support.test.InstrumentationRegistry;
......
package com.yidianling.muse.api.bean package com.yidianling.muse.bean
/** /**
* Created by xj on 2019/10/31. * Created by xj on 2019/10/31.
......
package com.yidianling.muse.api.bean package com.yidianling.muse.bean
/** /**
* 冥想模块所有数据 * 冥想模块所有数据
......
...@@ -8,7 +8,7 @@ import com.ydl.ydlcommon.utils.YDLCacheUtils ...@@ -8,7 +8,7 @@ import com.ydl.ydlcommon.utils.YDLCacheUtils
import com.ydl.ydlcommon.view.dialog.YDLShareDialog import com.ydl.ydlcommon.view.dialog.YDLShareDialog
import com.yidianling.common.tools.ToastUtil import com.yidianling.common.tools.ToastUtil
import com.yidianling.muse.R import com.yidianling.muse.R
import com.yidianling.muse.api.bean.MuseModuleBean import com.yidianling.muse.bean.MuseModuleBean
import io.flutter.app.FlutterActivity import io.flutter.app.FlutterActivity
import io.flutter.plugin.common.MethodCall import io.flutter.plugin.common.MethodCall
import io.flutter.plugin.common.MethodChannel import io.flutter.plugin.common.MethodChannel
......
package com.ydl.ydl_fm;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
}
\ No newline at end of file
...@@ -85,7 +85,6 @@ public class LoginActivity extends BaseMvpActivity<LoginContract.View,LoginContr ...@@ -85,7 +85,6 @@ public class LoginActivity extends BaseMvpActivity<LoginContract.View,LoginContr
} }
void init() { void init() {
UMEventUtils.um_login(this);
if (isSplash == -1) {//启动app进入,无取消 if (isSplash == -1) {//启动app进入,无取消
tbTitle.setmLeftText(""); tbTitle.setmLeftText("");
tbTitle.setOnLeftTextClick((view, isActive) -> { tbTitle.setOnLeftTextClick((view, isActive) -> {
......
...@@ -153,12 +153,10 @@ class InputPassWordActivity : BaseMvpActivity<IInputPassWordContract.View,IInput ...@@ -153,12 +153,10 @@ class InputPassWordActivity : BaseMvpActivity<IInputPassWordContract.View,IInput
input_iv_next.setOnClickListener { input_iv_next.setOnClickListener {
//下一步 //下一步
if (STATUS_INPUT_PWD == codeStatus) { if (STATUS_INPUT_PWD == codeStatus) {
UMEventUtils.umJavaEvent(javaClass.simpleName + "|click_next")
//密码登录 //密码登录
userLoginByPassword() userLoginByPassword()
} else { } else {
UMEventUtils.umJavaEvent(javaClass.simpleName + "|click_confirm")
//设置新密码 //设置新密码
if (checkPassWord()) { if (checkPassWord()) {
...@@ -171,24 +169,19 @@ class InputPassWordActivity : BaseMvpActivity<IInputPassWordContract.View,IInput ...@@ -171,24 +169,19 @@ class InputPassWordActivity : BaseMvpActivity<IInputPassWordContract.View,IInput
et_input_password.setText("") et_input_password.setText("")
} }
iv_visibility.setOnClickListener { iv_visibility.setOnClickListener {
UMEventUtils.umJavaEvent(javaClass.simpleName + "|click_visible")
iv_visibility.isSelected = !iv_visibility.isSelected iv_visibility.isSelected = !iv_visibility.isSelected
//切换密码显示、不显示 //切换密码显示、不显示
switchPwdShowType() switchPwdShowType()
} }
tv_msm_login.setOnClickListener { tv_msm_login.setOnClickListener {
UMEventUtils.umJavaEvent(javaClass.simpleName + "|click_sms")
UMEventUtils.umEvent("密码登录页", "短信登录", "")
//短信登录 //短信登录
VerificationCodeActivity.start(this, userPhoneNumber!!, countryCode!!, VerificationCodeActivity.STATUS_LOGIN_BY_CODE, false, true) VerificationCodeActivity.start(this, userPhoneNumber!!, countryCode!!, VerificationCodeActivity.STATUS_LOGIN_BY_CODE, false, true)
overridePendingTransition(0, 0) overridePendingTransition(0, 0)
} }
tv_forget.setOnClickListener { tv_forget.setOnClickListener {
UMEventUtils.umJavaEvent(javaClass.simpleName + "|click_forget")
UMEventUtils.umEvent("密码登录页", "忘记密码", "")
//忘记密码 //忘记密码
VerificationCodeActivity.start(this, userPhoneNumber!!, countryCode!!, VerificationCodeActivity.STATUS_FORGET_PWD) VerificationCodeActivity.start(this, userPhoneNumber!!, countryCode!!, VerificationCodeActivity.STATUS_FORGET_PWD)
overridePendingTransition(0, 0) overridePendingTransition(0, 0)
......
...@@ -354,13 +354,11 @@ class RegisterAndLoginActivity : BaseMvpActivity<ILoginContract.View, ILoginCont ...@@ -354,13 +354,11 @@ class RegisterAndLoginActivity : BaseMvpActivity<ILoginContract.View, ILoginCont
} }
//微信登录 //微信登录
iv_weixin.setOnClickListener { iv_weixin.setOnClickListener {
UMEventUtils.umJavaEvent(javaClass.simpleName + "|click_wechat")
mPresenter.loginByThird(this, SHARE_MEDIA.WEIXIN) mPresenter.loginByThird(this, SHARE_MEDIA.WEIXIN)
} }
//QQ 登录 //QQ 登录
iv_qq.setOnClickListener { iv_qq.setOnClickListener {
UMEventUtils.umJavaEvent(javaClass.simpleName + "|click_QQ")
val config = UMShareConfig() val config = UMShareConfig()
config.isNeedAuthOnGetUserInfo(true) config.isNeedAuthOnGetUserInfo(true)
...@@ -375,9 +373,6 @@ class RegisterAndLoginActivity : BaseMvpActivity<ILoginContract.View, ILoginCont ...@@ -375,9 +373,6 @@ class RegisterAndLoginActivity : BaseMvpActivity<ILoginContract.View, ILoginCont
} }
//下一步 //下一步
iv_next.setOnClickListener { iv_next.setOnClickListener {
UMEventUtils.umEvent("登录注册入口页", "", "")
//todo yuwai: 埋点统一命名,方便查看
UMEventUtils.umJavaEvent(javaClass.simpleName + "|click_next")
if (checkPhone()) { if (checkPhone()) {
mPresenter.checkPhoneStatus(userPhoneNumber!!, countryCode!!, isUmengLoginState) mPresenter.checkPhoneStatus(userPhoneNumber!!, countryCode!!, isUmengLoginState)
......
...@@ -175,7 +175,6 @@ class VerificationCodeActivity : BaseMvpActivity<IVerificationCodeContract.View, ...@@ -175,7 +175,6 @@ class VerificationCodeActivity : BaseMvpActivity<IVerificationCodeContract.View,
} }
//下一步 //下一步
ver_iv_next.setOnClickListener { ver_iv_next.setOnClickListener {
UMEventUtils.umEvent("短信登录", "下一步", "")
if (TextUtils.isEmpty(pc_1.phoneCode) || pc_1.phoneCode.length != 4) { if (TextUtils.isEmpty(pc_1.phoneCode) || pc_1.phoneCode.length != 4) {
startAnim() startAnim()
...@@ -186,14 +185,11 @@ class VerificationCodeActivity : BaseMvpActivity<IVerificationCodeContract.View, ...@@ -186,14 +185,11 @@ class VerificationCodeActivity : BaseMvpActivity<IVerificationCodeContract.View,
//重新发送验证码 //重新发送验证码
tv_countdown_time.setOnClickListener { tv_countdown_time.setOnClickListener {
UMEventUtils.umJavaEvent(javaClass.simpleName + "|click_resend")
sendMsgCode() sendMsgCode()
} }
tv_passWord.setOnClickListener { tv_passWord.setOnClickListener {
UMEventUtils.umJavaEvent(javaClass.simpleName + "|click_pwd")
UMEventUtils.umEvent("短信登录", "密码登录", "")
if (ActivityManager.getInstance().getSecondTaskActivity() == null) { if (ActivityManager.getInstance().getSecondTaskActivity() == null) {
closeAnim(true) closeAnim(true)
...@@ -218,7 +214,6 @@ class VerificationCodeActivity : BaseMvpActivity<IVerificationCodeContract.View, ...@@ -218,7 +214,6 @@ class VerificationCodeActivity : BaseMvpActivity<IVerificationCodeContract.View,
* 登录 * 登录
*/ */
fun login() { fun login() {
UMEventUtils.umJavaEvent(javaClass.simpleName + "|verify_code")
val msgCode = pc_1.phoneCode val msgCode = pc_1.phoneCode
if (codeType == STATUS_LOGIN_BY_CODE) {//验证码登录界面 if (codeType == STATUS_LOGIN_BY_CODE) {//验证码登录界面
if (isBindPhone) { if (isBindPhone) {
......
...@@ -60,9 +60,7 @@ class InputPassWordPresenterImpl : BasePresenter<IInputPassWordContract.View, II ...@@ -60,9 +60,7 @@ class InputPassWordPresenterImpl : BasePresenter<IInputPassWordContract.View, II
if (it.data.firstLogin == 1) {//第一次登录:是注册 if (it.data.firstLogin == 1) {//第一次登录:是注册
// 重设密码登录已经不可能是首次登录,所以不进行百度埋点 // 重设密码登录已经不可能是首次登录,所以不进行百度埋点
//view.baiduActionBury() //view.baiduActionBury()
UMEventUtils.loginSuccess("InputPassWordActivity|Reg_succ")
} else { } else {
UMEventUtils.loginSuccess("InputPassWordActivity|Login_succ")
} }
mView.closeActivity() mView.closeActivity()
} }
...@@ -99,10 +97,8 @@ class InputPassWordPresenterImpl : BasePresenter<IInputPassWordContract.View, II ...@@ -99,10 +97,8 @@ class InputPassWordPresenterImpl : BasePresenter<IInputPassWordContract.View, II
saveUserData(it.data) saveUserData(it.data)
if (it.data.firstLogin == 1) {//第一次登录:是注册 if (it.data.firstLogin == 1) {//第一次登录:是注册
mView.baiduActionBury() mView.baiduActionBury()
UMEventUtils.loginSuccess("InputPassWordActivity|Reg_succ")
} else { } else {
ActionCountUtils.countUid(UserBIConstants.ACTION_TYPE_PWD_LOGIN,it.data.uid!!) ActionCountUtils.countUid(UserBIConstants.ACTION_TYPE_PWD_LOGIN,it.data.uid!!)
UMEventUtils.loginSuccess("InputPassWordActivity|Login_succ")
} }
mView.closeActivity() mView.closeActivity()
} }
......
...@@ -72,11 +72,9 @@ class LoginPresenterImpl(view: ILoginContract.View) : BasePresenter<ILoginContra ...@@ -72,11 +72,9 @@ class LoginPresenterImpl(view: ILoginContract.View) : BasePresenter<ILoginContra
saveUserData(it.data) saveUserData(it.data)
if (it.data.firstLogin == 1) {//第一次登录:是注册 if (it.data.firstLogin == 1) {//第一次登录:是注册
mView.baiduActionBury(it.data.uid, UserBIConstants.POSITION_ALIYUN_REGISTER_CLICK) mView.baiduActionBury(it.data.uid, UserBIConstants.POSITION_ALIYUN_REGISTER_CLICK)
UMEventUtils.loginSuccess("RegisterAndLoginActivity|Reg_succ")
} else { } else {
ActionCountUtils.count(UserBIConstants.ACTION_TYPE_DIRECT_LOGIN) ActionCountUtils.count(UserBIConstants.ACTION_TYPE_DIRECT_LOGIN)
UMEventUtils.loginSuccess("RegisterAndLoginActivity|Login_succ")
} }
mView.autoLoginSuccess() mView.autoLoginSuccess()
} else { } else {
...@@ -204,22 +202,18 @@ class LoginPresenterImpl(view: ILoginContract.View) : BasePresenter<ILoginContra ...@@ -204,22 +202,18 @@ class LoginPresenterImpl(view: ILoginContract.View) : BasePresenter<ILoginContra
if (media == SHARE_MEDIA.QQ) { if (media == SHARE_MEDIA.QQ) {
if (it.data.firstLogin == 1) {//第一次登录:是注册 if (it.data.firstLogin == 1) {//第一次登录:是注册
mView.baiduActionBury(it.data.uid,UserBIConstants.POSITION_QQ_REGISTER_CLICK) mView.baiduActionBury(it.data.uid,UserBIConstants.POSITION_QQ_REGISTER_CLICK)
UMEventUtils.loginSuccess("RegisterAndLoginActivity|Reg_succ_byQQ")
} else { } else {
ActionCountUtils.count(UserHelper.getUserInfo()!!.uid, UserBIConstants.PART_ID_LOGIN_MAIN, ActionCountUtils.count(UserHelper.getUserInfo()!!.uid, UserBIConstants.PART_ID_LOGIN_MAIN,
UserBIConstants.POSITION_LOGIN_SUCCESS_CLICK, "友盟三方登录url无法获取", UserBIConstants.POSITION_LOGIN_SUCCESS_CLICK, "友盟三方登录url无法获取",
"友盟三方登录api无法获取", sign1) "友盟三方登录api无法获取", sign1)
UMEventUtils.loginSuccess("RegisterAndLoginActivity|Login_succ_byQQ")
} }
} else { } else {
if (it.data.firstLogin == 1) {//第一次登录:是注册 if (it.data.firstLogin == 1) {//第一次登录:是注册
mView.baiduActionBury(it.data.uid,UserBIConstants.POSITION_WX_REGISTER_CLICK) mView.baiduActionBury(it.data.uid,UserBIConstants.POSITION_WX_REGISTER_CLICK)
UMEventUtils.loginSuccess("RegisterAndLoginActivity|Reg_succ_byWechat")
} else { } else {
ActionCountUtils.count(UserHelper.getUserInfo()!!.uid, UserBIConstants.PART_ID_LOGIN_MAIN, ActionCountUtils.count(UserHelper.getUserInfo()!!.uid, UserBIConstants.PART_ID_LOGIN_MAIN,
UserBIConstants.POSITION_LOGIN_SUCCESS_CLICK, "友盟三方登录url无法获取", UserBIConstants.POSITION_LOGIN_SUCCESS_CLICK, "友盟三方登录url无法获取",
"友盟三方登录api无法获取", sign1) "友盟三方登录api无法获取", sign1)
UMEventUtils.loginSuccess("RegisterAndLoginActivity|Login_succ_byWechat")
} }
} }
}, { }, {
......
...@@ -145,10 +145,8 @@ class VerificationCodePresenterImpl(view: IVerificationCodeContract.View) : Base ...@@ -145,10 +145,8 @@ class VerificationCodePresenterImpl(view: IVerificationCodeContract.View) : Base
if (it.data.firstLogin == 1) {//第一次登录:是注册 if (it.data.firstLogin == 1) {//第一次登录:是注册
mView.baiduActionBury() mView.baiduActionBury()
UMEventUtils.loginSuccess("VerificationCodeActivity|Reg_succ")
} else { } else {
ActionCountUtils.countUid(UserBIConstants.ACTION_TYPE_CODE_LOGIN,it.data.uid!!) ActionCountUtils.countUid(UserBIConstants.ACTION_TYPE_CODE_LOGIN,it.data.uid!!)
UMEventUtils.loginSuccess("VerificationCodeActivity|Login_succ")
} }
mView.closeActivity() mView.closeActivity()
} else { } else {
......
...@@ -90,7 +90,6 @@ public class PhoneCode extends RelativeLayout { ...@@ -90,7 +90,6 @@ public class PhoneCode extends RelativeLayout {
codes.add(editable.toString()); codes.add(editable.toString());
showCode(); showCode();
} }
UMEventUtils.umJavaEvent(PhoneCode.this.getClass().getSimpleName() + "|input_code");
if (codes.size() == 4 && onMsgCodeInputCompleteListener != null) { if (codes.size() == 4 && onMsgCodeInputCompleteListener != null) {
onMsgCodeInputCompleteListener.onMsgCodeInputComplete(); onMsgCodeInputCompleteListener.onMsgCodeInputComplete();
......
include ':app',":router", ':ydl-net', ':ydl-utils', ':ydl-platform', ':ydl-webview', ':ydl-media',":m-user", ':m-consultant', ':m-muse' include ':app',":router", ':ydl-net', ':ydl-utils', ':ydl-platform', ':ydl-webview', ':ydl-media',":m-user", ':m-consultant', ':m-muse', ':m-fm'
\ No newline at end of file \ No newline at end of file
...@@ -23,7 +23,7 @@ import kotlin.collections.ArrayList ...@@ -23,7 +23,7 @@ import kotlin.collections.ArrayList
/** /**
* Created by haorui on 2019-10-27 . * Created by haorui on 2019-10-27 .
* Des: * Des:
*/ */
class AudioPlayer private constructor() { class AudioPlayer private constructor() {
...@@ -45,10 +45,10 @@ class AudioPlayer private constructor() { ...@@ -45,10 +45,10 @@ class AudioPlayer private constructor() {
var percent = (current * 100 / du).toInt() var percent = (current * 100 / du).toInt()
//保存进度 //保存进度
if (autoSaveProgress) { if (autoSaveProgress) {
PlayProgressUtil.saveProgress(context, playMusic!!.path,( if (percent == 99 || percent == 100) 0 else current.toInt())) PlayProgressUtil.saveProgress(context, playMusic!!.path, (if (percent == 99 || percent == 100) 0 else current.toInt()))
} }
for (listener in listeners) { for (listener in listeners) {
listener.onPublish(percent,current.toLong()) listener.onPublish(percent, current.toLong())
} }
} }
handler!!.postDelayed(this, TIME_UPDATE) handler!!.postDelayed(this, TIME_UPDATE)
...@@ -122,7 +122,7 @@ class AudioPlayer private constructor() { ...@@ -122,7 +122,7 @@ class AudioPlayer private constructor() {
} else { } else {
startPlayer() startPlayer()
} }
}else{ } else {
startPlayer() startPlayer()
} }
} }
...@@ -130,12 +130,12 @@ class AudioPlayer private constructor() { ...@@ -130,12 +130,12 @@ class AudioPlayer private constructor() {
listener.onPrepared(mediaPlayer!!.duration) listener.onPrepared(mediaPlayer!!.duration)
} }
} }
mediaPlayer!!.setOnBufferingUpdateListener{ mp, percent -> mediaPlayer!!.setOnBufferingUpdateListener { mp, percent ->
for (listener in listeners) { for (listener in listeners) {
listener.onBufferingUpdate(percent) listener.onBufferingUpdate(percent)
} }
} }
mediaPlayer!!.setOnCompletionListener{ mediaPlayer!!.setOnCompletionListener {
if (autoSaveProgress) { if (autoSaveProgress) {
PlayProgressUtil.saveProgress(applicationContext, playMusic!!.path, 0) PlayProgressUtil.saveProgress(applicationContext, playMusic!!.path, 0)
} }
...@@ -190,11 +190,11 @@ class AudioPlayer private constructor() { ...@@ -190,11 +190,11 @@ class AudioPlayer private constructor() {
/** /**
* 单曲模式播放音乐 * 单曲模式播放音乐
*/ */
fun singlePlay(music: Music) { fun singlePlay(music: Music, isAutoSaveProgress: Boolean = false) {
musicList.clear() musicList.clear()
musicList.add(music) musicList.add(music)
playMode = PlayModeEnum.SINGLE playMode = PlayModeEnum.SINGLE
autoSaveProgress = false autoSaveProgress = isAutoSaveProgress
play(0) play(0)
} }
...@@ -255,7 +255,7 @@ class AudioPlayer private constructor() { ...@@ -255,7 +255,7 @@ class AudioPlayer private constructor() {
for (listener in listeners) { for (listener in listeners) {
listener.onChange(music) listener.onChange(music)
} }
if (playMode != PlayModeEnum.SINGLE){ if (playMode != PlayModeEnum.SINGLE) {
NotifyManager.get().showPlay(music) NotifyManager.get().showPlay(music)
MediaSessionManager.get().updateMetaData(music) MediaSessionManager.get().updateMetaData(music)
MediaSessionManager.get().updatePlaybackState() MediaSessionManager.get().updatePlaybackState()
...@@ -313,7 +313,7 @@ class AudioPlayer private constructor() { ...@@ -313,7 +313,7 @@ class AudioPlayer private constructor() {
mediaPlayer!!.start() mediaPlayer!!.start()
state = STATE_PLAYING state = STATE_PLAYING
handler!!.post(mPublishRunnable) handler!!.post(mPublishRunnable)
if (playMode != PlayModeEnum.SINGLE){ if (playMode != PlayModeEnum.SINGLE) {
NotifyManager.get().showPlay(playMusic) NotifyManager.get().showPlay(playMusic)
MediaSessionManager.get().updatePlaybackState() MediaSessionManager.get().updatePlaybackState()
} }
...@@ -400,13 +400,13 @@ class AudioPlayer private constructor() { ...@@ -400,13 +400,13 @@ class AudioPlayer private constructor() {
* @param percent 百分比 * @param percent 百分比
* @param position 时间点 * @param position 时间点
*/ */
fun seekTo(percent: Int = -1 , position:Long = -1) { fun seekTo(percent: Int = -1, position: Long = -1) {
if (isPlaying || isPausing) { if (isPlaying || isPausing) {
var currentPosition = 0L var currentPosition = 0L
var currentPercent = 0 var currentPercent = 0
if (position != (-1).toLong()){ if (position != (-1).toLong()) {
val current = (currentPosition * 1.0).toFloat() val current = (currentPosition * 1.0).toFloat()
val du = mediaPlayer!!.duration.toFloat() val du = mediaPlayer!!.duration.toFloat()
currentPercent = (current * 100 / du).toInt() currentPercent = (current * 100 / du).toInt()
...@@ -422,7 +422,7 @@ class AudioPlayer private constructor() { ...@@ -422,7 +422,7 @@ class AudioPlayer private constructor() {
PlayProgressUtil.saveProgress(context, musicList[playPosition].coverPath, currentPosition.toInt()) PlayProgressUtil.saveProgress(context, musicList[playPosition].coverPath, currentPosition.toInt())
} }
for (listener in listeners) { for (listener in listeners) {
listener.onPublish(currentPercent,currentPosition) listener.onPublish(currentPercent, currentPosition)
} }
} }
} }
...@@ -434,11 +434,10 @@ class AudioPlayer private constructor() { ...@@ -434,11 +434,10 @@ class AudioPlayer private constructor() {
return musicList return musicList
} }
fun getDuration(): Long{ fun getDuration(): Long {
return if (isPlaying) mediaPlayer!!.duration else 0 return mediaPlayer?.duration ?: 0
} }
companion object { companion object {
private val STATE_IDLE = 0 private val STATE_IDLE = 0
private val STATE_PREPARING = 1 private val STATE_PREPARING = 1
......
...@@ -31,6 +31,13 @@ class PlayerFloatHelper { ...@@ -31,6 +31,13 @@ class PlayerFloatHelper {
var playingType = PlayTypeEnum.PLAY_TYPE_NONE var playingType = PlayTypeEnum.PLAY_TYPE_NONE
var playTempData = hashMapOf<String,String>() var playTempData = hashMapOf<String,String>()
/**
* FM:
* fmId
* fmTitle
* fmAuthor
* fmImageUrl
*/
/** /**
* 如果有音频正在播放则显示 * 如果有音频正在播放则显示
...@@ -194,6 +201,15 @@ class PlayerFloatHelper { ...@@ -194,6 +201,15 @@ class PlayerFloatHelper {
.navigation() .navigation()
} }
/**
* 获取FM播放Id
*/
fun getFmId(): Int {
return playTempData["fmId"]?.toInt()?:0
}
} }
......
...@@ -128,7 +128,7 @@ class PlayerFloatView(var mContext: Context) : FrameLayout(mContext) { ...@@ -128,7 +128,7 @@ class PlayerFloatView(var mContext: Context) : FrameLayout(mContext) {
true true
} }
titleView!!.setOnTouchListener { v, event -> titleView!!.setOnTouchListener { _, event ->
mCurrX = event.rawX mCurrX = event.rawX
mCurrY = event.rawY - 25 mCurrY = event.rawY - 25
when (event.action) { when (event.action) {
...@@ -192,7 +192,7 @@ class PlayerFloatView(var mContext: Context) : FrameLayout(mContext) { ...@@ -192,7 +192,7 @@ class PlayerFloatView(var mContext: Context) : FrameLayout(mContext) {
true true
} }
playClose!!.setOnTouchListener { v, event -> playClose!!.setOnTouchListener { _, event ->
mCurrX = event.rawX mCurrX = event.rawX
mCurrY = event.rawY - 25 mCurrY = event.rawY - 25
when (event.action) { when (event.action) {
......
...@@ -45,31 +45,9 @@ class SafeTipView : LinearLayout { ...@@ -45,31 +45,9 @@ class SafeTipView : LinearLayout {
.onEnd { visibility = View.GONE } .onEnd { visibility = View.GONE }
.playOn(this@SafeTipView) .playOn(this@SafeTipView)
WebModularServiceUtils.getUserRouter().setTrendsSafeTip(true) WebModularServiceUtils.getUserRouter().setTrendsSafeTip(true)
when (location) {
"msgList" -> {
UMEventUtils.msgListPrivacyClose(context)
}
"askList" -> {
UMEventUtils.askListPrivacyClose(context)
}
"orderList" -> {
UMEventUtils.orderListPrivacyClose(context)
}
}
} }
tvTip.setOnClickListener { tvTip.setOnClickListener {
WebModularServiceUtils.getUserRouter().privacyIntent(context as Activity) WebModularServiceUtils.getUserRouter().privacyIntent(context as Activity)
when (location) {
"msgList" -> {
UMEventUtils.msgListPrivacyAlert(context)
}
"askList" -> {
UMEventUtils.askListPrivacyAlert(context)
}
"orderList" -> {
UMEventUtils.orderListPrivacyAlert(context)
}
}
} }
} }
......
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