修复闪退BUG
This commit is contained in:
parent
c7e3897f38
commit
f44943d726
|
@ -53,7 +53,7 @@
|
||||||
<activity android:name=".activity_search" />
|
<activity android:name=".activity_search" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".bfq"
|
android:name=".bfq"
|
||||||
android:configChanges="keyboardHidden|orientation|screenSize"
|
android:configChanges="keyboardHidden|screenSize"
|
||||||
android:theme="@style/fragment_dialog" />
|
android:theme="@style/fragment_dialog" />
|
||||||
|
|
||||||
<activity android:name=".fragment.mp3" />
|
<activity android:name=".fragment.mp3" />
|
||||||
|
|
|
@ -31,7 +31,7 @@ public class MediaPlayer extends android.media.MediaPlayer {
|
||||||
public Runnable updateSeekBar = new Runnable() {
|
public Runnable updateSeekBar = new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if (isPlaying() && Media.view != null) {
|
if (isPlaying() && Media.lrcview != null) {
|
||||||
long position = getCurrentPosition();
|
long position = getCurrentPosition();
|
||||||
Media.setProgress((int) position);
|
Media.setProgress((int) position);
|
||||||
}
|
}
|
||||||
|
@ -110,7 +110,7 @@ public class MediaPlayer extends android.media.MediaPlayer {
|
||||||
start();
|
start();
|
||||||
main.handler.post(() -> {
|
main.handler.post(() -> {
|
||||||
bfui();
|
bfui();
|
||||||
if (Media.view != null) {
|
if (bfq.inflate != null) {
|
||||||
main.handler.removeCallbacks(updateSeekBar); // 在播放开始时启动更新进度
|
main.handler.removeCallbacks(updateSeekBar); // 在播放开始时启动更新进度
|
||||||
long duration = getDuration();
|
long duration = getDuration();
|
||||||
Media.setMax((int) getDuration());
|
Media.setMax((int) getDuration());
|
||||||
|
@ -167,10 +167,10 @@ public class MediaPlayer extends android.media.MediaPlayer {
|
||||||
public void bfui() {
|
public void bfui() {
|
||||||
setTX();
|
setTX();
|
||||||
String name = xm.name, zz = bfqkz.xm.zz;
|
String name = xm.name, zz = bfqkz.xm.zz;
|
||||||
if (Media.view != null) {
|
if (bfq.inflate != null) {
|
||||||
Media.setProgress(0);
|
Media.setProgress(0);
|
||||||
Media.setname(name);
|
bfq.setname(name);
|
||||||
Media.setzz(zz);
|
bfq.setzz(zz);
|
||||||
bfq_an.islike();
|
bfq_an.islike();
|
||||||
}
|
}
|
||||||
bfq_db.setname(name + "/" + zz);
|
bfq_db.setname(name + "/" + zz);
|
||||||
|
|
|
@ -38,8 +38,9 @@ public class url extends Thread {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String hq(MP3 x) {
|
public static String hq(MP3 x) {
|
||||||
|
getLrc(x.id);
|
||||||
if (Media.lrcview != null) {
|
if (Media.lrcview != null) {
|
||||||
gc(x.id);
|
Media.loadLyric();
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
if (wj.cz(wj.mp3 + x.id)) {
|
if (wj.cz(wj.mp3 + x.id)) {
|
||||||
|
@ -136,7 +137,7 @@ public class url extends Thread {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static void gc(String id) {
|
public static void getLrc(String id) {
|
||||||
String file = wj.mp3 + id;
|
String file = wj.mp3 + id;
|
||||||
if (wj.cz(file)) {
|
if (wj.cz(file)) {
|
||||||
try {
|
try {
|
||||||
|
@ -154,7 +155,6 @@ public class url extends Thread {
|
||||||
}else {
|
}else {
|
||||||
bfq.lrc = wl.hq("/lyric?id=" + id);
|
bfq.lrc = wl.hq("/lyric?id=" + id);
|
||||||
}
|
}
|
||||||
Media.loadLyric();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String picurl(String id) {
|
public static String picurl(String id) {
|
||||||
|
|
|
@ -40,23 +40,29 @@ import java.util.List;
|
||||||
|
|
||||||
public class bfq extends AppCompatActivity {
|
public class bfq extends AppCompatActivity {
|
||||||
@SuppressLint("StaticFieldLeak")
|
@SuppressLint("StaticFieldLeak")
|
||||||
public static AppCompatActivity context;
|
public static ActivityBfqBinding inflate;
|
||||||
public ActivityBfqBinding inflate;
|
|
||||||
public static String lrc;
|
public static String lrc;
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
|
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
|
||||||
context = this;
|
|
||||||
inflate = ActivityBfqBinding.inflate(getLayoutInflater());
|
inflate = ActivityBfqBinding.inflate(getLayoutInflater());
|
||||||
|
new Media(inflate);
|
||||||
|
Media.lrcview.setCurrentColor(ContextCompat.getColor(this,R.color.text));
|
||||||
|
Media.lrcview.setLabel(getString(R.string.app_name));
|
||||||
|
Media.lrcview.setCurrentTextSize(TypedValue.applyDimension(
|
||||||
|
TypedValue.COMPLEX_UNIT_SP, 16, getResources().getDisplayMetrics()));
|
||||||
|
// lrcView.setLrcPadding(16);
|
||||||
|
Media.lrcview.setCurrentTextSize(TypedValue.applyDimension(
|
||||||
|
TypedValue.COMPLEX_UNIT_SP, 20, getResources().getDisplayMetrics()));
|
||||||
|
Media.lrcview.setTimelineTextColor(ContextCompat.getColor(this,R.color.text_tm));
|
||||||
|
|
||||||
LinearLayout root = inflate.getRoot();
|
LinearLayout root = inflate.getRoot();
|
||||||
TypedValue typedValue = new TypedValue();
|
TypedValue typedValue = new TypedValue();
|
||||||
home.appCompatActivity.getTheme().resolveAttribute(android.R.attr.windowBackground, typedValue, true);
|
home.appCompatActivity.getTheme().resolveAttribute(android.R.attr.windowBackground, typedValue, true);
|
||||||
// 设置背景颜色
|
// 设置背景颜色
|
||||||
root.setBackgroundColor(typedValue.data);
|
root.setBackgroundColor(typedValue.data);
|
||||||
setContentView(root);
|
setContentView(root);
|
||||||
Media media = (Media) getSupportFragmentManager().findFragmentById(R.id.fragment_bfq);
|
|
||||||
media.setBfq(this);
|
|
||||||
Toolbar toolbar = inflate.toolbar;
|
Toolbar toolbar = inflate.toolbar;
|
||||||
toolbar.setNavigationOnClickListener(view1 -> finish());
|
toolbar.setNavigationOnClickListener(view1 -> finish());
|
||||||
toolbar.setOnMenuItemClickListener(item -> {
|
toolbar.setOnMenuItemClickListener(item -> {
|
||||||
|
@ -106,12 +112,6 @@ public class bfq extends AppCompatActivity {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (bfqkz.xm != null) {
|
|
||||||
Media.setname(bfqkz.xm.name);
|
|
||||||
Media.setzz(bfqkz.xm.zz);
|
|
||||||
bfq_an.islike();
|
|
||||||
bfqkz.mt.setTX();
|
|
||||||
}
|
|
||||||
inflate.download.setOnClickListener(view -> {
|
inflate.download.setOnClickListener(view -> {
|
||||||
if (wj.cz(wj.mp3 + bfqkz.xm.id)) {
|
if (wj.cz(wj.mp3 + bfqkz.xm.id)) {
|
||||||
gj.ts(this, "你已经下载过这首歌曲了");
|
gj.ts(this, "你已经下载过这首歌曲了");
|
||||||
|
@ -140,8 +140,27 @@ public class bfq extends AppCompatActivity {
|
||||||
}.start();
|
}.start();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
if (bfqkz.xm != null) {
|
||||||
|
setname(bfqkz.xm.name);
|
||||||
|
setzz(bfqkz.xm.zz);
|
||||||
|
bfq_an.islike();
|
||||||
|
bfqkz.mt.setTX();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void setname(String str) {
|
||||||
|
if (inflate == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
inflate.name.setText(str);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setzz(String str) {
|
||||||
|
if (inflate == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
inflate.zz.setText(str);
|
||||||
|
}
|
||||||
|
|
||||||
public static Bitmap bitmap;
|
public static Bitmap bitmap;
|
||||||
|
|
||||||
|
@ -152,7 +171,7 @@ public class bfq extends AppCompatActivity {
|
||||||
context.startActivity(intent);
|
context.startActivity(intent);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void kgsetImageResource(int a) {
|
public static void kgsetImageResource(int a) {
|
||||||
if (inflate == null) {
|
if (inflate == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -207,4 +226,15 @@ public class bfq extends AppCompatActivity {
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
public static void setlike(boolean bool) {
|
||||||
|
if (inflate == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
int color = R.color.text;
|
||||||
|
if (bool) {
|
||||||
|
color = android.R.color.holo_red_dark;
|
||||||
|
}
|
||||||
|
inflate.like.setImageTintList(ContextCompat.
|
||||||
|
getColorStateList(inflate.getRoot().getContext(), color));
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -120,6 +120,6 @@ public class bfq_an {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
bfqkz.like_bool = contains;
|
bfqkz.like_bool = contains;
|
||||||
Media.setlike(contains);
|
bfq.setlike(contains);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,42 +3,27 @@ package com.muqingbfq.fragment;
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
import android.os.Bundle;
|
|
||||||
import android.view.LayoutInflater;
|
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
import android.widget.SeekBar;
|
import android.widget.SeekBar;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
import androidx.annotation.Nullable;
|
|
||||||
import androidx.core.content.ContextCompat;
|
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
|
|
||||||
import com.muqingbfq.R;
|
import com.muqingbfq.R;
|
||||||
import com.muqingbfq.bfq;
|
import com.muqingbfq.bfq;
|
||||||
import com.muqingbfq.bfq_an;
|
import com.muqingbfq.bfq_an;
|
||||||
import com.muqingbfq.bfqkz;
|
import com.muqingbfq.bfqkz;
|
||||||
import com.muqingbfq.databinding.FragmentBfqBinding;
|
import com.muqingbfq.databinding.ActivityBfqBinding;
|
||||||
import com.muqingbfq.home;
|
|
||||||
import com.muqingbfq.main;
|
import com.muqingbfq.main;
|
||||||
import com.muqingbfq.mq.gj;
|
import com.muqingbfq.mq.gj;
|
||||||
|
import com.muqingbfq.view.CardImage;
|
||||||
|
|
||||||
import org.json.JSONException;
|
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
|
|
||||||
import me.wcy.lrcview.LrcView;
|
import me.wcy.lrcview.LrcView;
|
||||||
|
|
||||||
public class Media extends Fragment {
|
public class Media{
|
||||||
@SuppressLint("StaticFieldLeak")
|
|
||||||
public static LinearLayout view;
|
|
||||||
private static bfq bfq;
|
|
||||||
|
|
||||||
public void setBfq(bfq bfq) {
|
|
||||||
Media.bfq = bfq;
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressLint("StaticFieldLeak")
|
@SuppressLint("StaticFieldLeak")
|
||||||
private static TextView time_a, time_b;
|
private static TextView time_a, time_b;
|
||||||
@SuppressLint("StaticFieldLeak")
|
@SuppressLint("StaticFieldLeak")
|
||||||
|
@ -69,30 +54,21 @@ public class Media extends Fragment {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setbf(boolean bool) {
|
public static void setbf(boolean bool) {
|
||||||
if (bfq != null) {
|
if (bool) {
|
||||||
if (bool) {
|
//开始
|
||||||
//开始
|
bfq.kgsetImageResource(R.drawable.bf);
|
||||||
bfq.kgsetImageResource(R.drawable.bf);
|
} else {
|
||||||
} else {
|
//暂停
|
||||||
//暂停
|
bfq.kgsetImageResource(R.drawable.zt);
|
||||||
bfq.kgsetImageResource(R.drawable.zt);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
bfq_db.setkg(bool);
|
bfq_db.setkg(bool);
|
||||||
bfqkz.updateNotification();
|
bfqkz.updateNotification();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Media(ActivityBfqBinding binding) {
|
||||||
@Override
|
imageView = binding.cardview;
|
||||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
|
lrcview = binding.lrcView;
|
||||||
@Nullable Bundle savedInstanceState) {
|
tdt = binding.tdt;
|
||||||
if (view != null) {
|
|
||||||
return view;
|
|
||||||
}
|
|
||||||
FragmentBfqBinding inflate = FragmentBfqBinding.inflate(inflater, container, false);
|
|
||||||
view = inflate.getRoot();
|
|
||||||
inflate.cardview.addView(home.imageView);
|
|
||||||
tdt = inflate.tdt;
|
|
||||||
tdt.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
|
tdt.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
|
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
|
||||||
|
@ -112,44 +88,34 @@ public class Media extends Fragment {
|
||||||
bfqkz.mt.seekTo(seekBar.getProgress());
|
bfqkz.mt.seekTo(seekBar.getProgress());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
time_a = binding.timeA;
|
||||||
time_a = inflate.timeA;
|
time_b = binding.timeB;
|
||||||
time_b = inflate.timeB;
|
|
||||||
//初始化歌词组件
|
//初始化歌词组件
|
||||||
lrcview.setDraggable(true, (view, time) -> {
|
lrcview.setDraggable(true, (view, time) -> {
|
||||||
bfqkz.mt.seekTo(Math.toIntExact(time));
|
bfqkz.mt.seekTo(Math.toIntExact(time));
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
if (!isTablet(com.muqingbfq.bfq.context)) {
|
if (!isTablet(binding.getRoot().getContext())) {
|
||||||
lrcview.setOnTapListener((view, x, y) -> {
|
lrcview.setOnTapListener((view, x, y) -> {
|
||||||
View kp = inflate.kp1;
|
View kp = binding.kp1;
|
||||||
if (kp.getVisibility() == View.VISIBLE) {
|
if (kp.getVisibility() == View.VISIBLE) {
|
||||||
kp.setVisibility(View.GONE);
|
kp.setVisibility(View.GONE);
|
||||||
} else {
|
} else {
|
||||||
kp.setVisibility(View.VISIBLE);
|
kp.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
LinearLayout.LayoutParams layoutParams =
|
|
||||||
new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,
|
|
||||||
LinearLayout.LayoutParams.MATCH_PARENT,2);
|
|
||||||
inflate.linearlayout.addView(lrcview,layoutParams);
|
|
||||||
}else{
|
|
||||||
LinearLayout.LayoutParams layoutParams =
|
|
||||||
new LinearLayout.LayoutParams(0,
|
|
||||||
LinearLayout.LayoutParams.MATCH_PARENT,1);
|
|
||||||
inflate.linearlayout.addView(lrcview,layoutParams);
|
|
||||||
}
|
}
|
||||||
//初始化播放器列表
|
//初始化播放器列表
|
||||||
if (bfqkz.xm != null) {
|
if (bfqkz.xm != null) {
|
||||||
main.handler.removeCallbacks(bfqkz.mt.updateSeekBar); // 在播放开始时启动更新进度
|
// main.handler.removeCallbacks(bfqkz.mt.updateSeekBar); // 在播放开始时启动更新进度
|
||||||
long duration = bfqkz.mt.getDuration();
|
long duration = bfqkz.mt.getDuration();
|
||||||
tdt.setMax((int) bfqkz.mt.getDuration());
|
tdt.setMax((int) bfqkz.mt.getDuration());
|
||||||
setTime_a(bfq_an.getTime(duration));
|
setTime_a(bfq_an.getTime(duration));
|
||||||
long position = bfqkz.mt.getCurrentPosition();
|
long position = bfqkz.mt.getCurrentPosition();
|
||||||
|
// main.handler.post(bfqkz.mt.updateSeekBar); // 在播放开始时启动更新进度
|
||||||
|
loadLyric();
|
||||||
setProgress((int) position);
|
setProgress((int) position);
|
||||||
main.handler.post(bfqkz.mt.updateSeekBar); // 在播放开始时启动更新进度
|
|
||||||
}
|
}
|
||||||
return view;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isTablet(Context context) {
|
private boolean isTablet(Context context) {
|
||||||
|
@ -174,46 +140,14 @@ public class Media extends Fragment {
|
||||||
lrcview.loadLrc(a, b);
|
lrcview.loadLrc(a, b);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setlike(boolean bool) {
|
|
||||||
if (bfq == null || bfq.inflate == null) {
|
@SuppressLint("StaticFieldLeak")
|
||||||
return;
|
public static CardImage imageView;
|
||||||
}
|
|
||||||
int color = R.color.text;
|
|
||||||
if (bool) {
|
|
||||||
color = android.R.color.holo_red_dark;
|
|
||||||
}
|
|
||||||
gj.sc(color);
|
|
||||||
bfq.inflate.like.setImageTintList(ContextCompat.
|
|
||||||
getColorStateList(com.muqingbfq.bfq.context, color));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void setImageBitmap() {
|
public static void setImageBitmap() {
|
||||||
if (home.imageView == null) {
|
if (imageView == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
main.handler.post(() -> home.imageView.setImageBitmap(com.muqingbfq.bfq.bitmap));
|
main.handler.post(() -> imageView.setImage(com.muqingbfq.bfq.bitmap));
|
||||||
}
|
|
||||||
|
|
||||||
public static void setname(String str) {
|
|
||||||
if (com.muqingbfq.bfq.context == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
TextView name = com.muqingbfq.bfq.context.findViewById(R.id.name);
|
|
||||||
name.setText(str);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void setzz(String str) {
|
|
||||||
if (com.muqingbfq.bfq.context == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
TextView zz = com.muqingbfq.bfq.context.findViewById(R.id.zz);
|
|
||||||
zz.setText(str);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Context Context() {
|
|
||||||
if (view == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return view.getContext();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,46 +38,17 @@ import me.wcy.lrcview.LrcView;
|
||||||
public class home extends AppCompatActivity {
|
public class home extends AppCompatActivity {
|
||||||
@SuppressLint("StaticFieldLeak")
|
@SuppressLint("StaticFieldLeak")
|
||||||
public static AppCompatActivity appCompatActivity;
|
public static AppCompatActivity appCompatActivity;
|
||||||
@SuppressLint("StaticFieldLeak")
|
|
||||||
public static ImageView imageView;
|
|
||||||
ActivityHomeBinding binding;
|
ActivityHomeBinding binding;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
appCompatActivity = this;
|
appCompatActivity = this;
|
||||||
setTheme(R.style.Theme_muqing);
|
setTheme(R.style.Theme_muqing);
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
if (false) {
|
|
||||||
com.muqingbfq.mq.floating.start(this);
|
|
||||||
}
|
|
||||||
binding = ActivityHomeBinding.inflate(getLayoutInflater());
|
binding = ActivityHomeBinding.inflate(getLayoutInflater());
|
||||||
setContentView(binding.getRoot());
|
setContentView(binding.getRoot());
|
||||||
DisplayMetrics dm = getResources().getDisplayMetrics();
|
DisplayMetrics dm = getResources().getDisplayMetrics();
|
||||||
main.k = dm.widthPixels;
|
main.k = dm.widthPixels;
|
||||||
main.g = dm.heightPixels;
|
main.g = dm.heightPixels;
|
||||||
if (imageView == null) {
|
|
||||||
imageView = new ImageView(this);
|
|
||||||
imageView.setScaleType(ImageView.ScaleType.FIT_XY);
|
|
||||||
if (bfq.bitmap == null) {
|
|
||||||
imageView.setImageResource(R.drawable.icon);
|
|
||||||
} else {
|
|
||||||
Media.setImageBitmap();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (Media.lrcview == null) {
|
|
||||||
// 在合适的位置初始化LrcView
|
|
||||||
Media.lrcview = new LrcView(this);
|
|
||||||
// 请将Context替换为实际的上下文对象
|
|
||||||
// 设置LrcView的属性
|
|
||||||
Media.lrcview.setCurrentColor(ContextCompat.getColor(this,R.color.text));
|
|
||||||
Media.lrcview.setLabel(getString(R.string.app_name));
|
|
||||||
Media.lrcview.setCurrentTextSize(TypedValue.applyDimension(
|
|
||||||
TypedValue.COMPLEX_UNIT_SP, 16, getResources().getDisplayMetrics()));
|
|
||||||
// lrcView.setLrcPadding(16);
|
|
||||||
Media.lrcview.setCurrentTextSize(TypedValue.applyDimension(
|
|
||||||
TypedValue.COMPLEX_UNIT_SP, 20, getResources().getDisplayMetrics()));
|
|
||||||
Media.lrcview.setTimelineTextColor(ContextCompat.getColor(this,R.color.text_tm));
|
|
||||||
}
|
|
||||||
try {
|
try {
|
||||||
//初始化工具栏
|
//初始化工具栏
|
||||||
setSupportActionBar(binding.toolbar);
|
setSupportActionBar(binding.toolbar);
|
||||||
|
@ -108,7 +79,6 @@ public class home extends AppCompatActivity {
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Fragment> list = new ArrayList<>();
|
List<Fragment> list = new ArrayList<>();
|
||||||
|
|
||||||
private class adaper extends FragmentStateAdapter {
|
private class adaper extends FragmentStateAdapter {
|
||||||
public adaper(@NonNull FragmentActivity fragmentActivity) {
|
public adaper(@NonNull FragmentActivity fragmentActivity) {
|
||||||
super(fragmentActivity);
|
super(fragmentActivity);
|
||||||
|
|
|
@ -77,6 +77,9 @@ public class wj {
|
||||||
public static String dqwb(String url) {
|
public static String dqwb(String url) {
|
||||||
try {
|
try {
|
||||||
File file = new File(url);
|
File file = new File(url);
|
||||||
|
if (!file.exists()) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
FileInputStream fis = new FileInputStream(file);
|
FileInputStream fis = new FileInputStream(file);
|
||||||
BufferedReader br = new BufferedReader(new InputStreamReader(fis));
|
BufferedReader br = new BufferedReader(new InputStreamReader(fis));
|
||||||
StringBuilder str = new StringBuilder();
|
StringBuilder str = new StringBuilder();
|
||||||
|
@ -97,9 +100,6 @@ public class wj {
|
||||||
return new File(url).exists();
|
return new File(url).exists();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean cz(File file) {
|
|
||||||
return file.exists();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean sc(String url) {
|
public static boolean sc(String url) {
|
||||||
File file = new File(url);
|
File file = new File(url);
|
||||||
|
|
42
app/src/main/java/com/muqingbfq/view/CardImage.java
Normal file
42
app/src/main/java/com/muqingbfq/view/CardImage.java
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
package com.muqingbfq.view;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.graphics.Bitmap;
|
||||||
|
import android.util.AttributeSet;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
|
||||||
|
import com.bumptech.glide.Glide;
|
||||||
|
import com.google.android.material.card.MaterialCardView;
|
||||||
|
import com.muqingbfq.R;
|
||||||
|
|
||||||
|
public class CardImage extends MaterialCardView {
|
||||||
|
private ImageView imageView;
|
||||||
|
|
||||||
|
public CardImage(Context context) {
|
||||||
|
super(context);
|
||||||
|
start();
|
||||||
|
}
|
||||||
|
public CardImage(Context context, AttributeSet attrs) {
|
||||||
|
super(context, attrs);
|
||||||
|
start();
|
||||||
|
}
|
||||||
|
|
||||||
|
public CardImage(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||||
|
super(context, attrs, defStyleAttr);
|
||||||
|
start();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void start() {
|
||||||
|
imageView = new ImageView(getContext());
|
||||||
|
imageView.setScaleType(ImageView.ScaleType.FIT_XY);
|
||||||
|
addView(imageView);
|
||||||
|
setImage(R.drawable.icon);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void setImage(Object bitmap) {
|
||||||
|
Glide.with(getContext())
|
||||||
|
.load(bitmap)
|
||||||
|
.into(imageView);
|
||||||
|
}
|
||||||
|
}
|
|
@ -38,13 +38,69 @@
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</com.google.android.material.appbar.MaterialToolbar>
|
</com.google.android.material.appbar.MaterialToolbar>
|
||||||
|
|
||||||
<androidx.fragment.app.FragmentContainerView
|
<LinearLayout
|
||||||
android:id="@+id/fragment_bfq"
|
android:id="@+id/fragment_bfq"
|
||||||
android:name="com.muqingbfq.fragment.Media"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="0dp"
|
android:layout_height="0dp"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
tools:layout="@layout/fragment_bfq" />
|
android:orientation="vertical">
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/linearlayout"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
<RelativeLayout
|
||||||
|
android:id="@+id/kp1"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:gravity="center"
|
||||||
|
tools:ignore="NestedWeights">
|
||||||
|
<com.muqingbfq.view.CardImage
|
||||||
|
android:id="@+id/cardview"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
app:cardCornerRadius="16dp"
|
||||||
|
app:cardUseCompatPadding="true" />
|
||||||
|
</RelativeLayout>
|
||||||
|
<me.wcy.lrcview.LrcView
|
||||||
|
android:id="@+id/lrcView"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_weight="1"/>
|
||||||
|
</LinearLayout>
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="@color/bj"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:paddingStart="3dp"
|
||||||
|
android:paddingEnd="3dp">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/time_a"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/_00_00" />
|
||||||
|
|
||||||
|
<SeekBar
|
||||||
|
android:id="@+id/tdt"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="48dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:clickable="true"
|
||||||
|
android:focusable="true"
|
||||||
|
android:padding="6dp" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/time_b"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/_00_00" />
|
||||||
|
</LinearLayout>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
|
|
@ -1,60 +0,0 @@
|
||||||
<?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"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:orientation="vertical">
|
|
||||||
<LinearLayout
|
|
||||||
android:id="@+id/linearlayout"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="0dp"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:orientation="horizontal">
|
|
||||||
<LinearLayout
|
|
||||||
android:id="@+id/kp1"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:gravity="center"
|
|
||||||
android:orientation="vertical"
|
|
||||||
tools:ignore="NestedWeights">
|
|
||||||
<com.google.android.material.card.MaterialCardView
|
|
||||||
android:id="@+id/cardview"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
app:cardCornerRadius="16dp"
|
|
||||||
app:cardUseCompatPadding="true" />
|
|
||||||
</LinearLayout>
|
|
||||||
</LinearLayout>
|
|
||||||
<LinearLayout
|
|
||||||
android:background="@color/bj"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:gravity="center_vertical"
|
|
||||||
android:orientation="horizontal"
|
|
||||||
android:paddingStart="3dp"
|
|
||||||
android:paddingEnd="3dp">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/time_a"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="@string/_00_00" />
|
|
||||||
|
|
||||||
<SeekBar
|
|
||||||
android:id="@+id/tdt"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="48dp"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:clickable="true"
|
|
||||||
android:focusable="true"
|
|
||||||
android:padding="6dp" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/time_b"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="@string/_00_00" />
|
|
||||||
</LinearLayout>
|
|
||||||
</LinearLayout>
|
|
|
@ -38,13 +38,71 @@
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</com.google.android.material.appbar.MaterialToolbar>
|
</com.google.android.material.appbar.MaterialToolbar>
|
||||||
|
|
||||||
<androidx.fragment.app.FragmentContainerView
|
|
||||||
|
<LinearLayout
|
||||||
android:id="@+id/fragment_bfq"
|
android:id="@+id/fragment_bfq"
|
||||||
android:name="com.muqingbfq.fragment.Media"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="0dp"
|
android:layout_height="0dp"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
tools:layout="@layout/fragment_bfq" />
|
android:orientation="vertical">
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/linearlayout"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:orientation="vertical">
|
||||||
|
<RelativeLayout
|
||||||
|
android:id="@+id/kp1"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:gravity="center"
|
||||||
|
tools:ignore="NestedWeights">
|
||||||
|
<com.muqingbfq.view.CardImage
|
||||||
|
android:id="@+id/cardview"
|
||||||
|
android:layout_width="256dp"
|
||||||
|
android:layout_height="256dp"
|
||||||
|
app:cardCornerRadius="16dp"
|
||||||
|
app:cardUseCompatPadding="true" />
|
||||||
|
</RelativeLayout>
|
||||||
|
<me.wcy.lrcview.LrcView
|
||||||
|
android:id="@+id/lrcView"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_weight="3"/>
|
||||||
|
</LinearLayout>
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="@color/bj"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:paddingStart="3dp"
|
||||||
|
android:paddingEnd="3dp">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/time_a"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/_00_00" />
|
||||||
|
|
||||||
|
<SeekBar
|
||||||
|
android:id="@+id/tdt"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="48dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:clickable="true"
|
||||||
|
android:focusable="true"
|
||||||
|
android:padding="6dp" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/time_b"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/_00_00" />
|
||||||
|
</LinearLayout>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
|
|
@ -1,63 +0,0 @@
|
||||||
<?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"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:orientation="vertical">
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:id="@+id/linearlayout"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="0dp"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:orientation="vertical">
|
|
||||||
<RelativeLayout
|
|
||||||
android:id="@+id/kp1"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:gravity="center"
|
|
||||||
tools:ignore="NestedWeights">
|
|
||||||
<com.google.android.material.card.MaterialCardView
|
|
||||||
android:id="@+id/cardview"
|
|
||||||
android:layout_width="260dp"
|
|
||||||
android:layout_height="260dp"
|
|
||||||
app:cardCornerRadius="16dp" />
|
|
||||||
</RelativeLayout>
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:gravity="center_vertical"
|
|
||||||
android:orientation="horizontal"
|
|
||||||
android:background="@color/bj"
|
|
||||||
android:paddingStart="3dp"
|
|
||||||
android:paddingEnd="3dp">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/time_a"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="@string/_00_00" />
|
|
||||||
|
|
||||||
<SeekBar
|
|
||||||
android:id="@+id/tdt"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="48dp"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:clickable="true"
|
|
||||||
android:focusable="true"
|
|
||||||
android:padding="6dp" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/time_b"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="@string/_00_00" />
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
Loading…
Reference in New Issue
Block a user