Commit 2bb31177 by 徐健

资源文件命名规范,设置xlzx的主题色

parent 7f2786b4
......@@ -168,13 +168,13 @@ dependencies {
if (rootProject.ext.dev_mode) {
//开发模式
api project(':m-user')
//api project(':m-fm')
api project(':m-fm')
api project(':m-tests')
api project(':m-consultant')
api (project(':ydl-platform')){
transitive = true
}
implementation project(':ydl-webview')
// implementation project(':ydl-webview')
implementation project(':ydl-media')
} else {
//发布模式
......
......@@ -11,6 +11,7 @@ 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.utils.bitmap.ColorUtil;
import com.ydl.ydlcommon.view.SlidingTabLayout;
import com.ydl.ydlcommon.view.TitleBar;
......@@ -75,9 +76,10 @@ public class FMActivity extends BaseActivity {
}
FragmentWithTabPagerAdapter adapter = new FragmentWithTabPagerAdapter(getSupportFragmentManager(), titleList, fragmentList);
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);
stl_tab.setIsDoubleTab(true);
stl_tab.setSelectedIndicatorColors(0xFF1da1f2);
stl_tab.setDividerColors(Color.TRANSPARENT);
stl_tab.setViewPager(vp_content);
vp_content.setCurrentItem(0);
......
......@@ -25,15 +25,12 @@ 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;
......@@ -302,9 +299,9 @@ public class FMDetailActivity extends BaseActivity implements View.OnClickListen
refresh_icon.setVisibility(View.GONE);
anim.cancel();
if (AudioPlayer.Companion.get().isPlaying()) {
iv_play.setImageResource(R.drawable.fm_fm_stop_2);
iv_play.setImageResource(R.drawable.fm_stop_2);
} else {
iv_play.setImageResource(R.drawable.fm_fm_play_2);
iv_play.setImageResource(R.drawable.fm_play_2);
}
LogUtil.d("id equal " + id);
}
......@@ -323,7 +320,7 @@ public class FMDetailActivity extends BaseActivity implements View.OnClickListen
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
iv_play.setImageResource(R.drawable.fm_fm_play_2);
iv_play.setImageResource(R.drawable.fm_play_2);
AudioPlayer.Companion.get().pausePlayer();
}
......@@ -348,7 +345,7 @@ public class FMDetailActivity extends BaseActivity implements View.OnClickListen
canNext = false;
if (PlayerFloatHelper.Companion.getFmId() != id) {
anim.start();
iv_play.setImageResource(R.drawable.fm_fm_stop_2);
iv_play.setImageResource(R.drawable.fm_stop_2);
fmSurfaceView.stopTimer();
fm_progress.setEnabled(false);
if (type) {
......@@ -399,9 +396,9 @@ public class FMDetailActivity extends BaseActivity implements View.OnClickListen
tv_listen.setVisibility(View.VISIBLE);
}
if (fmDetail.is_favorite() == 1) {//love
iv_love.setImageResource(R.drawable.fm_fm_love_h_2);
iv_love.setImageResource(R.drawable.fm_love_h_2);
} else {
iv_love.setImageResource(R.drawable.fm_fm_love_n_2);
iv_love.setImageResource(R.drawable.fm_love_n_2);
}
canNext = true;
LogUtil.d("fmDetail.id " + fmDetail.getId());
......@@ -423,7 +420,7 @@ public class FMDetailActivity extends BaseActivity implements View.OnClickListen
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_fm_stop_2);
iv_play.setImageResource(R.drawable.fm_stop_2);
fm_progress.setProgress(0);
}else {
this.time = Integer.parseInt(String.valueOf(AudioPlayer.Companion.get().getAudioPosition()));
......@@ -436,7 +433,7 @@ public class FMDetailActivity extends BaseActivity implements View.OnClickListen
//todo xujian 通知栏改变状态修改应用内播放状态图标
// public void onEventMainThread(UpdatePlayStatusEvent status) {
// if (PlayerFloatHelper.Companion.isFmPlaying()) {
// iv_play.setImageResource(R.drawable.fm_fm_stop_2);
// iv_play.setImageResource(R.drawable.fm_stop_2);
// } else {
// iv_play.setImageResource(R.drawable.fm_fm_play_2);
// }
......@@ -456,11 +453,11 @@ public class FMDetailActivity extends BaseActivity implements View.OnClickListen
if (i == R.id.iv_play) {
if (AudioPlayer.Companion.get().isPlaying()) {
AudioPlayer.Companion.get().pausePlayer();
iv_play.setImageResource(R.drawable.fm_fm_play_2);
iv_play.setImageResource(R.drawable.fm_play_2);
fmSurfaceView.stopTimer();
} else {
AudioPlayer.Companion.get().startPlayer();
iv_play.setImageResource(R.drawable.fm_fm_stop_2);
iv_play.setImageResource(R.drawable.fm_stop_2);
fmSurfaceView.playTimer();
}
......@@ -520,9 +517,9 @@ public class FMDetailActivity extends BaseActivity implements View.OnClickListen
.observeOn(AndroidSchedulers.mainThread())
.subscribe(favFM -> {
if (favFM.getStatus() == 1) {
iv_love.setImageResource(R.drawable.fm_fm_love_h_2);
iv_love.setImageResource(R.drawable.fm_love_h_2);
} else {
iv_love.setImageResource(R.drawable.fm_fm_love_n_2);
iv_love.setImageResource(R.drawable.fm_love_n_2);
}
}, new ThrowableConsumer() {
@Override
......@@ -632,7 +629,7 @@ public class FMDetailActivity extends BaseActivity implements View.OnClickListen
refresh_icon.setVisibility(View.GONE);
anim.cancel();
fm_progress.setEnabled(true);
iv_play.setImageResource(R.drawable.fm_fm_stop_2);
iv_play.setImageResource(R.drawable.fm_stop_2);
fmSurfaceView.playTimer();
}
......
......@@ -71,7 +71,7 @@ public class FMListViewFragment extends BaseFragment implements PtrHandler, Load
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);
int color = getResources().getColor(R.color.fm_google_green);
header.setColorSchemeColors(new int[]{color});
header.setLayoutParams(new PtrFrameLayout.LayoutParams(-1, -2));
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;
}
}
......@@ -9,7 +9,7 @@
android:width="7dp"
android:height="7dp" />
<stroke android:color="@color/white" android:width="1dp"/>
<solid android:color="@color/google_green" />
<solid android:color="@color/fm_google_green" />
</shape>
</item>
<item>
......
......@@ -9,7 +9,7 @@
android:id="@+id/tb_title"
android:layout_width="match_parent"
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="心灵电台" />
<FrameLayout
......@@ -20,7 +20,7 @@
android:id="@+id/stl_tab"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white" />
android:background="@color/white"/>
</FrameLayout>
......
......@@ -4,7 +4,7 @@
android:id="@+id/ll_root"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/fm_fm_play_in"
android:background="@drawable/fm_play_in"
android:fitsSystemWindows="true"
android:orientation="vertical">
......@@ -13,8 +13,8 @@
android:layout_width="match_parent"
android:layout_height="@dimen/title_bar_height"
android:background="@color/transparent"
app:pa_left_start_icon="@drawable/fm_fm_back"
app:pa_right_start_icon="@drawable/fm_fm_item"
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="心灵电台" />
......@@ -50,7 +50,7 @@
android:id="@+id/fm_img"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/fm_fm_hint_img"
android:src="@drawable/fm_hint_img"
android:scaleType="centerCrop"/>
</android.support.v7.widget.CardView>
</LinearLayout>
......@@ -89,14 +89,14 @@
android:layout_weight="1"
android:layout_height="@dimen/platform_dp_19"
android:scaleType="fitCenter"
android:src="@drawable/fm_fm_love_n_2" />
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_fm_last_2" />
android:src="@drawable/fm_last_2" />
<ImageView
android:id="@+id/iv_play"
......@@ -104,7 +104,7 @@
android:layout_weight="2"
android:layout_height="60dp"
android:layout_centerInParent="true"
android:src="@drawable/fm_fm_play_2"/>
android:src="@drawable/fm_play_2"/>
<ImageView
......@@ -112,7 +112,7 @@
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="36dp"
android:src="@drawable/fm_fm_next_2" />
android:src="@drawable/fm_next_2" />
<ImageView
......@@ -120,7 +120,7 @@
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="19dp"
android:src="@drawable/fm_fm_share_2" />
android:src="@drawable/fm_share_2" />
</LinearLayout>
......@@ -162,7 +162,7 @@
android:id="@+id/tv_listen_icon"
android:layout_width="@dimen/platform_dp_15"
android:layout_height="@dimen/platform_dp_12"
android:src="@drawable/fm_fm_listen_2"
android:src="@drawable/fm_listen_2"
android:layout_marginRight="@dimen/platform_dp_5"
android:visibility="gone"/>
......@@ -181,7 +181,7 @@
android:id="@+id/tv_like_icon"
android:layout_width="@dimen/platform_dp_16"
android:layout_height="@dimen/platform_dp_13"
android:src="@drawable/fm_fm_like_2"
android:src="@drawable/fm_like_2"
android:layout_marginTop="0.5dp"
android:layout_marginRight="@dimen/platform_dp_5"
android:visibility="gone"/>
......
<?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="google_green">#2ca94f</color>
<color name="fm_google_green">#fdbd00</color>
</resources>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="google_green">#1da1f2</color>
<color name="fm_google_green">#1da1f2</color>
</resources>
\ No newline at end of file
package com.ydl.ydlcommon.utils.bitmap;
import android.content.Context;
import android.graphics.Color;
import android.graphics.LinearGradient;
import android.graphics.Shader;
......@@ -460,4 +461,13 @@ public class ColorUtil {
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 {
private static final int TITLE_OFFSET_DIPS = 24;
private static final int TAB_VIEW_PADDING_DIPS = 16;
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;
public static void setSelectColor(int color) {
SELECT_TEXT_COLOR = color;
}
private boolean isDoubleTab = false;//this mode has two tab and can not slide
private int mTitleOffset;
......
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