添加导入歌单操作优化歌曲显示UI
This commit is contained in:
parent
f00b765c91
commit
70a2a4e8b1
|
@ -18,7 +18,7 @@ android {
|
|||
//noinspection OldTargetApi
|
||||
targetSdk 31
|
||||
versionCode 1
|
||||
versionName "1.9.3"
|
||||
versionName "1.9.5"
|
||||
|
||||
}
|
||||
compileOptions {
|
||||
|
|
|
@ -1,10 +1,6 @@
|
|||
package com.muqingbfq;
|
||||
import static android.support.v4.media.session.MediaSessionCompat.*;
|
||||
|
||||
import android.support.v4.media.session.MediaSessionCompat;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.Queue;
|
||||
|
||||
public class MP3 {
|
||||
public String id, name, zz;
|
||||
|
|
|
@ -21,6 +21,7 @@ import com.mpatric.mp3agic.Mp3File;
|
|||
import com.muqingbfq.fragment.Media;
|
||||
import com.muqingbfq.fragment.bflb_db;
|
||||
import com.muqingbfq.fragment.bfq_db;
|
||||
import com.muqingbfq.fragment.mp3;
|
||||
import com.muqingbfq.fragment.search;
|
||||
import com.muqingbfq.mq.gj;
|
||||
import com.muqingbfq.mq.wj;
|
||||
|
@ -60,7 +61,6 @@ public class MediaPlayer extends android.media.MediaPlayer {
|
|||
}
|
||||
bfq_an.xyq();
|
||||
});
|
||||
// setAudioStreamType(AudioManager.STREAM_MUSIC);
|
||||
setAudioAttributes(new AudioAttributes
|
||||
.Builder()
|
||||
.setContentType(AudioAttributes.CONTENT_TYPE_MUSIC)
|
||||
|
@ -87,9 +87,6 @@ public class MediaPlayer extends android.media.MediaPlayer {
|
|||
super.start();
|
||||
Media.setbf(true);
|
||||
}
|
||||
|
||||
// 创建 MediaItem 列表
|
||||
// public static List<MediaItem> list = new ArrayList<>();
|
||||
@Override
|
||||
public void setDataSource(String path) throws IOException {
|
||||
reset();
|
||||
|
@ -132,7 +129,6 @@ public class MediaPlayer extends android.media.MediaPlayer {
|
|||
prepare();
|
||||
setTX();
|
||||
}
|
||||
|
||||
public void setTX() {
|
||||
Glide.with(main.application)
|
||||
.asBitmap()
|
||||
|
@ -171,30 +167,30 @@ public class MediaPlayer extends android.media.MediaPlayer {
|
|||
bfqkz.notify.tzl();
|
||||
}
|
||||
Media.setImageBitmap();
|
||||
return false;
|
||||
}
|
||||
})
|
||||
.submit();
|
||||
}
|
||||
@SuppressLint("NotifyDataSetChanged")
|
||||
public void bfui() {
|
||||
String name = xm.name, zz = bfqkz.xm.zz;
|
||||
setTX();
|
||||
if (bfq.view != null) {
|
||||
Media.setProgress(0);
|
||||
bfq.setname(name);
|
||||
bfq.setzz(zz);
|
||||
bfq_an.islike();
|
||||
}
|
||||
bfq_db.setname(name + "/" + zz);
|
||||
if (com.muqingbfq.fragment.mp3.lbspq != null) {
|
||||
com.muqingbfq.fragment.mp3.lbspq.notifyDataSetChanged();
|
||||
}
|
||||
if (search.lbspq != null) {
|
||||
search.lbspq.notifyDataSetChanged();
|
||||
}
|
||||
if (bflb_db.adapter != null) {
|
||||
bflb_db.adapter.notifyDataSetChanged();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
})
|
||||
.submit();
|
||||
}
|
||||
@SuppressLint("NotifyDataSetChanged")
|
||||
public void bfui() {
|
||||
String name = xm.name, zz = bfqkz.xm.zz;
|
||||
setTX();
|
||||
if (bfq.view != null) {
|
||||
Media.setProgress(0);
|
||||
bfq.setname(name);
|
||||
bfq.setzz(zz);
|
||||
bfq_an.islike();
|
||||
}
|
||||
bfq_db.setname(name + "/" + zz);
|
||||
if (com.muqingbfq.fragment.mp3.lbspq != null) {
|
||||
new mp3.lbspq_sx();
|
||||
}
|
||||
if (search.lbspq != null) {
|
||||
search.lbspq.notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,13 +1,19 @@
|
|||
package com.muqingbfq;
|
||||
|
||||
public class XM {
|
||||
public String id, name;
|
||||
public String id, name, message;
|
||||
public Object picurl;
|
||||
public XM(String id, String name, String picurl) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.picurl = picurl;
|
||||
}
|
||||
public XM(String id, String name,String message, String picurl) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.picurl = picurl;
|
||||
this.message = message;
|
||||
}
|
||||
public XM(String id, String name, int picurl) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package com.muqingbfq;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.text.Editable;
|
||||
import android.text.TextUtils;
|
||||
|
@ -13,7 +12,6 @@ import android.view.ViewGroup;
|
|||
import android.view.inputmethod.EditorInfo;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ListView;
|
||||
import android.widget.TextView;
|
||||
|
||||
|
@ -41,7 +39,6 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
public class activity_search extends FragmentActivity {
|
||||
private EditText editText;
|
||||
private ArrayAdapter<String> adapter;
|
||||
private List<String> json_list = new ArrayList<>();
|
||||
private final List<String> list = new ArrayList<>();
|
||||
|
@ -63,8 +60,7 @@ public class activity_search extends FragmentActivity {
|
|||
binding.listRecycler.setLayoutManager(manager);
|
||||
binding.listRecycler.setAdapter(new SearchRecordAdapter());
|
||||
|
||||
editText = findViewById(R.id.editview);
|
||||
editText.setOnEditorActionListener((v, actionId, event) -> {
|
||||
binding.editview.setOnEditorActionListener((v, actionId, event) -> {
|
||||
if (actionId == EditorInfo.IME_ACTION_SEARCH) {
|
||||
String str = v.getText().toString();
|
||||
if (!str.equals("")) {
|
||||
|
@ -93,19 +89,19 @@ public class activity_search extends FragmentActivity {
|
|||
|
||||
//设置项点击监听
|
||||
listPopupWindow.setOnItemClickListener((adapterView, view, i, l) -> {
|
||||
editText.clearFocus();
|
||||
view.clearFocus();
|
||||
InputMethodManager imm = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE);
|
||||
View v = getWindow().peekDecorView();
|
||||
if (null != v) {
|
||||
imm.hideSoftInputFromWindow(v.getWindowToken(), 0);
|
||||
}
|
||||
editText.setText(list.get(i));//把选择的选项内容展示在EditText上
|
||||
binding.editview.setText(list.get(i));//把选择的选项内容展示在EditText上
|
||||
dismiss();//如果已经选择了,隐藏起来
|
||||
start(editText.getText().toString());
|
||||
start(binding.editview.getText().toString());
|
||||
|
||||
});
|
||||
Object o = new Object();
|
||||
editText.addTextChangedListener(new TextWatcher() {
|
||||
binding.editview.addTextChangedListener(new TextWatcher() {
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
||||
}
|
||||
|
@ -147,20 +143,13 @@ public class activity_search extends FragmentActivity {
|
|||
public void afterTextChanged(Editable s) {
|
||||
}
|
||||
});
|
||||
|
||||
binding.editview.requestFocus();//获取焦点
|
||||
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
//if (!imm.isActive()) //没有显示键盘,弹出
|
||||
imm.showSoftInput(binding.editview, 0);
|
||||
gj.tcjp(binding.editview);
|
||||
}
|
||||
|
||||
public void dismiss() {
|
||||
binding.editview.clearFocus();
|
||||
listPopupWindow.setVisibility(View.GONE);
|
||||
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
if (imm.isActive()) //有显示键盘,隐藏
|
||||
imm.hideSoftInputFromWindow(binding.editview.getWindowToken(),
|
||||
InputMethodManager.HIDE_NOT_ALWAYS);
|
||||
gj.ycjp(binding.editview);
|
||||
}
|
||||
|
||||
@SuppressLint("NotifyDataSetChanged")
|
||||
|
@ -190,7 +179,7 @@ public class activity_search extends FragmentActivity {
|
|||
if (itemId == android.R.id.home) {
|
||||
finish();
|
||||
} else if (itemId == R.id.menu_search) {
|
||||
start(editText.getText().toString());
|
||||
start(binding.editview.getText().toString());
|
||||
}
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
@ -238,7 +227,7 @@ public class activity_search extends FragmentActivity {
|
|||
String keyword = json_list.get(position);
|
||||
holder.recordTextView.setText(keyword);
|
||||
holder.recordTextView.setOnClickListener(v -> {
|
||||
editText.setText(keyword);
|
||||
binding.editview.setText(keyword);
|
||||
start(keyword);
|
||||
});
|
||||
holder.recordTextView.setOnLongClickListener(view -> {
|
||||
|
|
|
@ -122,6 +122,7 @@ public class FileDownloader {
|
|||
outputStream = new FileOutputStream(outputFile);
|
||||
|
||||
int read;
|
||||
fileSizeDownloaded = 0;
|
||||
while ((read = inputStream.read(buffer)) != -1) {
|
||||
outputStream.write(buffer, 0, read);
|
||||
fileSizeDownloaded += read;
|
||||
|
|
|
@ -23,6 +23,14 @@ import java.util.List;
|
|||
public class playlist extends Thread {
|
||||
public static final String api = "/playlist/track/all?id=";
|
||||
|
||||
public static String gethq(String uid) {
|
||||
if (wj.cz(wj.filesdri + "user.mq")) {
|
||||
return wl.hq(api + uid + "&limit=100" + "&cookie=" + wl.Cookie);
|
||||
// gj.sc(hq);
|
||||
} else {
|
||||
return wl.hq(api + uid + "&limit=100");
|
||||
}
|
||||
}
|
||||
@SuppressLint("NotifyDataSetChanged")
|
||||
public static boolean hq(List<MP3> list, String uid) {
|
||||
switch (uid) {
|
||||
|
@ -39,11 +47,7 @@ public class playlist extends Thread {
|
|||
if (wj.cz(wj.gd + uid)) {
|
||||
hq = wj.dqwb(wj.gd + uid);
|
||||
} else {
|
||||
if (wj.cz(wj.filesdri + "user.mq")) {
|
||||
hq = wl.hq(api + uid + "&limit=100" + "&cookie=" + wl.Cookie);
|
||||
} else {
|
||||
hq = wl.hq(api + uid + "&limit=100");
|
||||
}
|
||||
hq = gethq(uid);
|
||||
}
|
||||
JSONObject json = new JSONObject(hq);
|
||||
JSONArray songs = json.getJSONArray("songs");
|
||||
|
@ -52,7 +56,14 @@ public class playlist extends Thread {
|
|||
JSONObject jsonObject = songs.getJSONObject(i);
|
||||
String id = jsonObject.getString("id");
|
||||
String name = jsonObject.getString("name");
|
||||
|
||||
try {
|
||||
String tns = jsonObject.getString("tns");
|
||||
tns = tns.replace("[\"", "(");
|
||||
tns = tns.replace("\"]", ")");
|
||||
name += tns;
|
||||
} catch (Exception e) {
|
||||
gj.sc(e);
|
||||
}
|
||||
JSONObject al = jsonObject.getJSONObject("al");
|
||||
JSONArray ar = jsonObject.getJSONArray("ar");
|
||||
StringBuilder zz = new StringBuilder();
|
||||
|
@ -95,13 +106,15 @@ public class playlist extends Thread {
|
|||
try {
|
||||
File file = new File(wj.filesdri + "mp3");
|
||||
File[] files = file.listFiles();
|
||||
int i = 0;
|
||||
for (File value : files) {
|
||||
ID3v2 mp3File = new Mp3File(value).getId3v2Tag();
|
||||
String id = value.getName();
|
||||
String name = mp3File.getTitle();
|
||||
String zz = mp3File.getArtist();
|
||||
String picUrl = mp3File.getUrl();
|
||||
list.add(new MP3(id, name, zz, picUrl));
|
||||
list.add(new MP3(id, name, zz.toString(), picUrl));
|
||||
i++;
|
||||
}
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
|
|
|
@ -29,6 +29,8 @@ public class url extends Thread {
|
|||
}
|
||||
|
||||
public static String hq(MP3 x) {
|
||||
getLrc(x.id);
|
||||
Media.loadLyric();
|
||||
try {
|
||||
if (wj.cz(wj.mp3 + x.id)) {
|
||||
return wj.mp3 + x.id;
|
||||
|
@ -47,7 +49,7 @@ public class url extends Thread {
|
|||
return null;
|
||||
}
|
||||
JSONObject json = new JSONObject(hq);
|
||||
gj.sc(json);
|
||||
// gj.sc(json);
|
||||
if (json.getInt("code") == -460) {
|
||||
String message = json.getString("message");
|
||||
main.handler.post(() -> {
|
||||
|
@ -57,15 +59,10 @@ public class url extends Thread {
|
|||
});
|
||||
return null;
|
||||
}
|
||||
getLrc(x.id);
|
||||
Media.loadLyric();
|
||||
JSONArray data = json.getJSONArray("data");
|
||||
JSONObject jsonObject = data.getJSONObject(0);
|
||||
String url = jsonObject.getString("url");
|
||||
if (wiFiConnected) {
|
||||
new FileDownloader(url, x,true);
|
||||
}
|
||||
return url;
|
||||
gj.sc(jsonObject.getString("url"));
|
||||
return jsonObject.getString("url");
|
||||
} catch (JSONException e) {
|
||||
yc.start("url hq :" + e);
|
||||
}
|
||||
|
|
|
@ -27,7 +27,6 @@ import java.util.List;
|
|||
public class bfqkz extends MediaBrowserServiceCompat {
|
||||
public static MediaPlayer mt = new MediaPlayer();
|
||||
public static List<MP3> list = new ArrayList<>();
|
||||
|
||||
//保存原始list顺序
|
||||
public static List<MP3> list_baocun = new ArrayList<>();
|
||||
public static List<MP3> lishi_list = new ArrayList<>();
|
||||
|
@ -52,7 +51,6 @@ public class bfqkz extends MediaBrowserServiceCompat {
|
|||
if (id == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (TextUtils.isEmpty(id)) {
|
||||
//针对错误进行相应的处理
|
||||
bfqkz.list.remove(bfqkz.xm);
|
||||
|
|
|
@ -136,9 +136,6 @@ public class Media {
|
|||
if (bfq.view == null) {
|
||||
return;
|
||||
}
|
||||
if (bfq.bitmap == null) {
|
||||
bfq.bitmap= BitmapFactory.decodeResource(bfq.view.getResources(), R.drawable.icon);
|
||||
}
|
||||
main.handler.post(() -> bfq.binding.cardview.setImage(com.muqingbfq.bfq.bitmap));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@ import com.muqingbfq.R;
|
|||
import com.muqingbfq.api.url;
|
||||
import com.muqingbfq.bfqkz;
|
||||
import com.muqingbfq.databinding.FragmentBflbDbBinding;
|
||||
import com.muqingbfq.databinding.ListMp3Binding;
|
||||
import com.muqingbfq.list.MyViewHoder;
|
||||
import com.muqingbfq.main;
|
||||
import com.muqingbfq.yc;
|
||||
|
@ -82,21 +83,22 @@ public class bflb_db extends BottomSheetDialog {
|
|||
@NonNull
|
||||
@Override
|
||||
public MyViewHoder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.list_mp3, parent, false);
|
||||
return new MyViewHoder(view);
|
||||
// View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.list_mp3, parent, false);
|
||||
return new MyViewHoder(ListMp3Binding.
|
||||
inflate(getLayoutInflater(),parent,false));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull MyViewHoder holder, int position) {
|
||||
MP3 x = bfqkz.list.get(position);
|
||||
holder.name.setText(x.name);
|
||||
holder.zz.setText(x.zz);
|
||||
holder.binding.name.setText(x.name);
|
||||
holder.binding.zz.setText(x.zz);
|
||||
int color = ContextCompat.getColor(holder.getContext(), R.color.text);
|
||||
if (bfqkz.xm != null && x.id.equals(bfqkz.xm.id)) {
|
||||
color = ContextCompat.getColor(holder.getContext(), R.color.text_cz);
|
||||
}
|
||||
holder.name.setTextColor(color);
|
||||
holder.zz.setTextColor(color);
|
||||
holder.binding.name.setTextColor(color);
|
||||
holder.binding.zz.setTextColor(color);
|
||||
holder.itemView.setOnClickListener(view -> {
|
||||
if (bfqkz.xm != x) {
|
||||
bfqkz.xm = x;
|
||||
|
|
|
@ -25,6 +25,8 @@ import com.muqingbfq.api.resource;
|
|||
import com.muqingbfq.bfq_an;
|
||||
import com.muqingbfq.bfqkz;
|
||||
import com.muqingbfq.databinding.FragmentMp3Binding;
|
||||
import com.muqingbfq.databinding.ListGdBBinding;
|
||||
import com.muqingbfq.databinding.ListGdBinding;
|
||||
import com.muqingbfq.main;
|
||||
import com.muqingbfq.mq.gj;
|
||||
import com.muqingbfq.mq.wj;
|
||||
|
@ -45,6 +47,7 @@ public class gd extends com.muqingbfq.mq.FragmentActivity {
|
|||
private final List<XM> list = new ArrayList<>();
|
||||
public static RecyclerView.Adapter<VH> adapter;
|
||||
int k;
|
||||
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
@ -52,7 +55,7 @@ public class gd extends com.muqingbfq.mq.FragmentActivity {
|
|||
setContentView(binding.getRoot());
|
||||
Intent intent = getIntent();
|
||||
binding.title.setText(intent.getStringExtra("name"));
|
||||
adapter = new baseadapter(this,list);
|
||||
adapter = new baseadapter(this, list);
|
||||
k = (int) (main.k / getResources().getDisplayMetrics().density + 0.5f);
|
||||
GridLayoutManager gridLayoutManager = new GridLayoutManager(this, k / 120);
|
||||
binding.lb.setLayoutManager(gridLayoutManager);
|
||||
|
@ -64,6 +67,7 @@ public class gd extends com.muqingbfq.mq.FragmentActivity {
|
|||
@SuppressLint("NotifyDataSetChanged")
|
||||
class start extends Thread {
|
||||
String id;
|
||||
|
||||
public start(String id) {
|
||||
this.id = id;
|
||||
list.clear();
|
||||
|
@ -97,7 +101,7 @@ public class gd extends com.muqingbfq.mq.FragmentActivity {
|
|||
}
|
||||
}
|
||||
|
||||
public static class baseadapter extends RecyclerView.Adapter<VH>{
|
||||
public static class baseadapter extends RecyclerView.Adapter<VH> {
|
||||
Context context;
|
||||
List<XM> list;
|
||||
|
||||
|
@ -107,6 +111,7 @@ public class gd extends com.muqingbfq.mq.FragmentActivity {
|
|||
}
|
||||
|
||||
boolean bool = false;
|
||||
|
||||
public baseadapter(Context context, List<XM> list, boolean bool) {
|
||||
this.context = context;
|
||||
this.list = list;
|
||||
|
@ -117,11 +122,11 @@ public class gd extends com.muqingbfq.mq.FragmentActivity {
|
|||
@Override
|
||||
public VH onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
if (bool) {
|
||||
return new VH(LayoutInflater.from(context)
|
||||
.inflate(R.layout.list_gd_b, parent, false));
|
||||
return new VH(ListGdBBinding.bind(LayoutInflater.from(context)
|
||||
.inflate(R.layout.list_gd_b, parent, false)));
|
||||
}
|
||||
return new VH(LayoutInflater.from(context)
|
||||
.inflate(R.layout.list_gd, parent, false));
|
||||
return new VH(ListGdBinding.bind(LayoutInflater.from(context)
|
||||
.inflate(R.layout.list_gd, parent, false)));
|
||||
}
|
||||
|
||||
public void setList(List<XM> list) {
|
||||
|
@ -134,12 +139,13 @@ public class gd extends com.muqingbfq.mq.FragmentActivity {
|
|||
CARD card = new CARD(position);
|
||||
if (bool) {
|
||||
holder.itemView.setOnClickListener(card);
|
||||
holder.bindingB.text2.setText(xm.message);
|
||||
holder.itemView.setOnLongClickListener(card);
|
||||
} else {
|
||||
holder.image.setOnClickListener(card);
|
||||
holder.image.setOnLongClickListener(card);
|
||||
holder.binding.image.setOnClickListener(card);
|
||||
holder.binding.image.setOnLongClickListener(card);
|
||||
}
|
||||
holder.textView.setText(xm.name);
|
||||
holder.title.setText(xm.name);
|
||||
holder.kg.setOnClickListener(view1 -> {
|
||||
ImageView tx = (ImageView) view1;
|
||||
new Thread() {
|
||||
|
@ -208,7 +214,7 @@ public class gd extends com.muqingbfq.mq.FragmentActivity {
|
|||
@Override
|
||||
public void run() {
|
||||
if (id == 0) {
|
||||
String hq = wl.hq(playlist.api + xm.id + "&limit=100");
|
||||
String hq = playlist.gethq(xm.id);
|
||||
if (hq != null) {
|
||||
wj.xrwb(wj.gd + xm.id, hq);
|
||||
try {
|
||||
|
@ -235,15 +241,14 @@ public class gd extends com.muqingbfq.mq.FragmentActivity {
|
|||
jsonObject.remove(xm.id);
|
||||
list.remove(xm);
|
||||
wj.xrwb(wj.gd_xz, jsonObject.toString());
|
||||
main.handler.post(() -> notifyItemChanged(position));
|
||||
} catch (JSONException e) {
|
||||
gj.sc(e);
|
||||
}
|
||||
}
|
||||
main.handler.post(() -> notifyItemChanged(position));
|
||||
}
|
||||
}.start();
|
||||
// 在这里处理菜单项的点击事件
|
||||
dialog.dismiss();
|
||||
}).show();
|
||||
return false;
|
||||
}
|
||||
|
@ -253,17 +258,29 @@ public class gd extends com.muqingbfq.mq.FragmentActivity {
|
|||
}
|
||||
|
||||
static class VH extends RecyclerView.ViewHolder {
|
||||
TextView textView;
|
||||
ImageView kg;
|
||||
CardImage image;
|
||||
public ListGdBinding binding;
|
||||
public ImageView kg;
|
||||
public CardImage image;
|
||||
public TextView title;
|
||||
public VH(@NonNull ListGdBinding itemView) {
|
||||
super(itemView.getRoot());
|
||||
binding = itemView;
|
||||
title = binding.wb1;
|
||||
kg = binding.kg;
|
||||
image = binding.image;
|
||||
}
|
||||
|
||||
public VH(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
textView = itemView.findViewById(R.id.wb1);
|
||||
image = itemView.findViewById(R.id.image);
|
||||
kg = itemView.findViewById(R.id.kg);
|
||||
ListGdBBinding bindingB;
|
||||
|
||||
public VH(@NonNull ListGdBBinding itemView) {
|
||||
super(itemView.getRoot());
|
||||
bindingB = itemView;
|
||||
title = bindingB.text1;
|
||||
kg = bindingB.kg;
|
||||
image = bindingB.image;
|
||||
}
|
||||
}
|
||||
|
||||
private class lbspq_sx implements Runnable {
|
||||
@SuppressLint("NotifyDataSetChanged")
|
||||
@Override
|
||||
|
|
|
@ -19,12 +19,12 @@ import com.muqingbfq.R;
|
|||
import com.muqingbfq.XM;
|
||||
import com.muqingbfq.api.resource;
|
||||
import com.muqingbfq.api.url;
|
||||
import com.muqingbfq.bfq;
|
||||
import com.muqingbfq.bfqkz;
|
||||
import com.muqingbfq.databinding.FragmentGdBinding;
|
||||
import com.muqingbfq.databinding.ListMp3ImageBinding;
|
||||
import com.muqingbfq.main;
|
||||
import com.muqingbfq.mq.gj;
|
||||
import com.muqingbfq.mq.wj;
|
||||
import com.muqingbfq.mq.wl;
|
||||
|
||||
import org.json.JSONArray;
|
||||
|
@ -91,8 +91,12 @@ public class gd_adapter extends Fragment {
|
|||
bfqkz.xm = x;
|
||||
new url(x);
|
||||
notifyDataSetChanged();
|
||||
} else if (!bfqkz.mt.isPlaying()) {
|
||||
bfqkz.mt.start();
|
||||
}
|
||||
if (!bfqkz.list.contains(x)) {
|
||||
bfqkz.list.add(0, x);
|
||||
}
|
||||
bfqkz.list.add(0, x);
|
||||
// bfqkz.list.addAll(list);
|
||||
// bfq.start(getContext());
|
||||
});
|
||||
|
@ -134,6 +138,9 @@ public class gd_adapter extends Fragment {
|
|||
public void run() {
|
||||
super.run();
|
||||
String hq = wl.hq("/recommend/songs" + "?cookie=" + wl.Cookie);
|
||||
if (hq == null) {
|
||||
hq = wj.dqwb(wj.filesdri + "songs.josn");
|
||||
}
|
||||
try {
|
||||
JSONObject jsonObject = new JSONObject(hq);
|
||||
JSONObject data = jsonObject.getJSONObject("data");
|
||||
|
@ -151,6 +158,7 @@ public class gd_adapter extends Fragment {
|
|||
String picUrl = al.getString("picUrl");
|
||||
listmp3.add(new MP3(id, name, zz.toString(), picUrl));
|
||||
}
|
||||
wj.xrwb(wj.filesdri + "songs.josn", hq);
|
||||
main.handler.post(() -> binding.recyclerview2.getAdapter().notifyDataSetChanged());
|
||||
} catch (Exception e) {
|
||||
gj.sc(e);
|
||||
|
|
|
@ -4,84 +4,132 @@ import android.annotation.SuppressLint;
|
|||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.text.Editable;
|
||||
import android.text.TextWatcher;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Filter;
|
||||
import android.widget.Filterable;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.recyclerview.widget.DividerItemDecoration;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.google.android.material.bottomsheet.BottomSheetDialog;
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import com.muqingbfq.MP3;
|
||||
import com.muqingbfq.R;
|
||||
import com.muqingbfq.XM;
|
||||
import com.muqingbfq.api.FileDownloader;
|
||||
import com.muqingbfq.api.playlist;
|
||||
import com.muqingbfq.api.resource;
|
||||
import com.muqingbfq.api.url;
|
||||
import com.muqingbfq.bfq;
|
||||
import com.muqingbfq.bfqkz;
|
||||
import com.muqingbfq.databinding.FragmentMp3Binding;
|
||||
import com.muqingbfq.databinding.ListMp3Binding;
|
||||
import com.muqingbfq.list.MyViewHoder;
|
||||
import com.muqingbfq.main;
|
||||
import com.muqingbfq.mq.FragmentActivity;
|
||||
import com.muqingbfq.mq.gj;
|
||||
import com.muqingbfq.mq.wj;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
public class mp3 extends FragmentActivity {
|
||||
private final List<MP3> list = new ArrayList<>();
|
||||
public static RecyclerView.Adapter<MyViewHoder> lbspq;
|
||||
|
||||
private List<MP3> list = new ArrayList<>();
|
||||
private List<MP3> list_ys = new ArrayList<>();
|
||||
public static adaper lbspq;
|
||||
FragmentMp3Binding binding;
|
||||
// private static String id;
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
FragmentMp3Binding inflate = FragmentMp3Binding.inflate(getLayoutInflater());
|
||||
binding = FragmentMp3Binding.inflate(getLayoutInflater());
|
||||
Intent intent = getIntent();
|
||||
inflate.title.setText(intent.getStringExtra("name"));
|
||||
// inflate.toolbar.setTitle(intent.getStringExtra("name"));
|
||||
setContentView(inflate.getRoot());
|
||||
lbspq = new spq();
|
||||
RecyclerView lb = findViewById(R.id.lb);
|
||||
LinearLayoutManager layoutManager = new LinearLayoutManager(this);
|
||||
lb.setLayoutManager(layoutManager);
|
||||
lb.setAdapter(lbspq);
|
||||
binding.title.setText(intent.getStringExtra("name"));
|
||||
String id = intent.getStringExtra("id");
|
||||
|
||||
// inflate.bfqDb.setBackground(gd.color);
|
||||
setContentView(binding.getRoot());
|
||||
lbspq = new adaper(list);
|
||||
binding.lb.setLayoutManager(new LinearLayoutManager(this));
|
||||
binding.lb.setAdapter(lbspq);
|
||||
new start(id);
|
||||
binding.edittext.addTextChangedListener(new TextWatcher() {
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
|
||||
if (binding.edittext.getVisibility() == View.VISIBLE) {
|
||||
lbspq.getFilter().filter(charSequence);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable editable) {
|
||||
|
||||
}
|
||||
});
|
||||
//添加Android自带的分割线
|
||||
binding.lb.addItemDecoration(
|
||||
new DividerItemDecoration(this,DividerItemDecoration.VERTICAL));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
MenuItem itemA = menu.add("下载所有歌曲");
|
||||
itemA.setTitle("下载所有歌曲");
|
||||
itemA.setIcon(R.drawable.download);
|
||||
MenuItem itemA = menu.add("搜索");
|
||||
itemA.setTitle("搜索");
|
||||
itemA.setIcon(R.drawable.sousuo);
|
||||
itemA.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
|
||||
gj.sc(itemA.getItemId());
|
||||
return super.onCreateOptionsMenu(menu);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
|
||||
if (item.getItemId() == 0) {
|
||||
FileDownloader fileDownloader = new FileDownloader(
|
||||
mp3.
|
||||
this);
|
||||
for (MP3 mp3 : list) {
|
||||
new Thread(){
|
||||
@Override
|
||||
public void run() {
|
||||
super.run();
|
||||
fileDownloader.downloadFile(mp3);
|
||||
}
|
||||
}.start();
|
||||
int itemId = item.getItemId();
|
||||
if (itemId == android.R.id.home) {
|
||||
if (binding.edittext.getVisibility() == View.VISIBLE) {
|
||||
binding.title.setVisibility(View.VISIBLE);
|
||||
binding.edittext.setVisibility(View.GONE);
|
||||
} else {
|
||||
finish();
|
||||
}
|
||||
gj.ycjp(binding.edittext);
|
||||
lbspq.getFilter().filter("");
|
||||
} else if (itemId == 0) {
|
||||
binding.title.setVisibility(View.GONE);
|
||||
binding.edittext.setVisibility(View.VISIBLE);
|
||||
gj.tcjp(binding.edittext);
|
||||
}
|
||||
return super.onOptionsItemSelected(item);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
if (binding.edittext.getVisibility() == View.VISIBLE) {
|
||||
binding.title.setVisibility(View.VISIBLE);
|
||||
binding.edittext.setVisibility(View.GONE);
|
||||
} else {
|
||||
finish();
|
||||
}
|
||||
gj.ycjp(binding.edittext);
|
||||
lbspq.getFilter().filter("");
|
||||
}
|
||||
|
||||
@SuppressLint("NotifyDataSetChanged")
|
||||
|
@ -91,7 +139,7 @@ public class mp3 extends FragmentActivity {
|
|||
public start(String id) {
|
||||
this.id = id;
|
||||
list.clear();
|
||||
mp3.lbspq.notifyDataSetChanged();
|
||||
list_ys.clear();
|
||||
start();
|
||||
}
|
||||
|
||||
|
@ -105,6 +153,7 @@ public class mp3 extends FragmentActivity {
|
|||
} else {
|
||||
playlist.hq(list, id);
|
||||
}
|
||||
list_ys = list;
|
||||
main.handler.post(new lbspq_sx());
|
||||
}
|
||||
}
|
||||
|
@ -117,25 +166,34 @@ public class mp3 extends FragmentActivity {
|
|||
}
|
||||
}
|
||||
|
||||
class spq extends RecyclerView.Adapter<MyViewHoder> {
|
||||
public static class adaper extends RecyclerView.Adapter<MyViewHoder> implements Filterable {
|
||||
|
||||
private List<MP3> list;
|
||||
private List<MP3> list_ys;
|
||||
public adaper(List list) {
|
||||
this.list = list;
|
||||
list_ys = list;
|
||||
}
|
||||
@NonNull
|
||||
@Override
|
||||
public MyViewHoder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.list_mp3, parent, false);
|
||||
return new MyViewHoder(view);
|
||||
return new MyViewHoder(ListMp3Binding.bind(LayoutInflater.from(parent.getContext()).
|
||||
inflate(R.layout.list_mp3,
|
||||
parent, false)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull MyViewHoder holder, int position) {
|
||||
MP3 x = list.get(position);
|
||||
holder.name.setText(x.name);
|
||||
holder.zz.setText(x.zz);
|
||||
holder.binding.text1.setText(String.valueOf(position + 1));
|
||||
holder.binding.name.setText(x.name);
|
||||
holder.binding.zz.setText(x.zz);
|
||||
int color = ContextCompat.getColor(holder.getContext(), R.color.text);
|
||||
if (bfqkz.xm != null && x.id.equals(bfqkz.xm.id)) {
|
||||
color = ContextCompat.getColor(holder.getContext(), R.color.text_cz);
|
||||
}
|
||||
holder.name.setTextColor(color);
|
||||
holder.zz.setTextColor(color);
|
||||
holder.binding.name.setTextColor(color);
|
||||
holder.binding.zz.setTextColor(color);
|
||||
holder.itemView.setOnClickListener(view -> {
|
||||
if (bfqkz.xm == null || !bfqkz.xm.id.equals(x.id)) {
|
||||
bfqkz.xm = x;
|
||||
|
@ -143,7 +201,48 @@ public class mp3 extends FragmentActivity {
|
|||
}
|
||||
bfqkz.list.clear();
|
||||
bfqkz.list.addAll(list);
|
||||
bfq.start(mp3.this);
|
||||
bfq.start(holder.getContext());
|
||||
});
|
||||
holder.itemView.setOnLongClickListener(view -> {
|
||||
String a[] = new String[]{"喜欢歌曲", "下载歌曲", "复制名字"};
|
||||
new MaterialAlertDialogBuilder(view.getContext()).
|
||||
setItems(a, (dialog, id) -> {
|
||||
String title = a[id];
|
||||
switch (title) {
|
||||
case "下载歌曲":
|
||||
new FileDownloader(view.getContext()).downloadFile(x);
|
||||
break;
|
||||
case "喜欢歌曲":
|
||||
try {
|
||||
Gson gson = new Gson();
|
||||
Type type = new TypeToken<List<MP3>>() {
|
||||
}.getType();
|
||||
List<MP3> list = gson.fromJson(wj.dqwb(wj.gd + "mp3_like.json"), type);
|
||||
if (list == null) {
|
||||
list = new ArrayList<>();
|
||||
}
|
||||
if (bfqkz.like_bool) {
|
||||
list.remove(bfqkz.xm);
|
||||
bfq.setlike(false);
|
||||
} else {
|
||||
if (!list.contains(bfqkz.xm)) {
|
||||
list.add(bfqkz.xm);
|
||||
bfq.setlike(true);
|
||||
}
|
||||
}
|
||||
bfqkz.like_bool = !bfqkz.like_bool;
|
||||
wj.xrwb(wj.gd + "mp3_like.json", gson.toJson(list));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
break;
|
||||
case "复制名字":
|
||||
gj.fz(view.getContext(), x.name);
|
||||
break;
|
||||
|
||||
}
|
||||
}).show();
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -151,6 +250,42 @@ public class mp3 extends FragmentActivity {
|
|||
public int getItemCount() {
|
||||
return list.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Filter getFilter() {
|
||||
return new Filter() {
|
||||
@Override
|
||||
protected FilterResults performFiltering(CharSequence charSequence) {
|
||||
String charString = charSequence.toString();
|
||||
if (charString.isEmpty()) {
|
||||
//没有过滤的内容,则使用源数据
|
||||
list = list_ys;
|
||||
} else {
|
||||
List<MP3> filteredList = new ArrayList<>();
|
||||
for (int i = 0; i < list_ys.size(); i++) {
|
||||
MP3 mp3 = list_ys.get(i);
|
||||
if (mp3.name.contains(charString)
|
||||
|| mp3.zz.contains(charString)) {
|
||||
filteredList.add(list_ys.get(i));
|
||||
}
|
||||
}
|
||||
list = filteredList;
|
||||
}
|
||||
|
||||
FilterResults filterResults = new FilterResults();
|
||||
filterResults.values = list;
|
||||
return filterResults;
|
||||
}
|
||||
|
||||
@SuppressLint("NotifyDataSetChanged")
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
protected void publishResults(CharSequence charSequence, FilterResults filterResults) {
|
||||
list = (List<MP3>) filterResults.values;
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -9,7 +9,6 @@ import android.view.ViewGroup;
|
|||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.recyclerview.widget.GridLayoutManager;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
|
@ -17,20 +16,17 @@ import androidx.recyclerview.widget.RecyclerView;
|
|||
|
||||
import com.google.android.material.tabs.TabLayout;
|
||||
import com.muqingbfq.MP3;
|
||||
import com.muqingbfq.R;
|
||||
import com.muqingbfq.api.url;
|
||||
import com.muqingbfq.bfq;
|
||||
import com.muqingbfq.bfqkz;
|
||||
import com.muqingbfq.XM;
|
||||
import com.muqingbfq.databinding.FragmentSearchBinding;
|
||||
import com.muqingbfq.list.MyViewHoder;
|
||||
import com.muqingbfq.main;
|
||||
import com.muqingbfq.mq.gj;
|
||||
import com.muqingbfq.mq.wl;
|
||||
import com.muqingbfq.XM;
|
||||
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
@ -48,7 +44,7 @@ public class search extends Fragment {
|
|||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
|
||||
@Nullable Bundle savedInstanceState) {
|
||||
inflate = FragmentSearchBinding.inflate(inflater, container, false);
|
||||
lbspq = new spq();
|
||||
lbspq = new mp3.adaper(list);
|
||||
View view = inflate.getRoot();
|
||||
TypedValue typedValue = new TypedValue();
|
||||
requireContext().getTheme().resolveAttribute(android.R.attr.windowBackground, typedValue, true);
|
||||
|
@ -90,15 +86,13 @@ public class search extends Fragment {
|
|||
|
||||
public void setStart(String name) {
|
||||
if (i == 0) {
|
||||
new spq();
|
||||
new mp3.adaper(list);
|
||||
inflate.recyclerview.setLayoutManager(new LinearLayoutManager(getContext()));
|
||||
inflate.recyclerview.setAdapter(lbspq);
|
||||
} else if (i == 1) {
|
||||
k = (int) (main.k / getResources().getDisplayMetrics().density + 0.5f) / 120;
|
||||
GridLayoutManager gridLayoutManager = new GridLayoutManager(getContext(),
|
||||
k);
|
||||
inflate.recyclerview.setLayoutManager(gridLayoutManager);
|
||||
inflate.recyclerview.setAdapter(new gd.baseadapter(getContext(), xmList));
|
||||
inflate.recyclerview.setLayoutManager(new LinearLayoutManager(getContext()));
|
||||
inflate.recyclerview.setAdapter(new gd.baseadapter(getContext(), xmList, true));
|
||||
}
|
||||
new start(name);
|
||||
}
|
||||
|
@ -175,23 +169,34 @@ public class search extends Fragment {
|
|||
gj.sc(e);
|
||||
}
|
||||
try {
|
||||
String hq = wl.hq("/search?keywords=" + name + "&limit=" + (k * 3) + "&type=1000");
|
||||
String hq = wl.hq("/search?keywords=" + name +"&type=1000");
|
||||
JSONArray jsonArray = new JSONObject(hq).getJSONObject("result")
|
||||
.getJSONArray("playlists");
|
||||
int length = jsonArray.length();
|
||||
for (int i = 0; i < length; i++) {
|
||||
JSONObject jsonObject = jsonArray.getJSONObject(i);
|
||||
String id = jsonObject.getString("id");
|
||||
int trackCount = jsonObject.getInt("trackCount");
|
||||
|
||||
String nickname = "by " + jsonObject.getJSONObject("creator")
|
||||
.getString("nickname");
|
||||
long playCount = jsonObject.getLong("playCount");
|
||||
String name = jsonObject.getString("name");
|
||||
String coverImgUrl = jsonObject.getString("coverImgUrl");
|
||||
// gj.sc(name);
|
||||
xmList.add(new XM(id, name, coverImgUrl));
|
||||
String formattedNumber = String.valueOf(playCount);
|
||||
if (playCount > 9999) {
|
||||
DecimalFormat df = new DecimalFormat("#,###.0万");
|
||||
formattedNumber = df.format(playCount / 10000);
|
||||
}
|
||||
xmList.add(new XM(id, name, trackCount + "首," + nickname + ",播放"
|
||||
+ formattedNumber + "次", coverImgUrl));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
gj.sc(e);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
class spq extends RecyclerView.Adapter<MyViewHoder> {
|
||||
public spq() {
|
||||
lbspq = this;
|
||||
|
@ -200,22 +205,21 @@ public class search extends Fragment {
|
|||
@NonNull
|
||||
@Override
|
||||
public MyViewHoder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
View view = LayoutInflater.
|
||||
from(parent.getContext()).inflate(R.layout.list_mp3, parent, false);
|
||||
return new MyViewHoder(view);
|
||||
return new MyViewHoder(ListMp3Binding.
|
||||
inflate(getLayoutInflater(),parent,false));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull MyViewHoder holder, int position) {
|
||||
MP3 x = list.get(position);
|
||||
holder.name.setText(x.name);
|
||||
holder.zz.setText(x.zz);
|
||||
holder.binding.name.setText(x.name);
|
||||
holder.binding.zz.setText(x.zz);
|
||||
int color = ContextCompat.getColor(holder.getContext(), R.color.text);
|
||||
if (bfqkz.xm != null && x.id.equals(bfqkz.xm.id)) {
|
||||
color = ContextCompat.getColor(holder.getContext(), R.color.text_cz);
|
||||
}
|
||||
holder.name.setTextColor(color);
|
||||
holder.zz.setTextColor(color);
|
||||
holder.binding.name.setTextColor(color);
|
||||
holder.binding.zz.setTextColor(color);
|
||||
holder.itemView.setOnClickListener(view1 -> {
|
||||
if (bfqkz.xm == null || !bfqkz.xm.id.equals(x.id)) {
|
||||
bfqkz.xm = x;
|
||||
|
@ -233,5 +237,5 @@ public class search extends Fragment {
|
|||
public int getItemCount() {
|
||||
return list.size();
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
|
|
@ -47,9 +47,6 @@ public class sz {
|
|||
} else if (id == R.id.f) {
|
||||
context.startActivity(new Intent(context, activity_about_software.class));
|
||||
// 关于软件
|
||||
} else if (id == R.id.g) {
|
||||
context.startActivity(new Intent(context, cookie.class));
|
||||
//绑定网易云
|
||||
}
|
||||
}
|
||||
}
|
|
@ -2,7 +2,6 @@ package com.muqingbfq.fragment;
|
|||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Intent;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
|
@ -12,7 +11,6 @@ import android.widget.TextView;
|
|||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.recyclerview.widget.GridLayoutManager;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
|
@ -23,6 +21,8 @@ import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
|||
import com.google.gson.Gson;
|
||||
import com.muqingbfq.R;
|
||||
import com.muqingbfq.XM;
|
||||
import com.muqingbfq.api.playlist;
|
||||
import com.muqingbfq.api.resource;
|
||||
import com.muqingbfq.databinding.FragmentWdBinding;
|
||||
import com.muqingbfq.login.user_logs;
|
||||
import com.muqingbfq.login.visitor;
|
||||
|
@ -31,13 +31,16 @@ import com.muqingbfq.mq.EditViewDialog;
|
|||
import com.muqingbfq.mq.gj;
|
||||
import com.muqingbfq.mq.wj;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.io.File;
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
public class wode extends Fragment {
|
||||
|
||||
|
@ -52,7 +55,7 @@ public class wode extends Fragment {
|
|||
{R.drawable.like, "喜欢音乐", "mp3_like.json"},
|
||||
{R.drawable.icon, "本地搜索", ""},
|
||||
{R.drawable.fuwuzhongxing, "更换接口", "API"},
|
||||
{R.drawable.icon, "导入歌单", ""},
|
||||
{R.drawable.gd, "导入歌单", "gd"},
|
||||
{R.drawable.paihangbang, "排行榜", "排行榜"},
|
||||
{R.drawable.icon, "开发中", ""}
|
||||
};
|
||||
|
@ -83,8 +86,6 @@ public class wode extends Fragment {
|
|||
startActivity(new Intent(getContext(), user_logs.class));
|
||||
}
|
||||
});
|
||||
// new user_message();
|
||||
// int k = (int) (main.k / getResources().getDisplayMetrics().density + 0.5f);
|
||||
GridLayoutManager gridLayoutManager = new GridLayoutManager(getContext(), 4) {
|
||||
@Override
|
||||
public boolean canScrollVertically() {
|
||||
|
@ -105,10 +106,7 @@ public class wode extends Fragment {
|
|||
public void onBindViewHolder(@NonNull VH holder, int position) {
|
||||
String s = lista[position][1].toString();
|
||||
holder.textView.setText(s);
|
||||
holder.imageView.setImageTintList(ColorStateList.valueOf(ContextCompat.getColor(getContext(), R.color.text)));
|
||||
Glide.with(getContext())
|
||||
.load(lista[position][0])
|
||||
.into(holder.imageView);
|
||||
holder.imageView.setImageResource((Integer) lista[position][0]);
|
||||
String data = lista[position][2].toString();
|
||||
holder.itemView.setOnClickListener(view -> {
|
||||
switch (data) {
|
||||
|
@ -142,6 +140,53 @@ public class wode extends Fragment {
|
|||
}
|
||||
}).show();
|
||||
break;
|
||||
case "gd":
|
||||
EditViewDialog editViewDialog1 = new EditViewDialog(getContext(),
|
||||
"导入歌单")
|
||||
.setMessage("请用网易云https链接来进行导入或者歌单id");
|
||||
editViewDialog1.setPositive(view1 -> {
|
||||
String str = editViewDialog1.getEditText();
|
||||
// 使用正则表达式提取链接
|
||||
Pattern pattern = Pattern.compile("https?://[\\w./?=&]+");
|
||||
Matcher matcher = pattern.matcher(str);
|
||||
if (matcher.find())
|
||||
str = matcher.group();
|
||||
if (!str.isEmpty()) {
|
||||
// 使用截取方法获取歌单 ID
|
||||
str = str.substring(str.indexOf("id=") + 3, str.indexOf("&"));
|
||||
}
|
||||
String finalStr = str;
|
||||
gj.ts(getContext(), "导入中");
|
||||
new Thread(){
|
||||
@Override
|
||||
public void run() {
|
||||
super.run();
|
||||
String hq = playlist.gethq(finalStr);
|
||||
if (hq != null) {
|
||||
wj.xrwb(wj.gd + finalStr, hq);
|
||||
try {
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
if (wj.cz(wj.gd_xz)) {
|
||||
jsonObject = new JSONObject(Objects.requireNonNull(wj.dqwb(wj.gd_xz)));
|
||||
}
|
||||
XM fh = resource.Playlist_content(finalStr);
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("name", fh.name);
|
||||
json.put("picUrl", fh.picurl);
|
||||
jsonObject.put(fh.id, json);
|
||||
wj.xrwb(wj.gd_xz, jsonObject.toString());
|
||||
sx();
|
||||
gj.xcts(getContext(), "成功");
|
||||
} catch (JSONException e) {
|
||||
gj.sc("list gd onclick thear " + e);
|
||||
gj.xcts(getContext(), "失败");
|
||||
}
|
||||
}
|
||||
}
|
||||
}.start();
|
||||
editViewDialog1.dismiss();
|
||||
}).show();
|
||||
break;
|
||||
|
||||
}
|
||||
});
|
||||
|
@ -218,6 +263,7 @@ public class wode extends Fragment {
|
|||
setqianming(user.qianming);
|
||||
Glide.with(getContext())
|
||||
.load(user.picUrl)
|
||||
.error(R.drawable.ic_launcher_foreground)
|
||||
.into(binding.imageView);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -250,7 +250,6 @@ public class home extends AppCompatActivity {
|
|||
@Override
|
||||
public void onChildrenLoaded(@NonNull String parentId,
|
||||
@NonNull List<MediaBrowserCompat.MediaItem> children) {
|
||||
|
||||
gj.sc("onChildrenLoaded------");
|
||||
}
|
||||
};
|
||||
|
@ -262,7 +261,7 @@ public class home extends AppCompatActivity {
|
|||
if (mBrowser != null && mBrowser.isConnected()) {
|
||||
mBrowser.disconnect();
|
||||
}
|
||||
int i = Process.myPid();
|
||||
android.os.Process.killProcess(i);
|
||||
// int i = Process.myPid();
|
||||
// android.os.Process.killProcess(i);
|
||||
}
|
||||
}
|
|
@ -8,13 +8,13 @@ import androidx.annotation.NonNull;
|
|||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.muqingbfq.R;
|
||||
import com.muqingbfq.databinding.ListMp3Binding;
|
||||
|
||||
public class MyViewHoder extends RecyclerView.ViewHolder {
|
||||
public TextView name, zz;
|
||||
public MyViewHoder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
name = itemView.findViewById(R.id.wb1);
|
||||
zz = itemView.findViewById(R.id.zz);
|
||||
public ListMp3Binding binding;
|
||||
public MyViewHoder(@NonNull ListMp3Binding itemView) {
|
||||
super(itemView.getRoot());
|
||||
binding = itemView;
|
||||
}
|
||||
public Context getContext() {
|
||||
return itemView.getContext();
|
||||
|
|
|
@ -33,76 +33,7 @@ public class cookie extends FragmentActivity {
|
|||
//view2 里面的控件
|
||||
textView = findViewById(R.id.textView);
|
||||
imageView = findViewById(R.id.imageView);
|
||||
new erweima();
|
||||
}
|
||||
|
||||
class erweima extends Thread {
|
||||
int code = 800;
|
||||
String unikey, qrimg, hq;
|
||||
private long time = 0;
|
||||
public erweima() {
|
||||
textView.setText("请使用网易云音乐扫码");
|
||||
start();
|
||||
}
|
||||
@Override
|
||||
public void run() {
|
||||
super.run();
|
||||
while (code != 0) {
|
||||
try {
|
||||
hq = wl.hq("/login/qr/check?key=" + unikey + Time());
|
||||
if (hq != null) {
|
||||
JSONObject json = new JSONObject(hq);
|
||||
code = json.getInt("code");
|
||||
switch (code) {
|
||||
case 800:
|
||||
case 400:
|
||||
setwb("二维码过期");
|
||||
hqkey();
|
||||
break;
|
||||
case 801:
|
||||
setwb("等待扫码");
|
||||
break;
|
||||
case 802:
|
||||
setwb("等待确认");
|
||||
break;
|
||||
case 803:
|
||||
setwb("登录成功");
|
||||
wl.setcookie(json.getString("cookie"));
|
||||
code = 0;
|
||||
cookie.this.finish();
|
||||
break;
|
||||
default:
|
||||
code = 0;
|
||||
// 默认情况下的操作
|
||||
break;
|
||||
}
|
||||
}
|
||||
sleep(1000);
|
||||
} catch (Exception e) {
|
||||
gj.sc(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void hqkey() throws Exception {
|
||||
unikey = new JSONObject(Objects.requireNonNull(wl.hq("/login/qr/key"))).
|
||||
getJSONObject("data").getString("unikey");
|
||||
JSONObject jsonObject = new JSONObject(Objects.requireNonNull(wl.hq("/login/qr/create?key=" +
|
||||
unikey +
|
||||
"&qrimg=base64")));
|
||||
qrimg = jsonObject.getJSONObject("data").getString("qrimg");
|
||||
main.handler.post(() -> imageView.setImageBitmap(user_logs.stringToBitmap(qrimg)));
|
||||
}
|
||||
|
||||
private String Time() {
|
||||
if (time < System.currentTimeMillis() - 1000) {
|
||||
time = System.currentTimeMillis();
|
||||
}
|
||||
return "×tamp" + time;
|
||||
}
|
||||
private void setwb(String wb) {
|
||||
main.handler.post(() -> textView.setText(wb));
|
||||
}
|
||||
// new erweima();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -154,72 +154,6 @@ public class user_editing extends FragmentActivity {
|
|||
com.muqingbfq.fragment.wode.setqianming(null);
|
||||
com.muqingbfq.fragment.wode.imageView.setImageResource(R.drawable.icon);
|
||||
});
|
||||
findViewById(R.id.button1).setOnClickListener(view -> {
|
||||
// 创建OkHttpClient实例
|
||||
OkHttpClient client = new OkHttpClient();
|
||||
|
||||
// 创建MultipartBody.Builder来构建请求体
|
||||
MultipartBody.Builder builder = new MultipartBody.Builder()
|
||||
.setType(MultipartBody.FORM);
|
||||
if (file_a != null) {
|
||||
File file = new File(file_a);
|
||||
RequestBody requestBody = RequestBody.create(file, MediaType.parse("image/*"));
|
||||
builder.addFormDataPart("icon", file.getName(), requestBody);
|
||||
}
|
||||
if (file_b != null) {
|
||||
File file = new File(file_b);
|
||||
RequestBody requestBody = RequestBody.create(file, MediaType.parse("image/*"));
|
||||
builder.addFormDataPart("cover", file.getName(), requestBody);
|
||||
}
|
||||
builder.addFormDataPart("token", main.token)
|
||||
.addFormDataPart("userName", edit_name.getText().toString())
|
||||
.addFormDataPart("introduce", edit_qianming.getText().toString())
|
||||
.addFormDataPart("gender", "1")
|
||||
.addFormDataPart("dynamicColor", "");
|
||||
// 构建请求体
|
||||
Request request = new Request.Builder()
|
||||
.url("https://rust.coldmint.top/php/user.php?action=updateSpaceInfo")
|
||||
.post(builder.build())
|
||||
.build();
|
||||
// 发起请求
|
||||
client.newCall(request).enqueue(new Callback() {
|
||||
@Override
|
||||
public void onFailure(@NonNull Call call, @NonNull IOException e) {
|
||||
gj.sc(e);
|
||||
// 请求失败处理
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResponse(@NonNull Call call, @NonNull Response response) throws IOException {
|
||||
// 请求成功处理
|
||||
String responseData = response.body().string();
|
||||
gj.sc(responseData);
|
||||
if (TextUtils.isEmpty(responseData)) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
JSONObject jsonObject = new JSONObject(responseData);
|
||||
int code = jsonObject.getInt("code");
|
||||
if (code == 1) {
|
||||
String data = jsonObject.getString("data");
|
||||
switch (data) {
|
||||
case "@event:用户名占用":
|
||||
break;
|
||||
case "introduce":
|
||||
break;
|
||||
}
|
||||
} else if (code == 0) {
|
||||
// new user_message();
|
||||
}
|
||||
gj.xcts(user_editing.this, jsonObject.getString("message"));
|
||||
} catch (JSONException e) {
|
||||
gj.sc(e);
|
||||
}
|
||||
// 处理响应数据
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
// 获取图片的实际路径
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package com.muqingbfq.login;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.os.Bundle;
|
||||
|
@ -9,22 +8,18 @@ import android.util.Base64;
|
|||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.EditText;
|
||||
|
||||
import androidx.activity.result.ActivityResultLauncher;
|
||||
import androidx.activity.result.contract.ActivityResultContracts;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.muqingbfq.databinding.ActivityUserLogsBinding;
|
||||
import com.muqingbfq.main;
|
||||
import com.muqingbfq.mq.EditViewDialog;
|
||||
import com.muqingbfq.mq.gj;
|
||||
import com.muqingbfq.mq.wl;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
|
||||
public class user_logs extends AppCompatActivity {
|
||||
|
@ -38,24 +33,9 @@ public class user_logs extends AppCompatActivity {
|
|||
this.picUrl = picUrl;
|
||||
}
|
||||
}
|
||||
EditText edituser, editpassword;
|
||||
public static String UUID;
|
||||
|
||||
ActivityResultLauncher<Intent> enroll =
|
||||
registerForActivityResult(new ActivityResultContracts.StartActivityForResult(),
|
||||
result -> {
|
||||
if (result.getResultCode() == RESULT_OK) {
|
||||
Intent data = result.getData();
|
||||
if (data != null) {
|
||||
Bundle bundle = data.getExtras();
|
||||
String user = bundle.getString("user");
|
||||
String password = bundle.getString("password");
|
||||
edituser.setText(user);
|
||||
editpassword.setText(password);
|
||||
}
|
||||
}
|
||||
});
|
||||
ActivityUserLogsBinding binding;
|
||||
erweima thread;
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
@ -63,17 +43,21 @@ public class user_logs extends AppCompatActivity {
|
|||
setContentView(binding.getRoot());
|
||||
setSupportActionBar(binding.toolbar);
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
|
||||
|
||||
// UUID = Settings.Secure.getString(getContentResolver(),
|
||||
// Settings.Secure.ANDROID_ID);
|
||||
binding.login.setOnClickListener(view -> new CloudUser());
|
||||
/* findViewById(R.id.enroll).setOnClickListener(view -> {
|
||||
Intent intent = new Intent(user_logs.this, enroll.class);
|
||||
intent.putExtra("user", edituser.getText().toString());
|
||||
intent.putExtra("appID", UUID);
|
||||
enroll.launch(intent);
|
||||
});*/
|
||||
binding.button1.setOnClickListener(view -> {
|
||||
if (binding.layout1.getVisibility() == View.VISIBLE) {
|
||||
binding.layout1.setVisibility(View.GONE);
|
||||
binding.layout2.setVisibility(View.VISIBLE);
|
||||
binding.button1.setText("账号");
|
||||
thread = new erweima();
|
||||
thread.start();
|
||||
} else {
|
||||
thread.interrupt();
|
||||
binding.button1.setText("二维码");
|
||||
binding.layout1.setVisibility(View.VISIBLE);
|
||||
binding.layout2.setVisibility(View.GONE);
|
||||
}
|
||||
});
|
||||
}
|
||||
//some statement
|
||||
|
||||
|
@ -102,6 +86,7 @@ public class user_logs extends AppCompatActivity {
|
|||
}
|
||||
|
||||
public String account, password;
|
||||
|
||||
class CloudUser extends Thread {
|
||||
public CloudUser() {
|
||||
InputMethodManager imm = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE);
|
||||
|
@ -132,7 +117,7 @@ public class user_logs extends AppCompatActivity {
|
|||
String cookie = jsonObject.getString("cookie");
|
||||
gj.xcts(user_logs.this, "登录成功");
|
||||
wl.setcookie(cookie);
|
||||
new user_message(nickname,signature,avatarUrl);
|
||||
new user_message(nickname, signature, avatarUrl);
|
||||
user_logs.this.finish();
|
||||
} else if (code == 502) {
|
||||
gj.xcts(user_logs.this, jsonObject.getString("message"));
|
||||
|
@ -144,4 +129,79 @@ public class user_logs extends AppCompatActivity {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class erweima extends Thread {
|
||||
int code = 800;
|
||||
String unikey, qrimg, hq;
|
||||
private long time = 0;
|
||||
|
||||
public erweima() {
|
||||
binding.text1.setText("请使用网易云音乐扫码");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
super.run();
|
||||
while (code != 0 && !Thread.currentThread().isInterrupted()) {
|
||||
gj.sc(code);
|
||||
try {
|
||||
hq = wl.hq("/login/qr/check?key=" + unikey + Time());
|
||||
if (hq != null) {
|
||||
JSONObject json = new JSONObject(hq);
|
||||
code = json.getInt("code");
|
||||
switch (code) {
|
||||
case 800:
|
||||
case 400:
|
||||
setwb("二维码过期");
|
||||
hqkey();
|
||||
break;
|
||||
case 801:
|
||||
setwb("等待扫码");
|
||||
break;
|
||||
case 802:
|
||||
setwb("等待确认");
|
||||
break;
|
||||
case 803:
|
||||
setwb("登录成功");
|
||||
wl.setcookie(json.getString("cookie"));
|
||||
code = 0;
|
||||
user_logs.this.finish();
|
||||
break;
|
||||
default:
|
||||
code = 0;
|
||||
// 默认情况下的操作
|
||||
break;
|
||||
}
|
||||
}
|
||||
sleep(1000);
|
||||
} catch (Exception e) {
|
||||
Thread.currentThread().interrupt();
|
||||
gj.sc(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void hqkey() throws Exception {
|
||||
unikey = new JSONObject(Objects.requireNonNull(wl.hq("/login/qr/key"))).
|
||||
getJSONObject("data").getString("unikey");
|
||||
JSONObject jsonObject = new JSONObject(Objects.requireNonNull(wl.hq("/login/qr/create?key=" +
|
||||
unikey +
|
||||
"&qrimg=base64")));
|
||||
qrimg = jsonObject.getJSONObject("data").getString("qrimg");
|
||||
main.handler.post(() -> binding.image.setImageBitmap(user_logs.stringToBitmap(qrimg)));
|
||||
}
|
||||
|
||||
private String Time() {
|
||||
if (time < System.currentTimeMillis() - 1000) {
|
||||
time = System.currentTimeMillis();
|
||||
}
|
||||
return "×tamp" + time;
|
||||
}
|
||||
|
||||
private void setwb(String wb) {
|
||||
main.handler.post(() -> binding.text1.setText(wb));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -5,20 +5,17 @@ import android.app.Activity;
|
|||
import android.app.Application;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.provider.Settings;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import androidx.activity.result.ActivityResultLauncher;
|
||||
import androidx.activity.result.contract.ActivityResultContracts;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.app.AppCompatDelegate;
|
||||
|
||||
import com.muqingbfq.login.visitor;
|
||||
import com.muqingbfq.mq.FloatingLyricsService;
|
||||
import com.muqingbfq.mq.gj;
|
||||
import com.muqingbfq.mq.wj;
|
||||
import com.muqingbfq.mq.wl;
|
||||
|
||||
|
@ -33,10 +30,8 @@ public class main extends Application {
|
|||
public static int k, g;
|
||||
public static SharedPreferences sp;
|
||||
public static SharedPreferences.Editor edit;
|
||||
|
||||
public static String account,token;
|
||||
|
||||
public int count = 0;
|
||||
public static long item = System.currentTimeMillis();
|
||||
@SuppressLint("HardwareIds")
|
||||
@Override
|
||||
public void onCreate() {
|
||||
|
@ -56,7 +51,6 @@ public class main extends Application {
|
|||
wj.xrwb(file.toString(), main.api);
|
||||
}
|
||||
application = this;
|
||||
// UUID.randomUUID().toString();
|
||||
sp = getSharedPreferences("Set_up", MODE_PRIVATE);
|
||||
edit = sp.edit();
|
||||
boolean bj = false;
|
||||
|
@ -95,13 +89,12 @@ public class main extends Application {
|
|||
|
||||
registerActivityLifecycleCallbacks(new ActivityLifecycleCallbacks() {
|
||||
@Override
|
||||
public void onActivityCreated(Activity activity, Bundle savedInstanceState) {
|
||||
public void onActivityCreated(@NonNull Activity activity, Bundle savedInstanceState) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityStarted(Activity activity) {
|
||||
public void onActivityStarted(@NonNull Activity activity) {
|
||||
if (count == 0) { //后台切换到前台
|
||||
gj.sc(">>>>>>>>>>>>>>>>>>>App切到前台");
|
||||
if (FloatingLyricsService.lei != null) {
|
||||
stopService(new Intent(main.this, FloatingLyricsService.class));
|
||||
}
|
||||
|
@ -110,19 +103,19 @@ public class main extends Application {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onActivityResumed(Activity activity) {
|
||||
public void onActivityResumed(@NonNull Activity activity) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityPaused(Activity activity) {
|
||||
public void onActivityPaused(@NonNull Activity activity) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityStopped(Activity activity) {
|
||||
public void onActivityStopped(@NonNull Activity activity) {
|
||||
count--;
|
||||
if (count == 0) { //后台切换到前台
|
||||
gj.sc(">>>>>>>>>>>>>>>>>>>App切到后台");
|
||||
// gj.sc(">>>>>>>>>>>>>>>>>>>App切到后台");
|
||||
new Thread(){
|
||||
@Override
|
||||
public void run() {
|
||||
|
@ -148,11 +141,11 @@ public class main extends Application {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onActivitySaveInstanceState(Activity activity, Bundle outState) {
|
||||
public void onActivitySaveInstanceState(@NonNull Activity activity, @NonNull Bundle outState) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityDestroyed(Activity activity) {
|
||||
public void onActivityDestroyed(@NonNull Activity activity) {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -11,6 +11,8 @@ import android.content.Intent;
|
|||
import android.net.Uri;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.util.Log;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.EditText;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||
|
@ -33,6 +35,7 @@ public class gj {
|
|||
main.handler.post(() -> Toast.makeText(context, b.toString(), Toast.LENGTH_SHORT).show());
|
||||
|
||||
}
|
||||
|
||||
public static boolean isAppInForeground(Context context) {
|
||||
ActivityManager activityManager = (ActivityManager) context.getSystemService(Service.ACTIVITY_SERVICE);
|
||||
List<ActivityManager.RunningAppProcessInfo> runningAppProcessInfoList = activityManager.getRunningAppProcesses();
|
||||
|
@ -48,6 +51,7 @@ public class gj {
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean isTablet(Context context) {
|
||||
boolean b;
|
||||
DisplayMetrics dm = context.getResources().getDisplayMetrics();
|
||||
|
@ -56,6 +60,7 @@ public class gj {
|
|||
b = main.k > main.g;
|
||||
return b;
|
||||
}
|
||||
|
||||
public static void sc(Object a) {
|
||||
if (a == null) {
|
||||
a = "null";
|
||||
|
@ -74,11 +79,13 @@ public class gj {
|
|||
shareIntent.putExtra(Intent.EXTRA_TEXT, str);
|
||||
context.startActivity(shareIntent);
|
||||
}
|
||||
|
||||
/**
|
||||
* 复制文字到剪切板
|
||||
*
|
||||
* @param text
|
||||
*/
|
||||
public static void fz(Context context,String text){
|
||||
public static void fz(Context context, String text) {
|
||||
ClipboardManager systemService =
|
||||
(ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
|
||||
// 创建能够存入剪贴板的ClipData对象
|
||||
|
@ -86,6 +93,7 @@ public class gj {
|
|||
ClipData mClipData = ClipData.newPlainText("Label", text);
|
||||
//将ClipData数据复制到剪贴板:
|
||||
systemService.setPrimaryClip(mClipData);
|
||||
gj.ts(context, "复制成功");
|
||||
}
|
||||
|
||||
public static boolean isWiFiConnected() {
|
||||
|
@ -135,7 +143,7 @@ public class gj {
|
|||
String bb = jsonObject.getString("bb");
|
||||
main.handler.post(() -> new MaterialAlertDialogBuilder(context)
|
||||
.setTitle("更新" + bb)
|
||||
.setMessage(msg+"\n"+"取消后不再提示更新你需要到关于软件手动检测")
|
||||
.setMessage(msg + "\n" + "取消后不再提示更新你需要到关于软件手动检测")
|
||||
.setNegativeButton("取消", (dialogInterface, i) -> wj.xrwb(wj.filesdri + "gx.mq", null))
|
||||
.setPositiveButton("更新", (dialogInterface, i) -> context.startActivity(new Intent(Intent.ACTION_VIEW,
|
||||
Uri.parse(url))))
|
||||
|
@ -149,4 +157,20 @@ public class gj {
|
|||
}
|
||||
return 400;
|
||||
}
|
||||
|
||||
public static void tcjp(EditText editText) {
|
||||
editText.requestFocus();//获取焦点
|
||||
InputMethodManager imm = (InputMethodManager)
|
||||
editText.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
// gj.sc(imm.isActive());
|
||||
//没有显示键盘,弹出
|
||||
imm.showSoftInput(editText, InputMethodManager.SHOW_IMPLICIT);
|
||||
}
|
||||
public static void ycjp(EditText editText) {
|
||||
InputMethodManager imm = (InputMethodManager)
|
||||
editText.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
if (imm.isActive()) //有显示键盘,隐藏
|
||||
imm.hideSoftInputFromWindow(editText.getWindowToken(),
|
||||
InputMethodManager.HIDE_NOT_ALWAYS);
|
||||
}
|
||||
}
|
|
@ -1,15 +1,15 @@
|
|||
package com.muqingbfq.mq;
|
||||
|
||||
|
||||
import com.muqingbfq.main;
|
||||
import com.muqingbfq.XM;
|
||||
import com.muqingbfq.main;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import okhttp3.FormBody;
|
||||
import okhttp3.MultipartBody;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.Response;
|
||||
|
@ -40,22 +40,29 @@ public class wl {
|
|||
}
|
||||
|
||||
public static String post(String str, String[][] a) {
|
||||
|
||||
OkHttpClient client = new OkHttpClient().newBuilder()
|
||||
.build();
|
||||
FormBody.Builder builder = new FormBody.Builder();
|
||||
for (String[] strings : a) {
|
||||
// gj.sc(strings[0] + ":" + strings[1]);
|
||||
builder.add(strings[0], strings[1]);
|
||||
// MediaType mediaType = MediaType.parse("text/plain");
|
||||
MultipartBody.Builder builder = new MultipartBody.Builder().setType(MultipartBody.FORM);
|
||||
for (String[] b : a) {
|
||||
builder.addFormDataPart(b[0], b[1]);
|
||||
}
|
||||
builder.addFormDataPart("cookie", Cookie);
|
||||
|
||||
Request request = new Request.Builder()
|
||||
.url(main.api + str)
|
||||
.post(builder.build())
|
||||
.method("POST", builder.build())
|
||||
.addHeader("User-Agent", "Apifox/1.0.0 (https://apifox.com)")
|
||||
.addHeader("Accept", "*/*")
|
||||
.addHeader("Host", "139.196.224.229:3000")
|
||||
.addHeader("Connection", "keep-alive")
|
||||
.build();
|
||||
try {
|
||||
Response response = client.newCall(request).execute();
|
||||
return response.body().string();
|
||||
} catch (IOException e) {
|
||||
if (response.body() != null) {
|
||||
return response.body().string();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
gj.sc(e);
|
||||
}
|
||||
return null;
|
||||
|
|
|
@ -42,6 +42,7 @@ public class CardImage extends MaterialCardView {
|
|||
Glide.with(this)
|
||||
.load(bitmap)
|
||||
// .apply(new RequestOptions().placeholder(R.drawable.icon))
|
||||
.error(R.drawable.ic_launcher_foreground)
|
||||
.into(imageView);
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@ package com.muqingbfq.view;
|
|||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Rect;
|
||||
import android.os.Handler;
|
||||
|
@ -112,33 +111,35 @@ public class LrcView extends RecyclerView {
|
|||
public void setLrcline(boolean lrcline) {
|
||||
Lrcline = lrcline;
|
||||
if (lrcline) {
|
||||
addItemDecoration(new ItemDecoration() {
|
||||
removeItemDecoration(ItemDecoration);
|
||||
/* addItemDecoration(new ItemDecoration() {
|
||||
@Override
|
||||
public void onDraw(@NonNull Canvas c, @NonNull RecyclerView parent, @NonNull State state) {
|
||||
super.onDraw(c, parent, state);
|
||||
}
|
||||
});
|
||||
});*/
|
||||
} else {
|
||||
addItemDecoration(new RecyclerView.ItemDecoration() {
|
||||
@Override
|
||||
public void getItemOffsets(@NonNull Rect outRect, @NonNull View view, @NonNull RecyclerView parent, @NonNull RecyclerView.State state) {
|
||||
super.getItemOffsets(outRect, view, parent, state);
|
||||
view.setOnClickListener(onClickListener);
|
||||
|
||||
int parentHeight = parent.getHeight();
|
||||
int childHeight = view.getHeight();
|
||||
|
||||
int topMargin = (parentHeight - childHeight) / 2;
|
||||
|
||||
// 设置第一项的顶部间距
|
||||
if (parent.getChildAdapterPosition(view) == 0) {
|
||||
outRect.top = topMargin;
|
||||
}
|
||||
}
|
||||
});
|
||||
addItemDecoration(ItemDecoration);
|
||||
}
|
||||
}
|
||||
|
||||
private final RecyclerView.ItemDecoration ItemDecoration = new ItemDecoration() {
|
||||
@Override
|
||||
public void getItemOffsets(@NonNull Rect outRect, @NonNull View view, @NonNull RecyclerView parent, @NonNull RecyclerView.State state) {
|
||||
super.getItemOffsets(outRect, view, parent, state);
|
||||
view.setOnClickListener(onClickListener);
|
||||
|
||||
int parentHeight = parent.getHeight();
|
||||
int childHeight = view.getHeight();
|
||||
|
||||
int topMargin = (parentHeight - childHeight) / 2;
|
||||
|
||||
// 设置第一项的顶部间距
|
||||
if (parent.getChildAdapterPosition(view) == 0) {
|
||||
outRect.top = topMargin;
|
||||
}
|
||||
}
|
||||
};
|
||||
public android.os.Handler handler = new Handler(Looper.getMainLooper());
|
||||
|
||||
@SuppressLint("ClickableViewAccessibility")
|
||||
|
|
9
app/src/main/res/drawable/gd.xml
Normal file
9
app/src/main/res/drawable/gd.xml
Normal file
|
@ -0,0 +1,9 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="200dp"
|
||||
android:height="200dp"
|
||||
android:viewportWidth="1024"
|
||||
android:viewportHeight="1024">
|
||||
<path
|
||||
android:pathData="M964.6,234.5c-46.1,-52.6 -104.8,-93.7 -169.6,-118.8a34,34 0,0 0,-46.4 31.7v420.4a178,178 0,0 0,-110.9 -38.7c-98.8,0 -179.2,80.4 -179.2,179.2S538.8,887.5 637.6,887.5s179.2,-80.4 179.2,-179.2c0,-1.9 -0.2,-3.8 -0.3,-5.6 0,-1 0.3,-1.9 0.3,-2.9V201.2c36.2,20.3 69.1,46.9 96.6,78.2 12.5,14.2 34.1,15.5 48.1,3.1 14.2,-12.3 15.5,-33.8 3.1,-48zM637.6,819.2c-61.1,0 -110.9,-49.8 -110.9,-110.9s49.8,-110.9 110.9,-110.9 110.9,49.8 110.9,110.9 -49.8,110.9 -110.9,110.9zM185.3,307.2h392.5c18.8,0 34.1,-15.4 34.1,-34.1s-15.4,-34.1 -34.1,-34.1h-392.5a34.1,34.1 0,1 0,0 68.3zM424.3,460.8h-238.9c-18.8,0 -34.1,15.4 -34.1,34.1s15.4,34.1 34.1,34.1h238.9c18.8,0 34.1,-15.4 34.1,-34.1s-15.4,-34.1 -34.1,-34.1zM321.9,682.7h-136.5c-18.8,0 -34.1,15.4 -34.1,34.1s15.4,34.1 34.1,34.1h136.5c18.8,0 34.1,-15.4 34.1,-34.1s-15.4,-34.1 -34.1,-34.1z"
|
||||
android:fillColor="@color/text"/>
|
||||
</vector>
|
|
@ -5,8 +5,8 @@
|
|||
android:viewportHeight="1024">
|
||||
<path
|
||||
android:pathData="M995,538.7c-13.8,-8.9 -30.3,-12 -46.4,-8.5l-182.9,39.3c-28.2,6.1 -48.6,31.4 -48.6,60.2v224.6c0,21.8 -17.7,39.5 -39.6,39.5 -21.8,0 -39.5,-17.7 -39.5,-39.5s17.7,-39.6 39.5,-39.6c15.4,0 27.8,-12.4 27.8,-27.8s-12.4,-27.8 -27.8,-27.8c-52.4,0 -95.1,42.7 -95.1,95.2 0,52.4 42.7,95.1 95.1,95.1 52.5,0 95.1,-42.7 95.1,-95.1V629.8c0,-2.9 2,-5.3 4.8,-5.9l182.9,-39.3c1.9,-0.5 3.6,0.2 4.5,0.8 1,0.6 2.2,1.8 2.7,5V814c0,21.8 -17.7,39.6 -39.6,39.6 -10.5,0 -20.5,-4.1 -27.9,-11.6 -7.5,-7.5 -11.6,-17.4 -11.6,-28 0,-21.8 17.7,-39.6 39.6,-39.6 15.4,0 27.8,-12.4 27.8,-27.8s-12.4,-27.8 -27.8,-27.8c-52.5,0 -95.1,42.7 -95.1,95.1 0,25.4 9.9,49.3 27.9,67.3s41.8,27.9 67.2,27.9c52.5,0 95.1,-42.7 95.1,-95.1V590.5c0,-4.4 -0.5,-8.7 -1.4,-12.9 -3.4,-16.1 -12.9,-29.9 -26.7,-38.9z"
|
||||
android:fillColor="#000000"/>
|
||||
android:fillColor="@color/text"/>
|
||||
<path
|
||||
android:pathData="M338.3,315.1c35.3,-63.9 90.4,-114.1 158.6,-143.6 81.4,-35.2 171.7,-36.6 254.1,-3.9 106.7,42.3 183,134.9 204.1,247.8 3.1,16.7 17.7,28.4 34.1,28.4 2.1,0 4.3,-0.2 6.4,-0.6 18.9,-3.5 31.3,-21.7 27.8,-40.5C997.9,266.2 905.7,154.1 776.6,103c-99.7,-39.5 -208.8,-37.8 -307.3,4.7 -92.5,40 -165.1,111.6 -206.4,202.8 -48.9,3.6 -96.2,19.8 -137.8,48C62.2,400.9 19.7,465.3 5.3,539.7c-14.4,74.4 1,150 43.5,212.9 52.9,78.3 140.8,125 235.2,125h153.3c19.2,0 34.7,-15.6 34.7,-34.7s-15.6,-34.7 -34.7,-34.7H284c-71.3,0 -137.7,-35.3 -177.7,-94.4C74.2,666.3 62.6,609.3 73.5,553c10.9,-56.2 43,-104.8 90.5,-136.9 47.5,-32.1 104.5,-43.7 160.8,-32.8 56.2,10.9 104.8,43 136.9,90.5 10.7,15.9 32.3,20.1 48.2,9.3 15.9,-10.7 20.1,-32.3 9.3,-48.2 -42.4,-62.8 -106.6,-105.3 -180.9,-119.8z"
|
||||
android:fillColor="#000000"/>
|
||||
android:fillColor="@color/text"/>
|
||||
</vector>
|
||||
|
|
|
@ -5,5 +5,5 @@
|
|||
android:viewportHeight="1024">
|
||||
<path
|
||||
android:pathData="M544,661.3a32,32 0,0 1,-64 0L480,362.7a32,32 0,0 1,64 0v298.7zM704,661.3a32,32 0,0 1,-64 0L640,490.7a32,32 0,0 1,64 0v170.7zM384,661.3a32,32 0,0 1,-64 0L320,448a32,32 0,0 1,64 0v213.3zM202.7,138.7h618.7c64.8,0 117.3,52.5 117.3,117.3v512c0,64.8 -52.5,117.3 -117.3,117.3L202.7,885.3c-64.8,0 -117.3,-52.5 -117.3,-117.3L85.3,256c0,-64.8 52.5,-117.3 117.3,-117.3zM202.7,202.7a53.3,53.3 0,0 0,-53.3 53.3v512a53.3,53.3 0,0 0,53.3 53.3h618.7a53.3,53.3 0,0 0,53.3 -53.3L874.7,256a53.3,53.3 0,0 0,-53.3 -53.3L202.7,202.7z"
|
||||
android:fillColor="#000000"/>
|
||||
android:fillColor="@color/text"/>
|
||||
</vector>
|
||||
|
|
|
@ -85,13 +85,4 @@
|
|||
</RelativeLayout>
|
||||
</RelativeLayout>
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
<com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton
|
||||
android:id="@+id/button1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom|end"
|
||||
android:layout_margin="16dp"
|
||||
android:contentDescription="登录模式切换"
|
||||
android:text="二维码"
|
||||
app:icon="@drawable/icon"/>
|
||||
</LinearLayout>
|
|
@ -11,85 +11,136 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:title="@string/login" />
|
||||
<LinearLayout
|
||||
android:id="@+id/user1"
|
||||
|
||||
<androidx.core.widget.NestedScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:fitsSystemWindows="true"
|
||||
android:fillViewport="true">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/layout1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center_horizontal"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/img_logo"
|
||||
android:layout_width="150dp"
|
||||
android:layout_height="150dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:src="@drawable/icon" />
|
||||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginTop="50dp"
|
||||
android:layout_marginEnd="16dp">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/edit_user"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:autofillHints=""
|
||||
android:hint="网易云音乐账号/手机号"
|
||||
android:inputType="textEmailAddress"
|
||||
tools:ignore="LabelFor,VisualLintTextFieldSize,TextContrastCheck" />
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
app:passwordToggleEnabled="true">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/edit_password"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:autofillHints=""
|
||||
android:hint="密码"
|
||||
android:inputType="textPassword"
|
||||
android:textColorHint="#546E7A"
|
||||
tools:ignore="LabelFor,TextContrastCheck,VisualLintTextFieldSize" />
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:hint="验证码"
|
||||
android:visibility="gone">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/edit_key"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:autofillHints=""
|
||||
android:inputType="number"
|
||||
tools:ignore="TextContrastCheck,VisualLintTextFieldSize" />
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<Button
|
||||
android:id="@+id/login"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginTop="30dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/login"
|
||||
tools:ignore="ButtonStyle,DuplicateSpeakableTextCheck,VisualLintButtonSize" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/layout2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:gravity="center"
|
||||
android:visibility="gone"
|
||||
tools:ignore="UseCompoundDrawables">
|
||||
<TextView
|
||||
android:id="@+id/text1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="6dp"
|
||||
android:text="@string/app_name"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/image"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:scaleType="fitCenter"
|
||||
android:src="@drawable/ic_launcher_foreground"/>
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
||||
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
|
||||
<com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton
|
||||
android:id="@+id/button1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_horizontal"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/img_logo"
|
||||
android:layout_width="150dp"
|
||||
android:layout_height="150dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:src="@drawable/icon" />
|
||||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginTop="50dp"
|
||||
android:layout_marginEnd="16dp">
|
||||
<EditText
|
||||
android:id="@+id/edit_user"
|
||||
android:hint="网易云音乐账号/手机号"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="textEmailAddress"
|
||||
tools:ignore="LabelFor,VisualLintTextFieldSize,TextContrastCheck"
|
||||
android:autofillHints="" />
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
app:passwordToggleEnabled="true">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/edit_password"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:autofillHints=""
|
||||
android:hint="密码"
|
||||
android:inputType="textPassword"
|
||||
android:textColorHint="#546E7A"
|
||||
tools:ignore="LabelFor,TextContrastCheck,VisualLintTextFieldSize" />
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:visibility="gone"
|
||||
android:hint="验证码">
|
||||
<EditText
|
||||
android:id="@+id/edit_key"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:autofillHints=""
|
||||
android:inputType="number"
|
||||
tools:ignore="TextContrastCheck,VisualLintTextFieldSize" />
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<Button
|
||||
android:id="@+id/login"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:layout_marginTop="30dp"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/login"
|
||||
tools:ignore="ButtonStyle,DuplicateSpeakableTextCheck" />
|
||||
</LinearLayout>
|
||||
android:layout_gravity="bottom|end"
|
||||
android:layout_margin="16dp"
|
||||
android:contentDescription="登录模式切换"
|
||||
android:text="二维码"
|
||||
app:icon="@drawable/icon" />
|
||||
</LinearLayout>
|
|
@ -1,29 +1,43 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:orientation="vertical">
|
||||
|
||||
<com.google.android.material.appbar.MaterialToolbar
|
||||
android:id="@+id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<com.muqingbfq.view.Text
|
||||
android:id="@+id/title"
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:textSize="26sp"
|
||||
android:textColor="@color/text"/>
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
<com.muqingbfq.view.Text
|
||||
android:id="@+id/title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/text"
|
||||
android:textSize="26sp" />
|
||||
<EditText
|
||||
android:id="@+id/edittext"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="输入需要搜索的音乐"
|
||||
android:visibility="gone"/>
|
||||
</LinearLayout>
|
||||
</com.google.android.material.appbar.MaterialToolbar>
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/lb"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"/>
|
||||
android:layout_weight="1" />
|
||||
|
||||
<androidx.fragment.app.FragmentContainerView
|
||||
android:id="@+id/bfq_db"
|
||||
android:name="com.muqingbfq.fragment.bfq_db"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:name="com.muqingbfq.fragment.bfq_db"
|
||||
tools:layout="@layout/fragment_bfq_db" />
|
||||
</LinearLayout>
|
|
@ -1,7 +1,6 @@
|
|||
<?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="120dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
|
|
|
@ -4,32 +4,50 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:cardUseCompatPadding="true">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<com.muqingbfq.view.CardImage
|
||||
android:id="@+id/image"
|
||||
android:layout_width="76dp"
|
||||
android:layout_height="76dp"
|
||||
app:cardUseCompatPadding="true"
|
||||
app:strokeWidth="0dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/kg"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:alpha="0.5"
|
||||
android:src="@drawable/zt" />
|
||||
</com.muqingbfq.view.CardImage>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<com.muqingbfq.view.CardImage
|
||||
android:id="@+id/image"
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="120dp"
|
||||
app:cardUseCompatPadding="true"
|
||||
android:padding="16dp">
|
||||
<ImageView
|
||||
android:id="@+id/kg"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:alpha="0.5"
|
||||
android:src="@drawable/zt"/>
|
||||
</com.muqingbfq.view.CardImage>
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="6dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:orientation="vertical">
|
||||
<TextView
|
||||
android:id="@+id/wb1"
|
||||
android:id="@+id/text1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_horizontal"
|
||||
android:paddingTop="16dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:lines="2"
|
||||
android:maxLines="2"
|
||||
android:maxLines="1"
|
||||
android:textSize="20sp"
|
||||
android:text="@string/name"
|
||||
android:textColor="@color/text" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:maxLines="1"
|
||||
android:text="@string/app_name"
|
||||
android:textColor="@color/text" />
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
</com.google.android.material.card.MaterialCardView>
|
|
@ -3,21 +3,44 @@
|
|||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:padding="10dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text1"
|
||||
android:layout_width="36dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="0"
|
||||
android:textSize="26sp"/>
|
||||
|
||||
<androidx.cardview.widget.CardView
|
||||
android:layout_width="3dp"
|
||||
android:layout_height="30dp"
|
||||
app:cardCornerRadius="36dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:layout_marginEnd="6dp">
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/text" />
|
||||
</androidx.cardview.widget.CardView>
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:layout_weight="1"
|
||||
tools:ignore="UselessParent">
|
||||
<TextView
|
||||
android:id="@+id/wb1"
|
||||
android:id="@+id/name"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:text="@string/name"
|
||||
android:singleLine="true"
|
||||
android:textColor="@color/text"
|
||||
android:textSize="16sp" />
|
||||
|
||||
|
@ -26,6 +49,7 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/text"
|
||||
android:singleLine="true"
|
||||
android:text="@string/zz" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
|
@ -29,8 +29,4 @@
|
|||
android:icon="@drawable/app_warning"
|
||||
android:title="@string/guanyuruanjiang" />
|
||||
|
||||
<item
|
||||
android:id="@+id/g"
|
||||
android:icon="@drawable/icon"
|
||||
android:title="绑定网易云" />
|
||||
</menu>
|
Loading…
Reference in New Issue
Block a user