diff --git a/app/debug/Cloud_music-debug-v1.6.7.apk b/app/debug/Cloud_music-debug-v1.6.7.apk new file mode 100644 index 0000000..168e71c Binary files /dev/null and b/app/debug/Cloud_music-debug-v1.6.7.apk differ diff --git a/app/debug/output-metadata.json b/app/debug/output-metadata.json new file mode 100644 index 0000000..cd8b7a9 --- /dev/null +++ b/app/debug/output-metadata.json @@ -0,0 +1,20 @@ +{ + "version": 3, + "artifactType": { + "type": "APK", + "kind": "Directory" + }, + "applicationId": "com.muqingbfq", + "variantName": "debug", + "elements": [ + { + "type": "SINGLE", + "filters": [], + "attributes": [], + "versionCode": 1, + "versionName": "1.6.7", + "outputFile": "Cloud_music-debug-v1.6.7.apk" + } + ], + "elementType": "File" +} \ No newline at end of file diff --git a/app/src/main/java/com/muqingbfq/fragment/Media.java b/app/src/main/java/com/muqingbfq/fragment/Media.java new file mode 100644 index 0000000..277f81c --- /dev/null +++ b/app/src/main/java/com/muqingbfq/fragment/Media.java @@ -0,0 +1,253 @@ +package com.muqingbfq.fragment; + +import android.annotation.SuppressLint; +import android.content.Context; +import android.content.res.Configuration; +import android.graphics.Bitmap; +import android.os.Bundle; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.ImageView; +import android.widget.SeekBar; +import android.widget.TextView; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.core.content.ContextCompat; +import androidx.fragment.app.Fragment; + +import com.bumptech.glide.Glide; +import com.dirror.lyricviewx.LyricViewX; +import com.muqingbfq.R; +import com.muqingbfq.api.url; +import com.muqingbfq.bfq; +import com.muqingbfq.bfq_an; +import com.muqingbfq.bfqkz; +import com.muqingbfq.main; +import com.muqingbfq.xm; + +import org.json.JSONObject; + +public class Media extends Fragment { + @SuppressLint("StaticFieldLeak") + public static View view; + @SuppressLint("StaticFieldLeak") + private static TextView time_a, time_b; + @SuppressLint("StaticFieldLeak") + private static SeekBar tdt; + private static LyricViewX lrcview; + + public static void setTime_a(String str) { + if (time_a == null) { + return; + } + time_a.setText(str); + } + + public static void setTime_b(String str) { + if (time_b == null) { + return; + } + time_b.setText(str); + } + + public static void setMax(int max) { + tdt.setMax(max); + } + + public static void setProgress(int progress) { + tdt.setProgress(progress); + lrcview.updateTime(progress, true); + } + + public static void setbf(boolean bool) { + if (bool) { + //开始 + kgsetImageResource(R.drawable.bf); + } else { + //暂停 + kgsetImageResource(R.drawable.zt); + } + bfq_db.setkg(bool); + bfqkz.updateNotification(); + } + + private static void kgsetImageResource(int a) { + if (view == null) { + return; + } + ImageView imageView = view.findViewById(R.id.kg); + imageView.setImageResource(a); + } + + @Override + public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, + @Nullable Bundle savedInstanceState) { + if (view != null) { +// main.handler.post(() -> setImageBitmap(bfq.bitmap)); + return view; + } + view = inflater.inflate(R.layout.fragment_bfq, container, false); + bfq_an.kz kz = new bfq_an.kz(); + ImageView kg = view.findViewById(R.id.kg); + kg.setOnClickListener(kz); + view.findViewById(R.id.xyq).setOnClickListener(kz); + view.findViewById(R.id.syq).setOnClickListener(kz); + ImageView tx = view.findViewById(R.id.mttx); + tdt = view.findViewById(R.id.tdt); + tdt.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() { + @Override + public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { + setTime_b(bfq_an.getTime(progress)); + } + + @Override + public void onStartTrackingTouch(SeekBar seekBar) { + // 拖动条移动中 + main.handler.removeCallbacks(bfqkz.mt.updateSeekBar); + } + + @Override + public void onStopTrackingTouch(SeekBar seekBar) { + // 播放音乐到指定位置 + main.handler.post(bfqkz.mt.updateSeekBar); + bfqkz.mt.seekTo(seekBar.getProgress()); + } + }); + + time_a = view.findViewById(R.id.time_a); + time_b = view.findViewById(R.id.time_b); + //初始化歌词组件 + View kp = view.findViewById(R.id.kp1); + lrcview = getlrcView(); + lrcview.setDraggable(true, (time) -> { + com.muqingbfq.bfqkz.mt.build.seekTo(Math.toIntExact(time)); + return true; + }); + if (!isTablet(bfq.context)) { + lrcview.setOnSingerClickListener(() -> { + if (kp.getVisibility() == View.VISIBLE) { + kp.setVisibility(View.GONE); + } else { + kp.setVisibility(View.VISIBLE); + } + }); + } + //初始化播放器列表 + view.findViewById(R.id.bfq_list_mp3). + setOnClickListener(view1 -> com.muqingbfq.fragment.bflb_db.start(bfq.context)); + + view.findViewById(R.id.like).setOnClickListener(view1 -> { + ImageView like = (ImageView) view1; + try { + if (bfqkz.like_bool) { + like.setImageTintList(ContextCompat.getColorStateList(view.getContext(), R.color.text)); + com.muqingbfq.fragment.gd.like.remove(String.valueOf(bfqkz.xm.id)); + } else { + like.setImageTintList(ContextCompat. + getColorStateList(view.getContext(), android.R.color.holo_red_dark)); + JSONObject json = new JSONObject(); + json.put("name", bfqkz.xm.name); + json.put("zz", bfqkz.xm.zz); + json.put("picUrl", bfqkz.xm.picurl); + com.muqingbfq.fragment.gd.like.put(String.valueOf(bfqkz.xm.id), json); + } + com.muqingbfq.mq.wj.xrwb(com.muqingbfq.mq.wj.mp3_like, + com.muqingbfq.fragment.gd.like.toString()); + bfqkz.like_bool = !bfqkz.like_bool; + } catch (Exception e) { + e.printStackTrace(); + } + }); + ImageView control = view.findViewById(R.id.control); + control.setOnClickListener(new bfq_an.control(control)); + if (bfqkz.xm != null) { + setname(bfqkz.xm.name); + setzz(bfqkz.xm.zz); + main.handler.removeCallbacks(bfqkz.mt.updateSeekBar); // 在播放开始时启动更新进度 + long duration = bfqkz.mt.build.getDuration(); + tdt.setMax((int) bfqkz.mt.build.getDuration()); + setTime_a(bfq_an.getTime(duration)); + + long position = bfqkz.mt.build.getCurrentPosition(); + setProgress((int) position); + + main.handler.post(bfqkz.mt.updateSeekBar); // 在播放开始时启动更新进度 + if (bfqkz.mt.build.isPlaying()) { + kg.setImageResource(R.drawable.bf); + } + Glide.with(getContext()) + .load(bfqkz.xm.picurl) + .error(R.drawable.icon)//图片加载失败后,显示的图片 + .into(tx); + bfq_an.islike(bfq.context); + new Thread() { + @Override + public void run() { + super.run(); + url.gc(bfqkz.xm.id); + } + }.start(); + } + return view; + } + + private boolean isTablet(Context context) { + return (context.getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) + >= Configuration.SCREENLAYOUT_SIZE_LARGE; + } + + public static LyricViewX getlrcView() { + if (view == null) { + return null; + } + return view.findViewById(R.id.gc); + } + + public static void loadLyric(String a, String b) { + lrcview.loadLyric(a, b); + } + + public static void setlike(boolean bool) { + ImageView imageView = view.findViewById(R.id.like); + int color = R.color.text; + if (bool) { + color = android.R.color.holo_red_dark; + } + imageView.setImageTintList(ContextCompat. + getColorStateList(view.getContext(), color)); + } + + public static void setImageBitmap(Bitmap bitmap) { + if (view == null) { + return; + } + ImageView imageView = view.findViewById(R.id.mttx); + if (imageView != null) { + imageView.setImageBitmap(bitmap); + } + } + + public static void setname(String str) { + if (view == null) { + return; + } + TextView name = view.findViewById(R.id.name); + name.setText(str); + } + + public static void setzz(String str) { + if (view == null) { + return; + } + TextView zz = view.findViewById(R.id.zz); + zz.setText(str); + } + + @Nullable + @Override + public Context getContext() { + return view.getContext(); + } +} diff --git a/app/src/main/java/com/muqingbfq/mq/EditViewDialog.java b/app/src/main/java/com/muqingbfq/mq/EditViewDialog.java new file mode 100644 index 0000000..cec6861 --- /dev/null +++ b/app/src/main/java/com/muqingbfq/mq/EditViewDialog.java @@ -0,0 +1,159 @@ +package com.muqingbfq.mq; +import android.annotation.SuppressLint; +import android.content.Context; +import android.text.InputType; +import android.view.LayoutInflater; +import android.view.View; +import android.widget.Button; +import android.widget.EditText; + +import androidx.annotation.NonNull; +import androidx.appcompat.app.AlertDialog; + +import com.google.android.material.dialog.MaterialAlertDialogBuilder; +import com.muqingbfq.R; +import com.muqingbfq.main; + +public class EditViewDialog { + + public EditText editText; + public Button buttona, buttonb; + public MaterialAlertDialogBuilder AlertDialogBuilder; + private AlertDialog alertDialog; + + public EditViewDialog(@NonNull Context context, String str) { + AlertDialogBuilder = new MaterialAlertDialogBuilder(context); + setTitle(str); + @SuppressLint("InflateParams") View inflate = LayoutInflater.from(context).inflate(R.layout.view_edit, null); + editText = inflate.findViewById(R.id.editview); + buttona = inflate.findViewById(R.id.button1); + buttonb = inflate.findViewById(R.id.button2); + AlertDialogBuilder.setView(inflate); + buttona.setOnClickListener(view -> dismiss()); + buttonb.setOnClickListener(view -> dismiss()); + } + public void setTitle(String str) { + AlertDialogBuilder.setTitle(str); + } + + public void setMessage(String str) { + AlertDialogBuilder.setMessage(str); + } + + public AlertDialog show() { + alertDialog = AlertDialogBuilder.show(); + alertDialog.setCancelable(true); + alertDialog.setCanceledOnTouchOutside(false); + return alertDialog; + } + + public String getEditText() { + return editText.getText().toString(); + } + + public void setEditinputType(String str) { + int inputType; + switch (str) { + case "textCapCharacters": + inputType = InputType.TYPE_TEXT_FLAG_CAP_CHARACTERS; + break; + case "textCapWords": + inputType = InputType.TYPE_TEXT_FLAG_CAP_WORDS; + break; + case "textCapSentences": + inputType = InputType.TYPE_TEXT_FLAG_CAP_SENTENCES; + break; + case "textAutoCorrect": + inputType = InputType.TYPE_TEXT_FLAG_AUTO_CORRECT; + break; + case "textAutoComplete": + inputType = InputType.TYPE_TEXT_FLAG_AUTO_COMPLETE; + break; + case "textMultiLine": + inputType = InputType.TYPE_TEXT_FLAG_MULTI_LINE; + break; + case "textImeMultiLine": + inputType = InputType.TYPE_TEXT_FLAG_IME_MULTI_LINE; + break; + case "textNoSuggestions": + inputType = InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS; + break; + case "textUri": + inputType = InputType.TYPE_TEXT_VARIATION_URI; + break; + case "textEmailAddress": + inputType = InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS; + break; + case "textEmailSubject": + inputType = InputType.TYPE_TEXT_VARIATION_EMAIL_SUBJECT; + break; + case "textShortMessage": + inputType = InputType.TYPE_TEXT_VARIATION_SHORT_MESSAGE; + break; + case "textLongMessage": + inputType = InputType.TYPE_TEXT_VARIATION_LONG_MESSAGE; + break; + case "textPersonName": + inputType = InputType.TYPE_TEXT_VARIATION_PERSON_NAME; + break; + case "textPostalAddress": + inputType = InputType.TYPE_TEXT_VARIATION_POSTAL_ADDRESS; + break; + case "textPassword": + inputType = InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD; + break; + case "textVisiblePassword": + inputType = InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD; + break; + case "textWebEditText": + inputType = InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_WEB_EDIT_TEXT; + break; + case "textFilter": + inputType = InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_FILTER; + break; + case "textPhonetic": + inputType = InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PHONETIC; + break; + case "number": + inputType = InputType.TYPE_CLASS_NUMBER; + break; + case "numberSigned": + inputType = InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_SIGNED; + break; + case "numberDecimal": + inputType = InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_DECIMAL; + break; + case "phone": + inputType = InputType.TYPE_CLASS_PHONE; + break; + case "datetime": + inputType = InputType.TYPE_CLASS_DATETIME; + break; + case "date": + inputType = InputType.TYPE_CLASS_DATETIME | InputType.TYPE_DATETIME_VARIATION_DATE; + break; + case "time": + inputType = InputType.TYPE_CLASS_DATETIME | InputType.TYPE_DATETIME_VARIATION_TIME; + break; + case "none": + case "text": + default: + inputType = InputType.TYPE_CLASS_TEXT; + break; + } + editText.setInputType(inputType); + } + + public void dismiss() { + main.handler.post(() -> alertDialog.dismiss()); + } + + public void setNegative(View.OnClickListener a) { + buttona.setOnClickListener(a); + } + + public void setPositive(View.OnClickListener a) { + buttonb.setOnClickListener(a); + } + +} diff --git a/app/src/main/java/com/muqingbfq/mq/floating.java b/app/src/main/java/com/muqingbfq/mq/floating.java new file mode 100644 index 0000000..058ec81 --- /dev/null +++ b/app/src/main/java/com/muqingbfq/mq/floating.java @@ -0,0 +1,165 @@ +package com.muqingbfq.mq; + +import android.annotation.SuppressLint; +import android.app.Service; +import android.content.ClipData; +import android.content.ClipboardManager; +import android.content.Context; +import android.content.Intent; +import android.graphics.Color; +import android.graphics.PixelFormat; +import android.os.Build; +import android.os.IBinder; +import android.provider.Settings; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.view.WindowManager; +import android.widget.TextView; + +import androidx.annotation.NonNull; +import androidx.recyclerview.widget.RecyclerView; + +import com.muqingbfq.R; +import com.muqingbfq.main; + +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +public class floating extends Service { + private static RecyclerView.Adapter lbspq = new RecyclerView.Adapter() { + @NonNull + @Override + public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { + return new ViewHolder(new TextView(parent.getContext())); + } + + @Override + public void onBindViewHolder(@NonNull ViewHolder holder, int position) { + String s = list.get(position); + holder.textView.setText(s); + } + + @Override + public int getItemCount() { + return list.size(); + } + }; + + public static void start(Context context) { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && + Settings.canDrawOverlays(context)) { + context.startService(new Intent(context, floating.class)); + } + } + + public static void end(Context context) { + Intent serviceIntent = new Intent(context, floating.class); + context.stopService(serviceIntent); + } + + public static List list = new ArrayList<>(); + private WindowManager windowManager; + private View view; + private View image, layout; + + @Override + public IBinder onBind(Intent intent) { + return null; + } + + @SuppressLint("NotifyDataSetChanged") + public static void addtext(String str) { + if (lbspq == null || list == null) { + return; + } + SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss"); // 创建一个 SimpleDateFormat 对象,指定时间格式 + String formattedDate = sdf.format(new Date()); // 格式化当前时间 + list.add(0, formattedDate + ": " + str); + main.handler.post(lbspq::notifyDataSetChanged); + } + + @SuppressLint("NotifyDataSetChanged") + @Override + public void onCreate() { + super.onCreate(); + view = LayoutInflater.from(this).inflate(R.layout.floating_sc, null); + layout = view.findViewById(R.id.view1); + ViewGroup.LayoutParams layoutParams = layout.getLayoutParams(); + layoutParams.height = main.g - main.g / 2 / 2; + layoutParams.width = main.k - main.k / 2 / 2; + layout.setLayoutParams(layoutParams); + layout.setVisibility(View.GONE); + image = view.findViewById(R.id.image); + image.setOnClickListener(vw -> { + layout.setVisibility(View.VISIBLE); + vw.setVisibility(View.GONE); + }); + view.findViewById(R.id.text4).setOnClickListener(view -> { + layout.setVisibility(View.GONE); + image.setVisibility(View.VISIBLE); + }); + RecyclerView recyclerView = view.findViewById(R.id.list); + recyclerView.setAdapter(lbspq); + addtext("Android stdio 2022.3.1版-调试器"); + + //清空按钮 + view.findViewById(R.id.text1).setOnClickListener(view -> { + list.clear(); + lbspq.notifyDataSetChanged(); + }); + //复制按钮 + view.findViewById(R.id.text2).setOnClickListener(view -> { + // 获取剪贴板管理器 + ClipboardManager clipboard = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE); + clipboard.setPrimaryClip(ClipData.newPlainText("label", list.get(0))); + gj.ts(this,"成功复制了第一个数据"); + }); + //关闭按钮 + view.findViewById(R.id.text3).setOnClickListener(view -> stopSelf()); + int i = WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL + | WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE; + WindowManager.LayoutParams params = new WindowManager.LayoutParams( + WindowManager.LayoutParams.WRAP_CONTENT, + WindowManager.LayoutParams.WRAP_CONTENT, + Build.VERSION.SDK_INT >= Build.VERSION_CODES.O ? + WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY : + WindowManager.LayoutParams.TYPE_PHONE, + i, + PixelFormat.TRANSLUCENT + ); + params.x = -main.k; + windowManager = (WindowManager) getSystemService(WINDOW_SERVICE); + windowManager.addView(view, params); + } + + @Override + public void onDestroy() { + super.onDestroy(); + if (view != null && windowManager != null) { + lbspq = null; + list = null; + windowManager.removeView(view); + } + } + + private static class ViewHolder extends RecyclerView.ViewHolder { + public TextView textView; + + public ViewHolder(View itemview) { + super(itemview); + textView = (TextView) itemview; + textView.setTextColor(Color.WHITE); + textView.setOnLongClickListener(view -> { + // 获取剪贴板管理器 + ClipboardManager clipboard = (ClipboardManager) view.getContext(). + getSystemService(Context.CLIPBOARD_SERVICE); + clipboard.setPrimaryClip(ClipData.newPlainText("label", list.get(0))); + gj.ts(view.getContext(), "复制成功"); + return false; + }); + } + } +} \ No newline at end of file diff --git a/app/src/main/res/layout-land/fragment_bfq.xml b/app/src/main/res/layout-land/fragment_bfq.xml new file mode 100644 index 0000000..d4d0cb6 --- /dev/null +++ b/app/src/main/res/layout-land/fragment_bfq.xml @@ -0,0 +1,202 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/activity_bfq.xml b/app/src/main/res/layout/activity_bfq.xml new file mode 100644 index 0000000..6bb360f --- /dev/null +++ b/app/src/main/res/layout/activity_bfq.xml @@ -0,0 +1,18 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/floating_sc.xml b/app/src/main/res/layout/floating_sc.xml new file mode 100644 index 0000000..7fe1508 --- /dev/null +++ b/app/src/main/res/layout/floating_sc.xml @@ -0,0 +1,73 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/view_edit.xml b/app/src/main/res/layout/view_edit.xml new file mode 100644 index 0000000..7f6c766 --- /dev/null +++ b/app/src/main/res/layout/view_edit.xml @@ -0,0 +1,42 @@ + + + + + + +