Commit 8619efbe by 严久程
parents ab5f7bff 0e3e5822
...@@ -165,10 +165,9 @@ dependencies { ...@@ -165,10 +165,9 @@ dependencies {
kapt rootProject.ext.dependencies["butterknife-compiler"] kapt rootProject.ext.dependencies["butterknife-compiler"]
if (rootProject.ext.dev_mode) { if (true) {
//开发模式 //开发模式
api project(':m-user') api project(':m-user')
//api project(':m-fm')
api project(':m-tests') api project(':m-tests')
api project(':m-consultant') api project(':m-consultant')
api (project(':ydl-platform')){ api (project(':ydl-platform')){
...@@ -176,6 +175,12 @@ dependencies { ...@@ -176,6 +175,12 @@ dependencies {
} }
implementation project(':ydl-webview') implementation project(':ydl-webview')
implementation project(':ydl-media') implementation project(':ydl-media')
// api rootProject.ext.dependencies["ydl-m-fm-module-ydl"]
// api rootProject.ext.dependencies["ydl-m-fm-api"]
api project(':m-fm')
implementation modularPublication('com.ydl:m-fm-api')
} else { } else {
//发布模式 //发布模式
api 'com.ydl:m-user-module-ydl:0.0.6' api 'com.ydl:m-user-module-ydl:0.0.6'
......
...@@ -19,9 +19,11 @@ import com.ydl.component.mvp.DemoPresenter ...@@ -19,9 +19,11 @@ import com.ydl.component.mvp.DemoPresenter
import com.ydl.media.audio.PlayService import com.ydl.media.audio.PlayService
import com.ydl.ydl_router.manager.YDLRouterManager import com.ydl.ydl_router.manager.YDLRouterManager
import com.ydl.ydl_router.manager.YDLRouterParams import com.ydl.ydl_router.manager.YDLRouterParams
import com.ydl.ydlcommon.modular.ModularServiceManager
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.fm.api.service.IFMService
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.*
...@@ -31,9 +33,18 @@ import kotlinx.android.synthetic.main.activity_main.* ...@@ -31,9 +33,18 @@ import kotlinx.android.synthetic.main.activity_main.*
*/ */
class MainActivity : BaseLceActivity<DemoContract.View, DemoContract.Presenter>(), class MainActivity : BaseLceActivity<DemoContract.View, DemoContract.Presenter>(),
DemoContract.View { DemoContract.View {
private var serviceConnection: ServiceConnection? = null private var serviceConnection: ServiceConnection? = null
protected var playService: PlayService? = null protected var playService: PlayService? = null
override fun getContentViewId(): Int {
return R.id.lce_content_view
}
override fun getStateViewId(): Int {
return R.id.lce_state_view
}
override fun setData(data: String) { override fun setData(data: String) {
tv_content.text = data tv_content.text = data
} }
...@@ -48,10 +59,10 @@ class MainActivity : BaseLceActivity<DemoContract.View, DemoContract.Presenter>( ...@@ -48,10 +59,10 @@ class MainActivity : BaseLceActivity<DemoContract.View, DemoContract.Presenter>(
override fun initDataAndEvent() { override fun initDataAndEvent() {
bindService() bindService()
loadData() reLoadData()
requestPermission() requestPermission()
tv_user.setOnClickListener { tv_user.setOnClickListener {
loadData() reLoadData()
} }
tv_home.setOnClickListener { tv_home.setOnClickListener {
...@@ -102,13 +113,14 @@ class MainActivity : BaseLceActivity<DemoContract.View, DemoContract.Presenter>( ...@@ -102,13 +113,14 @@ class MainActivity : BaseLceActivity<DemoContract.View, DemoContract.Presenter>(
} }
bt_to_fm.setOnClickListener { bt_to_fm.setOnClickListener {
YDLRouterManager.router(IYDLRouterConstant.ROUTER_FM_LIST) startActivity(ModularServiceManager.provide(IFMService::class.java).fmListIntent(this))
// YDLRouterManager.router(IYDLRouterConstant.ROUTER_FM_LIST)
} }
} }
override fun loadData() { override fun reLoadData() {
mPresenter?.loadUsers() mPresenter?.loadUsers()
} }
......
...@@ -6,6 +6,14 @@ import com.ydl.component.mvp.DemoPresenter ...@@ -6,6 +6,14 @@ import com.ydl.component.mvp.DemoPresenter
import com.ydl.ydlcommon.mvp.lce.BaseLceActivity import com.ydl.ydlcommon.mvp.lce.BaseLceActivity
class MusicPlayActivity : BaseLceActivity<DemoContract.View, DemoContract.Presenter>(), DemoContract.View { class MusicPlayActivity : BaseLceActivity<DemoContract.View, DemoContract.Presenter>(), DemoContract.View {
override fun getContentViewId(): Int {
return R.id.lce_content_view
}
override fun getStateViewId(): Int {
return R.id.lce_state_view
}
private var mPlayFragment: PlayFragment? = null private var mPlayFragment: PlayFragment? = null
override fun createPresenter(): DemoContract.Presenter { override fun createPresenter(): DemoContract.Presenter {
...@@ -17,10 +25,10 @@ class MusicPlayActivity : BaseLceActivity<DemoContract.View, DemoContract.Prese ...@@ -17,10 +25,10 @@ class MusicPlayActivity : BaseLceActivity<DemoContract.View, DemoContract.Prese
} }
override fun initDataAndEvent() { override fun initDataAndEvent() {
loadData() reLoadData()
} }
override fun loadData() { override fun reLoadData() {
mPresenter.loadFmMusic() mPresenter.loadFmMusic()
} }
......
...@@ -18,7 +18,8 @@ import io.reactivex.Observable ...@@ -18,7 +18,8 @@ import io.reactivex.Observable
class DemoModel : BaseModel(), DemoContract.Model { class DemoModel : BaseModel(), DemoContract.Model {
override fun getFmMusic(): Observable<HomeFMBean> { override fun getFmMusic(): Observable<HomeFMBean> {
return YDLHttpUtils.obtainApi(DemoService::class.java) return YDLHttpUtils.obtainApi(DemoService::class.java)
.getFMData().compose(RxUtils.resultJavaData()) .getFMData()
.compose(RxUtils.resultJavaData())
} }
......
...@@ -24,18 +24,15 @@ class DemoPresenter : BasePresenter<DemoContract.View,DemoContract.Model>(), ...@@ -24,18 +24,15 @@ class DemoPresenter : BasePresenter<DemoContract.View,DemoContract.Model>(),
} }
override fun onSuccess(homeFMBean: HomeFMBean) { override fun onSuccess(homeFMBean: HomeFMBean) {
// var jsonStirng = Gson().toJson(homeFMBean.list)
// val list = Gson().fromJson<ArrayList<Music>>(jsonStirng, object : TypeToken<ArrayList<Music>>() {}.type)
homeFMBean.list?.let { homeFMBean.list?.let {
AudioPlayer.get().addPlayList(stringToMusicPlayerList(it)) AudioPlayer.get().addPlayList(stringToMusicPlayerList(it))
mView.setData("") mView.setData("")
} }
} }
}) })
} }
override fun loadHome() = mModel!!.getHome() override fun loadHome() = mModel.getHome()
.compose(RxUtils.applySchedulers(mView)) .compose(RxUtils.applySchedulers(mView))
.subscribe(object : CommonObserver<JsonObject>() { .subscribe(object : CommonObserver<JsonObject>() {
override fun onError(errorMsg: String) { override fun onError(errorMsg: String) {
...@@ -43,11 +40,11 @@ class DemoPresenter : BasePresenter<DemoContract.View,DemoContract.Model>(), ...@@ -43,11 +40,11 @@ class DemoPresenter : BasePresenter<DemoContract.View,DemoContract.Model>(),
override fun onSuccess(users: JsonObject) { override fun onSuccess(users: JsonObject) {
var cateTitle = users.getAsJsonObject("data").getAsJsonArray("askCategoryData").get(0).asJsonObject.get("cateTitle").asString; var cateTitle = users.getAsJsonObject("data").getAsJsonArray("askCategoryData").get(0).asJsonObject.get("cateTitle").asString;
mView?.setData(cateTitle) mView.setData(cateTitle)
} }
}) })
override fun loadUsers() = mModel!!.getUser() override fun loadUsers() = mModel.getUser()
.compose(RxUtils.applySchedulers(mView))//使用 Rxlifecycle,使 Disposable 和 Activity 一起销毁 .compose(RxUtils.applySchedulers(mView))//使用 Rxlifecycle,使 Disposable 和 Activity 一起销毁
.subscribe(object : CommonObserver<JsonArray>() { .subscribe(object : CommonObserver<JsonArray>() {
override fun onError(errorMsg: String) { override fun onError(errorMsg: String) {
......
...@@ -169,12 +169,16 @@ ext { ...@@ -169,12 +169,16 @@ ext {
"ydl-hnet" : 'com.ydl:h-net:0.0.8', "ydl-hnet" : 'com.ydl:h-net:0.0.8',
"ydl-utils" : 'com.ydl:ydl-utils:0.0.2', "ydl-utils" : 'com.ydl:ydl-utils:0.0.2',
"ydl-net" : 'com.ydl:ydl-net:0.0.1', "ydl-net" : 'com.ydl:ydl-net:0.0.1',
//Modular Api
"ydl-user-router" : 'com.ydl:router:1.0.0-SNAPSHOT@aar', "ydl-user-router" : 'com.ydl:router:1.0.0-SNAPSHOT@aar',
"ydl-platform" : 'com.ydl:ydl-platform:0.0.10@aar',
//功能组件
"ydl-platform" : 'com.ydl:ydl-platform:0.0.13@aar',
"ydl-webview" : 'com.ydl:ydl-webview:0.0.15@aar',
//业务组件
"ydl-m-user-api" : 'com.ydl:m-user-api:0.0.5', "ydl-m-user-api" : 'com.ydl:m-user-api:0.0.5',
"ydl-webview" : 'com.ydl:ydl-webview:0.0.14@aar', "ydl-m-muse-api" : 'com.ydl:m-muse-api:0.0.1',
"ydl-m-muse-api" : 'com.ydl:m-muse-api:0.0.1@aar' "ydl-m-fm-api" : 'com.ydl:m-fm-api:0.0.2',
"ydl-m-fm-module-ydl" : 'com.ydl:m-fm-module-ydl:0.0.1@aar'
] ]
} }
...@@ -8,14 +8,14 @@ modular { ...@@ -8,14 +8,14 @@ modular {
groupId = "com.ydl" groupId = "com.ydl"
artifactId = "m-consultant-module-xlzx" artifactId = "m-consultant-module-xlzx"
// 上报的 心理咨询 业务模块 aar 包的版本号 // 上报的 心理咨询 业务模块 aar 包的版本号
version = "0.0.11" version = "0.0.13"
} }
ydl{ ydl{
groupId = "com.ydl" groupId = "com.ydl"
artifactId = "m-consultant-module-ydl" artifactId = "m-consultant-module-ydl"
// 上报的 壹点灵 业务模块 aar 包的版本号 // 上报的 壹点灵 业务模块 aar 包的版本号
version = "0.0.11" version = "0.0.13"
} }
} }
......
...@@ -2,6 +2,13 @@ apply plugin: 'com.android.library' ...@@ -2,6 +2,13 @@ apply plugin: 'com.android.library'
apply plugin: 'kotlin-android' apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt' apply plugin: 'kotlin-kapt'
apply plugin: 'kotlin-android-extensions' apply plugin: 'kotlin-android-extensions'
apply plugin: 'plugin.resTools' // 资源重命名插件
// 配置资源重命名插件
resConfig {
new_prefix = 'fm_' // 资源前缀
old_prefix = '' // 老前缀,可为''空字符串
}
kapt { kapt {
arguments { arguments {
...@@ -62,18 +69,18 @@ dependencies { ...@@ -62,18 +69,18 @@ dependencies {
// 注意此处的依赖方式:kotlin中使用和java中使用方式有不同 // 注意此处的依赖方式:kotlin中使用和java中使用方式有不同
kapt "com.alibaba:arouter-compiler:$arouter_compiler" kapt "com.alibaba:arouter-compiler:$arouter_compiler"
api rootProject.ext.dependencies["ydl-user-router"]
if (rootProject.ext.dev_mode){ if (rootProject.ext.dev_mode){
//开发时使用 //开发时使用
api project(":ydl-platform") api project(":ydl-platform")
api project(':m-user') api project(':m-user')
implementation project(':ydl-media')
implementation modularPublication('com.ydl:m-user-api') implementation modularPublication('com.ydl:m-user-api')
implementation project(':ydl-media')
} else { } else {
//发布时使用 //发布时使用
api rootProject.ext.dependencies["ydl-m-user-api"] implementation project(':ydl-media')
api(rootProject.ext.dependencies["ydl-platform"]) { implementation rootProject.ext.dependencies["ydl-m-user-api"]
transitive = true implementation rootProject.ext.dependencies["ydl-platform"]
}
} }
} }
...@@ -15,7 +15,7 @@ modular { ...@@ -15,7 +15,7 @@ modular {
groupId = "com.ydl" groupId = "com.ydl"
artifactId = "m-fm-module-ydl" artifactId = "m-fm-module-ydl"
// 上报的 壹点灵 业务模块 aar 包的版本号 // 上报的 壹点灵 业务模块 aar 包的版本号
version = "0.0.1" version = "0.0.6"
} }
} }
...@@ -24,7 +24,7 @@ modular { ...@@ -24,7 +24,7 @@ modular {
groupId = "com.ydl" groupId = "com.ydl"
artifactId = "m-fm-api" artifactId = "m-fm-api"
//开发时注释掉版本号,发布api时打开 //开发时注释掉版本号,发布api时打开
//version = "0.0.1" version = "0.0.2"
// API 层打包时需要引入的依赖 // API 层打包时需要引入的依赖
apiDependencies { apiDependencies {
implementation "com.google.code.gson:gson:2.8.2" implementation "com.google.code.gson:gson:2.8.2"
......
package com.yidianling.fm; package com.yidianling.fm;
import android.app.Activity;
import android.content.Intent;
import android.graphics.Color; import android.graphics.Color;
import android.os.Bundle;
import android.support.v4.app.Fragment; import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager; import android.support.v4.view.ViewPager;
import android.widget.PopupWindow; import android.widget.PopupWindow;
...@@ -11,6 +14,7 @@ import com.ydl.media.view.PlayerFloatHelper; ...@@ -11,6 +14,7 @@ import com.ydl.media.view.PlayerFloatHelper;
import com.ydl.ydlcommon.adapter.FragmentWithTabPagerAdapter; import com.ydl.ydlcommon.adapter.FragmentWithTabPagerAdapter;
import com.ydl.ydlcommon.base.BaseActivity; import com.ydl.ydlcommon.base.BaseActivity;
import com.ydl.ydlcommon.utils.PopUtils; import com.ydl.ydlcommon.utils.PopUtils;
import com.ydl.ydlcommon.utils.bitmap.ColorUtil;
import com.ydl.ydlcommon.view.SlidingTabLayout; import com.ydl.ydlcommon.view.SlidingTabLayout;
import com.ydl.ydlcommon.view.TitleBar; import com.ydl.ydlcommon.view.TitleBar;
...@@ -34,11 +38,13 @@ public class FMActivity extends BaseActivity { ...@@ -34,11 +38,13 @@ public class FMActivity extends BaseActivity {
private PopupWindow popupWindow; private PopupWindow popupWindow;
public static Intent newIntent(Activity activity) {
Intent intent = new Intent(activity, FMActivity.class);
return intent;
}
@Override @Override
protected int layoutResId() { protected int layoutResId() {
return R.layout.activity_fm; return R.layout.fm_activity_fm;
} }
@Override @Override
...@@ -75,9 +81,10 @@ public class FMActivity extends BaseActivity { ...@@ -75,9 +81,10 @@ public class FMActivity extends BaseActivity {
} }
FragmentWithTabPagerAdapter adapter = new FragmentWithTabPagerAdapter(getSupportFragmentManager(), titleList, fragmentList); FragmentWithTabPagerAdapter adapter = new FragmentWithTabPagerAdapter(getSupportFragmentManager(), titleList, fragmentList);
stl_tab.setBackgroundColor(Color.WHITE); stl_tab.setBackgroundColor(Color.WHITE);
stl_tab.setSelectedIndicatorColors(ColorUtil.changeColor(this, R.color.fm_google_green));
stl_tab.setSelectColor(ColorUtil.changeColor(this, R.color.fm_google_green));
vp_content.setAdapter(adapter); vp_content.setAdapter(adapter);
stl_tab.setIsDoubleTab(true); stl_tab.setIsDoubleTab(true);
stl_tab.setSelectedIndicatorColors(0xFF1da1f2);
stl_tab.setDividerColors(Color.TRANSPARENT); stl_tab.setDividerColors(Color.TRANSPARENT);
stl_tab.setViewPager(vp_content); stl_tab.setViewPager(vp_content);
vp_content.setCurrentItem(0); vp_content.setCurrentItem(0);
......
...@@ -25,15 +25,12 @@ import com.alibaba.android.arouter.facade.annotation.Route; ...@@ -25,15 +25,12 @@ import com.alibaba.android.arouter.facade.annotation.Route;
import com.ydl.media.audio.AudioPlayer; import com.ydl.media.audio.AudioPlayer;
import com.ydl.media.audio.OnPlayerEventListener; import com.ydl.media.audio.OnPlayerEventListener;
import com.ydl.media.audio.model.Music; import com.ydl.media.audio.model.Music;
import com.ydl.media.audio.utils.PlayProgressUtil;
import com.ydl.media.view.PlayerFloatHelper; import com.ydl.media.view.PlayerFloatHelper;
import com.ydl.ydl_image.module.GlideApp; import com.ydl.ydl_image.module.GlideApp;
import com.ydl.ydl_image.transform.GlideCircleRingTransform; import com.ydl.ydl_image.transform.GlideCircleRingTransform;
import com.ydl.ydlcommon.base.BaseActivity; import com.ydl.ydlcommon.base.BaseActivity;
import com.ydl.ydlcommon.data.http.RxUtils; import com.ydl.ydlcommon.data.http.RxUtils;
import com.ydl.ydlcommon.data.http.ThrowableConsumer; 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.utils.remind.ToastHelper;
import com.ydl.ydlcommon.view.TitleBar; import com.ydl.ydlcommon.view.TitleBar;
import com.ydl.ydlcommon.view.dialog.YDLShareDialog; import com.ydl.ydlcommon.view.dialog.YDLShareDialog;
...@@ -158,7 +155,7 @@ public class FMDetailActivity extends BaseActivity implements View.OnClickListen ...@@ -158,7 +155,7 @@ public class FMDetailActivity extends BaseActivity implements View.OnClickListen
@Override @Override
protected int layoutResId() { protected int layoutResId() {
return R.layout.activity_fm_detail; return R.layout.fm_activity_fm_detail;
} }
/** /**
...@@ -438,7 +435,7 @@ public class FMDetailActivity extends BaseActivity implements View.OnClickListen ...@@ -438,7 +435,7 @@ public class FMDetailActivity extends BaseActivity implements View.OnClickListen
// if (PlayerFloatHelper.Companion.isFmPlaying()) { // if (PlayerFloatHelper.Companion.isFmPlaying()) {
// iv_play.setImageResource(R.drawable.fm_stop_2); // iv_play.setImageResource(R.drawable.fm_stop_2);
// } else { // } else {
// iv_play.setImageResource(R.drawable.fm_play_2); // iv_play.setImageResource(R.drawable.fm_fm_play_2);
// } // }
// } // }
......
...@@ -27,7 +27,7 @@ public class FMListItemView extends LinearLayout { ...@@ -27,7 +27,7 @@ public class FMListItemView extends LinearLayout {
public FMListItemView(Context context) { public FMListItemView(Context context) {
super(context); super(context);
inflate(context, R.layout.ui_fm_list_item, this); inflate(context, R.layout.fm_ui_fm_list_item, this);
sdv_head = findViewById(R.id.sdv_head); sdv_head = findViewById(R.id.sdv_head);
tv_title = findViewById(R.id.tv_title); tv_title = findViewById(R.id.tv_title);
tv_anchor = findViewById(R.id.tv_anchor); tv_anchor = findViewById(R.id.tv_anchor);
......
...@@ -52,7 +52,7 @@ public class FMListViewFragment extends BaseFragment implements PtrHandler, Load ...@@ -52,7 +52,7 @@ public class FMListViewFragment extends BaseFragment implements PtrHandler, Load
@Override @Override
public int layoutResId() { public int layoutResId() {
return R.layout.fragment_fm_list_view; return R.layout.fm_fragment_fm_list_view;
} }
@Override @Override
...@@ -71,7 +71,7 @@ public class FMListViewFragment extends BaseFragment implements PtrHandler, Load ...@@ -71,7 +71,7 @@ public class FMListViewFragment extends BaseFragment implements PtrHandler, Load
store_house_ptr_frame = getRootView().findViewById(R.id.store_house_ptr_frame); store_house_ptr_frame = getRootView().findViewById(R.id.store_house_ptr_frame);
} }
final MaterialHeader header = new MaterialHeader(getActivity()); final MaterialHeader header = new MaterialHeader(getActivity());
int color = getResources().getColor(R.color.google_green); int color = getResources().getColor(R.color.fm_google_green);
header.setColorSchemeColors(new int[]{color}); header.setColorSchemeColors(new int[]{color});
header.setLayoutParams(new PtrFrameLayout.LayoutParams(-1, -2)); header.setLayoutParams(new PtrFrameLayout.LayoutParams(-1, -2));
int padding = (int) getActivity().getResources().getDimension(R.dimen.platform_default_dis_size); int padding = (int) getActivity().getResources().getDimension(R.dimen.platform_default_dis_size);
......
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.modular
import android.app.Activity
import android.content.Context
import android.content.Intent
import com.alibaba.android.arouter.facade.annotation.Route
import com.ydl.media.audio.AudioPlayer
import com.ydl.media.view.PlayerFloatHelper
import com.yidianling.fm.FMActivity
import com.yidianling.fm.FMDetailActivity
import com.yidianling.fm.api.service.IFMService
/**
* Created by xj on 2019/11/6.
*/
@Route(path = "/fm/FMService")
class FMServiceImpl : IFMService {
constructor()
override fun init(context: Context?) {
}
/**
* 打开FM列表页面
*/
override fun fmListIntent(activity: Activity): Intent {
return FMActivity.newIntent(activity)
}
/**
* 打开FM播放页面
*/
override fun fmDetailIntent(activity: Activity, id: Int): Intent {
return FMDetailActivity.newIntent(activity, id)
}
/**
* 打开FM播放页面
*/
override fun fmDetailIntent(activity: Activity, id: Int, isSplash: Boolean): Intent {
return FMDetailActivity.newIntent(activity, id, isSplash)
}
/**
* 获取FM播放ID
*/
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
...@@ -15,7 +15,6 @@ object FMIn { ...@@ -15,7 +15,6 @@ object FMIn {
fun isLogin(): Boolean { fun isLogin(): Boolean {
return ModularServiceManager.provide(IUserService::class.java).isLogin() return ModularServiceManager.provide(IUserService::class.java).isLogin()
// return RouterManager.getUserRouter()?.isLogin()?:false
} }
fun mainIntent(activity: Activity): Intent? { fun mainIntent(activity: Activity): Intent? {
......
package com.yidianling.fm.api.service package com.yidianling.fm.api.service
import android.app.Activity
import android.content.Intent
import com.alibaba.android.arouter.facade.template.IProvider import com.alibaba.android.arouter.facade.template.IProvider
/** /**
...@@ -7,4 +9,19 @@ import com.alibaba.android.arouter.facade.template.IProvider ...@@ -7,4 +9,19 @@ import com.alibaba.android.arouter.facade.template.IProvider
*/ */
interface IFMService: IProvider{ interface IFMService: IProvider{
fun fmListIntent(activity: Activity): Intent
fun fmDetailIntent(activity: Activity, id: Int): Intent
fun fmDetailIntent(activity: Activity, id: Int, isSplash: Boolean): Intent
fun getFmId(): Int
fun closePlayer()
fun isPlaying(): Boolean
fun pause()
fun replay()
} }
\ No newline at end of file
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
android:width="7dp" android:width="7dp"
android:height="7dp" /> android:height="7dp" />
<stroke android:color="@color/white" android:width="1dp"/> <stroke android:color="@color/white" android:width="1dp"/>
<solid android:color="@color/google_green" /> <solid android:color="@color/fm_google_green" />
</shape> </shape>
</item> </item>
<item> <item>
......
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/fm_nim_picker_preview_pressed" android:state_pressed="true"></item>
<item android:drawable="@drawable/fm_nim_picker_preview_disable" android:state_enabled="false"></item>
<item android:drawable="@drawable/fm_nim_picker_preview_normal"></item>
</selector>
<?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"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="vertical"> android:orientation="vertical">
<com.ydl.ydlcommon.view.TitleBar <com.ydl.ydlcommon.view.TitleBar
android:id="@+id/tb_title" android:id="@+id/tb_title"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="@dimen/title_bar_height" android:layout_height="@dimen/title_bar_height"
app:pa_left_start_icon_color="@color/google_green" app:pa_left_start_icon_color="@color/fm_google_green"
app:pa_title_text="心灵电台" /> app:pa_title_text="心灵电台" />
<FrameLayout <FrameLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"> android:layout_height="wrap_content">
<com.ydl.ydlcommon.view.SlidingTabLayout <com.ydl.ydlcommon.view.SlidingTabLayout
android:id="@+id/stl_tab" android:id="@+id/stl_tab"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@color/white" /> android:background="@color/white"/>
</FrameLayout> </FrameLayout>
<ImageView <ImageView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="@dimen/divide_line_stroke_width" android:layout_height="@dimen/divide_line_stroke_width"
android:background="@color/divide_color" /> android:background="@color/fm_divide_color" />
<android.support.v4.view.ViewPager <android.support.v4.view.ViewPager
android:id="@+id/vp_content" android:id="@+id/vp_content"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="0px" android:layout_height="0px"
android:layout_weight="1" /> android:layout_weight="1" />
</LinearLayout> </LinearLayout>
\ No newline at end of file
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
<in.srain.cube.views.ptr.PtrFrameLayout <in.srain.cube.views.ptr.PtrFrameLayout
android:id="@+id/store_house_ptr_frame" android:id="@+id/store_house_ptr_frame"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
<in.srain.cube.views.loadmore.LoadMoreListViewContainer <in.srain.cube.views.loadmore.LoadMoreListViewContainer
android:id="@+id/load_more_list_view_container" android:id="@+id/load_more_list_view_container"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
<ListView <ListView
android:id="@+id/lv_content" android:id="@+id/lv_content"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:divider="@color/divide_color" android:divider="@color/fm_divide_color"
android:dividerHeight="@dimen/divide_line_stroke_width" /> android:dividerHeight="@dimen/divide_line_stroke_width" />
<com.ydl.ydlcommon.ui.LogoLoadingView <com.ydl.ydlcommon.ui.LogoLoadingView
android:id="@+id/v_loading" android:id="@+id/v_loading"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"/> android:layout_height="match_parent"/>
<LinearLayout <LinearLayout
android:id="@+id/ll_empty" android:id="@+id/ll_empty"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:gravity="center" android:gravity="center"
android:orientation="vertical"> android:orientation="vertical">
<ImageView <ImageView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:src="@drawable/empty_video" /> android:src="@drawable/fm_empty_video" />
<TextView <TextView
android:id="@+id/ll_empty_txt" android:id="@+id/ll_empty_txt"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="@dimen/platform_default_dis_size_huge" android:layout_marginTop="@dimen/platform_default_dis_size_huge"
android:text="还没有喜欢的电台内容" android:text="还没有喜欢的电台内容"
android:textColor="#D6D6D6" /> android:textColor="#D6D6D6" />
</LinearLayout> </LinearLayout>
</in.srain.cube.views.loadmore.LoadMoreListViewContainer> </in.srain.cube.views.loadmore.LoadMoreListViewContainer>
</in.srain.cube.views.ptr.PtrFrameLayout> </in.srain.cube.views.ptr.PtrFrameLayout>
</FrameLayout> </FrameLayout>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@color/white" android:background="@color/white"
android:padding="@dimen/platform_default_dis_size"> android:padding="@dimen/platform_default_dis_size">
<ImageView <ImageView
android:id="@+id/sdv_head" android:id="@+id/sdv_head"
android:layout_width="112dp" android:layout_width="112dp"
android:layout_height="70dp" android:layout_height="70dp"
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:contentDescription="@null" android:contentDescription="@null"
android:scaleType="centerCrop" /> android:scaleType="centerCrop" />
<TextView <TextView
android:id="@+id/tv_title" android:id="@+id/tv_title"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_toLeftOf="@+id/iv_next" android:layout_toLeftOf="@+id/iv_next"
android:layout_toRightOf="@+id/sdv_head" android:layout_toRightOf="@+id/sdv_head"
android:padding="@dimen/platform_default_dis_size_small" android:padding="@dimen/platform_default_dis_size_small"
android:text="" android:text=""
android:textSize="@dimen/platform_default_text_size_big" /> android:textSize="@dimen/platform_default_text_size_big" />
<TextView <TextView
android:id="@+id/tv_anchor" android:id="@+id/tv_anchor"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_below="@+id/tv_title" android:layout_below="@+id/tv_title"
android:layout_toRightOf="@+id/sdv_head" android:layout_toRightOf="@+id/sdv_head"
android:drawablePadding="@dimen/platform_default_dis_size_micro" android:drawablePadding="@dimen/platform_default_dis_size_micro"
android:padding="@dimen/platform_default_dis_size_small" android:padding="@dimen/platform_default_dis_size_small"
android:text="主播:" android:text="主播:"
android:textColor="@color/platform_default_text_color_hint" /> android:textColor="@color/platform_default_text_color_hint" />
<TextView <TextView
android:id="@+id/tv_listen_num" android:id="@+id/tv_listen_num"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_below="@+id/tv_title" android:layout_below="@+id/tv_title"
android:layout_toLeftOf="@+id/iv_next" android:layout_toLeftOf="@+id/iv_next"
android:layout_toRightOf="@+id/tv_anchor" android:layout_toRightOf="@+id/tv_anchor"
android:drawablePadding="@dimen/platform_default_dis_size_micro" android:drawablePadding="@dimen/platform_default_dis_size_micro"
android:padding="@dimen/platform_default_dis_size_small" android:padding="@dimen/platform_default_dis_size_small"
android:text="收听:0" android:text="收听:0"
android:textColor="@color/platform_default_text_color_hint" /> android:textColor="@color/platform_default_text_color_hint" />
<ImageView <ImageView
android:id="@+id/iv_next" android:id="@+id/iv_next"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentRight="true" android:layout_alignParentRight="true"
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:src="@drawable/msg_next" /> android:src="@drawable/fm_msg_next" />
</RelativeLayout> </RelativeLayout>
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:gravity="center_vertical" android:gravity="center_vertical"
android:orientation="horizontal" android:orientation="horizontal"
android:padding="15dp"> android:padding="15dp">
<ImageView <ImageView
android:id="@+id/iv_head" android:id="@+id/iv_head"
android:layout_width="60dp" android:layout_width="60dp"
android:layout_height="60dp" android:layout_height="60dp"
android:contentDescription="@string/platform_header" android:contentDescription="@string/platform_header"
android:src="@drawable/platform_default_img" /> android:src="@drawable/platform_default_img" />
<TextView <TextView
android:id="@+id/tv_title" android:id="@+id/tv_title"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_marginLeft="12dp" android:layout_marginLeft="12dp"
android:layout_marginRight="12dp" android:layout_marginRight="12dp"
android:layout_weight="1" android:layout_weight="1"
android:background="?android:attr/selectableItemBackground" android:background="?android:attr/selectableItemBackground"
android:ellipsize="end" android:ellipsize="end"
android:gravity="center_vertical" android:gravity="center_vertical"
android:maxLines="2" android:maxLines="2"
android:textColor="@color/platform_default_text_color" android:textColor="@color/platform_default_text_color"
android:textSize="14sp" android:textSize="14sp"
tools:text="课课程名称课程名称课程名称课程名称课程名称课" /> tools:text="课课程名称课程名称课程名称课程名称课程名称课" />
<ImageButton <ImageButton
android:id="@+id/btn_pause_play" android:id="@+id/btn_pause_play"
style="@android:style/Widget.Holo.Button.Borderless.Small" style="@android:style/Widget.Holo.Button.Borderless.Small"
android:layout_width="48dp" android:layout_width="48dp"
android:layout_height="48dp" android:layout_height="48dp"
android:contentDescription="@string/platform_pause_play" android:contentDescription="@string/platform_pause_play"
android:scaleType="centerInside" android:scaleType="centerInside"
android:src="@drawable/ic_pause_24dp" /> android:src="@drawable/fm_ic_pause_24dp" />
<ImageButton <ImageButton
android:id="@+id/btn_close" android:id="@+id/btn_close"
style="@android:style/Widget.Holo.Button.Borderless.Small" style="@android:style/Widget.Holo.Button.Borderless.Small"
android:layout_width="48dp" android:layout_width="48dp"
android:layout_height="48dp" android:layout_height="48dp"
android:contentDescription="@string/platform_close" android:contentDescription="@string/platform_close"
android:scaleType="centerInside" android:scaleType="centerInside"
android:src="@drawable/ic_close_24dp" /> android:src="@drawable/fm_ic_close_24dp" />
</LinearLayout> </LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <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> </resources>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<color name="divide_color">#EDEDED</color> <color name="fm_divide_color">#EDEDED</color>
</resources> </resources>
\ No newline at end of file
<resources> <resources>
<string name="app_name">FM</string> <string name="fm_app_name">FM</string>
</resources> </resources>
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<color name="google_green">#2ca94f</color> <color name="fm_google_green">#FFDD33</color>
</resources> </resources>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<color name="google_green">#1da1f2</color> <color name="fm_google_green">#1da1f2</color>
</resources> </resources>
\ No newline at end of file
...@@ -68,6 +68,7 @@ dependencies { ...@@ -68,6 +68,7 @@ dependencies {
implementation project(':ydl-media') implementation project(':ydl-media')
} else { } else {
//发布时使用 //发布时使用
implementation project(':ydl-media')
api(rootProject.ext.dependencies["ydl-platform"]) { api(rootProject.ext.dependencies["ydl-platform"]) {
transitive = true transitive = true
} }
......
...@@ -78,7 +78,7 @@ dependencies { ...@@ -78,7 +78,7 @@ dependencies {
implementation modularPublication('com.ydl:m-test-api') implementation modularPublication('com.ydl:m-test-api')
}else { }else {
//发布时使用 //发布时使用
compileOnly rootProject.ext.dependencies["ydl-m-test-api"] implementation modularPublication('com.ydl:m-test-api')
api rootProject.ext.dependencies["ydl-webview"] api rootProject.ext.dependencies["ydl-webview"]
api(rootProject.ext.dependencies["ydl-platform"]) { api(rootProject.ext.dependencies["ydl-platform"]) {
transitive = true transitive = true
......
...@@ -8,14 +8,14 @@ modular { ...@@ -8,14 +8,14 @@ modular {
groupId = "com.ydl" groupId = "com.ydl"
artifactId = "m-user-module-xlzx" artifactId = "m-user-module-xlzx"
// 上报的 心理咨询 业务模块 aar 包的版本号 // 上报的 心理咨询 业务模块 aar 包的版本号
version = "0.0.19" version = "0.0.21"
} }
ydl{ ydl{
groupId = "com.ydl" groupId = "com.ydl"
artifactId = "m-user-module-ydl" artifactId = "m-user-module-ydl"
// 上报的 壹点灵 业务模块 aar 包的版本号 // 上报的 壹点灵 业务模块 aar 包的版本号
version = "0.0.19" version = "0.0.21"
} }
} }
......
IS_PUBLISH=true IS_PUBLISH=true
VERSION_NAME=0.0.1 VERSION_NAME=0.0.4
\ No newline at end of file \ No newline at end of file
IS_PUBLISH=true IS_PUBLISH=true
VERSION_NAME=0.0.10 VERSION_NAME=0.0.13
\ No newline at end of file \ No newline at end of file
...@@ -86,6 +86,7 @@ object RxUtils { ...@@ -86,6 +86,7 @@ object RxUtils {
/** /**
* RxJava 线程协调 / RxLifecycle绑定方法 * RxJava 线程协调 / RxLifecycle绑定方法
* 自动调用 showLoading/hideLoading 方法
* @param view LceView 强转使用 * @param view LceView 强转使用
*/ */
fun <T> applySchedulers(view: ILceView): ObservableTransformer<T, T> { fun <T> applySchedulers(view: ILceView): ObservableTransformer<T, T> {
......
...@@ -2,7 +2,6 @@ package com.ydl.ydlcommon.mvp.lce ...@@ -2,7 +2,6 @@ package com.ydl.ydlcommon.mvp.lce
import android.support.annotation.CallSuper import android.support.annotation.CallSuper
import android.view.View import android.view.View
import com.ydl.ydlcommon.R
import com.ydl.ydlcommon.base.BaseMvpActivity import com.ydl.ydlcommon.base.BaseMvpActivity
import com.ydl.ydlcommon.mvp.base.IPresenter import com.ydl.ydlcommon.mvp.base.IPresenter
import com.ydl.ydlcommon.mvp.base.IView import com.ydl.ydlcommon.mvp.base.IView
...@@ -13,34 +12,28 @@ import com.ydl.ydlcommon.mvp.lce.view.ILceViewState ...@@ -13,34 +12,28 @@ import com.ydl.ydlcommon.mvp.lce.view.ILceViewState
* Des: LCE 架构 BaseActivity,统一处理页面加载状态 * Des: LCE 架构 BaseActivity,统一处理页面加载状态
* LCE:L:Loading加载,C:Content加载内容,E:Error加载失败 * LCE:L:Loading加载,C:Content加载内容,E:Error加载失败
* *
* 【注意:StateView需设置id为:R.id.lce_state_view】 * 【注意:StateView需继承 ILceViewState 接口】
* 【注意:ContentView需设置id为:R.id.lce_content_view】
*/ */
abstract class BaseLceActivity<V : IView, P : IPresenter<V>> : BaseMvpActivity<V, P>(), ILceView{ abstract class BaseLceActivity<V : IView, P : IPresenter<V>> : BaseMvpActivity<V, P>(), ILceView {
protected lateinit var lceStateView: ILceViewState private var lceStateView: ILceViewState? = null
protected var lceContentView: View? = null private var lceContentView: View? = null
@CallSuper @CallSuper
override fun onContentChanged() { override fun onContentChanged() {
super.onContentChanged() super.onContentChanged()
lceStateView = createStateView() lceStateView = createStateView()
lceContentView = createContentView() lceContentView = createContentView()
if (lceContentView == null) {
throw NullPointerException(
"请检查布局文件中ContentView是否设置,id需为R.id.lce_content_view"
)
}
} }
protected fun createStateView(): ILceViewState { private fun createStateView(): ILceViewState {
val stateView = findViewById<View>(R.id.lce_state_view) val stateView:View? = findViewById<View>(getStateViewId())
if (stateView is ILceViewState) {
if (stateView != null && stateView is ILceViewState) {
val viewState = stateView as ILceViewState val viewState = stateView as ILceViewState
viewState.setListener(object : ILceViewState.LogoLoadingListener { viewState.setListener(object : ILceViewState.LogoLoadingListener {
override fun onDataResetClick() { override fun onDataResetClick() {
loadData() reLoadData()
} }
override fun onBackClick() { override fun onBackClick() {
...@@ -51,33 +44,48 @@ abstract class BaseLceActivity<V : IView, P : IPresenter<V>> : BaseMvpActivity<V ...@@ -51,33 +44,48 @@ abstract class BaseLceActivity<V : IView, P : IPresenter<V>> : BaseMvpActivity<V
} }
throw NullPointerException( throw NullPointerException(
"请检查布局文件中StateView是否设置,id需为R.id.lce_state_view" "请检查布局文件中 StateView 是否设置,StateView 需继承 ILceViewState 接口 , className:${this.javaClass.simpleName}"
) )
} }
protected fun createContentView(): View { private fun createContentView(): View {
return findViewById(R.id.lce_content_view) val contentView: View? = findViewById<View>(getContentViewId())
?: throw NullPointerException(
"请检查布局文件中 ContentView 是否设置 , className:${this.javaClass.simpleName}"
)
return contentView!!
} }
/**
* 获取 ContentView 控件ID
*/
abstract fun getContentViewId(): Int
/**
* 获取 StateVie 控件 ID
*/
abstract fun getStateViewId(): Int
override fun showLoading() { override fun showLoading() {
lceStateView.showLoading() lceStateView?.showLoading()
lceContentView?.visibility = View.INVISIBLE
} }
override fun hideLoading() { override fun hideLoading() {
lceStateView.hideLoading()
}
override fun showContent() {
lceContentView?.visibility = View.VISIBLE lceContentView?.visibility = View.VISIBLE
lceStateView.hideLoading() lceStateView?.hideLoading()
} }
override fun showEmpty(msg: String) { override fun showEmpty(msg: String) {
lceStateView.showEmpty(msg) lceContentView?.visibility = View.INVISIBLE
lceStateView?.showEmpty(msg)
} }
override fun showError(msg: String) { override fun showError(msg: String) {
lceStateView.showError(msg) lceContentView?.visibility = View.INVISIBLE
lceStateView?.showError(msg)
} }
} }
......
...@@ -4,7 +4,6 @@ import android.os.Bundle ...@@ -4,7 +4,6 @@ import android.os.Bundle
import android.support.annotation.CallSuper import android.support.annotation.CallSuper
import android.support.v4.app.FragmentActivity import android.support.v4.app.FragmentActivity
import android.view.View import android.view.View
import com.ydl.ydlcommon.R
import com.ydl.ydlcommon.base.BaseMvpDialogFragment import com.ydl.ydlcommon.base.BaseMvpDialogFragment
import com.ydl.ydlcommon.mvp.base.IPresenter import com.ydl.ydlcommon.mvp.base.IPresenter
import com.ydl.ydlcommon.mvp.base.IView import com.ydl.ydlcommon.mvp.base.IView
...@@ -21,30 +20,23 @@ import java.util.* ...@@ -21,30 +20,23 @@ import java.util.*
*/ */
abstract class BaseLceDialogFragment<V : IView, P : IPresenter<V>> : BaseMvpDialogFragment<V, P>(), ILceView { abstract class BaseLceDialogFragment<V : IView, P : IPresenter<V>> : BaseMvpDialogFragment<V, P>(), ILceView {
protected var lceStateView: ILceViewState? = null private var lceStateView: ILceViewState? = null
protected var lceContentView: View? = null private var lceContentView: View? = null
@CallSuper @CallSuper
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState) super.onViewCreated(view, savedInstanceState)
lceStateView = createStateView(view) lceStateView = createStateView(view)
lceContentView = createContentView(view) lceContentView = createContentView(view)
if (lceContentView == null) {
throw NullPointerException(
"请检查布局文件中ContentView是否设置,id需为R.id.lce_content_view"
)
}
} }
protected fun createStateView(view: View): ILceViewState { private fun createStateView(view: View): ILceViewState {
val stateView = view.findViewById<View>(R.id.lce_state_view) val stateView:View? = view.findViewById<View>(getStateViewId())
if (stateView is ILceViewState) { if (stateView != null && stateView is ILceViewState) {
val viewState = stateView as ILceViewState val viewState = stateView as ILceViewState
viewState.setListener(object : ILceViewState.LogoLoadingListener { viewState.setListener(object : ILceViewState.LogoLoadingListener {
override fun onDataResetClick() { override fun onDataResetClick() {
loadData() reLoadData()
} }
override fun onBackClick() { override fun onBackClick() {
...@@ -55,34 +47,48 @@ abstract class BaseLceDialogFragment<V : IView, P : IPresenter<V>> : BaseMvpDial ...@@ -55,34 +47,48 @@ abstract class BaseLceDialogFragment<V : IView, P : IPresenter<V>> : BaseMvpDial
} }
throw NullPointerException( throw NullPointerException(
"请检查布局文件中StateView是否设置,id需为R.id.lce_state_view" "请检查布局文件中 StateView 是否设置,StateView 需继承 ILceViewState 接口 , className:${this.javaClass.simpleName}"
) )
} }
private fun createContentView(view: View): View {
val contentView: View? = view.findViewById<View>(getContentViewId())
?: throw NullPointerException(
"请检查布局文件中 ContentView 是否设置 , className:${this.javaClass.simpleName}"
)
protected fun createContentView(view: View): View { return contentView!!
return view.findViewById(R.id.lce_content_view)
} }
/**
* 获取 ContentView 控件ID
*/
abstract fun getContentViewId(): Int
/**
* 获取 StateVie 控件 ID
*/
abstract fun getStateViewId(): Int
override fun showLoading() { override fun showLoading() {
lceStateView!!.showLoading() lceStateView?.showLoading()
lceContentView?.visibility = View.INVISIBLE
} }
override fun hideLoading() { override fun hideLoading() {
lceStateView!!.hideLoading()
}
override fun showContent() {
lceContentView?.visibility = View.VISIBLE lceContentView?.visibility = View.VISIBLE
lceStateView!!.hideLoading() lceStateView?.hideLoading()
} }
override fun showEmpty(msg: String) { override fun showEmpty(msg: String) {
lceStateView!!.showEmpty(msg) lceContentView?.visibility = View.INVISIBLE
lceStateView?.showEmpty(msg)
} }
override fun showError(msg: String) { override fun showError(msg: String) {
lceStateView!!.showError(msg) lceContentView?.visibility = View.INVISIBLE
lceStateView?.showError(msg)
} }
override fun onDestroyView() { override fun onDestroyView() {
......
...@@ -4,7 +4,6 @@ import android.os.Bundle ...@@ -4,7 +4,6 @@ import android.os.Bundle
import android.support.annotation.CallSuper import android.support.annotation.CallSuper
import android.support.v4.app.FragmentActivity import android.support.v4.app.FragmentActivity
import android.view.View import android.view.View
import com.ydl.ydlcommon.R
import com.ydl.ydlcommon.base.BaseMvpFragment import com.ydl.ydlcommon.base.BaseMvpFragment
import com.ydl.ydlcommon.mvp.base.IPresenter import com.ydl.ydlcommon.mvp.base.IPresenter
import com.ydl.ydlcommon.mvp.base.IView import com.ydl.ydlcommon.mvp.base.IView
...@@ -20,8 +19,8 @@ import java.util.* ...@@ -20,8 +19,8 @@ import java.util.*
*/ */
abstract class BaseLceFragment< V : IView, P : IPresenter<V>> : BaseMvpFragment<V, P>(), ILceView { abstract class BaseLceFragment< V : IView, P : IPresenter<V>> : BaseMvpFragment<V, P>(), ILceView {
protected var lceStateView: ILceViewState? = null private var lceStateView: ILceViewState? = null
protected var lceContentView: View? = null private var lceContentView: View? = null
@CallSuper @CallSuper
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
...@@ -37,13 +36,13 @@ abstract class BaseLceFragment< V : IView, P : IPresenter<V>> : BaseMvpFragment< ...@@ -37,13 +36,13 @@ abstract class BaseLceFragment< V : IView, P : IPresenter<V>> : BaseMvpFragment<
} }
protected fun createStateView(view: View): ILceViewState { private fun createStateView(view: View): ILceViewState {
val stateView = view.findViewById<View>(R.id.lce_state_view) val stateView:View? = view.findViewById<View>(getStateViewId())
if (stateView is ILceViewState) { if (stateView != null && stateView is ILceViewState) {
val viewState = stateView as ILceViewState val viewState = stateView as ILceViewState
viewState.setListener(object : ILceViewState.LogoLoadingListener { viewState.setListener(object : ILceViewState.LogoLoadingListener {
override fun onDataResetClick() { override fun onDataResetClick() {
loadData() reLoadData()
} }
override fun onBackClick() { override fun onBackClick() {
...@@ -54,34 +53,48 @@ abstract class BaseLceFragment< V : IView, P : IPresenter<V>> : BaseMvpFragment< ...@@ -54,34 +53,48 @@ abstract class BaseLceFragment< V : IView, P : IPresenter<V>> : BaseMvpFragment<
} }
throw NullPointerException( throw NullPointerException(
"请检查布局文件中StateView是否设置,id需为R.id.lce_state_view" "请检查布局文件中 StateView 是否设置,StateView 需继承 ILceViewState 接口 , className:${this.javaClass.simpleName}"
) )
} }
private fun createContentView(view: View): View {
val contentView: View? = view.findViewById<View>(getContentViewId())
?: throw NullPointerException(
"请检查布局文件中 ContentView 是否设置 , className:${this.javaClass.simpleName}"
)
protected fun createContentView(view: View): View { return contentView!!
return view.findViewById(R.id.lce_content_view)
} }
/**
* 获取 ContentView 控件ID
*/
abstract fun getContentViewId(): Int
/**
* 获取 StateVie 控件 ID
*/
abstract fun getStateViewId(): Int
override fun showLoading() { override fun showLoading() {
lceStateView!!.showLoading() lceStateView?.showLoading()
lceContentView?.visibility = View.INVISIBLE
} }
override fun hideLoading() { override fun hideLoading() {
lceStateView!!.hideLoading()
}
override fun showContent() {
lceContentView?.visibility = View.VISIBLE lceContentView?.visibility = View.VISIBLE
lceStateView!!.hideLoading() lceStateView?.hideLoading()
} }
override fun showEmpty(msg: String) { override fun showEmpty(msg: String) {
lceStateView!!.showEmpty(msg) lceContentView?.visibility = View.INVISIBLE
lceStateView?.showEmpty(msg)
} }
override fun showError(msg: String) { override fun showError(msg: String) {
lceStateView!!.showError(msg) lceContentView?.visibility = View.INVISIBLE
lceStateView?.showError(msg)
} }
override fun onDestroyView() { override fun onDestroyView() {
......
...@@ -16,15 +16,12 @@ interface ILceView : IView{ ...@@ -16,15 +16,12 @@ interface ILceView : IView{
fun hideLoading() fun hideLoading()
@UiThread @UiThread
fun showContent()
@UiThread
fun showError(msg: String) fun showError(msg: String)
@UiThread @UiThread
fun showEmpty(msg: String) fun showEmpty(msg: String)
@UiThread @UiThread
fun loadData() fun reLoadData()
} }
package com.ydl.ydlcommon.utils.bitmap; package com.ydl.ydlcommon.utils.bitmap;
import android.content.Context;
import android.graphics.Color; import android.graphics.Color;
import android.graphics.LinearGradient; import android.graphics.LinearGradient;
import android.graphics.Shader; import android.graphics.Shader;
...@@ -460,4 +461,13 @@ public class ColorUtil { ...@@ -460,4 +461,13 @@ public class ColorUtil {
return Color.argb(alpha, red, green, blue); return Color.argb(alpha, red, green, blue);
} }
public static int changeColor(Context context, int id){
StringBuffer stringBuffer = new StringBuffer();
int color = context.getResources().getColor(id);
String hexCode = String.format("#%06X", Integer.valueOf(16777215 & color));
return Color.parseColor(hexCode);
}
} }
...@@ -74,9 +74,13 @@ public class SlidingTabLayout extends HorizontalScrollView { ...@@ -74,9 +74,13 @@ public class SlidingTabLayout extends HorizontalScrollView {
private static final int TITLE_OFFSET_DIPS = 24; private static final int TITLE_OFFSET_DIPS = 24;
private static final int TAB_VIEW_PADDING_DIPS = 16; private static final int TAB_VIEW_PADDING_DIPS = 16;
private static final int TAB_VIEW_TEXT_SIZE_SP = 14; private static final int TAB_VIEW_TEXT_SIZE_SP = 14;
private static final int SELECT_TEXT_COLOR = 0xFF1da1f2; private static int SELECT_TEXT_COLOR = 0xFF1da1f2;
private static final int UNSELECT_TEXT_COLOR = 0xFF7D7D7D; private static final int UNSELECT_TEXT_COLOR = 0xFF7D7D7D;
public static void setSelectColor(int color) {
SELECT_TEXT_COLOR = color;
}
private boolean isDoubleTab = false;//this mode has two tab and can not slide private boolean isDoubleTab = false;//this mode has two tab and can not slide
private int mTitleOffset; private int mTitleOffset;
......
IS_PUBLISH=true IS_PUBLISH=true
VERSION_NAME=0.0.14 VERSION_NAME=0.0.15
\ No newline at end of file \ No newline at end of file
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