From de76eefd7d48280b22cd9c07abd2b1c0312440df Mon Sep 17 00:00:00 2001 From: muqing <1966944300@qq.com> Date: Fri, 19 Jul 2024 08:03:23 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E4=BA=86UI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 55 ++---- .../muqingbfq/activity_about_software.java | 16 +- .../com/muqingbfq/adapter/AdapterMp3.java | 75 ++++++++ app/src/main/java/com/muqingbfq/api/url.java | 6 +- app/src/main/java/com/muqingbfq/bfq.java | 8 +- .../com/muqingbfq/fragment/gd_adapter.java | 111 ++--------- .../main/java/com/muqingbfq/fragment/mp3.java | 16 +- .../java/com/muqingbfq/fragment/wode.java | 27 +-- app/src/main/java/com/muqingbfq/home.java | 33 ++-- .../java/com/muqingbfq/login/user_logs.java | 21 +- app/src/main/java/com/muqingbfq/main.java | 2 +- .../com/muqingbfq/mq/AppCompatActivity.java | 13 +- .../muqingbfq/mq/FloatingLyricsService.java | 55 +++--- .../main/java/com/muqingbfq/mq/Fragment.java | 27 +++ .../com/muqingbfq/mq/RecyclerAdapter.java | 13 ++ app/src/main/java/com/muqingbfq/mq/VH.java | 16 ++ app/src/main/java/com/muqingbfq/mq/gj.java | 6 +- app/src/main/java/com/muqingbfq/mq/llq.java | 18 +- app/src/main/java/com/muqingbfq/sz.java | 79 ++++---- app/src/main/res/drawable/mpbackground.xml | 4 +- .../res/layout/activity_about_software.xml | 179 ++++++++++-------- app/src/main/res/layout/activity_bfq.xml | 2 + app/src/main/res/layout/activity_mp3.xml | 2 +- .../main/res/layout/activity_sz_setlrc.xml | 69 +++---- .../main/res/layout/activity_user_logs.xml | 78 ++------ app/src/main/res/layout/float_lrcview.xml | 36 ++-- app/src/main/res/layout/fragment_bflb_db.xml | 18 +- app/src/main/res/layout/fragment_bfq_db.xml | 3 +- app/src/main/res/layout/fragment_gd.xml | 39 ++-- app/src/main/res/layout/list_gd.xml | 12 +- app/src/main/res/layout/list_gd_b.xml | 14 +- app/src/main/res/layout/list_mp3.xml | 99 +++++----- app/src/main/res/layout/list_mp3_image.xml | 63 +++--- settings.gradle | 4 +- 34 files changed, 616 insertions(+), 603 deletions(-) create mode 100644 app/src/main/java/com/muqingbfq/adapter/AdapterMp3.java create mode 100644 app/src/main/java/com/muqingbfq/mq/Fragment.java create mode 100644 app/src/main/java/com/muqingbfq/mq/RecyclerAdapter.java create mode 100644 app/src/main/java/com/muqingbfq/mq/VH.java diff --git a/README.md b/README.md index 5a6ae62..ab0f144 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,12 @@ -云音乐是什么? +## 云音乐是什么? 一个对接网易云的音乐播放器 - * 内置集成作者自己写的歌词Lrc组件支持单行歌词和多行歌词支持悬浮窗歌词。 * 内置适配Android13的通知栏 (不完善请大佬请教) * 对接了网易云的歌单,歌曲,搜索,二维码登录等其余功能。 * main.java-内api变量是网易云SDK后台服务器地址(可变更) * http 是我服务器php接口的地址用于软件更新用或者其他功能(个根据需要做出必须的更改或者删除) -进度: - +## 进度 * UI * 歌单 * 音乐播放选择列表 @@ -24,54 +22,23 @@ * 悬浮歌词功能 * 基本播放器功能(控制暂停 上下曲 播放歌单操作) - + +## 截图 Screenshot_20240224_154259_com.muqingbfq.jpg Screenshot_20240224_154302_com.muqingbfq.jpg Screenshot_20240224_154306_com.muqingbfq.jpg -* 在使用中有任何问题,欢迎反馈给我,可以用以下联系方式跟我交流 - * [邮件]() - * QQ:1966944300 - * 后台源码-Github: [网易云音乐 API](https://github.com/Binaryify/NeteaseCloudMusicApi) +## 在使用中有任何问题,欢迎反馈给我,可以用以下联系方式跟我交流 + * QQ:1966944300 -开发者说 : +## 后台 + * Github: [网易云音乐 API](https://github.com/Binaryify/NeteaseCloudMusicApi) + +## 关于 在兴趣的驱动下,写一个`免费`的东西,有欣喜,也还有汗水,希望你喜欢我的作品,同时也能支持一下。 -导入的包 - -```javascript -dependencies { - implementation 'androidx.appcompat:appcompat:1.6.1' - implementation 'com.google.android.material:material:1.9.0' - - implementation 'androidx.constraintlayout:constraintlayout:2.1.4' - - implementation 'com.google.code.gson:gson:2.9.1' - - implementation 'com.squareup.okhttp3:okhttp:4.11.0' - //图片处理 - implementation 'com.github.bumptech.glide:glide:4.16.0' - implementation "androidx.palette:palette:1.0.0" -// 废弃的歌词组件 -// implementation 'com.github.wangchenyan:lrcview:2.2.1' - implementation 'com.google.android.flexbox:flexbox:3.0.0' - - implementation 'androidx.legacy:legacy-support-v4:1.0.0' - -//修改音乐标签库 - implementation 'com.mpatric:mp3agic:0.9.1' - -// 沉浸式状态栏 - api project(path: ':StatusBarUtil') - api project(path: ':lrcview') -} -``` - -修改JAR的包 +## 修改JAR的包 ```javascript [//]: # (主要修改内容MD3化) com.github.QuadFlask:colorpicker:0.0.15 diff --git a/app/src/main/java/com/muqingbfq/activity_about_software.java b/app/src/main/java/com/muqingbfq/activity_about_software.java index 427176d..e34966f 100644 --- a/app/src/main/java/com/muqingbfq/activity_about_software.java +++ b/app/src/main/java/com/muqingbfq/activity_about_software.java @@ -6,6 +6,7 @@ import android.content.res.AssetManager; import android.os.Build; import android.os.Bundle; import android.text.Html; +import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuItem; import android.view.View; @@ -14,14 +15,15 @@ import android.widget.ImageView; import android.widget.TextView; import androidx.annotation.NonNull; -import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.widget.Toolbar; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import com.bumptech.glide.Glide; import com.google.android.material.bottomsheet.BottomSheetDialog; +import com.muqingbfq.databinding.ActivityAboutSoftwareBinding; import com.muqingbfq.databinding.ListKaifazheBinding; +import com.muqingbfq.mq.AppCompatActivity; import com.muqingbfq.mq.gj; import com.muqingbfq.mq.wj; @@ -32,21 +34,20 @@ import java.io.InputStreamReader; import java.util.ArrayList; import java.util.List; -public class activity_about_software extends AppCompatActivity { +public class activity_about_software extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - setContentView(R.layout.activity_about_software); + setContentView(); try { String versionName = getPackageManager().getPackageInfo(getPackageName(), 0).versionName; - ((TextView) findViewById(R.id.text2)).setText(String.format("%s Bate", versionName)); + binding.text2.setText(String.format("%s Bate", versionName)); } catch (PackageManager.NameNotFoundException e) { yc.start(this, e); } setSupportActionBar(findViewById(R.id.toolbar)); getSupportActionBar().setDisplayHomeAsUpEnabled(true); findViewById(R.id.button1).setOnClickListener(view -> { - wj.sc(wj.filesdri + "gx.mq"); new Thread() { @Override public void run() { @@ -103,6 +104,11 @@ public class activity_about_software extends AppCompatActivity { return super.onOptionsItemSelected(item); } + @Override + protected ActivityAboutSoftwareBinding getViewBindingObject(LayoutInflater layoutInflater) { + return ActivityAboutSoftwareBinding.inflate(layoutInflater); + } + class botton extends BottomSheetDialog { List list = new ArrayList<>(); diff --git a/app/src/main/java/com/muqingbfq/adapter/AdapterMp3.java b/app/src/main/java/com/muqingbfq/adapter/AdapterMp3.java new file mode 100644 index 0000000..e2dac90 --- /dev/null +++ b/app/src/main/java/com/muqingbfq/adapter/AdapterMp3.java @@ -0,0 +1,75 @@ +package com.muqingbfq.adapter; + +import android.content.Context; +import android.util.TypedValue; +import android.view.LayoutInflater; +import android.view.ViewGroup; + +import androidx.annotation.NonNull; +import androidx.core.content.ContextCompat; +import androidx.recyclerview.widget.RecyclerView; + +import com.bumptech.glide.Glide; +import com.bumptech.glide.request.RequestOptions; +import com.muqingbfq.MP3; +import com.muqingbfq.R; +import com.muqingbfq.api.url; +import com.muqingbfq.bfqkz; +import com.muqingbfq.databinding.ListMp3ImageBinding; +import com.muqingbfq.mq.VH; + +import java.util.ArrayList; +import java.util.List; + +public class AdapterMp3 extends RecyclerView.Adapter> { + public List list = new ArrayList<>(); + + @NonNull + @Override + public VH onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { + return new VH<>(ListMp3ImageBinding.inflate( + LayoutInflater.from(parent.getContext()), parent, false)); + } + + @Override + public void onBindViewHolder(@NonNull VH holder, int position) { + MP3 x = list.get(position); + holder.binding.wb1.setText(x.name); + holder.binding.zz.setText(x.zz); + if (bfqkz.xm != null && x.id.equals(bfqkz.xm.id)) { + TypedValue typedValue = new TypedValue(); + holder.itemView.getContext().getTheme().resolveAttribute( + com.google.android.material.R.attr.colorPrimaryDark, typedValue, true); + int colorSurface = typedValue.data; + // 这里 colorSurface 就是你要找的颜色值 + holder.binding.getRoot().setCardBackgroundColor(colorSurface); + } else { + holder.binding.getRoot().setCardBackgroundColor(ContextCompat + .getColor(holder.itemView.getContext(), android.R.color.transparent)); + } + holder.itemView.setOnClickListener(view -> { + if (bfqkz.xm == null || !bfqkz.xm.id.equals(x.id)) { + 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.addAll(list); +// bfq.start(getContext()); + }); + Glide.with(holder.itemView.getContext()).load(x.picurl) + .apply(new RequestOptions().placeholder(R.drawable.ic_launcher_foreground)) + .error(R.drawable.ic_launcher_foreground) + .into(holder.binding.imageView); + } + + @Override + public int getItemCount() { + return list.size(); + } + +} diff --git a/app/src/main/java/com/muqingbfq/api/url.java b/app/src/main/java/com/muqingbfq/api/url.java index d727bcf..faabf8e 100644 --- a/app/src/main/java/com/muqingbfq/api/url.java +++ b/app/src/main/java/com/muqingbfq/api/url.java @@ -52,11 +52,7 @@ public class url extends Thread { // gj.sc(json); if (json.getInt("code") == -460) { String message = json.getString("message"); - main.handler.post(() -> { - gj.ts(home.activity, message); - home.activity.startActivity(new android.content.Intent(home.activity - , com.muqingbfq.login.user_logs.class)); - }); + gj.sc(message); return null; } JSONArray data = json.getJSONArray("data"); diff --git a/app/src/main/java/com/muqingbfq/bfq.java b/app/src/main/java/com/muqingbfq/bfq.java index 1caafc6..877609a 100644 --- a/app/src/main/java/com/muqingbfq/bfq.java +++ b/app/src/main/java/com/muqingbfq/bfq.java @@ -171,9 +171,9 @@ public class bfq extends AppCompatActivity } } - @SuppressLint("ClickableViewAccessibility") - @Override - protected void UI(@Nullable Bundle savedInstanceState) { + protected void onCreate(@Nullable Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(); gestureDetector = new GestureDetector(this, this); setLrc(); rotateAnimation = ObjectAnimator.ofFloat(binding.cardview @@ -223,7 +223,7 @@ public class bfq extends AppCompatActivity bfqkz.like_bool = !bfqkz.like_bool; wj.xrwb(wj.gd + "mp3_like.json", gson.toJson(list)); } catch (Exception e) { - e.printStackTrace(); + gj.sc(e); } }); binding.download.setOnClickListener(view -> { diff --git a/app/src/main/java/com/muqingbfq/fragment/gd_adapter.java b/app/src/main/java/com/muqingbfq/fragment/gd_adapter.java index 8cd2349..90f0d98 100644 --- a/app/src/main/java/com/muqingbfq/fragment/gd_adapter.java +++ b/app/src/main/java/com/muqingbfq/fragment/gd_adapter.java @@ -10,23 +10,19 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.appcompat.app.ActionBarDrawerToggle; import androidx.appcompat.app.AppCompatActivity; -import androidx.core.content.ContextCompat; -import androidx.fragment.app.Fragment; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; -import com.bumptech.glide.Glide; -import com.bumptech.glide.request.RequestOptions; import com.muqingbfq.MP3; import com.muqingbfq.R; import com.muqingbfq.XM; import com.muqingbfq.activity_search; +import com.muqingbfq.adapter.AdapterMp3; import com.muqingbfq.api.resource; -import com.muqingbfq.api.url; -import com.muqingbfq.bfqkz; import com.muqingbfq.databinding.FragmentGdBinding; import com.muqingbfq.databinding.ListMp3ImageBinding; import com.muqingbfq.main; +import com.muqingbfq.mq.Fragment; import com.muqingbfq.mq.gj; import com.muqingbfq.mq.wj; import com.muqingbfq.mq.wl; @@ -37,10 +33,9 @@ import org.json.JSONObject; import java.util.ArrayList; import java.util.List; -public class gd_adapter extends Fragment { +public class gd_adapter extends Fragment { List list = new ArrayList<>(); - List listmp3 = new ArrayList<>(); - FragmentGdBinding binding; + AdapterMp3 adapterMp3 = new AdapterMp3(); public void toolbar() { // binding.bar.setupWithDrawer @@ -52,15 +47,18 @@ public class gd_adapter extends Fragment { toggle.syncState(); } - @Nullable @Override - public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, + protected FragmentGdBinding inflateViewBinding(LayoutInflater inflater, ViewGroup container) { + return FragmentGdBinding.inflate(inflater, container, false); + } + + + @Override + public void setUI(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { - binding = FragmentGdBinding.inflate(getLayoutInflater(), container, false); //初始化工具栏 toolbar(); - LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getContext()); - linearLayoutManager.setOrientation(LinearLayoutManager.HORIZONTAL); + LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getContext(),LinearLayoutManager.HORIZONTAL,false); binding.recyclerview1.setHasFixedSize(true); binding.recyclerview1.setNestedScrollingEnabled(false); binding.recyclerview1.setLayoutManager(linearLayoutManager); @@ -74,81 +72,12 @@ public class gd_adapter extends Fragment { } }.start(); - binding.recyclerview2.setLayoutManager(new LinearLayoutManager(getContext()) { - @Override - public boolean canScrollVertically() { - return false; - } - }); - binding.recyclerview2.setAdapter(new RecyclerView.Adapter() { - @NonNull - @Override - public VH_MP3 onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { - return new VH_MP3(ListMp3ImageBinding.inflate(getLayoutInflater(), parent, false)); - } - - @SuppressLint("NotifyDataSetChanged") - @Override - public void onBindViewHolder(@NonNull VH_MP3 holder, int position) { - MP3 x = listmp3.get(position); - holder.binding.wb1.setText(x.name); - holder.binding.zz.setText(x.zz); - if (bfqkz.xm != null && x.id.equals(bfqkz.xm.id)) { - int musicListBackgroundColor = ContextCompat.getColor(holder.itemView.getContext(), R.color.bj); - holder.binding.getRoot().setBackgroundColor(musicListBackgroundColor); - }else{ - holder.binding.getRoot().setBackground(ContextCompat - .getDrawable(holder.itemView.getContext(),R.drawable.background)); - } - holder.itemView.setOnClickListener(view -> { - if (bfqkz.xm == null || !bfqkz.xm.id.equals(x.id)) { - 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.addAll(list); -// bfq.start(getContext()); - }); - Glide.with(getContext()).load(x.picurl) - .apply(new RequestOptions().placeholder(R.drawable.ic_launcher_foreground)) - .error(R.drawable.ic_launcher_foreground) - .into(holder.binding.imageView); - } - - @Override - public int getItemCount() { - return listmp3.size(); - } - }); mp3list(); - + binding.recyclerview2.setLayoutManager(new LinearLayoutManager(getContext())); + binding.recyclerview2.setNestedScrollingEnabled(false); + binding.recyclerview2.setAdapter(adapterMp3); binding.toolbar.setOnClickListener(v -> activity_search.start(getActivity(), v)); - return binding.getRoot(); } - - class VH_MP3 extends RecyclerView.ViewHolder { - ListMp3ImageBinding binding; - - public VH_MP3(@NonNull ListMp3ImageBinding itemView) { - super(itemView.getRoot()); - this.binding = itemView; - } - } - - @SuppressLint("NotifyDataSetChanged") - @Override - public void onResume() { - super.onResume(); - if (binding.recyclerview1.getAdapter() != null) { - binding.recyclerview1.getAdapter().notifyDataSetChanged(); - } - } - private class sx implements Runnable { @SuppressLint("NotifyDataSetChanged") @Override @@ -166,7 +95,7 @@ public class gd_adapter extends Fragment { super.run(); String hq = wl.hq("/recommend/songs" + "?cookie=" + wl.Cookie); if (hq == null) { - hq = wj.dqwb(wj.filesdri + "songs.josn"); + hq = wj.dqwb(wj.filesdri + "songs.json"); } try { JSONObject jsonObject = new JSONObject(hq); @@ -183,11 +112,11 @@ public class gd_adapter extends Fragment { } JSONObject al = jsonObject1.getJSONObject("al"); String picUrl = al.getString("picUrl"); - listmp3.add(new MP3(id, name, zz.toString(), picUrl)); + adapterMp3.list.add(new MP3(id, name, zz.toString(), picUrl)); } - wj.xrwb(wj.filesdri + "songs.josn", hq); - main.handler.post(() -> { - binding.recyclerview2.getAdapter().notifyDataSetChanged(); + wj.xrwb(wj.filesdri + "songs.json", hq); + requireActivity().runOnUiThread(() -> { + adapterMp3.notifyDataSetChanged(); binding.recyclerview2Bar.setVisibility(View.GONE); }); } catch (Exception e) { diff --git a/app/src/main/java/com/muqingbfq/fragment/mp3.java b/app/src/main/java/com/muqingbfq/fragment/mp3.java index c1eeceb..fb98df3 100644 --- a/app/src/main/java/com/muqingbfq/fragment/mp3.java +++ b/app/src/main/java/com/muqingbfq/fragment/mp3.java @@ -8,6 +8,7 @@ import android.content.Intent; import android.os.Bundle; import android.text.Editable; import android.text.TextWatcher; +import android.util.TypedValue; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuItem; @@ -89,9 +90,6 @@ public class mp3 extends FragmentActivity { } }); - //添加Android自带的分割线 - binding.lb.addItemDecoration( - new DividerItemDecoration(this, DividerItemDecoration.VERTICAL)); } @Override @@ -208,11 +206,15 @@ public class mp3 extends FragmentActivity { holder.binding.name.setText(x.name); holder.binding.zz.setText(x.zz); if (bfqkz.xm != null && x.id.equals(bfqkz.xm.id)) { - int musicListBackgroundColor = ContextCompat.getColor(holder.getContext(), R.color.bj); - holder.binding.getRoot().setBackgroundColor(musicListBackgroundColor); + TypedValue typedValue = new TypedValue(); + holder.itemView.getContext().getTheme().resolveAttribute( + com.google.android.material.R.attr.colorPrimaryDark, typedValue, true); + int colorSurface = typedValue.data; + // 这里 colorSurface 就是你要找的颜色值 + holder.binding.getRoot().setCardBackgroundColor(colorSurface); }else{ - holder.binding.getRoot().setBackground(ContextCompat - .getDrawable(holder.getContext(),R.drawable.background)); + holder.binding.getRoot().setCardBackgroundColor(ContextCompat + .getColor(holder.itemView.getContext(), android.R.color.transparent)); } // holder.binding.zz.setTextColor(color); holder.itemView.setOnClickListener(view -> { diff --git a/app/src/main/java/com/muqingbfq/fragment/wode.java b/app/src/main/java/com/muqingbfq/fragment/wode.java index 8c9a60b..716a77c 100644 --- a/app/src/main/java/com/muqingbfq/fragment/wode.java +++ b/app/src/main/java/com/muqingbfq/fragment/wode.java @@ -3,7 +3,6 @@ package com.muqingbfq.fragment; import android.annotation.SuppressLint; import android.app.Activity; import android.content.Intent; -import android.content.res.ColorStateList; import android.graphics.drawable.Drawable; import android.os.Bundle; import android.view.LayoutInflater; @@ -16,18 +15,13 @@ import androidx.activity.result.ActivityResultLauncher; import androidx.activity.result.contract.ActivityResultContracts; import androidx.annotation.NonNull; import androidx.annotation.Nullable; -import androidx.appcompat.app.ActionBarDrawerToggle; -import androidx.appcompat.app.AppCompatActivity; import androidx.core.content.ContextCompat; -import androidx.drawerlayout.widget.DrawerLayout; -import androidx.fragment.app.Fragment; import androidx.recyclerview.widget.GridLayoutManager; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import com.bumptech.glide.Glide; import com.bumptech.glide.request.RequestOptions; -import com.google.android.material.appbar.AppBarLayout; import com.google.android.material.dialog.MaterialAlertDialogBuilder; import com.google.gson.Gson; import com.muqingbfq.R; @@ -41,6 +35,7 @@ import com.muqingbfq.login.user_logs; import com.muqingbfq.login.visitor; import com.muqingbfq.main; import com.muqingbfq.mq.EditViewDialog; +import com.muqingbfq.mq.Fragment; import com.muqingbfq.mq.gj; import com.muqingbfq.mq.wj; @@ -54,10 +49,9 @@ import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; -public class wode extends Fragment { +public class wode extends Fragment { public TextView name, jieshao; public ImageView imageView; - FragmentWdBinding binding; private final Object[][] lista = { {R.drawable.mdimusicbox, "最近播放", "mp3_hc.json"}, {R.drawable.download, "下载音乐", "mp3_xz.json"}, @@ -72,22 +66,14 @@ public class wode extends Fragment { @SuppressLint("StaticFieldLeak") public static baseadapter adaper; - public void toolbar() { - ((AppCompatActivity) requireActivity()).setSupportActionBar(binding.toolbar); - DrawerLayout drawerLayout = requireActivity().findViewById(R.id.chct); - ActionBarDrawerToggle toggle = new ActionBarDrawerToggle( - requireActivity(), drawerLayout, binding.toolbar, R.string.app_name, R.string.app_name); - drawerLayout.addDrawerListener(toggle); - toggle.syncState(); + @Override + protected FragmentWdBinding inflateViewBinding(LayoutInflater inflater, ViewGroup container) { + return FragmentWdBinding.inflate(inflater, container, false); } - @Nullable @Override - public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, + public void setUI(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { - binding = FragmentWdBinding.inflate(inflater, container, false); - //初始化工具栏 - toolbar(); name = binding.text1; binding.appbar.addOnOffsetChangedListener((appBarLayout, verticalOffset) -> { gj.sc(binding.text1.isShown()); @@ -217,7 +203,6 @@ public class wode extends Fragment { binding.recyclerview2.setAdapter(adaper); sx(); denglu(); - return binding.getRoot(); } ActivityResultLauncher dlintent = registerForActivityResult( diff --git a/app/src/main/java/com/muqingbfq/home.java b/app/src/main/java/com/muqingbfq/home.java index 7ed50dc..89adeef 100644 --- a/app/src/main/java/com/muqingbfq/home.java +++ b/app/src/main/java/com/muqingbfq/home.java @@ -1,7 +1,6 @@ package com.muqingbfq; import android.annotation.SuppressLint; -import android.app.Activity; import android.content.ComponentName; import android.content.Context; import android.content.Intent; @@ -14,10 +13,7 @@ import android.view.Menu; import android.view.MenuItem; import androidx.annotation.NonNull; -import androidx.appcompat.app.AppCompatActivity; import androidx.fragment.app.Fragment; -import androidx.fragment.app.FragmentActivity; -import androidx.recyclerview.widget.RecyclerView; import androidx.viewpager2.adapter.FragmentStateAdapter; import androidx.viewpager2.widget.ViewPager2; @@ -25,7 +21,7 @@ import com.jaeger.library.StatusBarUtil; import com.muqingbfq.databinding.ActivityHomeBinding; import com.muqingbfq.fragment.gd_adapter; import com.muqingbfq.fragment.wode; -import com.muqingbfq.login.visitor; +import com.muqingbfq.mq.AppCompatActivity; import com.muqingbfq.mq.gj; import com.muqingbfq.mq.wl; @@ -34,20 +30,18 @@ import org.json.JSONObject; import java.util.ArrayList; import java.util.List; -public class home extends AppCompatActivity { +public class home extends AppCompatActivity { public MediaBrowserCompat mBrowser; - @SuppressLint("StaticFieldLeak") - public static Context activity; - - ActivityHomeBinding binding; - + @Override + protected ActivityHomeBinding getViewBindingObject(LayoutInflater layoutInflater) { + return ActivityHomeBinding.inflate(layoutInflater); + } @Override protected void onCreate(Bundle savedInstanceState) { setTheme(R.style.Theme_muqing); - activity = this; super.onCreate(savedInstanceState); wl.Cookie = main.sp.getString("Cookie", ""); - if (wl.Cookie.equals("")) { + if (wl.Cookie.isEmpty()) { new Thread() { @Override public void run() { @@ -56,9 +50,7 @@ public class home extends AppCompatActivity { try { JSONObject jsonObject = new JSONObject(hq); wl.setcookie(jsonObject.getString("cookie")); - home.this.runOnUiThread(() -> { - UI(); - }); + home.this.runOnUiThread(() -> UI()); } catch (Exception e) { com.muqingbfq.mq.gj.sc(e); } @@ -68,14 +60,15 @@ public class home extends AppCompatActivity { UI(); } } - + @Override + protected void onResume() { + super.onResume(); + } public static ComponentName componentName; List list = new ArrayList<>(); - public void UI() { - binding = ActivityHomeBinding.inflate(getLayoutInflater()); StatusBarUtil.setTransparent(home.this); - setContentView(binding.getRoot()); + setContentView(); DisplayMetrics dm = getResources().getDisplayMetrics(); main.k = dm.widthPixels; main.g = dm.heightPixels; diff --git a/app/src/main/java/com/muqingbfq/login/user_logs.java b/app/src/main/java/com/muqingbfq/login/user_logs.java index 5be5944..98f02cd 100644 --- a/app/src/main/java/com/muqingbfq/login/user_logs.java +++ b/app/src/main/java/com/muqingbfq/login/user_logs.java @@ -6,15 +6,16 @@ import android.graphics.BitmapFactory; import android.os.Bundle; import android.text.TextUtils; import android.util.Base64; +import android.view.LayoutInflater; import android.view.MenuItem; import android.view.View; import android.view.inputmethod.InputMethodManager; import androidx.annotation.NonNull; -import androidx.appcompat.app.AppCompatActivity; import com.muqingbfq.databinding.ActivityUserLogsBinding; import com.muqingbfq.main; +import com.muqingbfq.mq.AppCompatActivity; import com.muqingbfq.mq.gj; import com.muqingbfq.mq.wl; @@ -23,7 +24,12 @@ import org.json.JSONObject; import java.util.Objects; -public class user_logs extends AppCompatActivity { +public class user_logs extends AppCompatActivity { + @Override + protected ActivityUserLogsBinding getViewBindingObject(LayoutInflater layoutInflater) { + return ActivityUserLogsBinding.inflate(layoutInflater); + } + public static class USER { public String name, qianming; public Object picUrl; @@ -35,13 +41,11 @@ public class user_logs extends AppCompatActivity { } } - ActivityUserLogsBinding binding; erweima thread; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - binding = ActivityUserLogsBinding.inflate(getLayoutInflater()); - setContentView(binding.getRoot()); + setContentView(); setSupportActionBar(binding.toolbar); getSupportActionBar().setDisplayHomeAsUpEnabled(true); binding.login.setOnClickListener(view -> new CloudUser()); @@ -103,8 +107,9 @@ public class user_logs extends AppCompatActivity { imm.hideSoftInputFromWindow(v.getWindowToken(), 0); } user_logs.this.account = binding.editUser.getText().toString(); - user_logs.this.password = binding.editPassword.getText().toString(); - start(); + gj.xcts(user_logs.this, "设置成功"); + wl.setcookie(account); +// start(); } @Override @@ -123,8 +128,6 @@ public class user_logs extends AppCompatActivity { String avatarUrl = data.getString("avatarUrl");//用户头像 String signature = data.getString("signature");//用户签名 String cookie = jsonObject.getString("cookie"); - gj.xcts(user_logs.this, "登录成功"); - wl.setcookie(cookie); new user_message(nickname, signature, avatarUrl); user_logs.this.finish(true); } else if (code == 502) { diff --git a/app/src/main/java/com/muqingbfq/main.java b/app/src/main/java/com/muqingbfq/main.java index 6c6a6e8..4c9ba97 100644 --- a/app/src/main/java/com/muqingbfq/main.java +++ b/app/src/main/java/com/muqingbfq/main.java @@ -29,7 +29,7 @@ import java.util.List; public class main extends Application { public static Application application; public static Handler handler = new Handler(Looper.getMainLooper()); - public static String api = "https://service-8xjb06vc-1319932248.gz.tencentapigw.com.cn/release"; + public static String api = "https://api.csm.sayqz.com"; public static String http = "https://www.muqingkaifazhe.top/muqingbfq.php"; public static int k, g; public static SharedPreferences sp; diff --git a/app/src/main/java/com/muqingbfq/mq/AppCompatActivity.java b/app/src/main/java/com/muqingbfq/mq/AppCompatActivity.java index c736248..3d770eb 100644 --- a/app/src/main/java/com/muqingbfq/mq/AppCompatActivity.java +++ b/app/src/main/java/com/muqingbfq/mq/AppCompatActivity.java @@ -2,6 +2,7 @@ package com.muqingbfq.mq; import android.os.Bundle; import android.view.LayoutInflater; +import android.view.View; import androidx.annotation.Nullable; import androidx.viewbinding.ViewBinding; @@ -18,15 +19,7 @@ public abstract class AppCompatActivity ext } public ViewBindingType binding; - @Override - protected void onCreate(@Nullable Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - StatusBarUtil.setTransparent(this); - setContentView(getViewBinding().getRoot()); - UI(savedInstanceState); - } - - protected void UI(@Nullable Bundle savedInstanceState) { - + public void setContentView() { + super.setContentView(getViewBinding().getRoot()); } } diff --git a/app/src/main/java/com/muqingbfq/mq/FloatingLyricsService.java b/app/src/main/java/com/muqingbfq/mq/FloatingLyricsService.java index 9e9bfa8..33d845c 100644 --- a/app/src/main/java/com/muqingbfq/mq/FloatingLyricsService.java +++ b/app/src/main/java/com/muqingbfq/mq/FloatingLyricsService.java @@ -19,6 +19,7 @@ import androidx.annotation.Nullable; import com.dirror.lyricviewx.LyricEntry; import com.dirror.lyricviewx.LyricViewX; +import com.google.android.material.card.MaterialCardView; import com.google.gson.Gson; import com.google.gson.reflect.TypeToken; import com.muqingbfq.R; @@ -28,9 +29,10 @@ import com.muqingbfq.main; import java.io.File; import java.lang.reflect.Type; + public class FloatingLyricsService extends Service implements View.OnClickListener, View.OnTouchListener { private WindowManager windowManager; - private View layout; + FloatLrcviewBinding binding; public Runnable updateSeekBar = new Runnable() { @Override @@ -45,19 +47,20 @@ public class FloatingLyricsService extends Service implements View.OnClickListen } } if (index < LyricViewX.lyricEntryList.size()) { - String text; LyricEntry currentLrc = LyricViewX.lyricEntryList.get(index); - text = currentLrc.text; + binding.lrcView.setText(currentLrc.text); if (currentLrc.secondText != null) { - text += "\n" + currentLrc.secondText; + binding.lrcViewMessage.setText(currentLrc.secondText); + }else{ + binding.lrcViewMessage.setText(""); } - binding.lrcView.setText(text); } handler.postDelayed(this, 1000); // 每秒更新一次进度 } }; @SuppressLint("StaticFieldLeak") public static FloatingLyricsService lei; + public static boolean get() { File file = new File(wj.filesdri + "FloatingLyricsService.json"); if (file.exists() && file.isFile()) { @@ -71,9 +74,10 @@ public class FloatingLyricsService extends Service implements View.OnClickListen return false; } } + Handler handler = new Handler(); - FloatLrcviewBinding binding; WindowManager.LayoutParams params; + public static class SETUP { //0是关闭 1是打开 2是锁定 public int i = 1, size = 20; @@ -83,6 +87,7 @@ public class FloatingLyricsService extends Service implements View.OnClickListen } public SETUP setup = new SETUP(); + public int lock() { if (setup != null && setup.i == 2) { return WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE @@ -91,6 +96,7 @@ public class FloatingLyricsService extends Service implements View.OnClickListen return WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL | WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE; } + @Override public void onCreate() { super.onCreate(); @@ -107,8 +113,7 @@ public class FloatingLyricsService extends Service implements View.OnClickListen // 创建悬浮窗歌词的 View // FloatLrcviewBinding binding = FloatLrcviewBinding.inflate(LayoutInflater.from(this)); - layout = binding.getRoot(); - layout.setOnTouchListener(this); +// binding.getRoot().setOnTouchListener(this); // int i = WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE;FLAG_NOT_TOUCH_MODAL params = new WindowManager.LayoutParams( WindowManager.LayoutParams.MATCH_PARENT, @@ -122,24 +127,24 @@ public class FloatingLyricsService extends Service implements View.OnClickListen params.y = setup.Y; - binding.lrcView.setAlpha(setup.Alpha); - binding.lrcView.setTextSize(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_PX, + binding.getRoot().setAlpha(setup.Alpha); + float v = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_PX, setup.size, - getResources().getDisplayMetrics())); + getResources().getDisplayMetrics()); + binding.lrcView.setTextSize(v); binding.lrcView.setTextColor(Color.parseColor(setup.Color)); + binding.lrcViewMessage.setTextSize(v-1.0f); + binding.lrcViewMessage.setTextColor(Color.parseColor(setup.Color)); binding.lock.setOnClickListener(this); // params.gravity = Gravity.CENTER; // 获取 WindowManager 并将悬浮窗歌词添加到窗口中 windowManager = (WindowManager) getSystemService(WINDOW_SERVICE); - windowManager.addView(layout, params); + windowManager.addView(binding.getRoot(), params); if (setup.i == 2) { setyc(); -/* params.flags = lock(); - layout.setBackground(null); - binding.lrcView.setAlpha(setup.Alpha); - layout.findViewById(R.id.lock).setVisibility(View.GONE);*/ + } else { show(); } @@ -158,8 +163,8 @@ public class FloatingLyricsService extends Service implements View.OnClickListen public void onDestroy() { super.onDestroy(); // 在 Service 销毁时移除悬浮窗歌词 - if (windowManager != null && layout != null) { - windowManager.removeView(layout); + if (windowManager != null && binding != null) { + windowManager.removeView(binding.getRoot()); handler.removeCallbacks(updateSeekBar); // 在播放开始时启动更新进度 } lei = null; @@ -176,6 +181,7 @@ public class FloatingLyricsService extends Service implements View.OnClickListen wj.xrwb(new File(wj.filesdri + "FloatingLyricsService.json").toString(), new Gson().toJson(setup)); } + public static void baocun(SETUP setup) { if (setup == null) { return; @@ -202,7 +208,7 @@ public class FloatingLyricsService extends Service implements View.OnClickListen int offsetY = (int) (motionEvent.getRawY() - initialTouchY); setup.Y = initialY + offsetY; params.y = setup.Y; - windowManager.updateViewLayout(layout, params); + windowManager.updateViewLayout(binding.getRoot(), params); return true; case MotionEvent.ACTION_UP: baocun(); @@ -235,10 +241,8 @@ public class FloatingLyricsService extends Service implements View.OnClickListen public void setyc() { setup.i = 2; params.flags = lock(); - layout.setBackground(null); - binding.lrcView.setAlpha(setup.Alpha); - layout.findViewById(R.id.lock).setVisibility(View.GONE); - windowManager.updateViewLayout(layout, params); + binding.lock.setVisibility(View.GONE); + windowManager.updateViewLayout(binding.getRoot(), params); baocun(); } @@ -246,9 +250,8 @@ public class FloatingLyricsService extends Service implements View.OnClickListen public void show() { setup.i = 1; params.flags = lock(); - binding.lrcView.setAlpha(1.0f); - layout.findViewById(R.id.lock).setVisibility(View.VISIBLE); - windowManager.updateViewLayout(layout, params); + binding.lock.setVisibility(View.VISIBLE); + windowManager.updateViewLayout(binding.getRoot(), params); baocun(); } } diff --git a/app/src/main/java/com/muqingbfq/mq/Fragment.java b/app/src/main/java/com/muqingbfq/mq/Fragment.java new file mode 100644 index 0000000..709098a --- /dev/null +++ b/app/src/main/java/com/muqingbfq/mq/Fragment.java @@ -0,0 +1,27 @@ +package com.muqingbfq.mq; + +import android.graphics.Rect; +import android.os.Bundle; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.viewbinding.ViewBinding; + +public abstract class Fragment extends androidx.fragment.app.Fragment { + + protected abstract Binding inflateViewBinding(LayoutInflater inflater,ViewGroup container); + + public Binding binding; + @Nullable + @Override + public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { + binding=inflateViewBinding(inflater,container); + setUI(inflater, container, savedInstanceState); + return binding.getRoot(); + } + + public abstract void setUI(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState); +} diff --git a/app/src/main/java/com/muqingbfq/mq/RecyclerAdapter.java b/app/src/main/java/com/muqingbfq/mq/RecyclerAdapter.java new file mode 100644 index 0000000..8f6387e --- /dev/null +++ b/app/src/main/java/com/muqingbfq/mq/RecyclerAdapter.java @@ -0,0 +1,13 @@ +package com.muqingbfq.mq; + +import android.content.Context; +import android.view.View; +import android.view.ViewGroup; + +import androidx.annotation.NonNull; +import androidx.recyclerview.widget.RecyclerView; +import androidx.viewbinding.ViewBinding; + +public class RecyclerAdapter { + +} diff --git a/app/src/main/java/com/muqingbfq/mq/VH.java b/app/src/main/java/com/muqingbfq/mq/VH.java new file mode 100644 index 0000000..ec57bc8 --- /dev/null +++ b/app/src/main/java/com/muqingbfq/mq/VH.java @@ -0,0 +1,16 @@ +package com.muqingbfq.mq; + +import android.view.View; + +import androidx.annotation.NonNull; +import androidx.recyclerview.widget.RecyclerView; +import androidx.viewbinding.ViewBinding; + +public class VH extends RecyclerView.ViewHolder { + + public bind binding; + public VH(bind itemView) { + super(itemView.getRoot()); + binding = itemView; + } +} diff --git a/app/src/main/java/com/muqingbfq/mq/gj.java b/app/src/main/java/com/muqingbfq/mq/gj.java index ee9d6fa..770f34a 100644 --- a/app/src/main/java/com/muqingbfq/mq/gj.java +++ b/app/src/main/java/com/muqingbfq/mq/gj.java @@ -144,11 +144,10 @@ public class gj { String bb = jsonObject.getString("bb"); main.handler.post(() -> new MaterialAlertDialogBuilder(context) .setTitle("更新" + bb) - .setMessage(msg + "\n" + "取消后不再提示更新你需要到关于软件手动检测") - .setNegativeButton("取消", (dialogInterface, i) -> wj.xrwb(wj.filesdri + "gx.mq", null)) + .setMessage(msg) + .setNegativeButton("取消", null) .setPositiveButton("更新", (dialogInterface, i) -> context.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)))) -// new ApkDownloader(context).downloadAndInstall(url, wj.filesdri)) .show()); } //1表示需要更新 @@ -158,7 +157,6 @@ public class gj { } return 400; } - public static void tcjp(EditText editText) { editText.requestFocus();//获取焦点 InputMethodManager imm = (InputMethodManager) diff --git a/app/src/main/java/com/muqingbfq/mq/llq.java b/app/src/main/java/com/muqingbfq/mq/llq.java index c61f948..46edadc 100644 --- a/app/src/main/java/com/muqingbfq/mq/llq.java +++ b/app/src/main/java/com/muqingbfq/mq/llq.java @@ -42,13 +42,17 @@ import okhttp3.Response; public class llq extends AppCompatActivity { WebView web; + @Override protected ActivityLlqBinding getViewBindingObject(LayoutInflater layoutInflater) { return ActivityLlqBinding.inflate(layoutInflater); } + @SuppressLint("SetJavaScriptEnabled") @Override - protected void UI(@Nullable Bundle savedInstanceState) { + protected void onCreate(@Nullable Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(); Intent intent = getIntent(); setSupportActionBar(binding.toolbar); getSupportActionBar().setDisplayHomeAsUpEnabled(true); @@ -108,6 +112,7 @@ public class llq extends AppCompatActivity { public void onFailure(@NonNull Call call, @NonNull IOException e) { } + @Override public void onResponse(@NonNull Call call, @NonNull Response response) throws IOException { InputStream inputStream = response.body().byteStream(); @@ -131,13 +136,13 @@ public class llq extends AppCompatActivity { } fileOutputStream.close(); } catch (Exception e) { - e.printStackTrace(); - }finally { + gj.sc(e); + } finally { if (fileOutputStream != null) { fileOutputStream.close(); } } - main.handler.post(()->{ + main.handler.post(() -> { gj.ts(llq.this, "下载完成"); show.dismiss(); }); @@ -162,9 +167,11 @@ public class llq extends AppCompatActivity { }); loadUrl(intent.getStringExtra("url")); } + private void loadUrl(String url) { web.loadUrl(url); } + @Override public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { super.onRequestPermissionsResult(requestCode, permissions, grantResults); @@ -174,11 +181,13 @@ public class llq extends AppCompatActivity { gj.ts(this, "权限已授予,请重新执行文件下载操作"); } } + @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.llq, menu); return super.onCreateOptionsMenu(menu); } + @Override public void onBackPressed() { if (web.canGoBack()) { @@ -187,6 +196,7 @@ public class llq extends AppCompatActivity { finish(); } } + @Override public boolean onOptionsItemSelected(@NonNull MenuItem item) { int itemId = item.getItemId(); diff --git a/app/src/main/java/com/muqingbfq/sz.java b/app/src/main/java/com/muqingbfq/sz.java index 811d728..eeaff0d 100644 --- a/app/src/main/java/com/muqingbfq/sz.java +++ b/app/src/main/java/com/muqingbfq/sz.java @@ -31,19 +31,22 @@ import com.muqingbfq.databinding.ActivitySzBinding; import com.muqingbfq.databinding.ActivitySzSetlrcBinding; import com.muqingbfq.mq.AppCompatActivity; import com.muqingbfq.mq.FloatingLyricsService; +import com.muqingbfq.mq.gj; import com.muqingbfq.mq.wj; import java.io.File; import java.lang.reflect.Type; -import java.util.Locale; public class sz extends AppCompatActivity { @Override protected ActivitySzBinding getViewBindingObject(LayoutInflater layoutInflater) { return ActivitySzBinding.inflate(layoutInflater); } + @Override - protected void UI(Bundle bundle) { + protected void onCreate(Bundle bundle) { + super.onCreate(bundle); + setContentView(); setSupportActionBar(binding.toolbar); getSupportActionBar().setDisplayHomeAsUpEnabled(true); setTitle(getString(R.string.sz)); @@ -82,6 +85,7 @@ public class sz extends AppCompatActivity { } }); } + @Override public boolean onOptionsItemSelected(@NonNull MenuItem item) { if (item.getItemId() == android.R.id.home) { @@ -89,9 +93,11 @@ public class sz extends AppCompatActivity { } return super.onOptionsItemSelected(item); } + public static class setlrc extends Fragment implements Slider.OnSliderTouchListener, Slider.OnChangeListener { ActivitySzSetlrcBinding binding; + boolean is = true; ActivityResultLauncher LyricsService = registerForActivityResult(new ActivityResultContracts.StartActivityForResult(), result -> { if (Settings.canDrawOverlays(getContext())) { @@ -99,15 +105,16 @@ public class sz extends AppCompatActivity { } else { binding.switchA3.setChecked(false); binding.slide1.setEnabled(true); - binding.slide2.setEnabled(true); } }); FloatingLyricsService.SETUP setup; - public Runnable updateSeekBar = new Runnable() { + + class ThreadLrc extends Thread { @Override public void run() { - if (bfqkz.mt.isPlaying()) { + super.run(); + while (is) { int index = 0; for (int i = 0; i < LyricViewX.lyricEntryList.size(); i++) { LyricEntry lineLrc = LyricViewX.lyricEntryList.get(i); @@ -118,20 +125,25 @@ public class sz extends AppCompatActivity { } } if (index < LyricViewX.lyricEntryList.size()) { - String text; LyricEntry currentLrc = LyricViewX.lyricEntryList.get(index); - text = currentLrc.text; - if (currentLrc.secondText != null) { - text += "\n" + currentLrc.secondText; - } - binding.lrctext.setText(text); + requireActivity().runOnUiThread(() -> { + if (currentLrc.secondText != null) { + binding.lrcViewMessage.setText(currentLrc.secondText); + } else { + binding.lrcViewMessage.setText(""); + } + binding.lrcView.setText(currentLrc.text); + }); + } + gj.sc("ThreadLrc"); + try { + sleep(1000); + } catch (InterruptedException e) { + break; } } -// gj.sc(getClass()+"执行"); - main.handler.postDelayed(this, 1000); // 每秒更新一次进度 } - }; - + } @Nullable @Override @@ -145,18 +157,19 @@ public class sz extends AppCompatActivity { }.getType(); binding.slide1.setEnabled(true); - binding.slide2.setEnabled(true); - setup = gson.fromJson(dqwb, type); binding.slide1.setValue(setup.size); - binding.slide2.setValue(setup.Alpha); - binding.lrctext.setAlpha(setup.Alpha); - binding.lrctext.setTextSize(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_PX, + binding.lrcView.setTextSize(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_PX, setup.size, getResources().getDisplayMetrics())); - binding.lrctext.setTextColor(Color.parseColor(setup.Color)); - binding.lrctext.setOnClickListener(view -> ColorPickerDialogBuilder + binding.lrcView.setTextColor(Color.parseColor(setup.Color)); + + binding.lrcViewMessage.setTextSize(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_PX, + setup.size, + getResources().getDisplayMetrics()) - 1.0f); + binding.lrcViewMessage.setTextColor(Color.parseColor(setup.Color)); + binding.lrclin.setOnClickListener(view -> ColorPickerDialogBuilder .with(view.getContext()) .setTitle("调色盘") .initialColor(Color.parseColor(setup.Color)) @@ -166,18 +179,18 @@ public class sz extends AppCompatActivity { }) .setPositiveButton("确定", (dialog, selectedColor, allColors) -> { setup.Color = String.format("#%08X", selectedColor); - binding.lrctext.setTextColor(selectedColor); + binding.lrcView.setTextColor(selectedColor); + binding.lrcViewMessage.setTextColor(selectedColor); FloatingLyricsService.baocun(setup); }) .setNegativeButton("取消", null) .build() .show()); binding.textSlide1.setText(String.valueOf(setup.size)); - binding.textSlide2.setText(String.format(Locale.US, "%.2f", setup.Alpha)); if (setup.i != 0) { binding.switchA3.setChecked(true); } - main.handler.post(updateSeekBar); + new ThreadLrc().start(); } binding.switchA3.setOnCheckedChangeListener((compoundButton, b) -> { if (b) { @@ -206,16 +219,13 @@ public class sz extends AppCompatActivity { binding.slide1.addOnChangeListener(this); binding.slide1.addOnSliderTouchListener(this); - binding.slide2.addOnChangeListener(this); - binding.slide2.addOnSliderTouchListener(this); - return binding.getRoot(); } @Override public void onDestroy() { super.onDestroy(); - main.handler.removeCallbacks(updateSeekBar); + is = false; } @Override @@ -236,17 +246,14 @@ public class sz extends AppCompatActivity { if (setup == null) { return; } - if (slider == binding.slide1) { setup.size = (int) value; - binding.lrctext.setTextSize(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_PX, + float v = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_PX, setup.size, - getResources().getDisplayMetrics())); + getResources().getDisplayMetrics()); + binding.lrcView.setTextSize(v); + binding.lrcViewMessage.setTextSize(v - 1.0f); binding.textSlide1.setText(String.valueOf(setup.size)); - } else if (slider == binding.slide2) { - setup.Alpha = value; - binding.lrctext.setAlpha(value); - binding.textSlide2.setText(String.format(Locale.US, "%.2f", value)); } } } diff --git a/app/src/main/res/drawable/mpbackground.xml b/app/src/main/res/drawable/mpbackground.xml index 19123fa..ff1963b 100644 --- a/app/src/main/res/drawable/mpbackground.xml +++ b/app/src/main/res/drawable/mpbackground.xml @@ -1,7 +1,7 @@ \ No newline at end of file diff --git a/app/src/main/res/layout/activity_about_software.xml b/app/src/main/res/layout/activity_about_software.xml index d0d2366..8bd5d0f 100644 --- a/app/src/main/res/layout/activity_about_software.xml +++ b/app/src/main/res/layout/activity_about_software.xml @@ -1,91 +1,120 @@ - - - - - + android:fitsSystemWindows="true"> + + + + + + - - - - - + + + android:layout_height="match_parent" + android:orientation="vertical"> + + + + + + + + + + + + + + + + + +