├── .gitignore
├── .idea
├── .gitignore
├── compiler.xml
├── gradle.xml
└── misc.xml
├── app
├── .gitignore
├── build.gradle.kts
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── com
│ │ └── quietfall
│ │ └── ExampleInstrumentedTest.java
│ ├── main
│ ├── AndroidManifest.xml
│ ├── java
│ │ └── com
│ │ │ └── quietfall
│ │ │ ├── AddMusicListActivity.java
│ │ │ ├── MainActivity.java
│ │ │ ├── MusicListActivity.java
│ │ │ ├── MusicPlayActivity.java
│ │ │ ├── database
│ │ │ └── ListSqliteHelper.java
│ │ │ ├── entity
│ │ │ ├── LinkInfo.java
│ │ │ ├── ListInfo.java
│ │ │ ├── Music.java
│ │ │ └── MusicList.java
│ │ │ ├── fragment
│ │ │ ├── AboutFragment.java
│ │ │ └── HomeFragment.java
│ │ │ ├── service
│ │ │ └── MusicService.java
│ │ │ └── utils
│ │ │ ├── HttpUtils.java
│ │ │ └── ToastUtil.java
│ └── res
│ │ ├── drawable
│ │ ├── about1.png
│ │ ├── about2.png
│ │ ├── add.png
│ │ ├── back.png
│ │ ├── btn_selector.xml
│ │ ├── btn_shape_normal.xml
│ │ ├── btn_shape_pressed.xml
│ │ ├── home1.png
│ │ ├── home2.png
│ │ ├── ic_launcher_background.xml
│ │ ├── ic_launcher_foreground.xml
│ │ ├── item_selector.xml
│ │ ├── last.png
│ │ ├── logo.jpg
│ │ ├── love.png
│ │ ├── loved.png
│ │ ├── menu.png
│ │ ├── next.png
│ │ ├── order.png
│ │ ├── pause.png
│ │ ├── play.png
│ │ ├── random.png
│ │ └── repeat.png
│ │ ├── layout
│ │ ├── activity_add_music_list.xml
│ │ ├── activity_main.xml
│ │ ├── activity_music_list.xml
│ │ ├── activity_music_play.xml
│ │ ├── fragment_about.xml
│ │ ├── fragment_home.xml
│ │ ├── list_item.xml
│ │ ├── music_list_item.xml
│ │ └── title_layout.xml
│ │ ├── mipmap-hdpi
│ │ ├── ic_launcher.webp
│ │ └── ic_launcher_round.webp
│ │ ├── mipmap-mdpi
│ │ ├── ic_launcher.webp
│ │ └── ic_launcher_round.webp
│ │ ├── mipmap-xhdpi
│ │ ├── ic_launcher.webp
│ │ └── ic_launcher_round.webp
│ │ ├── mipmap-xxhdpi
│ │ ├── ic_launcher.webp
│ │ └── ic_launcher_round.webp
│ │ ├── mipmap-xxxhdpi
│ │ ├── ic_launcher.webp
│ │ └── ic_launcher_round.webp
│ │ ├── values-night
│ │ └── themes.xml
│ │ └── values
│ │ ├── colors.xml
│ │ ├── strings.xml
│ │ └── themes.xml
│ └── test
│ └── java
│ └── com
│ └── quietfall
│ └── ExampleUnitTest.java
├── build.gradle.kts
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
└── settings.gradle.kts
/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/caches
5 | /.idea/libraries
6 | /.idea/modules.xml
7 | /.idea/workspace.xml
8 | /.idea/navEditor.xml
9 | /.idea/assetWizardSettings.xml
10 | .DS_Store
11 | /build
12 | /captures
13 | .externalNativeBuild
14 | .cxx
15 | local.properties
16 |
--------------------------------------------------------------------------------
/.idea/.gitignore:
--------------------------------------------------------------------------------
1 | # Default ignored files
2 | /shelf/
3 | /workspace.xml
4 |
--------------------------------------------------------------------------------
/.idea/compiler.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
18 |
19 |
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
--------------------------------------------------------------------------------
/app/build.gradle.kts:
--------------------------------------------------------------------------------
1 | plugins {
2 | id("com.android.application")
3 | }
4 |
5 | android {
6 | namespace = "com.quietfall"
7 | compileSdk = 33
8 |
9 | defaultConfig {
10 | applicationId = "com.quietfall"
11 | minSdk = 28
12 | targetSdk = 33
13 | versionCode = 1
14 | versionName = "1.0"
15 |
16 | testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
17 | }
18 |
19 | buildTypes {
20 | release {
21 | isMinifyEnabled = false
22 | proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
23 | }
24 | }
25 | compileOptions {
26 | sourceCompatibility = JavaVersion.VERSION_1_8
27 | targetCompatibility = JavaVersion.VERSION_1_8
28 | }
29 | }
30 |
31 | dependencies {
32 |
33 | implementation ("com.google.code.gson:gson:2.10.1")
34 | implementation("com.squareup.okhttp3:okhttp:4.10.0")
35 | implementation("com.github.bumptech.glide:glide:3.7.0")
36 | implementation("androidx.appcompat:appcompat:1.6.1")
37 | implementation("com.google.android.material:material:1.8.0")
38 | implementation("androidx.constraintlayout:constraintlayout:2.1.4")
39 | testImplementation("junit:junit:4.13.2")
40 | androidTestImplementation("androidx.test.ext:junit:1.1.5")
41 | androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1")
42 | }
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
--------------------------------------------------------------------------------
/app/src/androidTest/java/com/quietfall/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.quietfall;
2 |
3 | import android.content.Context;
4 |
5 | import androidx.test.platform.app.InstrumentationRegistry;
6 | import androidx.test.ext.junit.runners.AndroidJUnit4;
7 |
8 | import org.junit.Test;
9 | import org.junit.runner.RunWith;
10 |
11 | import static org.junit.Assert.*;
12 |
13 | /**
14 | * Instrumented test, which will execute on an Android device.
15 | *
16 | * @see Testing documentation
17 | */
18 | @RunWith(AndroidJUnit4.class)
19 | public class ExampleInstrumentedTest {
20 | @Test
21 | public void useAppContext() {
22 | // Context of the app under test.
23 | Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
24 | assertEquals("com.quietfall", appContext.getPackageName());
25 | }
26 | }
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
18 |
22 |
23 |
26 |
29 |
32 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
--------------------------------------------------------------------------------
/app/src/main/java/com/quietfall/AddMusicListActivity.java:
--------------------------------------------------------------------------------
1 | package com.quietfall;
2 |
3 | import androidx.appcompat.app.AppCompatActivity;
4 |
5 | import android.content.ContentValues;
6 | import android.content.Intent;
7 | import android.graphics.Bitmap;
8 | import android.os.Build;
9 | import android.os.Bundle;
10 | import android.util.Log;
11 | import android.view.ViewGroup;
12 | import android.webkit.WebResourceError;
13 | import android.webkit.WebResourceRequest;
14 | import android.webkit.WebSettings;
15 | import android.webkit.WebView;
16 | import android.webkit.WebViewClient;
17 |
18 | import com.quietfall.database.ListSqliteHelper;
19 | import com.quietfall.entity.MusicList;
20 | import com.quietfall.utils.HttpUtils;
21 | import com.quietfall.utils.ToastUtil;
22 |
23 | import java.io.IOException;
24 | import java.util.List;
25 | import java.util.regex.Matcher;
26 | import java.util.regex.Pattern;
27 |
28 | public class AddMusicListActivity extends AppCompatActivity {
29 | private final String TAG = "qf";
30 | private WebView webview;
31 | private WebSettings webSettings;
32 | private String url;
33 | private String starUrl;
34 | private static final String ID_REGEX = "(fid=)(\\d*)(&|$)";
35 | private static final Pattern ID_PATTERN;
36 | private ListSqliteHelper mHelper;
37 |
38 | static {
39 | ID_PATTERN = Pattern.compile(ID_REGEX);
40 | }
41 |
42 | @Override
43 | protected void onCreate(Bundle savedInstanceState) {
44 | super.onCreate(savedInstanceState);
45 | setContentView(R.layout.activity_add_music_list);
46 | Intent intent = getIntent();
47 | String uid = intent.getStringExtra("uid");
48 | url = "https://space.bilibili.com/" + uid + "/favlist";
49 | webview = findViewById(R.id.webview);
50 |
51 | webSettings = webview.getSettings();
52 | webSettings.setJavaScriptEnabled(true);
53 | webSettings.setJavaScriptCanOpenWindowsAutomatically(true);
54 |
55 | webSettings.setUseWideViewPort(true);//支持viewport
56 | // webSettings.setLoadWithOverviewMode(true);//自适应屏幕
57 | webSettings.setBuiltInZoomControls(true);
58 | webSettings.setDisplayZoomControls(false);
59 | webSettings.setSupportZoom(true);//支持缩放
60 |
61 | webSettings.setUserAgentString("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36 Edg/120.0.0.0");
62 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
63 | webSettings.setMixedContentMode(WebSettings.MIXED_CONTENT_COMPATIBILITY_MODE);
64 | }
65 | webSettings.setDomStorageEnabled(true);
66 |
67 |
68 | webview.loadUrl(url);
69 |
70 |
71 | webview.setWebViewClient(new WebViewClient() {
72 | @Override
73 | public boolean shouldOverrideUrlLoading(WebView view, String url) {
74 | view.loadUrl(url);
75 | return true;
76 | }
77 |
78 | @Override
79 | public void onLoadResource(WebView view, String url) {
80 | super.onLoadResource(view, url);
81 | String thisUrl = view.getUrl();
82 | if (!thisUrl.equals(starUrl)) {
83 | starUrl = thisUrl;
84 | if (thisUrl.contains("fid")) {
85 |
86 | Matcher matcher = ID_PATTERN.matcher(thisUrl);
87 | if (matcher.find()) {
88 | //id为收藏夹官方id
89 | String id = matcher.group(2);
90 | ToastUtil.show(AddMusicListActivity.this, "已选择收藏夹" + matcher.group(2));
91 | new Thread() {
92 | @Override
93 | public void run() {
94 | super.run();
95 | String name = HttpUtils.getListNameById(id);
96 | Log.d(TAG, "AddMusicListActivity获取批量数据失败获取到收藏夹名字: " + name);
97 | long result = mHelper.insert(new MusicList(name, id));
98 | Log.d(TAG, "AddMusicListActivity插入单个收藏夹信息返回结果: " + result);
99 | mHelper.createMusicListTable(id);
100 | List valuesList = null;
101 | try {
102 | valuesList = HttpUtils.getColumnById(id, HttpUtils.getCountById(id));
103 | } catch (IOException e) {
104 | Log.d(TAG, "AddMusicListActivity获取批量数据失败run: error");
105 | }
106 | mHelper.insertSomeMusic(valuesList, id);
107 | finish();
108 |
109 | }
110 | }.start();
111 | }
112 | }
113 | }
114 | }
115 | });
116 |
117 | }
118 |
119 | @Override
120 | protected void onStart() {
121 | super.onStart();
122 | mHelper = ListSqliteHelper.getInstance(this);
123 | mHelper.openWriteLink();
124 | mHelper.openReadLink();
125 | }
126 |
127 | @Override
128 | protected void onStop() {
129 | super.onStop();
130 | // mHelper.closeLink();
131 | }
132 |
133 | @Override
134 | protected void onDestroy() {
135 | super.onDestroy();
136 | /**
137 | * 避免内存泄露,界面销毁时做如下处理
138 | */
139 | if (webview != null) {
140 | webview.loadDataWithBaseURL(null, "", "text/html", "utf-8", null);
141 | webview.clearHistory();
142 |
143 | ((ViewGroup) webview.getParent()).removeView(webview);
144 | webview.destroy();
145 | webview = null;
146 | }
147 | }
148 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/quietfall/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.quietfall;
2 |
3 | import androidx.appcompat.app.AppCompatActivity;
4 | import androidx.fragment.app.FragmentManager;
5 | import androidx.fragment.app.FragmentTransaction;
6 |
7 | import android.app.AlertDialog;
8 | import android.content.DialogInterface;
9 | import android.content.Intent;
10 | import android.os.Bundle;
11 | import android.view.View;
12 | import android.widget.AdapterView;
13 | import android.widget.BaseAdapter;
14 | import android.widget.EditText;
15 | import android.widget.ImageView;
16 | import android.widget.ListView;
17 | import android.widget.SimpleAdapter;
18 |
19 | import com.quietfall.database.ListSqliteHelper;
20 | import com.quietfall.entity.MusicList;
21 | import com.quietfall.fragment.AboutFragment;
22 | import com.quietfall.fragment.HomeFragment;
23 | import com.quietfall.utils.ToastUtil;
24 |
25 | import java.util.ArrayList;
26 | import java.util.HashMap;
27 | import java.util.List;
28 | import java.util.Map;
29 |
30 | public class MainActivity extends AppCompatActivity implements View.OnClickListener {
31 |
32 | private ListView lv_list;
33 | private ListSqliteHelper mHelper;
34 | private FragmentTransaction ft;
35 | private FragmentManager fm;
36 | private boolean isHome;
37 | private boolean isAbout;
38 | private ImageView iv_home;
39 | private ImageView iv_about;
40 |
41 |
42 | @Override
43 | protected void onCreate(Bundle savedInstanceState) {
44 | super.onCreate(savedInstanceState);
45 | setContentView(R.layout.activity_main);
46 |
47 |
48 | /*findViewById(R.id.iv_add)
49 | .setOnClickListener(this);*/
50 | iv_home = findViewById(R.id.iv_home);
51 | iv_about = findViewById(R.id.iv_about);
52 |
53 |
54 |
55 | iv_about.setOnClickListener(this);
56 | iv_home.setOnClickListener(this);
57 | isHome = true;
58 | isAbout = false;
59 |
60 | }
61 |
62 | /*private void initList() {
63 | List musicListList = mHelper.queryAll();
64 | if (musicListList.size() == 0) {
65 | lv_list.setVisibility(View.GONE);
66 | } else {
67 | lv_list.setVisibility(View.VISIBLE);
68 | }
69 | List