Commit c2a4f935 by konghaorui

Merge branch 'dev' of ssh://gitlab.yidianling.com:2224/app_android_lib/YDL-Component into dev

# Conflicts:
#	app/build.gradle
#	app/src/main/java/com/ydl/component/MainActivity.kt
#	删除测评、课程模块友盟埋点代码
parents 5b259dd7 1fdac5a6
...@@ -167,10 +167,10 @@ dependencies { ...@@ -167,10 +167,10 @@ 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-fm')
api project(':m-tests') api project(':m-tests')
api project(':m-muse') api project(':m-consultant')
api (project(':ydl-platform')){ api (project(':ydl-platform')){
transitive = true transitive = true
} }
...@@ -181,7 +181,7 @@ dependencies { ...@@ -181,7 +181,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,7 +191,6 @@ dependencies { ...@@ -191,7 +191,6 @@ dependencies {
implementation rootProject.ext.dependencies["retrofit-url-manager"] implementation rootProject.ext.dependencies["retrofit-url-manager"]
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',
......
...@@ -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 com.yidianling.tests.home.TestHomeActivity import com.yidianling.tests.home.TestHomeActivity
import kotlinx.android.synthetic.main.activity_main.* import kotlinx.android.synthetic.main.activity_main.*
...@@ -65,15 +64,15 @@ class MainActivity : BaseLceActivity<DemoContract.View, DemoContract.Presenter>( ...@@ -65,15 +64,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))
} }
...@@ -101,6 +100,10 @@ class MainActivity : BaseLceActivity<DemoContract.View, DemoContract.Presenter>( ...@@ -101,6 +100,10 @@ class MainActivity : BaseLceActivity<DemoContract.View, DemoContract.Presenter>(
" }]\n" + " }]\n" +
" }")) " }"))
} }
bt_to_fm.setOnClickListener {
YDLRouterManager.router(IYDLRouterConstant.ROUTER_FM_LIST)
}
} }
......
...@@ -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
android:layout_width="match_parent" android:layout_width="match_parent"
......
...@@ -371,9 +371,6 @@ public class CourseListFragment extends BaseLazyFragment implements PtrHandler, ...@@ -371,9 +371,6 @@ public class CourseListFragment extends BaseLazyFragment implements PtrHandler,
h5Params.setShareData(shareData); h5Params.setShareData(shareData);
} }
UMEventUtils.umEvent("列表页分类点击", "分类id", course.id + "");
UMEventUtils.umEvent("列表页分类点击", "分类名称", course.title);
NewH5Activity.start(getActivity(), h5Params); NewH5Activity.start(getActivity(), h5Params);
BuryPointUtils.getInstance().createMap() BuryPointUtils.getInstance().createMap()
.put("curriculum_name", course.title == null ? "" : course.title) .put("curriculum_name", course.title == null ? "" : course.title)
......
...@@ -335,8 +335,7 @@ public class MyCourseListFragment extends BaseLazyFragment implements PtrHandler ...@@ -335,8 +335,7 @@ public class MyCourseListFragment extends BaseLazyFragment implements PtrHandler
h5Params.setShareData(shareData); h5Params.setShareData(shareData);
} }
UMEventUtils.umEvent("列表页分类点击", "分类id", course.id + "");
UMEventUtils.umEvent("列表页分类点击", "分类名称", course.title);
NewH5Activity.start(getActivity(), h5Params); NewH5Activity.start(getActivity(), h5Params);
BuryPointUtils.getInstance().createMap() BuryPointUtils.getInstance().createMap()
......
...@@ -101,8 +101,6 @@ public class CourseHeadPagerAdapter extends PagerAdapter { ...@@ -101,8 +101,6 @@ public class CourseHeadPagerAdapter extends PagerAdapter {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
UMEventUtils.umEvent("banner点击", "banner链接", banners.get(position).linkUrl);
ActionCountUtils.Companion.count(BIConstants.CourseHomeEvent.POSITION_COURSE_HOME_BANNER_CLICK, position + ""); ActionCountUtils.Companion.count(BIConstants.CourseHomeEvent.POSITION_COURSE_HOME_BANNER_CLICK, position + "");
LinkUrlRouterProtocol.jump(container.getContext(), banners.get(position).linkUrl); LinkUrlRouterProtocol.jump(container.getContext(), banners.get(position).linkUrl);
......
...@@ -67,7 +67,6 @@ class CourseTopicActivity : BaseActivity(), View.OnClickListener, SwipeRefreshLa ...@@ -67,7 +67,6 @@ class CourseTopicActivity : BaseActivity(), View.OnClickListener, SwipeRefreshLa
swl.setColorSchemeResources(R.color.google_green) swl.setColorSchemeResources(R.color.google_green)
swl.setOnRefreshListener(this) swl.setOnRefreshListener(this)
tv_left_menu.setOnClickListener { tv_left_menu.setOnClickListener {
UMEventUtils.umEvent("专题详情", "分享", "分享")
//分享 //分享
share() share()
......
...@@ -77,9 +77,6 @@ class CourseTopicAdapter(val context: Context, var mDatas: List<Course>) : Recyc ...@@ -77,9 +77,6 @@ class CourseTopicAdapter(val context: Context, var mDatas: List<Course>) : Recyc
(holder.getItemView() as CourseItemNewView).setBottomLineGone() (holder.getItemView() as CourseItemNewView).setBottomLineGone()
} }
holder.itemView.setOnClickListener { view -> holder.itemView.setOnClickListener { view ->
UMEventUtils.umEvent("列表点击", "专题id", course.id.toString())
UMEventUtils.umEvent("列表点击", "专题名称", course.title)
NewH5Activity.start(context, H5Params(CourseConstants.COURSE_DETAIL_H5 + course.id, null)) NewH5Activity.start(context, H5Params(CourseConstants.COURSE_DETAIL_H5 + course.id, null))
} }
} }
......
...@@ -161,8 +161,6 @@ class CourseListContainerActivity : BaseActivity(), PtrHandler, LoadMoreHandler ...@@ -161,8 +161,6 @@ class CourseListContainerActivity : BaseActivity(), PtrHandler, LoadMoreHandler
h5Params.shareData = shareData h5Params.shareData = shareData
} }
UMEventUtils.umEvent("列表页分类点击", "分类id", course.id.toString() + "")
UMEventUtils.umEvent("列表页分类点击", "分类名称", course.title)
NewH5Activity.start(this@CourseListContainerActivity, h5Params) NewH5Activity.start(this@CourseListContainerActivity, h5Params)
} }
......
...@@ -114,7 +114,6 @@ class CourseHomeFragment : BaseFragment(), ICourseHomeView, SwipeRefreshLayout.O ...@@ -114,7 +114,6 @@ class CourseHomeFragment : BaseFragment(), ICourseHomeView, SwipeRefreshLayout.O
tv_left_menu.setOnClickListener { tv_left_menu.setOnClickListener {
ActionCountUtils.count(BIConstants.CourseHomeEvent.POSITION_COURSE_HOME_MY_COUSE_CLICK) ActionCountUtils.count(BIConstants.CourseHomeEvent.POSITION_COURSE_HOME_MY_COUSE_CLICK)
UMEventUtils.umEvent("我的课程点击", "我的课程", "我的课程")
if (CourseIn.isLogin()) { if (CourseIn.isLogin()) {
MyCourseActivity.start(activity) MyCourseActivity.start(activity)
......
...@@ -134,9 +134,7 @@ public class MyCourseActivity extends BaseActivity { ...@@ -134,9 +134,7 @@ public class MyCourseActivity extends BaseActivity {
@Override @Override
public Fragment getItem(int position) { public Fragment getItem(int position) {
if (position == 0) { if (position == 0) {
UMEventUtils.umEvent("我的课程", "收藏", "收藏");
} else { } else {
UMEventUtils.umEvent("我的课程", "已购", "已购");
} }
return mFragments[position]; return mFragments[position];
......
...@@ -95,9 +95,6 @@ public class CategorySection extends Section { ...@@ -95,9 +95,6 @@ public class CategorySection extends Section {
ciView.setImage(category.image); ciView.setImage(category.image);
ciView.setOnClickListener(view -> { ciView.setOnClickListener(view -> {
UMEventUtils.umEvent("课程分类点击", "分类id", category.linkUrl);
UMEventUtils.umEvent("课程分类点击", "分类名称", category.title);
ActionCountUtils.Companion.count(BIConstants.CourseHomeEvent.POSITION_COURSE_HOME_CLASSIFICATION_CLICK, category.title); ActionCountUtils.Companion.count(BIConstants.CourseHomeEvent.POSITION_COURSE_HOME_CLASSIFICATION_CLICK, category.title);
if (!TextUtils.isEmpty(category.linkUrl)) { if (!TextUtils.isEmpty(category.linkUrl)) {
LinkUrlRouterProtocol.jump(itemView.getContext(), category.linkUrl); LinkUrlRouterProtocol.jump(itemView.getContext(), category.linkUrl);
......
...@@ -45,7 +45,6 @@ public class ClassifiedCourseSection extends Section { ...@@ -45,7 +45,6 @@ public class ClassifiedCourseSection extends Section {
if (holder instanceof FooterMoreViewHolder) { if (holder instanceof FooterMoreViewHolder) {
((FooterMoreViewHolder) holder).titleView.setText(data.footer.title); ((FooterMoreViewHolder) holder).titleView.setText(data.footer.title);
((FooterMoreViewHolder) holder).linearLayout.setOnClickListener(view -> { ((FooterMoreViewHolder) holder).linearLayout.setOnClickListener(view -> {
UMEventUtils.umEvent(data.head.title, "更多课程", "更多课程");
LinkUrlRouterProtocol.jump(context, data.footer.linkUrl); LinkUrlRouterProtocol.jump(context, data.footer.linkUrl);
if (!TextUtils.isEmpty(data.head.title)) { if (!TextUtils.isEmpty(data.head.title)) {
...@@ -71,7 +70,6 @@ public class ClassifiedCourseSection extends Section { ...@@ -71,7 +70,6 @@ public class ClassifiedCourseSection extends Section {
realHolder.courseItemNewView.setData(courseBean); realHolder.courseItemNewView.setData(courseBean);
holder.itemView.setOnClickListener(view -> { holder.itemView.setOnClickListener(view -> {
UMEventUtils.umEvent(data.head.title, data.head.title + "链接", course.linkUrl);
LinkUrlRouterProtocol.jump(context, courseBean.linkUrl); LinkUrlRouterProtocol.jump(context, courseBean.linkUrl);
......
...@@ -61,7 +61,6 @@ public class QulityCourseSection extends Section { ...@@ -61,7 +61,6 @@ public class QulityCourseSection extends Section {
if (holder instanceof FooterMoreViewHolder) { if (holder instanceof FooterMoreViewHolder) {
((FooterMoreViewHolder) holder).titleView.setText(data.footer.title); ((FooterMoreViewHolder) holder).titleView.setText(data.footer.title);
((FooterMoreViewHolder) holder).linearLayout.setOnClickListener(v -> { ((FooterMoreViewHolder) holder).linearLayout.setOnClickListener(v -> {
UMEventUtils.umEvent("更多课程", "更多课程", "更多课程");
LinkUrlRouterProtocol.jump(context, data.footer.linkUrl + "?childId=" + (type + 1)); LinkUrlRouterProtocol.jump(context, data.footer.linkUrl + "?childId=" + (type + 1));
...@@ -94,7 +93,6 @@ public class QulityCourseSection extends Section { ...@@ -94,7 +93,6 @@ public class QulityCourseSection extends Section {
realHolder.courseItemNewView.setData(courseBean); realHolder.courseItemNewView.setData(courseBean);
holder.itemView.setOnClickListener(view -> { holder.itemView.setOnClickListener(view -> {
UMEventUtils.umEvent("精品课程", "精品课程链接", courseBean.linkUrl);
LinkUrlRouterProtocol.jump(context, courseBean.linkUrl); LinkUrlRouterProtocol.jump(context, courseBean.linkUrl);
...@@ -216,7 +214,6 @@ public class QulityCourseSection extends Section { ...@@ -216,7 +214,6 @@ public class QulityCourseSection extends Section {
tv_tab2 = itemView.findViewById(R.id.tv_tab2); tv_tab2 = itemView.findViewById(R.id.tv_tab2);
iv_tab2 = itemView.findViewById(R.id.iv_tab2); iv_tab2 = itemView.findViewById(R.id.iv_tab2);
itemView.findViewById(R.id.ll_tab1).setOnClickListener(v -> { itemView.findViewById(R.id.ll_tab1).setOnClickListener(v -> {
UMEventUtils.umEvent("精品课程", "免费课程", "免费课程");
tv_tab1.setTextColor(ContextCompat.getColor(itemView.getContext(), R.color.green_34cd65)); tv_tab1.setTextColor(ContextCompat.getColor(itemView.getContext(), R.color.green_34cd65));
iv_tab1.setVisibility(View.VISIBLE); iv_tab1.setVisibility(View.VISIBLE);
...@@ -225,7 +222,6 @@ public class QulityCourseSection extends Section { ...@@ -225,7 +222,6 @@ public class QulityCourseSection extends Section {
section.setType(FREE); section.setType(FREE);
}); });
itemView.findViewById(R.id.ll_tab2).setOnClickListener(v -> { itemView.findViewById(R.id.ll_tab2).setOnClickListener(v -> {
UMEventUtils.umEvent("精品课程", "付费课程", "付费课程");
tv_tab2.setTextColor(ContextCompat.getColor(itemView.getContext(), R.color.green_34cd65)); tv_tab2.setTextColor(ContextCompat.getColor(itemView.getContext(), R.color.green_34cd65));
iv_tab2.setVisibility(View.VISIBLE); iv_tab2.setVisibility(View.VISIBLE);
......
...@@ -49,7 +49,6 @@ public class TopicsCoursesSection extends Section { ...@@ -49,7 +49,6 @@ public class TopicsCoursesSection extends Section {
((SingleTitleHeaderViewHolder) holder).subTitleView.setVisibility(View.VISIBLE); ((SingleTitleHeaderViewHolder) holder).subTitleView.setVisibility(View.VISIBLE);
((SingleTitleHeaderViewHolder) holder).subTitleView.setText(data.head.subTitle); ((SingleTitleHeaderViewHolder) holder).subTitleView.setText(data.head.subTitle);
((SingleTitleHeaderViewHolder) holder).subTitleView.setOnClickListener(v -> { ((SingleTitleHeaderViewHolder) holder).subTitleView.setOnClickListener(v -> {
UMEventUtils.umEvent("专题课程", "更多点击", "更多点击");
if (null != mContext) { if (null != mContext) {
CourseLinkUrl.Companion.jump(mContext, data.head.subLinkUrl); CourseLinkUrl.Companion.jump(mContext, data.head.subLinkUrl);
} }
...@@ -155,7 +154,6 @@ public class TopicsCoursesSection extends Section { ...@@ -155,7 +154,6 @@ public class TopicsCoursesSection extends Section {
public void onBindViewHolder(BaseViewHolder holder, int position) { public void onBindViewHolder(BaseViewHolder holder, int position) {
holder.setImageWithUrl(R.id.img, data.get(position).image); holder.setImageWithUrl(R.id.img, data.get(position).image);
holder.setOnClickListener(R.id.img, view -> { holder.setOnClickListener(R.id.img, view -> {
UMEventUtils.umEvent("专题课程", "专题链接", data.get(position).linkUrl);
LinkUrlRouterProtocol.jump(mContext, data.get(position).linkUrl); LinkUrlRouterProtocol.jump(mContext, data.get(position).linkUrl);
......
...@@ -125,11 +125,9 @@ class CoursePlayActivity : BaseActivity() { ...@@ -125,11 +125,9 @@ class CoursePlayActivity : BaseActivity() {
fun initView() { fun initView() {
iv_back.setOnClickListener { iv_back.setOnClickListener {
UMEventUtils.umEvent("返回点击", "返回", "返回")
onBackPressed() onBackPressed()
} }
iv_share.setOnClickListener { iv_share.setOnClickListener {
UMEventUtils.umEvent("分享点击", "分享", "分享")
//分享 //分享
share(courPlayBean?.courseExtra?.shareData) share(courPlayBean?.courseExtra?.shareData)
} }
......
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.animation.ValueAnimator;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Intent;
import android.graphics.Color;
import android.os.Build;
import android.os.Bundle;
import android.support.v7.widget.CardView;
import android.text.TextUtils;
import android.view.KeyEvent;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.view.animation.AccelerateDecelerateInterpolator;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.SeekBar;
import android.widget.TextView;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.ydl.media.audio.AudioPlayer;
import com.ydl.media.audio.OnPlayerEventListener;
import com.ydl.media.audio.model.Music;
import com.ydl.media.audio.utils.PlayProgressUtil;
import com.ydl.media.view.PlayerFloatHelper;
import com.ydl.ydl_image.module.GlideApp;
import com.ydl.ydl_image.transform.GlideCircleRingTransform;
import com.ydl.ydlcommon.base.BaseActivity;
import com.ydl.ydlcommon.data.http.RxUtils;
import com.ydl.ydlcommon.data.http.ThrowableConsumer;
import com.ydl.ydlcommon.router.YdlCommonOut;
import com.ydl.ydlcommon.utils.UMEventUtils;
import com.ydl.ydlcommon.utils.remind.ToastHelper;
import com.ydl.ydlcommon.view.TitleBar;
import com.ydl.ydlcommon.view.dialog.YDLShareDialog;
import com.yidianling.common.tools.LogUtil;
import com.yidianling.common.tools.RxDeviceTool;
import com.yidianling.common.tools.RxImageTool;
import com.yidianling.fm.param.DetailParam;
import com.yidianling.fm.param.FavParam;
import com.yidianling.fm.response.FMDetail;
import com.yidianling.fm.router.FMIn;
import com.yidianling.fm.widget.FMSurfaceView;
import org.jetbrains.annotations.NotNull;
import org.json.JSONException;
import org.json.JSONObject;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import io.reactivex.android.schedulers.AndroidSchedulers;
/**
* 电台详情
* Created by softrice on 15/12/11.
*/
@Route(path = "/fm/detail")
public class FMDetailActivity extends BaseActivity implements View.OnClickListener, OnPlayerEventListener {
int id;
boolean isSplash;
TitleBar tb_title;
ImageView iv_play;
TextView tv_fm_title;
TextView tv_anchor;
TextView tv_like;
TextView tv_listen;
ImageView iv_love;
ImageView iv_next;
ImageView iv_last;
ImageView iv_share;
LinearLayout ll_bottom;
TextView tv_currentTime;
TextView tv_allTime;
SeekBar fm_progress;
FMSurfaceView fmSurfaceView;
LinearLayout ll_last_time;
ImageView fm_img;
ImageView refresh_icon;
CardView fm_card;
ImageView tv_like_icon;
ImageView tv_listen_icon;
private ValueAnimator anim;
private ArrayList<Integer> fmIdList = new ArrayList();
private FMDetail fmDetail;
private SimpleDateFormat formatter = new SimpleDateFormat("mm:ss");
private Date currentTime = new Date();
private boolean canNext = true;
private int time;
private int allTime;
private int max_progress = 1000;
// private MyPlayer player;
private static final String ID = "id";
private static final String IS_SPLASH = "isSplash";
//是否跳转到心事动态
private boolean isToTrend = false;
public static Intent newIntent(Activity activity, int id) {
Intent intent = new Intent(activity, FMDetailActivity.class);
Bundle bundle = new Bundle();
bundle.putInt(ID, id);
intent.putExtra("bundle", bundle);
return intent;
}
public static Intent newIntent(Activity activity, int id, boolean isSplash) {
Intent intent = new Intent(activity, FMDetailActivity.class);
Bundle bundle = new Bundle();
bundle.putInt(ID, id);
bundle.putBoolean(IS_SPLASH, isSplash);
intent.putExtra("bundle", bundle);
return intent;
}
@Override
protected void onNewIntent(Intent intent) {
if (null == intent) {
finish();
return;
}
Bundle bundle = intent.getBundleExtra("bundle");
if (null != bundle) {
id = bundle.getInt(ID, 0);
isSplash = bundle.getBoolean("isSplash", false);
}
//路由跳转 取值
if (intent.hasExtra("routerParam")) {
String json = intent.getStringExtra("routerParam");
if (!TextUtils.isEmpty(json)) {
try {
JSONObject jsonObject = new JSONObject(json);
id = jsonObject.getInt("id");
} catch (JSONException e) {
e.printStackTrace();
}
}
}
//重置当前为第一首
fmIdList.clear();
getFMDetail(id, true);
}
@Override
protected int layoutResId() {
return R.layout.activity_fm_detail;
}
/**
* 路由跳转 取值
*/
private void getParam() {
if (getIntent().hasExtra("routerParam")) {
String json = getIntent().getStringExtra("routerParam");
if (!TextUtils.isEmpty(json)) {
try {
JSONObject jsonObject = new JSONObject(json);
id = jsonObject.getInt("id");
} catch (JSONException e) {
e.printStackTrace();
}
}
}
}
@Override
protected void initDataAndEvent() {
fmIdList.clear();
// todo 打开
// EventBus.getDefault().register(this);
if (null == getIntent()) {
finish();
return;
}
Bundle bundle = getIntent().getBundleExtra("bundle");
if (null != bundle) {
id = bundle.getInt(ID, 0);
isSplash = bundle.getBoolean("isSplash", false);
}
//路由跳转 取值
getParam();
tb_title = findViewById(R.id.tb_title);
iv_play = findViewById(R.id.iv_play);
tv_fm_title = findViewById(R.id.tv_fm_title);
tv_anchor = findViewById(R.id.tv_anchor);
tv_like = findViewById(R.id.tv_like);
tv_listen = findViewById(R.id.tv_listen);
iv_love = findViewById(R.id.iv_love);
iv_next = findViewById(R.id.iv_next);
iv_last = findViewById(R.id.iv_last);
iv_share = findViewById(R.id.iv_share);
ll_bottom = findViewById(R.id.ll_bottom);
tv_currentTime = findViewById(R.id.tv_currentTime);
tv_allTime = findViewById(R.id.tv_allTime);
fm_progress = findViewById(R.id.fm_progress);
fmSurfaceView = findViewById(R.id.fmSurfaceView);
ll_last_time = findViewById(R.id.ll_last_time);
fm_img = findViewById(R.id.fm_img);
tv_like_icon = findViewById(R.id.tv_like_icon);
tv_listen_icon = findViewById(R.id.tv_listen_icon);
refresh_icon = findViewById(R.id.refresh_icon);
fm_card = findViewById(R.id.fm_card);
iv_play.setOnClickListener(this);
iv_love.setOnClickListener(this);
iv_next.setOnClickListener(this);
iv_last.setOnClickListener(this);
iv_share.setOnClickListener(this);
initRefreshAnimate();
init();
initSurfaceView();
initImg();
}
@SuppressLint("WrongConstant")
private void initRefreshAnimate() {
anim = ValueAnimator.ofFloat(1f, 1.5f, 1f);
anim.setDuration(1000);
anim.setStartDelay(1000);
anim.setRepeatCount(ValueAnimator.INFINITE);
anim.setRepeatMode(ValueAnimator.INFINITE);
anim.setInterpolator(new AccelerateDecelerateInterpolator());
int refreshIconWidth = RxImageTool.dp2px(25f);
anim.addUpdateListener(animation -> {
refresh_icon.setVisibility(View.VISIBLE);
float currentValue = (float) animation.getAnimatedValue();
RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams((int) (refreshIconWidth * currentValue), (int) (refreshIconWidth * currentValue));
params.addRule(RelativeLayout.CENTER_IN_PARENT);
refresh_icon.setLayoutParams(params);
});
}
private void initSurfaceView() {
int width = RxDeviceTool.getScreenWidth(this);
RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(width, width);
fmSurfaceView.setLayoutParams(params);
}
private void initImg() {
int screenWidth = RxDeviceTool.getScreenWidth(this);
RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(screenWidth, screenWidth);
ll_last_time.setLayoutParams(params);
int width = screenWidth * 140 / 375;
LinearLayout.LayoutParams cardParams = new LinearLayout.LayoutParams(width, width);
fm_card.setRadius(width / 2);
fm_card.setLayoutParams(cardParams);
FrameLayout.LayoutParams imgParams = new FrameLayout.LayoutParams(width, width);
fm_img.setLayoutParams(imgParams);
}
int changeProgress = 0;
void init() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
Window window = getWindow();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
window.setStatusBarColor(Color.TRANSPARENT);
window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
window.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
} else {
window.addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
}
}
fm_progress.setMax(max_progress);
tb_title.setDivideVisible(View.GONE);
tb_title.setLeftListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Back();
}
});
tb_title.setOnRightTextClick(new TitleBar.OnTitleBarTextClick() {
@Override
public void onClick(View view, boolean isActive) {
startActivity(new Intent(FMDetailActivity.this, FMActivity.class));
}
});
LogUtil.d("id " + id);
if (PlayerFloatHelper.Companion.getFmId() == id) {
refresh_icon.setVisibility(View.GONE);
anim.cancel();
if (AudioPlayer.Companion.get().isPlaying()) {
iv_play.setImageResource(R.drawable.fm_stop_2);
} else {
iv_play.setImageResource(R.drawable.fm_play_2);
}
LogUtil.d("id equal " + id);
}
getFMDetail(id, true);
fm_progress.setProgress(0);
fm_progress.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
allTime = Integer.parseInt(String.valueOf(AudioPlayer.Companion.get().getDuration()));
int current = seekBar.getProgress() * allTime / 1000;
tv_allTime.setText(formatter.format(allTime));
tv_currentTime.setText(formatter.format(current));
changeProgress = progress;
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
iv_play.setImageResource(R.drawable.fm_play_2);
AudioPlayer.Companion.get().pausePlayer();
}
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
allTime = Integer.parseInt(String.valueOf(AudioPlayer.Companion.get().getDuration()));
int current = seekBar.getProgress() * allTime / 1000;
tv_allTime.setText(formatter.format(allTime));
tv_currentTime.setText(formatter.format(current));
AudioPlayer.Companion.get().seekTo(-1, current);
}
});
// player.getMediaPlayer().setOnSeekCompleteListener(mp -> iv_play.setImageResource(R.drawable.fm_stop));
}
/**
* @param id
* @param type 为true则为下一首,否则为上一首
*/
private void getFMDetail(int id, boolean type) {
canNext = false;
if (PlayerFloatHelper.Companion.getFmId() != id) {
anim.start();
iv_play.setImageResource(R.drawable.fm_stop_2);
fmSurfaceView.stopTimer();
fm_progress.setEnabled(false);
if (type) {
fmIdList.add(id);
} else {
fmIdList.remove(fmIdList.size() - 1);
}
}
FmDataManager.INSTANCE.getHttp().fmDetail(new DetailParam(id))
.compose(RxUtils.resultData())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(fmDetail -> {
this.fmDetail = fmDetail;
this.id = fmDetail.getId();
setData();
}, new ThrowableConsumer() {
@Override
public void accept(@NotNull String msg) {
ToastHelper.Companion.show(msg);
}
});
}
void setData() {
if (!TextUtils.isEmpty(fmDetail.getImage_url())) {
GlideApp.with(this)
.load(fmDetail.getImage_url())
.placeholder(fm_img.getDrawable())
.transform(new GlideCircleRingTransform(this))
.into(fm_img);
}
if (!TextUtils.isEmpty(fmDetail.getAuthor())) {
tv_anchor.setText("主播:" + fmDetail.getAuthor());
tv_anchor.setVisibility(View.VISIBLE);
}
if (!TextUtils.isEmpty(fmDetail.getTitle())) {
tv_fm_title.setText(fmDetail.getTitle());
tv_fm_title.setVisibility(View.VISIBLE);
}
if (!TextUtils.isEmpty(fmDetail.getCount_favorite())) {
tv_like.setText("" + fmDetail.getCount_favorite());
tv_like_icon.setVisibility(View.VISIBLE);
tv_like.setVisibility(View.VISIBLE);
}
if (!TextUtils.isEmpty(String.valueOf(fmDetail.getHits()))) {
tv_listen.setText("" + fmDetail.getHits());
tv_listen_icon.setVisibility(View.VISIBLE);
tv_listen.setVisibility(View.VISIBLE);
}
if (fmDetail.is_favorite() == 1) {//love
iv_love.setImageResource(R.drawable.fm_love_h_2);
} else {
iv_love.setImageResource(R.drawable.fm_love_n_2);
}
canNext = true;
LogUtil.d("fmDetail.id " + fmDetail.getId());
if (PlayerFloatHelper.Companion.getFmId() != fmDetail.getId()) {
if (!TextUtils.isEmpty(fmDetail.getFm_url())) {
Music music = new Music();
music.setPath(fmDetail.getFm_url());
music.setAlbum("");
music.setArtist("");
music.setCoverPath("");
music.setTitle("");
AudioPlayer.Companion.get().prev();
AudioPlayer.Companion.get().singlePlay(music, false);
}
LogUtil.d("fmDetail.id not equal " + fmDetail.getId());
HashMap<String,String> map = new HashMap();
map.put("fmId", String.valueOf(fmDetail.getId()));
map.put("fmTitle", String.valueOf(fmDetail.getTitle()));
map.put("fmAuthor", String.valueOf(fmDetail.getAuthor()));
map.put("fmImageUrl", String.valueOf(fmDetail.getImage_url()));
PlayerFloatHelper.Companion.setPlayTempData(map);
iv_play.setImageResource(R.drawable.fm_stop_2);
fm_progress.setProgress(0);
}else {
this.time = Integer.parseInt(String.valueOf(AudioPlayer.Companion.get().getAudioPosition()));
//PlayProgressUtil.INSTANCE.getProgress(this, fmDetail.getFm_url());
updateThread();
}
AudioPlayer.Companion.get().addOnPlayEventListener(this);
}
//todo xujian 通知栏改变状态修改应用内播放状态图标
// public void onEventMainThread(UpdatePlayStatusEvent status) {
// if (PlayerFloatHelper.Companion.isFmPlaying()) {
// iv_play.setImageResource(R.drawable.fm_stop_2);
// } else {
// iv_play.setImageResource(R.drawable.fm_play_2);
// }
// }
//todo xujian
// public void onEvent(UserLoginEvent event) {
// if (isToTrend) {
// isToTrend = false;
// toTrend();
// }
// }
@Override
public void onClick(View v) {
int i = v.getId();
if (i == R.id.iv_play) {
if (AudioPlayer.Companion.get().isPlaying()) {
AudioPlayer.Companion.get().pausePlayer();
iv_play.setImageResource(R.drawable.fm_play_2);
fmSurfaceView.stopTimer();
} else {
AudioPlayer.Companion.get().startPlayer();
iv_play.setImageResource(R.drawable.fm_stop_2);
fmSurfaceView.playTimer();
}
} else if (i == R.id.iv_love) {
if (!FMIn.INSTANCE.isLogin()) {
startActivity(FMIn.INSTANCE.loginWayIntent(this));
return;
}
collect();
} else if (i == R.id.iv_next) {// 锁
if (canNext)
getFMDetail(fmDetail.getNext_id(), true);
} else if (i == R.id.iv_last) {
//这里调用canNext同样的状态控制,以及判定是否还有上一首,如果id数组大小为1,则当前已经是第一首了
if (canNext && fmIdList.size() >= 2) {
getFMDetail(fmIdList.get(fmIdList.size() - 2), false);
} else if (fmIdList.size() <= 1) {
ToastHelper.Companion.show("前面没有了哦");
}
} else if (i == R.id.iv_share) {
share();
}
}
private void share() {
if (fmDetail == null)
return;
YDLShareDialog dialog = YDLShareDialog.Companion.style1(this, fmDetail.getTitle(), fmDetail.getShare_url(), null, fmDetail.getImage_url());
dialog.setCallBack(type -> {
if (1 == type) {
if (!FMIn.INSTANCE.isLogin()) {
isToTrend = true;
startActivity(FMIn.INSTANCE.loginWayIntent(this));
} else {
//分享到心事动态
toTrend();
}
}
});
dialog.show(getFragmentManager(), "lose");
}
private void toTrend() {
//分享到心事动态
Intent fmIntent = FMIn.INSTANCE.publisFmToTrend(FMDetailActivity.this, fmDetail.getShare_url(), fmDetail.getImage_url(), fmDetail.getTitle());
if (null != fmIntent) {
FMDetailActivity.this.startActivity(fmIntent);
}
}
private void collect() {
FmDataManager.INSTANCE.getHttp().favFM(new FavParam(id))
.compose(RxUtils.resultData())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(favFM -> {
if (favFM.getStatus() == 1) {
iv_love.setImageResource(R.drawable.fm_love_h_2);
} else {
iv_love.setImageResource(R.drawable.fm_love_n_2);
}
}, new ThrowableConsumer() {
@Override
public void accept(@NotNull String msg) {
ToastHelper.Companion.show(msg);
}
});
}
private void updateAnimateStatus() {
//如果FM是在播放状态,那么就进行动画
if (AudioPlayer.Companion.get().isPlaying()) {
fmSurfaceView.playTimer();
} else {
fmSurfaceView.stopTimer();
}
}
public void updateThread() {
runOnUiThread(() -> {
allTime = Integer.parseInt(String.valueOf(AudioPlayer.Companion.get().getDuration()));
currentTime.setTime(time - 8 * 60 * 60 * 1000);
int percent = (int) (1000.0 * time / allTime);
fm_progress.setProgress(percent);
tv_currentTime.setText(formatter.format(currentTime));
tv_allTime.setText(formatter.format(allTime));
});
}
@Override
protected void onResume() {
super.onResume();
fmSurfaceView.surfaceCreated(null);
if (PlayerFloatHelper.Companion.isShow(this)) {
PlayerFloatHelper.Companion.removeView(this);
}
}
@Override
protected void onPause() {
super.onPause();
}
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK) {
Back();
return true;
}
return super.onKeyDown(keyCode, event);
}
private void Back() {
if (isSplash) {
// FMOut.INSTANCE.startMain(this);
startActivity(FMIn.INSTANCE.mainIntent(this));
finish();
} else {
finish();
}
}
@Override
protected void onDestroy() {
super.onDestroy();
anim.cancel();
// todo 打开
// EventBus.getDefault().unregister(this);
AudioPlayer.Companion.get().removeOnPlayEventListener(this);
}
@Override
public void onChange(@NotNull Music music) {
}
@Override
public void onPlayerStart() {
}
@Override
public void onPlayerPause() {
}
@Override
public void onPublish(int percent, long currentPosition) {
this.time = Integer.parseInt(String.valueOf(currentPosition));
updateThread();
updateAnimateStatus();
}
@Override
public void onBufferingUpdate(int percent) {
}
@Override
public void onPrepared(long duration) {
this.allTime = Integer.parseInt(String.valueOf(duration));
iv_play.setVisibility(View.VISIBLE);
refresh_icon.setVisibility(View.GONE);
anim.cancel();
fm_progress.setEnabled(true);
iv_play.setImageResource(R.drawable.fm_stop_2);
fmSurfaceView.playTimer();
}
@Override
public void onComplete() {
fm_progress.setProgress(max_progress);
updateAnimateStatus();
getFMDetail(fmDetail.getNext_id(), true);
}
}
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 android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.TextView;
import com.ydl.ydlcommon.base.BaseFragment;
import com.ydl.ydlcommon.data.http.RxUtils;
import com.ydl.ydlcommon.data.http.ThrowableConsumer;
import com.ydl.ydlcommon.ui.LogoLoadingView;
import com.ydl.ydlcommon.utils.BuryPointUtils;
import com.yidianling.fm.param.FMParam;
import com.yidianling.fm.router.FMIn;
import org.jetbrains.annotations.NotNull;
import in.srain.cube.views.loadmore.LoadMoreContainer;
import in.srain.cube.views.loadmore.LoadMoreHandler;
import in.srain.cube.views.loadmore.LoadMoreListViewContainer;
import in.srain.cube.views.ptr.PtrDefaultHandler;
import in.srain.cube.views.ptr.PtrFrameLayout;
import in.srain.cube.views.ptr.PtrHandler;
import in.srain.cube.views.ptr.header.MaterialHeader;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;
public class FMListViewFragment extends BaseFragment implements PtrHandler, LoadMoreHandler {
FMListAdapter adapter;
int page = 0;
boolean hasMore = true;
int tagId;
// @BindView(R.id.lv_content)
private ListView lv_content;
// @BindView(R.id.load_more_list_view_container)
private LoadMoreListViewContainer load_more_list_view_container;
// @BindView(R.id.store_house_ptr_frame)
private PtrFrameLayout store_house_ptr_frame;
private TextView ll_empty_txt;
private LinearLayout ll_empty;
private LogoLoadingView v_loading;
@Override
public int layoutResId() {
return R.layout.fragment_fm_list_view;
}
@Override
public void initDataAndEventLazy() {
}
@Override
public void initDataAndEvent() {
if (getRootView() != null) {
lv_content = getRootView().findViewById(R.id.lv_content);
ll_empty_txt = getRootView().findViewById(R.id.ll_empty_txt);
ll_empty = getRootView().findViewById(R.id.ll_empty);
v_loading = getRootView().findViewById(R.id.v_loading);
load_more_list_view_container = getRootView().findViewById(R.id.load_more_list_view_container);
store_house_ptr_frame = getRootView().findViewById(R.id.store_house_ptr_frame);
}
final MaterialHeader header = new MaterialHeader(getActivity());
int color = getResources().getColor(R.color.google_green);
header.setColorSchemeColors(new int[]{color});
header.setLayoutParams(new PtrFrameLayout.LayoutParams(-1, -2));
int padding = (int) getActivity().getResources().getDimension(R.dimen.default_dis_size);
header.setPadding(0, padding, 0, padding);
header.setPtrFrameLayout(store_house_ptr_frame);
store_house_ptr_frame.setHeaderView(header);
store_house_ptr_frame.setPtrHandler(this);
store_house_ptr_frame.addPtrUIHandler(header);
// 使用默认样式
//load_more_list_view_container.useDefaultHeader();
load_more_list_view_container.setLoadMoreHandler(this);
adapter = new FMListAdapter(getActivity());
lv_content.setAdapter(adapter);
initNetLossView();
lv_content.setVisibility(View.GONE);
v_loading.setVisibility(View.VISIBLE);
ll_empty.setVisibility(View.GONE);
if (tagId == 1) {
if (FMIn.INSTANCE.isLogin()) {
v_loading.setViewType(LogoLoadingView.TYPE_LOADING, null);
} else {
v_loading.setVisibility(View.GONE);
ll_empty.setVisibility(View.VISIBLE);
}
} else {
v_loading.setViewType(LogoLoadingView.TYPE_LOADING, null);
}
lv_content.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
Intent intent = new Intent(getActivity(), FMDetailActivity.class);
Bundle bundle = new Bundle();
bundle.putInt("id", adapter.mDataList.get(position).getId());
intent.putExtra("bundle", bundle);
startActivity(intent);
click_play();
BuryPointUtils.getInstance().createMap()
.put("FM_name", adapter.mDataList.get(position).getName())
.burryPoint("FM_play");
}
});
if (tagId == 1 && !FMIn.INSTANCE.isLogin()) {
return;
}
getData(false);
}
private void initNetLossView() {
v_loading.setListener(new LogoLoadingView.LogoLoadingListener() {
@Override
public void onDataResetClick() {
v_loading.setViewType(LogoLoadingView.TYPE_LOADING, null);
if (tagId == 1) {
collectList(false);
}else {
allList(false);
}
}
@Override
public void onBackClick() {
getActivity().finish();
}
});
}
public void click_play() {
}
public FMListViewFragment setTagId(int tagId) {
this.tagId = tagId;
return this;
}
void getData(final boolean loadMore) {
if (loadMore && !hasMore) {
if (load_more_list_view_container != null) {
load_more_list_view_container.loadMoreFinish(false, false);
}
return;
}
if (loadMore) {
page++;
} else {
page = 1;
}
switch (tagId) {
case 0:
allList(loadMore);
break;
case 1:
collectList(loadMore);
break;
}
}
private void collectList(final boolean loadMore) {
FmDataManager.INSTANCE.getHttp().getFavFMs(new FMParam(String.valueOf(page), "20"))
.subscribeOn(Schedulers.io())
.compose(RxUtils.resultJavaData())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(fms -> {
if (fms.getList().size() == 0) {
lv_content.setVisibility(View.GONE);
v_loading.setVisibility(View.GONE);
ll_empty.setVisibility(View.VISIBLE);
}else {
lv_content.setVisibility(View.VISIBLE);
v_loading.setVisibility(View.GONE);
ll_empty.setVisibility(View.GONE);
load_more_list_view_container.loadMoreFinish(false, true);
if (fms == null || fms.getList().size() < 20) {
hasMore = false;
}
if (!loadMore)
adapter.setDataList(fms.getList());
else if (fms != null)
adapter.addDataList(fms.getList());
}
}, new ThrowableConsumer() {
@Override
public void accept(@NotNull String msg) {
lv_content.setVisibility(View.GONE);
v_loading.setVisibility(View.VISIBLE);
ll_empty.setVisibility(View.GONE);
v_loading.setViewType(LogoLoadingView.TYPE_NET_LOSS, msg);
if (msg.equals("还没有喜欢的电台内容")) {
return;
}
}
});
}
private void allList(final boolean loadMore) {
FmDataManager.INSTANCE.getHttp().getAllFMs(new FMParam(String.valueOf(page), "20"))
.subscribeOn(Schedulers.io())
.compose(RxUtils.resultJavaData())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(fms -> {
if (fms.getList().size() == 0) {
lv_content.setVisibility(View.GONE);
v_loading.setVisibility(View.GONE);
ll_empty.setVisibility(View.VISIBLE);
ll_empty_txt.setText("这里还没有数据哦");
} else {
lv_content.setVisibility(View.VISIBLE);
v_loading.setVisibility(View.GONE);
ll_empty.setVisibility(View.GONE);
load_more_list_view_container.loadMoreFinish(false, true);
if (fms == null || fms.getList().size() < 20) {
hasMore = false;
}
if (!loadMore)
adapter.setDataList(fms.getList());
else if (fms != null)
adapter.addDataList(fms.getList());
}
}, new ThrowableConsumer() {
@Override
public void accept(@NotNull String msg) {
lv_content.setVisibility(View.GONE);
v_loading.setVisibility(View.VISIBLE);
ll_empty.setVisibility(View.GONE);
v_loading.setViewType(LogoLoadingView.TYPE_NET_LOSS, msg);
}
});
}
@Override
public boolean checkCanDoRefresh(PtrFrameLayout frame, View content, View header) {
return PtrDefaultHandler.checkContentCanBePulledDown(frame, lv_content, header);
}
@Override
public void onRefreshBegin(PtrFrameLayout frame) {
frame.postDelayed(new Runnable() {
@Override
public void run() {
store_house_ptr_frame.refreshComplete();
}
}, 1500);
getData(false);
}
@Override
public void onLoadMore(LoadMoreContainer loadMoreContainer) {
getData(true);
}
}
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.widget
/**
* @author <a href="https://www.jianshu.com/u/c1e5310dd724">xujian</a>
* @描述: FM播放页面动画效果
* @Copyright Copyright (c) 2019
* @Company 壹点灵
* @date 2019/05/08
*/
import android.content.Context
import android.graphics.*
import android.util.AttributeSet
import android.view.SurfaceHolder
import android.view.SurfaceView
import android.view.View
import com.yidianling.common.tools.RxDeviceTool
import java.lang.Exception
import java.util.*
class FMSurfaceView(context: Context?, attrs: AttributeSet?) : SurfaceView(context, attrs), SurfaceHolder.Callback {
private var mHolder: SurfaceHolder? = null
private var paint: Paint? = null
private var path: Path? = null
private var canvas: Canvas? = null
private var timer: Timer? = null
private var timerTask: TimerTask? = null
private var minRadius: Float = (RxDeviceTool.getScreenWidth(context) * 150 / 375 / 2).toFloat() // 初始化最小六边形所在圆半径
private var ringRadius: Float = (RxDeviceTool.getScreenWidth(context) * 145 / 375 / 2).toFloat() // 初始化内部圆环半径
private var ringWidth: Float = (RxDeviceTool.getScreenWidth(context) * 10 / 375 / 2).toFloat() // 初始化内部圆环宽度
private var presentRadius: Float = minRadius // 初始化当前最小六边形所在圆半径
private var presentRadiusChangeNumber: Float = 1f
private var maxRadius: Float = (RxDeviceTool.getScreenWidth(context) * 198 / 375 / 2).toFloat() // 初始化六边形所在圆最大时的半径
private var circleSpace: Float = maxRadius - minRadius // 初始化圆边之间的距离
private var clockwise: Boolean = true // 默认最小的六边形为顺时针旋转
private var hintColor: String = "FFFFFF" // 默认不透明色
private var percentColorNum: Float = 105f // 初始化初始颜色透明度 255f的时候最小的六边形为纯色没有透明度,颜色为hintColor
private var cornerRadius: Float = (RxDeviceTool.getScreenWidth(context) * 150 / 375 / 2).toFloat() // paint初始拐角半径
private var periodTime: Long = 30 // 定时任务间隔时间
private var firstPlay: Boolean = false
private var xfermode: PorterDuffXfermode? = null
init {
initPaint()
initPath()
mHolder = holder
mHolder?.addCallback(this)
//该行代码为设置透明
setZOrderOnTop(true)
mHolder?.setFormat(PixelFormat.TRANSLUCENT)
xfermode = PorterDuffXfermode(PorterDuff.Mode.XOR)//绘制交集,显示非交集
}
private fun initPath() {
path = Path()
}
private fun initPaint() {
paint = Paint(Color.GRAY)
paint?.color = Color.WHITE
paint?.isAntiAlias = true //抗锯齿
paint?.style = Paint.Style.FILL //设置画笔为填充模式
paint?.strokeCap = Paint.Cap.ROUND //画笔拐角为圆弧
paint?.pathEffect = CornerPathEffect(cornerRadius) //设置path拐角半径
}
fun playTimer() {
if (null == timer) {
timer = Timer()
timerTask = timerTask ?: object : TimerTask() {
override fun run() {
drawAnimate()
}
}
timer?.let {
timer!!.schedule(timerTask, 0, periodTime)
}
}
}
private fun drawAnimate() {
mHolder?.let {
canvas = mHolder?.lockCanvas()
canvas?.let {
//清空画布,进行重绘
canvas?.drawColor(Color.TRANSPARENT, PorterDuff.Mode.CLEAR)
//重置最小六边形半径
resetPresentRadius()
paint?.style = Paint.Style.FILL //设置画笔为填充模式
//绘制四个变化的六边形
drawMinHexagon()
drawMiddleHexagon()
drawMaxHexagon()
drawMMaxHexagon()
//绘制图片外面包围的一层圆
canvas?.let {
paint?.strokeWidth = ringWidth + 0.5f
paint?.style = Paint.Style.STROKE //设置画笔为线模式
paint?.color = Color.parseColor("#D0FFFFFF")
paint?.setShadowLayer(ringWidth, 1F, 1F, Color.parseColor("#D0FFFFFF"))
canvas!!.drawCircle((canvas?.width!! / 2).toFloat(), (canvas?.height!! / 2).toFloat(), ringRadius + 0.5f, paint!!)
paint?.setShadowLayer(0F, 0F, 0F, Color.WHITE)
}
presentRadius += presentRadiusChangeNumber //每次循环presentRadius+presentRadiusChangeNumber
}
//这里有些机型上面会出现异常,暴力try一次,也可以用 mHolder?.surface?.isValid先进行一次判断后进行try
try {
mHolder?.unlockCanvasAndPost(canvas) // android 4.3 会有IllegalArgumentException
} catch (e: Exception) {
}
}
}
private fun drawPath(point: Point, pointRadius: Float) {
path = Path()
path?.moveTo(point.x + canvas?.width!! / 2, point.y + canvas?.height!! / 2)
for (i in 1..5) {
path?.lineTo((point.x * Math.cos(getRadian(60 * i)) - point.y * Math.sin(getRadian(60 * i))).toFloat() + canvas?.width!! / 2,
(point.x * Math.sin(getRadian(60 * i)) + point.y * Math.cos(getRadian(60 * i))).toFloat() + canvas?.height!! / 2)
}
path?.close()
path?.addCircle((canvas?.width!! / 2).toFloat(), (canvas?.height!! / 2).toFloat(), minRadius, Path.Direction.CCW)
path?.fillType = Path.FillType.EVEN_ODD
/**
* 这边是2,1,根号3的三角形, 这部分代码绘制了从圆到六边形的变化
*/
val mRadius = (pointRadius * 1.7320508075689 / 2).toFloat()
if (mRadius > minRadius) {
//设置paint 拐角半径
if (mRadius - minRadius < 50f)
paint?.pathEffect = CornerPathEffect(cornerRadius - (mRadius - minRadius) * 2)
else
paint?.pathEffect = CornerPathEffect(cornerRadius - 100f)
canvas?.drawPath(path!!, paint!!)
}
}
private fun getRotatePoint(point: Point, angle: Int): Point {
return Point(
(point.x * Math.cos(getRadian(angle)) - point.y * Math.sin(getRadian(angle))).toFloat(),
(point.x * Math.sin(getRadian(angle)) + point.y * Math.cos(getRadian(angle))).toFloat()
)
}
/**
* 绘制最小的六边形
*/
private fun drawMinHexagon() {
val radius: Float = presentRadius
var percentOfColor: String = getColorPercent(radius)
percentOfColor = if (percentOfColor.length == 2) percentOfColor else "0${percentOfColor[0]}"
paint?.color = Color.parseColor("#$percentOfColor$hintColor")
canvas?.let {
if (clockwise) {
drawPath(getRotatePoint(Point(0f, radius), (radius - minRadius).toInt()), radius)
} else {
drawPath(getRotatePoint(Point(0f, radius), -(radius - minRadius).toInt()), radius)
}
}
}
/**
* 绘制中间的六边形
*/
private fun drawMiddleHexagon() {
val radius: Float = presentRadius + circleSpace
var percentOfColor: String = getColorPercent(radius)
percentOfColor = if (percentOfColor.length == 2) percentOfColor else "0${percentOfColor[0]}"
paint?.color = Color.parseColor("#$percentOfColor$hintColor")
canvas?.let {
if (clockwise) {
drawPath(getRotatePoint(Point(0f, radius), -(radius - minRadius).toInt()), radius)
} else {
drawPath(getRotatePoint(Point(0f, radius), (radius - minRadius).toInt()), radius)
}
}
}
/**
* 绘制最大的六边形
*/
private fun drawMaxHexagon() {
val radius: Float = presentRadius + circleSpace * 2
var percentOfColor: String = getColorPercent(radius)
percentOfColor = if (percentOfColor.length == 2) percentOfColor else "0${percentOfColor[0]}"
paint?.color = Color.parseColor("#$percentOfColor$hintColor")
canvas?.let {
if (clockwise) {
drawPath(getRotatePoint(Point(0f, radius), (radius - minRadius).toInt()), radius)
} else {
drawPath(getRotatePoint(Point(0f, radius), -(radius - minRadius).toInt()), radius)
}
}
}
/**
* 绘制最大的六边形之再来一个更大的
*/
private fun drawMMaxHexagon() {
val radius: Float = presentRadius + circleSpace * 3
var percentOfColor: String = getColorPercent(radius)
percentOfColor = if (percentOfColor.length == 2) percentOfColor else "0${percentOfColor[0]}"
paint?.color = Color.parseColor("#$percentOfColor$hintColor")
canvas?.let {
if (clockwise) {
drawPath(getRotatePoint(Point(0f, radius), -(radius - minRadius).toInt()), radius)
} else {
drawPath(getRotatePoint(Point(0f, radius), (radius - minRadius).toInt()), radius)
}
}
}
private fun getColorPercent(radius: Float): String {
return Integer.toHexString(((1f - (radius - minRadius) / (maxRadius + circleSpace * 3 - minRadius)) * percentColorNum).toInt())
}
/**
* 重置最小半径
*/
private fun resetPresentRadius() {
if (presentRadius >= maxRadius) {
presentRadius = minRadius
clockwise = !clockwise
firstPlay = true
}
}
fun stopTimer() {
releaseResource()
}
/**
* 清除定时任务,进行资源释放
*/
private fun releaseResource() {
timer?.let {
timer?.cancel()
timerTask?.cancel()
timerTask = null
timer = null
}
}
/**
* 根据角度获取弧度值
*/
private fun getRadian(angle: Int): Double {
return angle * (Math.PI / 180)
}
override fun surfaceDestroyed(holder: SurfaceHolder?) {
//mHolder?.removeCallback(this)
releaseResource()
this.setLayerType(View.LAYER_TYPE_SOFTWARE, null)
}
override fun surfaceCreated(holder: SurfaceHolder?) {
this.setLayerType(View.LAYER_TYPE_SOFTWARE, paint)
drawAnimate()
}
override fun surfaceChanged(holder: SurfaceHolder?, format: Int, width: Int, height: Int) {
}
class Point(val x: Float, val y: Float)
}
\ 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
...@@ -10,10 +10,12 @@ import com.alibaba.android.arouter.facade.annotation.Route ...@@ -10,10 +10,12 @@ import com.alibaba.android.arouter.facade.annotation.Route
import com.google.gson.Gson import com.google.gson.Gson
import com.google.gson.reflect.TypeToken import com.google.gson.reflect.TypeToken
import com.ydl.ydlcommon.base.BaseMvpActivity import com.ydl.ydlcommon.base.BaseMvpActivity
import com.ydl.ydlcommon.utils.* import com.ydl.ydlcommon.utils.BuryPointUtils
import com.ydl.ydlcommon.utils.SharedPreferencesEditor
import com.ydl.ydlcommon.utils.YDLAsyncUtils
import com.ydl.ydlcommon.utils.YDLCacheUtils
import com.ydl.ydlcommon.utils.remind.ToastHelper import com.ydl.ydlcommon.utils.remind.ToastHelper
import com.yidianling.tests.R import com.yidianling.tests.R
import com.yidianling.tests.TestsBIConstants
import com.yidianling.tests.home.adapter.AdapterWrapper import com.yidianling.tests.home.adapter.AdapterWrapper
import com.yidianling.tests.home.adapter.TestHomeAdapter import com.yidianling.tests.home.adapter.TestHomeAdapter
import com.yidianling.tests.home.bean.TestHomeDataBean import com.yidianling.tests.home.bean.TestHomeDataBean
...@@ -223,7 +225,6 @@ class TestHomeActivity : BaseMvpActivity<ITestHomeContract.View,ITestHomeContrac ...@@ -223,7 +225,6 @@ class TestHomeActivity : BaseMvpActivity<ITestHomeContract.View,ITestHomeContrac
} }
override fun dailyChange() { override fun dailyChange() {
UMEventUtils.umEvent(TestsBIConstants.EVENT_TEST_HOME_DAILY_CHANGE_CLICK, "", "")
//埋点 //埋点
BuryPointUtils.getInstance().createMap() BuryPointUtils.getInstance().createMap()
.burryPoint("ceping_change") .burryPoint("ceping_change")
......
...@@ -10,9 +10,7 @@ import com.ydl.ydl_router.manager.YDLRouterParams ...@@ -10,9 +10,7 @@ import com.ydl.ydl_router.manager.YDLRouterParams
import com.ydl.ydlcommon.base.config.HttpConfig import com.ydl.ydlcommon.base.config.HttpConfig
import com.ydl.ydlcommon.router.IYDLRouterConstant import com.ydl.ydlcommon.router.IYDLRouterConstant
import com.ydl.ydlcommon.utils.BuryPointUtils import com.ydl.ydlcommon.utils.BuryPointUtils
import com.ydl.ydlcommon.utils.UMEventUtils
import com.yidianling.router.RouterManager import com.yidianling.router.RouterManager
import com.yidianling.tests.TestsBIConstants
import com.yidianling.tests.list.view.TestCategoryListActivity import com.yidianling.tests.list.view.TestCategoryListActivity
import com.yidianling.tests.router.TestsIn import com.yidianling.tests.router.TestsIn
import com.yidianling.tests.search.TestSearchActivity import com.yidianling.tests.search.TestSearchActivity
...@@ -36,7 +34,6 @@ class TestHomeEventImpl(mContext: Context) : ITestHomeEvent { ...@@ -36,7 +34,6 @@ class TestHomeEventImpl(mContext: Context) : ITestHomeEvent {
* 跳转我的界面 * 跳转我的界面
*/ */
override fun jumpMine() { override fun jumpMine() {
UMEventUtils.umEvent(TestsBIConstants.EVENT_TEST_HOME_MINE_CLICK, "", "")
// TestHomeUtils.buildJumpMine(context!!) // TestHomeUtils.buildJumpMine(context!!)
if (!TestsIn.isLogin()) { if (!TestsIn.isLogin()) {
...@@ -53,8 +50,6 @@ class TestHomeEventImpl(mContext: Context) : ITestHomeEvent { ...@@ -53,8 +50,6 @@ class TestHomeEventImpl(mContext: Context) : ITestHomeEvent {
* 跳转搜索界面 * 跳转搜索界面
*/ */
override fun jumpSearch() { override fun jumpSearch() {
UMEventUtils.umEvent(TestsBIConstants.EVENT_TEST_HOME_SEARCH_CLICK, "", "")
TestSearchActivity.start(context!!) TestSearchActivity.start(context!!)
} }
...@@ -62,9 +57,6 @@ class TestHomeEventImpl(mContext: Context) : ITestHomeEvent { ...@@ -62,9 +57,6 @@ class TestHomeEventImpl(mContext: Context) : ITestHomeEvent {
* banner点击事件 * banner点击事件
*/ */
override fun bannerClick(linkUrl: String?, position: Int, title: String?) { override fun bannerClick(linkUrl: String?, position: Int, title: String?) {
UMEventUtils.umEvent(TestsBIConstants.EVENT_TEST_HOME_BANNER_CLICK, TestsBIConstants.PROPERTY_TEST_HOME_BANNER_URL, linkUrl)
UMEventUtils.umEvent(TestsBIConstants.EVENT_TEST_HOME_BANNER_CLICK, TestsBIConstants.PROPERTY_TEST_HOME_BANNER_NAME, title)
//埋点 //埋点
BuryPointUtils.getInstance().createMap() BuryPointUtils.getInstance().createMap()
.put("position", position) .put("position", position)
...@@ -77,9 +69,6 @@ class TestHomeEventImpl(mContext: Context) : ITestHomeEvent { ...@@ -77,9 +69,6 @@ class TestHomeEventImpl(mContext: Context) : ITestHomeEvent {
* 测评分类点击事件 * 测评分类点击事件
*/ */
override fun categoryClick(tabName: String?, position: Int, title: String?, id: String?) { override fun categoryClick(tabName: String?, position: Int, title: String?, id: String?) {
UMEventUtils.umEvent(TestsBIConstants.EVENT_TEST_HOME_CATEGORY_CLICK, TestsBIConstants.PROPERTY_TEST_HOME_CATEGORY_NAME, title)
UMEventUtils.umEvent(TestsBIConstants.EVENT_TEST_HOME_CATEGORY_CLICK, TestsBIConstants.PROPERTY_TEST_HOME_CATEGORY_ID, id)
//埋点 //埋点
BuryPointUtils.getInstance().createMap() BuryPointUtils.getInstance().createMap()
.put("position", position) .put("position", position)
...@@ -93,7 +82,6 @@ class TestHomeEventImpl(mContext: Context) : ITestHomeEvent { ...@@ -93,7 +82,6 @@ class TestHomeEventImpl(mContext: Context) : ITestHomeEvent {
* 实时测试状态点击事件 * 实时测试状态点击事件
*/ */
override fun realTestClick(linkUrl: String?, title: String?) { override fun realTestClick(linkUrl: String?, title: String?) {
UMEventUtils.umEvent(TestsBIConstants.EVENT_TEST_HOME_LOOP_CLICK, TestsBIConstants.PROPERTY_TEST_HOME_LOOP_NAME, title)
//埋点 //埋点
BuryPointUtils.getInstance().createMap() BuryPointUtils.getInstance().createMap()
.put("title", title) .put("title", title)
...@@ -105,9 +93,6 @@ class TestHomeEventImpl(mContext: Context) : ITestHomeEvent { ...@@ -105,9 +93,6 @@ class TestHomeEventImpl(mContext: Context) : ITestHomeEvent {
* 每日精选点击事件 * 每日精选点击事件
*/ */
override fun dailyClick(linkUrl: String?, position: Int, title: String?) { override fun dailyClick(linkUrl: String?, position: Int, title: String?) {
UMEventUtils.umEvent(TestsBIConstants.EVENT_TEST_HOME_DAILY_CLICK, TestsBIConstants.PROPERTY_TEST_HOME_DAILY_NAME, title)
UMEventUtils.umEvent(TestsBIConstants.EVENT_TEST_HOME_DAILY_CLICK, TestsBIConstants.PROPERTY_TEST_HOME_DAILY_URL, title)
//埋点 //埋点
BuryPointUtils.getInstance().createMap() BuryPointUtils.getInstance().createMap()
.put("position", position) .put("position", position)
...@@ -120,9 +105,6 @@ class TestHomeEventImpl(mContext: Context) : ITestHomeEvent { ...@@ -120,9 +105,6 @@ class TestHomeEventImpl(mContext: Context) : ITestHomeEvent {
* 热门推荐点击事件 * 热门推荐点击事件
*/ */
override fun recommendedClick(linkUrl: String?, position: Int, title: String?) { override fun recommendedClick(linkUrl: String?, position: Int, title: String?) {
UMEventUtils.umEvent(TestsBIConstants.EVENT_TEST_HOME_HOT_CLICK, TestsBIConstants.PROPERTY_TEST_HOME_HOT_URL, linkUrl)
UMEventUtils.umEvent(TestsBIConstants.EVENT_TEST_HOME_HOT_CLICK, TestsBIConstants.PROPERTY_TEST_HOME_HOT_NAME, title)
//埋点 //埋点
BuryPointUtils.getInstance().createMap() BuryPointUtils.getInstance().createMap()
.put("position", position) .put("position", position)
......
...@@ -108,7 +108,6 @@ class TestCategoryListActivity : BaseMvpActivity<TestListActivityView, TestListA ...@@ -108,7 +108,6 @@ class TestCategoryListActivity : BaseMvpActivity<TestListActivityView, TestListA
tabName = intent.getStringExtra(EXTRA_TABNAME) tabName = intent.getStringExtra(EXTRA_TABNAME)
} }
tv_test_search.setOnClickListener { tv_test_search.setOnClickListener {
UMEventUtils.umEvent(TestsBIConstants.EVENT_TEST_LIST_SEARCH_CLICK, "", "")
TestSearchActivity.start(this) TestSearchActivity.start(this)
} }
iv_test_list_back.setOnClickListener { iv_test_list_back.setOnClickListener {
...@@ -132,7 +131,6 @@ class TestCategoryListActivity : BaseMvpActivity<TestListActivityView, TestListA ...@@ -132,7 +131,6 @@ class TestCategoryListActivity : BaseMvpActivity<TestListActivityView, TestListA
override fun onPageSelected(position: Int) { override fun onPageSelected(position: Int) {
currentPageIndex = position currentPageIndex = position
setConditionContent(); setConditionContent();
UMEventUtils.umEvent(TestsBIConstants.EVENT_TEST_LIST_CATEGORY_CLICK, TestsBIConstants.PROPERTY_TEST_LIST_CATEGORY_NAME, testCategory?.get(position)?.name)
click_category() click_category()
......
...@@ -10,13 +10,11 @@ import com.alibaba.android.arouter.facade.annotation.Route ...@@ -10,13 +10,11 @@ import com.alibaba.android.arouter.facade.annotation.Route
import com.ydl.ydlcommon.base.BaseMvpActivity import com.ydl.ydlcommon.base.BaseMvpActivity
import com.ydl.ydlcommon.utils.BuryPointUtils import com.ydl.ydlcommon.utils.BuryPointUtils
import com.ydl.ydlcommon.utils.PopUtils import com.ydl.ydlcommon.utils.PopUtils
import com.ydl.ydlcommon.utils.UMEventUtils
import com.ydl.ydlcommon.utils.log.LogHelper import com.ydl.ydlcommon.utils.log.LogHelper
import com.ydl.ydlcommon.utils.remind.HttpErrorUtils import com.ydl.ydlcommon.utils.remind.HttpErrorUtils
import com.yidianling.common.tools.LogUtil import com.yidianling.common.tools.LogUtil
import com.yidianling.common.tools.ToastUtil import com.yidianling.common.tools.ToastUtil
import com.yidianling.tests.R import com.yidianling.tests.R
import com.yidianling.tests.TestsBIConstants
import com.yidianling.tests.list.model.bean.TestCategory import com.yidianling.tests.list.model.bean.TestCategory
import com.yidianling.tests.list.model.bean.TestsRedPacketBean import com.yidianling.tests.list.model.bean.TestsRedPacketBean
import com.yidianling.tests.list.presenter.TestListActivityPresenter import com.yidianling.tests.list.presenter.TestListActivityPresenter
...@@ -40,11 +38,9 @@ class TestListActivity : BaseMvpActivity<TestListActivityView, TestListActivityP ...@@ -40,11 +38,9 @@ class TestListActivity : BaseMvpActivity<TestListActivityView, TestListActivityP
tabName = intent.getStringExtra(EXTRA_TABNAME) tabName = intent.getStringExtra(EXTRA_TABNAME)
} }
titleBar.setOnRightTextClick { _, _ -> titleBar.setOnRightTextClick { _, _ ->
UMEventUtils.umEvent(TestsBIConstants.EVENT_TEST_LIST_SEARCH_CLICK, "", "")
TestSearchActivity.start(this) TestSearchActivity.start(this)
} }
titleBar.setRightImageListener { titleBar.setRightImageListener {
UMEventUtils.umEvent(TestsBIConstants.EVENT_TEST_LIST_MORE_CLICK, "", "")
popupWindow = PopUtils.showMoreItem(mContext, popupWindow = PopUtils.showMoreItem(mContext,
titleBar.rootView, titleBar.rootView,
0, 0,
...@@ -57,8 +53,6 @@ class TestListActivity : BaseMvpActivity<TestListActivityView, TestListActivityP ...@@ -57,8 +53,6 @@ class TestListActivity : BaseMvpActivity<TestListActivityView, TestListActivityP
override fun onPageScrolled(position: Int, positionOffset: Float, positionOffsetPixels: Int) {} override fun onPageScrolled(position: Int, positionOffset: Float, positionOffsetPixels: Int) {}
override fun onPageSelected(position: Int) { override fun onPageSelected(position: Int) {
UMEventUtils.umEvent(TestsBIConstants.EVENT_TEST_LIST_CATEGORY_CLICK, TestsBIConstants.PROPERTY_TEST_LIST_CATEGORY_NAME, testCategorys?.get(position)?.name)
click_category() click_category()
LogUtil.d("page selected: " + testCategorys?.get(position)?.name) LogUtil.d("page selected: " + testCategorys?.get(position)?.name)
......
...@@ -144,7 +144,6 @@ class TestListFragment : BaseFragment(), MyBaseAdapter.OnItemClickListener<Test> ...@@ -144,7 +144,6 @@ class TestListFragment : BaseFragment(), MyBaseAdapter.OnItemClickListener<Test>
} }
override fun onItemClickListener(v: View?, position: Int, data: Test?) { override fun onItemClickListener(v: View?, position: Int, data: Test?) {
UMEventUtils.umEvent(TestsBIConstants.EVENT_TEST_LIST_TEST_TITLE_CLICK, TestsBIConstants.PROPERTY_TEST_LIST_TEST_NAME, data?.name)
BuryPointUtils.getInstance().createMap() BuryPointUtils.getInstance().createMap()
.put("test_id", data?.id.toString()) .put("test_id", data?.id.toString())
......
...@@ -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', ':m-tests' include ':app',":router", ':ydl-net', ':ydl-utils', ':ydl-platform', ':ydl-webview', ':ydl-media',":m-user", ':m-consultant', ':m-muse', ':m-fm', ':m-tests'
\ 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()
} }
...@@ -355,6 +355,7 @@ class AudioPlayer private constructor() { ...@@ -355,6 +355,7 @@ class AudioPlayer private constructor() {
if (isIdle) { if (isIdle) {
return return
} }
pausePlayer() pausePlayer()
musicList.clear() musicList.clear()
mediaPlayer!!.reset() mediaPlayer!!.reset()
...@@ -399,13 +400,13 @@ class AudioPlayer private constructor() { ...@@ -399,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()
...@@ -421,7 +422,7 @@ class AudioPlayer private constructor() { ...@@ -421,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)
} }
} }
} }
...@@ -436,11 +437,10 @@ class AudioPlayer private constructor() { ...@@ -436,11 +437,10 @@ class AudioPlayer private constructor() {
/** /**
* 获取音乐时长 * 获取音乐时长
*/ */
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) {
......
package com.ydl.ydlcommon.utils; package com.ydl.ydlcommon.utils;
import android.content.Context; import android.content.Context;
import android.util.Log;
import com.umeng.analytics.MobclickAgent;
import com.umeng.analytics.dplus.UMADplus;
import com.ydl.ydl_router.provider.YDLRouterBurryPointProvider;
import com.yidianling.common.tools.LogUtil;
import java.util.HashMap; import com.ydl.ydl_router.provider.YDLRouterBurryPointProvider;
/** /**
* Created by Wi1ls on 2016/11/11; * Created by Wi1ls on 2016/11/11;
*/ */
//@Route(path = "/burry/point") //@Route(path = "/burry/point")
public class UMEventUtils implements YDLRouterBurryPointProvider{ public class UMEventUtils implements YDLRouterBurryPointProvider{
public static final String test = "aaa";
//登录注册首页_登录注册确认点击
public static final String POINT_LOGIN_CLINK_NEXT = "RegisterAndLoginActivity|click_next";
//登录注册首页_微信登录点击
public static final String POINT_CLICK_WECHAT = "RegisterAndLoginActivity|click_wechat";
//登录注册首页_QQ登录点击
public static final String POINT_CLICK_QQ = "RegisterAndLoginActivity|click_QQ";
//密码登录_下一步点击
public static final String POINT_CLICK_NEXT = "InputPassWordActivity|click_next";
//密码登录_切换短信登录
public static final String POINT_CLICK_SMS = "InputPassWordActivity|click_sms";
//密码登录_忘记密码
public static final String POINT_CLICK_FORGET = "InputPassWordActivity|click_forget";
//密码登录_密码可见切换
public static final String POINT_CLICK_VISIBLE = "InputPassWordActivity|click_visible";
//短信登录1_切换密码登录
public static final String POINT_CLICK_PWD = "VerificationCodeActivity|click_pwd";
//短信登录1_重发短信
public static final String POINT_CLICK_RESEND = "VerificationCodeActivity|click_resend";
//短信登录1_验证码输入
public static final String POINT_INPUT_CODE = "PhoneCode|input_code";
//短信登录1_验证码校验
public static final String POINT_VERIFY_CODE = "VerificationCodeActivity|verify_code";
private static final String UMEventUtilsTAG = "UMEventUtils-clickEvent";
public static final String NEW_HOME_MODULE_KEY = "home|";
//搜索
public static void um_search(Context mContext) {
MobclickAgent.onEvent(mContext, "um_search");
}
//广告
public static void um_ad(Context mContext) {
MobclickAgent.onEvent(mContext, "um_ad");
}
//电话倾诉
public static void um_listenerlist(Context mContext) {
MobclickAgent.onEvent(mContext, "um_listenerlist");
}
//说心事列表
public static void um_asklist(Context mContext) {
MobclickAgent.onEvent(mContext, "um_asklist");
}
//专家推荐
public static void um_experrecommend(Context mContext) {
MobclickAgent.onEvent(mContext, "um_experrecommend");
}
//fm详情
public static void um_fmdetail(Context mContext) {
MobclickAgent.onEvent(mContext, "um_fmdetail");
}
//文章详情
public static void um_articledetail(Context mContext) {
MobclickAgent.onEvent(mContext, "um_articledetail");
}
public static void te(){
YdlBuryPointUtil.sendClick("home|click_wenzhang");
}
//专家列表
public static void um_expertlist(Context mContext) {
MobclickAgent.onEvent(mContext, "um_expertlist");
}
//专家主页
public static void um_expertdetail(Context mContext) {
MobclickAgent.onEvent(mContext, "um_expertdetail");
}
//私聊
public static void um_chat(Context mContext) {
MobclickAgent.onEvent(mContext, "um_chat");
}
//小壹
public static void um_chat_xiaoyi(Context mContext) {
MobclickAgent.onEvent(mContext, "um_chat_xiaoyi");
}
//壹点灵
public static void um_chat_ydl(Context mContext) {
MobclickAgent.onEvent(mContext, "um_chat_ydl");
}
//消息列表
public static void um_msg(Context mContext) {
MobclickAgent.onEvent(mContext, "um_msg");
}
//预约页
public static void um_order(Context mContext) {
MobclickAgent.onEvent(mContext, "um_order");
}
//预约付款页
public static void um_pay(Context mContext) {
MobclickAgent.onEvent(mContext, "um_pay");
}
//付款成功页
public static void um_pay_success(Context mContext) {
MobclickAgent.onEvent(mContext, "um_pay_success");
}
//聆听者详情页
public static void um_listendetail(Context mContext) {
MobclickAgent.onEvent(mContext, "um_listendetail");
}
//倾诉页
public static void um_listening(Context mContext) {
MobclickAgent.onEvent(mContext, "um_listening");
}
//登录页
public static void um_login(Context mContext) {
MobclickAgent.onEvent(mContext, "um_login");
}
//充值页
public static void um_recharge(Context mContext) {
MobclickAgent.onEvent(mContext, "um_recharge");
}
//消息列表设置手势提醒点击
public static void msgListPrivacyAlert(Context context) {
MobclickAgent.onEvent(context, "msglist_privacy_alert");
}
//消息列表设置手势提醒关闭
public static void msgListPrivacyClose(Context context) {
MobclickAgent.onEvent(context, "msglist_privacy_close");
}
//动态列表设置手势提醒点击
public static void askListPrivacyAlert(Context context) {
MobclickAgent.onEvent(context, "asklist_privacy_alert");
}
//动态列表设置手势提醒关闭
public static void askListPrivacyClose(Context context) {
MobclickAgent.onEvent(context, "asklist_privacy_close");
}
//订单列表设置手势提醒点击
public static void orderListPrivacyAlert(Context context) {
MobclickAgent.onEvent(context, "orderlist_privacy_alert");
}
//订单列表设置手势提醒关闭
public static void orderListPrivacyClose(Context context) {
MobclickAgent.onEvent(context, "orderklist_privacy_close");
}
//倾诉列表(PV/UV/连接)
public static void listen_list(Context context) {
MobclickAgent.onEvent(context, "listen_list");
}
//倾诉首页banner(PV/UV)
public static void listen_banner(Context context) {
MobclickAgent.onEvent(context, "banner");
}
//倾诉首页分类(PV/UV)
public static void listen_classification(Context context) {
MobclickAgent.onEvent(context, "classification");
}
//倾诉首页连接(放弃/充值/成功)
public static void listen_connect(Context context) {
MobclickAgent.onEvent(context, "Connect");
}
//为你推荐-再换一个(PV/UV)
public static void listen_recommend_change(Context context) {
MobclickAgent.onEvent(context, "Recommend_change");
}
//为你推荐-向TA倾诉(PV/UV/付费)
public static void listen_recommend_say(Context context) {
MobclickAgent.onEvent(context, "Recommend_say");
}
//为你推荐-更多(PV/UV)
public static void listen_recommend_more(Context context) {
MobclickAgent.onEvent(context, "Recommend_more");
}
//为你推荐-播放(PV/UV)
public static void listen_recommend_play(Context context) {
MobclickAgent.onEvent(context, "Recommend_play");
}
//听声寻人-向TA倾诉(PV/UV/付费)
public static void listen_find_say(Context context) {
MobclickAgent.onEvent(context, "Listen_find_say");
}
//听声寻人-更多(PV/UV)
public static void listen_find_more(Context context) {
MobclickAgent.onEvent(context, "Listen_find_more");
}
//听声寻人-播放(PV/UV)
public static void listen_find_play(Context context) {
MobclickAgent.onEvent(context, "Listen_find_play");
}
//底部分类(PV/UV)
public static void listen_recommend(Context context) {
MobclickAgent.onEvent(context, "Listen_Recommend");
}
//音频播放(PV/UV/平均时长)
public static void listen_audio_frequency(Context context) {
MobclickAgent.onEvent(context, "audio_frequency");
}
//音频列表(PV/UV)
public static void listen_audio_list(Context context) {
MobclickAgent.onEvent(context, "audio_list");
}
public static void login(Context context, String des) {
UMADplus.track(context,des,new HashMap<>());
MobclickAgent.onEvent(context, des);
}
/**
* 点击微信
* @param className
*/
public static void clickWechat(String className){
YdlBuryPointUtil.sendClick(className + "|click_wechat");
}
/**
* 点击QQ
* @param className
*/
public static void clickQQ(String className){
YdlBuryPointUtil.sendClick(className + "|click_QQ");
}
/**
* 微信登录成功
* @param className
*/
public static void loginSuccWechat(String className){
YdlBuryPointUtil.sendClick(className + "|Login_succ_byWechat");
YdlBuryPointUtil.reLogin();
}
/**
* 注册微信成功
* @param className
*/
public static void regSuccByWechat(String className){
YdlBuryPointUtil.sendClick(className + "|Reg_succ_byWechat");
YdlBuryPointUtil.reLogin();
}
/** @Override
* qq登录成功 public void init(Context context) {
* @param className
*/
public static void loginSuccQQ(String className){
YdlBuryPointUtil.sendClick(className + "|Login_succ_byQQ");
YdlBuryPointUtil.reLogin();
}
/**
* 注册QQ成功
* @param className
*/
public static void regSuccByQQ(String className){
YdlBuryPointUtil.sendClick(className + "|Reg_succ_byQQ");
YdlBuryPointUtil.reLogin();
}
/**
* (第三方登录后)手机绑定成功
* @param className
*/
public static void bindPhoneByThird(String className){
YdlBuryPointUtil.sendClick(className + "|Bind_succ_byPhone");
}
//壹点零用户版-首页热门话题-更多按钮 add by xujian 20181224
public static void click_more(String className) {
YdlBuryPointUtil.sendClick(className + "|click_more");
}
//壹点零用户版-编辑页-发布按钮点击 add by xujian 20181224
public static void click_publish(String className) {
YdlBuryPointUtil.sendClick(className + "|click_publish");
}
//壹点零用户版-编辑页-返回按钮点击 add by xujian 20181224
public static void click_return(String className) {
YdlBuryPointUtil.sendClick(className + "|click_return");
}
//壹点零用户版-选择话题页面-取消按钮点击 add by xujian 20181224
public static void click_cancel(String className) {
YdlBuryPointUtil.sendClick(className + "|click_cancel");
}
//壹点零用户版-选择话题页面-话题选择点击 add by xujian 20181224
public static void click_topic(String className) {
YdlBuryPointUtil.sendClick(className + "|click_topic");
}
//壹点零用户版-测试详情页面-测试详情页面计数 add by xujian 20181224
public static void click_subject(String className) {
YdlBuryPointUtil.sendClick(className + "|click_subject");
}
//壹点零用户版-测试详情页面-点击立即测试 add by xujian 20181224
public static void click_start(String className) {
YdlBuryPointUtil.sendClick(className + "|click_start");
}
//壹点零用户版-测试结果页面-点击重新测试 add by xujian 20181224
public static void click_retest(String className) {
YdlBuryPointUtil.sendClick(className + "|click_retest");
}
//壹点零用户版-首页心理测试按钮 add by xujian 20190109
public static void click_test(String className) {
LogUtil.i(UMEventUtilsTAG, className);
YdlBuryPointUtil.sendClick(className + "|click_test");
}
//壹点零用户版-测评频道页-搜索栏点击 add by xujian 20190109
public static void click_search(String className) {
LogUtil.i(UMEventUtilsTAG, className);
YdlBuryPointUtil.sendClick(className + "|click_search");
}
//壹点零用户版-测评频道页-banner页点击 add by xujian 20190109
public static void click_banner(String className) {
LogUtil.i(UMEventUtilsTAG, className);
YdlBuryPointUtil.sendClick(className + "|click_banner");
}
//壹点零用户版-测评频道页-热门推荐题点击 add by xujian 20190109
public static void click_recommend(String className) {
LogUtil.i(UMEventUtilsTAG, className);
YdlBuryPointUtil.sendClick(className + "|click_recommend");
}
//壹点零用户版-测评频道页-热门推荐题点击 add by xujian 20190109
public static void click_personal(String className) {
LogUtil.i(UMEventUtilsTAG, className);
YdlBuryPointUtil.sendClick(className + "|click_personal");
}
//壹点零用户版-测评列表页_类目点击 add by xujian 20190109
public static void click_category(String className) {
LogUtil.i(UMEventUtilsTAG, className);
YdlBuryPointUtil.sendClick(className + "|click_category");
}
//壹点零用户版-我的课程-和他私聊点击 add by xujian 20190109
public static void click_chat(String className) {
LogUtil.i(UMEventUtilsTAG, className);
YdlBuryPointUtil.sendClick(className + "|click_chat");
}
//壹点零用户版-我的课程-和他倾诉点击 add by xujian 20190109
public static void click_audient(String className) {
LogUtil.i(UMEventUtilsTAG, className);
YdlBuryPointUtil.sendClick(className + "|click_audient");
}
//壹点零用户版-我的课程-和他咨询点击 add by xujian 20190109
public static void click_consult(String className) {
LogUtil.i(UMEventUtilsTAG, className);
YdlBuryPointUtil.sendClick(className + "|click_consult");
}
//壹点零用户版-fm播放点击 add by xujian 20190109
public static void click_play(String className) {
LogUtil.i(UMEventUtilsTAG, className);
YdlBuryPointUtil.sendClick(className + "|click_play");
}
//壹点零用户版-测评频道页_付费类目点击 add by xujian 20190109
public static void click_category_btn(String className, String clickName) {
LogUtil.i(UMEventUtilsTAG, className);
YdlBuryPointUtil.sendClick(className + "|" + clickName);
}
//壹点零用户版-H5页面埋点通用方法 add by xujian 20190109
public static void click_common_h5(String className, String clickName) {
LogUtil.i(UMEventUtilsTAG, className);
YdlBuryPointUtil.sendClick(className + "|" + clickName);
}
//首页改版 - Banner点击
public static void click_banner() {
YdlBuryPointUtil.sendClick(NEW_HOME_MODULE_KEY + "click_banner");
}
//首页改版 - 测试题目点击
public static void click_ceshi() {
YdlBuryPointUtil.sendClick(NEW_HOME_MODULE_KEY + "click_ceshi");
}
//首页改版 - 更多测试点击
public static void click_ceshimore() {
YdlBuryPointUtil.sendClick(NEW_HOME_MODULE_KEY + "click_ceshimore");
}
//首页改版 - 倾述专家点击
public static void click_qingsu() {
YdlBuryPointUtil.sendClick(NEW_HOME_MODULE_KEY + "click_qingsu");
}
//首页改版 - 更多专家点击
public static void click_qingsumore() {
YdlBuryPointUtil.sendClick(NEW_HOME_MODULE_KEY + "click_qingsumore");
}
//首页改版 - 主页底部导航栏选择课程tab
public static void click_main_tab_kecheng() {
YdlBuryPointUtil.sendClick(NEW_HOME_MODULE_KEY + "click_main_tab_kecheng");
}
//首页改版 - 顶部心理课堂模块点击
public static void click_top_kecheng_tab() {
YdlBuryPointUtil.sendClick(NEW_HOME_MODULE_KEY + "click_top_kecheng_tab");
}
//首页改版 - 课程点击
public static void click_kecheng() {
YdlBuryPointUtil.sendClick(NEW_HOME_MODULE_KEY + "click_kecheng");
}
//首页改版 - 更多课程点击
public static void click_kechengmore() {
YdlBuryPointUtil.sendClick(NEW_HOME_MODULE_KEY + "click_kechengmore");
}
//首页改版 - 问答点击
public static void click_dongtai() {
YdlBuryPointUtil.sendClick(NEW_HOME_MODULE_KEY + "click_dongtai");
}
//首页改版 - 更多问答点击
public static void click_dongtaimore() {
YdlBuryPointUtil.sendClick(NEW_HOME_MODULE_KEY + "click_dongtaimore");
}
//首页改版 - 编辑入口点击
public static void click_ask() {
YdlBuryPointUtil.sendClick(NEW_HOME_MODULE_KEY + "click_ask");
}
//首页改版 - fm详情点击
public static void click_fm() {
YdlBuryPointUtil.sendClick(NEW_HOME_MODULE_KEY + "click_fm");
}
//首页改版 - 更多fm点击
public static void click_fmmore() {
YdlBuryPointUtil.sendClick(NEW_HOME_MODULE_KEY + "click_fmmore");
}
//首页改版 - 文章详情点击
public static void click_wenzhang() {
YdlBuryPointUtil.sendClick(NEW_HOME_MODULE_KEY + "click_wenzhang");
}
//首页改版 - 更多文章点击
public static void click_wenzhangmore() {
YdlBuryPointUtil.sendClick(NEW_HOME_MODULE_KEY + "click_wenzhangmore");
}
//咨询频道页 - Banner图点击
public static void click_zixun_banner() {
YdlBuryPointUtil.sendClick(NEW_HOME_MODULE_KEY + "zixunbanner");
}
//咨询频道页 - 免费测试点击
public static void click_zixun_free() {
YdlBuryPointUtil.sendClick(NEW_HOME_MODULE_KEY + "click_free");
}
//咨询频道页 - 咨询指南点击
public static void click_zixun_zhinan() {
YdlBuryPointUtil.sendClick(NEW_HOME_MODULE_KEY + "click_zhinan");
}
/**
* 登录成功
*
* @param eventName
*/
public static void loginSuccess(String eventName) {
Log.e("http","-----------loginSuccess="+eventName);
// umJavaEvent(eventName);
YdlBuryPointUtil.sendClick(eventName);
YdlBuryPointUtil.reLogin();
}
/**
* 所有点击时间的埋点
* 除事件名外,其余两个参数可以为空
*
* @param eventName 事件名
* @param propertyName 属性名
* @param propertyValue 属性值
*/
// @PointTrace()
public static void umEvent(String eventName, String propertyName, String propertyValue) {
}
/**
* 基于java长链接的埋点
*
* @param eventName 事件名
*/
// @CustomPointTrace()
public static void umJavaEvent(String eventName) {
Log.e("http","-------------"+eventName);
} }
@Override @Override
public void burryPoint(String s, String s1) { public void burryPoint(String s, String s1) {
click_common_h5(s,s1);
}
@Override
public void init(Context context) {
} }
} }
...@@ -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