├── .gitignore
├── .idea
├── assetWizardSettings.xml
├── caches
│ └── build_file_checksums.ser
├── codeStyles
│ └── Project.xml
├── encodings.xml
├── gradle.xml
├── inspectionProfiles
│ └── Project_Default.xml
├── jarRepositories.xml
├── misc.xml
├── modules.xml
├── runConfigurations.xml
└── vcs.xml
├── LICENSE
├── MyFiles
├── git命令.txt
├── login界面代码.txt
├── picture
│ ├── screenshot
│ │ ├── Version1.0
│ │ │ ├── Screenshot_2018-12-02-22-46-42-71.png
│ │ │ ├── Screenshot_2018-12-02-22-46-47-79.png
│ │ │ ├── Screenshot_2018-12-02-22-46-52-22.png
│ │ │ ├── Screenshot_2018-12-02-22-46-56-24.png
│ │ │ ├── Screenshot_2018-12-02-22-47-02-97.png
│ │ │ ├── Screenshot_2018-12-02-22-47-16-86.png
│ │ │ └── Screenshot_2018-12-02-22-47-35-54.png
│ │ ├── Version1.1
│ │ │ ├── display.png
│ │ │ ├── login.png
│ │ │ ├── playHistory.png
│ │ │ ├── play_music.png
│ │ │ └── searchMusic.png
│ │ ├── Version1.2
│ │ │ ├── automaticStop.png
│ │ │ ├── display.png
│ │ │ ├── playHistory.png
│ │ │ ├── searchMusic.png
│ │ │ └── setting.png
│ │ ├── Version1.3
│ │ │ ├── automaticStop.png
│ │ │ ├── display.png
│ │ │ ├── notification.png
│ │ │ ├── playHistory.png
│ │ │ ├── playMode.png
│ │ │ ├── searchMusic.png
│ │ │ └── setting.png
│ │ └── Version1.4
│ │ │ ├── detail.png
│ │ │ ├── love_songs.png
│ │ │ ├── main.png
│ │ │ ├── menu.png
│ │ │ ├── playMode.png
│ │ │ ├── search.png
│ │ │ ├── share.png
│ │ │ └── stop_with_time.png
│ └── 图标
│ │ ├── music.png
│ │ ├── music_false.png
│ │ ├── music_true.png
│ │ ├── next_1.png
│ │ ├── pause.png
│ │ ├── play_2.png
│ │ ├── user.png
│ │ └── user_red.png
├── startWindow.psd
└── 淘汰的代码.txt
├── README.md
├── app
├── .gitignore
├── build.gradle
├── libs
│ ├── httpclient-4.2.5.jar
│ └── httpcore-4.4.4.jar
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── edu
│ │ └── whut
│ │ └── ruansong
│ │ └── musicplayer
│ │ └── ExampleInstrumentedTest.java
│ ├── main
│ ├── AndroidManifest.xml
│ ├── java
│ │ └── edu
│ │ │ └── whut
│ │ │ └── ruansong
│ │ │ └── musicplayer
│ │ │ ├── activity
│ │ │ ├── DisplayActivity.java
│ │ │ ├── LoginActivity.java
│ │ │ ├── MyLoveSongsActivity.java
│ │ │ ├── SearchDetailActivity.java
│ │ │ ├── ShareActivity.java
│ │ │ ├── SongDetailActivity.java
│ │ │ └── SplashActivity.java
│ │ │ ├── db
│ │ │ ├── MyDbFunctions.java
│ │ │ └── MyDbHelper.java
│ │ │ ├── model
│ │ │ ├── ActivityCollector.java
│ │ │ ├── BaseActivity.java
│ │ │ ├── DrawerLayoutListViewItem.java
│ │ │ ├── PlayHistory.java
│ │ │ ├── Song.java
│ │ │ └── SongsCollector.java
│ │ │ ├── myView
│ │ │ └── GramophoneView.java
│ │ │ ├── service
│ │ │ ├── MungNotification.java
│ │ │ └── MusicService.java
│ │ │ └── tool
│ │ │ ├── DrawerLayoutListViewAdapter.java
│ │ │ ├── PictureDealHelper.java
│ │ │ ├── PlayPauseBtn.java
│ │ │ ├── SocketLogin.java
│ │ │ └── SongAdapter.java
│ └── res
│ │ ├── drawable-v24
│ │ └── ic_launcher_foreground.xml
│ │ ├── drawable
│ │ ├── about.png
│ │ ├── album_icon_test.jpg
│ │ ├── album_svg_32.xml
│ │ ├── back.png
│ │ ├── back_detail_activity.png
│ │ ├── background_gradient.xml
│ │ ├── btn_play_click.xml
│ │ ├── btn_rounded_corner_black_stroke.xml
│ │ ├── btn_rounded_corner_shape.xml
│ │ ├── checkbox_false.png
│ │ ├── checkbox_style.xml
│ │ ├── checkbox_true.png
│ │ ├── close.png
│ │ ├── close_black_32.png
│ │ ├── close_gray.png
│ │ ├── cycle_32.png
│ │ ├── danger.png
│ │ ├── default_album_icon.png
│ │ ├── default_album_icon2.png
│ │ ├── default_album_icon_detail_activity.png
│ │ ├── default_album_icon_gray.png
│ │ ├── exit.png
│ │ ├── exit_2.png
│ │ ├── full_love_32.png
│ │ ├── head_login_80.png
│ │ ├── history_32.png
│ │ ├── ic_launcher_background.xml
│ │ ├── list_view_rounded_corner.xml
│ │ ├── login_background.jpg
│ │ ├── logo.png
│ │ ├── love.png
│ │ ├── menu_gray.png
│ │ ├── more_options.png
│ │ ├── next_32.png
│ │ ├── next_5_gray.png
│ │ ├── next_black_48.png
│ │ ├── order_32.png
│ │ ├── password_white_login_25.png
│ │ ├── pause_32.png
│ │ ├── pause_5_gray.png
│ │ ├── pause_black_64.png
│ │ ├── play_32.png
│ │ ├── play_5_gray.png
│ │ ├── play_black_64.png
│ │ ├── playing_grass_green.png
│ │ ├── playing_violet.png
│ │ ├── pre_black.png
│ │ ├── pre_black_48.png
│ │ ├── random_32.png
│ │ ├── refresh.png
│ │ ├── save_32.png
│ │ ├── scrollbar_track.xml
│ │ ├── scrollbars.xml
│ │ ├── search.png
│ │ ├── search_view.xml
│ │ ├── setting.png
│ │ ├── share_detail_activity.png
│ │ ├── song_item_picture.png
│ │ ├── start_window.png
│ │ ├── stop_with_time.png
│ │ └── user_white_login_25.png
│ │ ├── layout
│ │ ├── activity_display.xml
│ │ ├── activity_login.xml
│ │ ├── activity_my_love_songs.xml
│ │ ├── activity_search_detail.xml
│ │ ├── activity_share.xml
│ │ ├── activity_song_detail.xml
│ │ ├── dialog_feedback.xml
│ │ ├── dialog_stop_with_time.xml
│ │ ├── drawer_layout_list_item.xml
│ │ ├── my_history_view.xml
│ │ ├── notification.xml
│ │ ├── play_pause_btn.xml
│ │ └── song_list_item.xml
│ │ ├── menu
│ │ ├── menu_display.xml
│ │ ├── menu_play_mode.xml
│ │ ├── menu_search_detail_activity.xml
│ │ └── menu_song_detail_activity.xml
│ │ ├── mipmap-anydpi-v26
│ │ ├── ic_launcher.xml
│ │ └── ic_launcher_round.xml
│ │ ├── mipmap-hdpi
│ │ ├── ic_launcher.png
│ │ ├── ic_launcher_round.png
│ │ ├── logo.png
│ │ ├── pause.png
│ │ └── play_2.png
│ │ ├── mipmap-mdpi
│ │ ├── ic_launcher.png
│ │ ├── ic_launcher_round.png
│ │ └── logo.png
│ │ ├── mipmap-xhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxxhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ └── values
│ │ ├── colors.xml
│ │ ├── dimen.xml
│ │ ├── gramophoneView_attr.xml
│ │ ├── play_pause_btn_attr.xml
│ │ ├── strings.xml
│ │ └── styles.xml
│ └── test
│ └── java
│ └── edu
│ └── whut
│ └── ruansong
│ └── musicplayer
│ └── ExampleUnitTest.java
├── build.gradle
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
└── settings.gradle
/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/workspace.xml
5 | /.idea/libraries
6 | .DS_Store
7 | /build
8 | /captures
9 | .externalNativeBuild
10 |
--------------------------------------------------------------------------------
/.idea/assetWizardSettings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
46 |
47 |
--------------------------------------------------------------------------------
/.idea/caches/build_file_checksums.ser:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RSMung/RSMungMusic/69604871803c311798a01c4c722c996cf1f01bda/.idea/caches/build_file_checksums.ser
--------------------------------------------------------------------------------
/.idea/codeStyles/Project.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 | xmlns:android
14 |
15 | ^$
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 | xmlns:.*
25 |
26 | ^$
27 |
28 |
29 | BY_NAME
30 |
31 |
32 |
33 |
34 |
35 |
36 | .*:id
37 |
38 | http://schemas.android.com/apk/res/android
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 | .*:name
48 |
49 | http://schemas.android.com/apk/res/android
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 | name
59 |
60 | ^$
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 | style
70 |
71 | ^$
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 | .*
81 |
82 | ^$
83 |
84 |
85 | BY_NAME
86 |
87 |
88 |
89 |
90 |
91 |
92 | .*
93 |
94 | http://schemas.android.com/apk/res/android
95 |
96 |
97 | ANDROID_ATTRIBUTE_ORDER
98 |
99 |
100 |
101 |
102 |
103 |
104 | .*
105 |
106 | .*
107 |
108 |
109 | BY_NAME
110 |
111 |
112 |
113 |
114 |
115 |
116 |
--------------------------------------------------------------------------------
/.idea/encodings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
20 |
21 |
--------------------------------------------------------------------------------
/.idea/inspectionProfiles/Project_Default.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.idea/jarRepositories.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
--------------------------------------------------------------------------------
/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/.idea/runConfigurations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/MyFiles/git命令.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RSMung/RSMungMusic/69604871803c311798a01c4c722c996cf1f01bda/MyFiles/git命令.txt
--------------------------------------------------------------------------------
/MyFiles/login界面代码.txt:
--------------------------------------------------------------------------------
1 | package musicplayer;
2 |
3 |
4 | import android.app.ProgressDialog;
5 | import android.content.Intent;
6 | import android.content.SharedPreferences;
7 | import android.media.MediaPlayer;
8 | import android.net.Uri;
9 | import android.os.Bundle;
10 | import android.os.Handler;
11 | import android.os.Message;
12 | import android.util.Log;
13 | import android.view.View;
14 | import android.widget.Button;
15 | import android.widget.CheckBox;
16 | import android.widget.ImageButton;
17 | import android.widget.TextView;
18 | import android.widget.Toast;
19 |
20 | import org.apache.http.HttpEntity;
21 | import org.apache.http.HttpResponse;
22 | import org.apache.http.client.HttpClient;
23 | import org.apache.http.client.methods.HttpGet;
24 | import org.apache.http.impl.client.DefaultHttpClient;
25 | import org.apache.http.params.CoreConnectionPNames;
26 | import org.apache.http.util.EntityUtils;
27 | import musicplayer.dynamicBackGround.VideoBackground;
28 |
29 | public class LoginActivity extends BaseActivity {
30 |
31 | private VideoBackground login_videoview = null;
32 | private int curVolume;
33 | private static int login_status = 0;//��¼״̬
34 | private Button b_login;
35 | private CheckBox remember_user,remember_password;
36 | private TextView login_pas;
37 | private TextView login_user;
38 | private String passwordStr;//�����������
39 | private String userStr;//����û���
40 | private SharedPreferences.Editor sPreEditor_usr,sPreEditor_password;
41 | private ProgressDialog progDia1;
42 | private ImageButton login_ban_music;
43 | private int flag_ban_music = 0;//���ƽ�ֹ����ͼƬ�õ�
44 | @Override
45 | protected void onCreate(Bundle savedInstanceState) {
46 | super.onCreate(savedInstanceState);
47 | Log.w("LoginActivity","onCreate��ִ����");
48 | Log.w("LoginActivity","login_status��"+login_status);
49 | if(login_status == 0){//δ��¼���
50 | setContentView(R.layout.activity_login);
51 | b_login = findViewById(R.id.button_login);//��¼��ťʵ����
52 | initButtonDeal();//�����¼��ť���¼�
53 | initBackground();//��ʼ����̬����
54 | loadDefaultMsg();//����Ĭ���û���������
55 | ban_music_button();
56 | }else{//�Ѿ���½�� ��������Ϊ�˵�¼���˳�app�ٽ��벻��Ҫ�ٴε�¼
57 | jumpToNextPage();
58 | }
59 | }
60 | public void jumpToNextPage(){
61 | Intent intent = new Intent(LoginActivity.this, DisplayActivity.class);
62 | intent.putExtra("userName", userStr);
63 | startActivity(intent);
64 | }
65 | public void initButtonDeal(){
66 | //����ȷ����ť���¼�
67 | b_login.setOnClickListener(new View.OnClickListener() {
68 | @Override
69 | public void onClick(View view) {
70 | login_pas = findViewById(R.id.login_pas);//�����ı������
71 | login_user = findViewById(R.id.login_user);//�û����ı������
72 | userStr = login_user.getText().toString();//���������û������ı���
73 | passwordStr = login_pas.getText().toString();//�����������루�ı���
74 | if(!userStr.equals("")&&!passwordStr.equals("")){//���������
75 | //�������߳�ȥ����������е�����
76 | sendRequestWithHttpClient(userStr,passwordStr);
77 | //��ʾ ȦȦ ���ӷ�������...
78 | progDia1 = new ProgressDialog(LoginActivity.this);
79 | progDia1.setMessage("���ӷ�������...");
80 | progDia1.show();
81 | progDia1.setCanceledOnTouchOutside(false);//�����ʾȦ�ⲿʱ���Ȧ������ʧ����
82 | progDia1.setCancelable(true);//���ý������Ƿ�����˻ؼ�ȡ��
83 | }else{
84 | Toast.makeText(LoginActivity.this,
85 | "�˺š����벻��Ϊ�գ�",Toast.LENGTH_SHORT).show();
86 | }
87 | }
88 | });
89 | }
90 |
91 | //��������������
92 | public void sendRequestWithHttpClient(final String username,final String password){
93 | new Thread(new Runnable() {
94 | @Override
95 | public void run() {
96 | //��HttpClient���������Ϊ�岽
97 | //��һ��������HttpClient����
98 | HttpClient httpClient = new DefaultHttpClient();
99 | //����ʱ
100 | httpClient.getParams().setParameter(CoreConnectionPNames.CONNECTION_TIMEOUT,
101 | 10000);
102 | //��ȡ��ʱ
103 | httpClient.getParams().setParameter(CoreConnectionPNames.SO_TIMEOUT, 10000 );
104 | //�ڶ�����������������Ķ������Ƿ��ʵķ������ĵ�ַ
105 | /*�����run���������������ӵ�ͬһ����������
106 | URL��IP��ֵ����run�����������ľ�������ַ*/
107 | //�����ģ����������в��ԣ���ô IP��ֵ����Ϊ 10.0.2.2
108 | String LOGIN_URL = "http://192.168.31.174:8080/Demo_Login/android/" +
109 | "loginServlet.jsp?";
110 | LOGIN_URL = LOGIN_URL+"name="+username+"&password="+password;
111 | HttpGet httpGet = new HttpGet(LOGIN_URL);
112 | try {
113 | //��������ִ��������ȡ��������������Ӧ����
114 | HttpResponse httpResponse = httpClient.execute(httpGet);
115 | //���IJ��������Ӧ��״̬�Ƿ����������״̬���ֵ��200��ʾ����
116 | if(httpResponse.getStatusLine().getStatusCode() ==200){
117 | //���岽������Ӧ������ȡ�����ݣ��ŵ�entity��
118 | HttpEntity entity = httpResponse.getEntity();
119 | //������ת��Ϊ�ַ���
120 | String response = EntityUtils.toString(entity,"utf-8");
121 |
122 | //�����߳��н�Message�����ͳ�ȥ
123 | Message message = Message.obtain();
124 | message.what = 1;//�����ȡ���ݻ�ȡ�ɹ�
125 | message.obj = response;
126 | handler.sendMessage(message);
127 |
128 | //����Ƿ���Ҫ��ס�û���
129 | sPreEditor_usr = getSharedPreferences("username_data",
130 | MODE_PRIVATE).edit();
131 | if (remember_user.isChecked()) {
132 | sPreEditor_usr.putString("name", userStr);//��������
133 | } else {
134 | sPreEditor_usr.clear();//�������
135 | }
136 | sPreEditor_usr.apply();//��Ч
137 |
138 | //����Ƿ���Ҫ��ס����
139 | sPreEditor_password = getSharedPreferences("password_data",
140 | MODE_PRIVATE).edit();
141 | if(remember_password.isChecked()){
142 | sPreEditor_password.putString("password",passwordStr);//����
143 | }else{
144 | sPreEditor_password.clear();//���
145 | }
146 | sPreEditor_password.apply();//��Ч
147 | }
148 | }catch (Exception e){
149 | //��ȡ���������ݳ���
150 | Message message = Message.obtain();
151 | message.what = 0;//�����ȡ���ݳ���
152 | handler.sendMessage(message);
153 | e.printStackTrace();
154 | }
155 | }
156 | }).start();
157 | }
158 |
159 | private Handler handler = new Handler(){
160 | @Override
161 | public void handleMessage(Message msg){
162 | super.handleMessage(msg);
163 | progDia1.dismiss();
164 | switch (msg.what){
165 | case 1://��ȡ�������ɹ�
166 | String reponse = (String) msg.obj;
167 | //���������֤�ɹ�
168 | if(reponse.contains(":1")){
169 | jumpToNextPage();
170 | login_status = 1;
171 | }else{
172 | Toast.makeText(LoginActivity.this, "�˺���֤ʧ�ܣ������ԣ�", Toast.LENGTH_SHORT).show();
173 | }
174 | break;
175 | case 0://��ȡ����������ʧ��
176 | Toast.makeText(LoginActivity.this, "��ȡ����������ʧ��", Toast.LENGTH_SHORT).show();
177 | break;
178 | default:
179 | break;
180 | }
181 | }
182 | };
183 |
184 | public void initBackground() {
185 | //��VideoView�ؼ�
186 | login_videoview = findViewById(R.id.login_videoview); //������Ƶ����
187 | login_videoview.setVideoURI(Uri.parse("android.resource://" + getPackageName() +
188 | "/" + R.raw.five));
189 | // ����
190 | login_videoview.start();
191 | //ѭ������ ����һ����ý���ļ�������ϣ������յ�ʱ���õĻص�
192 | login_videoview.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
193 | @Override
194 | public void onCompletion(MediaPlayer mediaPlayer) {
195 | login_videoview.start();
196 | }
197 | });
198 | }
199 |
200 | public void loadDefaultMsg(){//����Ĭ���û���������
201 |
202 | remember_user = findViewById(R.id.remember_user);
203 | login_user = findViewById(R.id.login_user);
204 | //����Ĭ���û���
205 | SharedPreferences pref = getSharedPreferences("username_data", MODE_PRIVATE);
206 | String default_name = pref.getString("name", "");
207 | if (!default_name.isEmpty()) {
208 | login_user.setText(default_name);
209 | }
210 |
211 | remember_password = findViewById(R.id.remember_password);
212 | login_pas = findViewById(R.id.login_pas);
213 | //����Ĭ������
214 | SharedPreferences pref_pas = getSharedPreferences("password_data", MODE_PRIVATE);
215 | String default_password = pref_pas.getString("password", "");
216 | if (!default_password.isEmpty()) {
217 | login_pas.setText(default_password);
218 | }
219 | }
220 | public void ban_music_button(){//��ֹ�������ֲ���
221 | login_ban_music = findViewById(R.id.login_ban_music);
222 | login_ban_music.setOnClickListener(new View.OnClickListener() {
223 | @Override
224 | public void onClick(View view) {
225 | if(flag_ban_music == 0){//���ڲ���
226 | login_ban_music.setImageDrawable(getResources().getDrawable(R.drawable.music_false));
227 | flag_ban_music = 1;
228 | //��ֹ����֮ǰ���ص�ǰ���� ��дVideoBackground����
229 | curVolume = login_videoview.setVolume(0);
230 | }else{
231 | login_ban_music.setImageDrawable(getResources().getDrawable(R.drawable.music_true));
232 | flag_ban_music = 0;
233 | login_videoview.setVolume(curVolume);
234 | }
235 | }
236 | });
237 | }
238 | public static void setStatusMusicPlayer(int login_status) {//��̨����MusicService�����õ�
239 | LoginActivity.login_status = login_status;
240 | }
241 | //������������
242 | @Override
243 | protected void onRestart() {
244 | super.onRestart();
245 | Log.w("LoginActivity","onRestart��ִ����");
246 | initBackground();
247 | }
248 | //��ֹ���������г���ʱ���������ڲ���
249 | @Override
250 | protected void onStop() {
251 | super.onStop();
252 | if (login_videoview!=null)
253 | login_videoview.stopPlayback();
254 | }
255 | }
--------------------------------------------------------------------------------
/MyFiles/picture/screenshot/Version1.0/Screenshot_2018-12-02-22-46-42-71.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RSMung/RSMungMusic/69604871803c311798a01c4c722c996cf1f01bda/MyFiles/picture/screenshot/Version1.0/Screenshot_2018-12-02-22-46-42-71.png
--------------------------------------------------------------------------------
/MyFiles/picture/screenshot/Version1.0/Screenshot_2018-12-02-22-46-47-79.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RSMung/RSMungMusic/69604871803c311798a01c4c722c996cf1f01bda/MyFiles/picture/screenshot/Version1.0/Screenshot_2018-12-02-22-46-47-79.png
--------------------------------------------------------------------------------
/MyFiles/picture/screenshot/Version1.0/Screenshot_2018-12-02-22-46-52-22.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RSMung/RSMungMusic/69604871803c311798a01c4c722c996cf1f01bda/MyFiles/picture/screenshot/Version1.0/Screenshot_2018-12-02-22-46-52-22.png
--------------------------------------------------------------------------------
/MyFiles/picture/screenshot/Version1.0/Screenshot_2018-12-02-22-46-56-24.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RSMung/RSMungMusic/69604871803c311798a01c4c722c996cf1f01bda/MyFiles/picture/screenshot/Version1.0/Screenshot_2018-12-02-22-46-56-24.png
--------------------------------------------------------------------------------
/MyFiles/picture/screenshot/Version1.0/Screenshot_2018-12-02-22-47-02-97.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RSMung/RSMungMusic/69604871803c311798a01c4c722c996cf1f01bda/MyFiles/picture/screenshot/Version1.0/Screenshot_2018-12-02-22-47-02-97.png
--------------------------------------------------------------------------------
/MyFiles/picture/screenshot/Version1.0/Screenshot_2018-12-02-22-47-16-86.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RSMung/RSMungMusic/69604871803c311798a01c4c722c996cf1f01bda/MyFiles/picture/screenshot/Version1.0/Screenshot_2018-12-02-22-47-16-86.png
--------------------------------------------------------------------------------
/MyFiles/picture/screenshot/Version1.0/Screenshot_2018-12-02-22-47-35-54.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RSMung/RSMungMusic/69604871803c311798a01c4c722c996cf1f01bda/MyFiles/picture/screenshot/Version1.0/Screenshot_2018-12-02-22-47-35-54.png
--------------------------------------------------------------------------------
/MyFiles/picture/screenshot/Version1.1/display.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RSMung/RSMungMusic/69604871803c311798a01c4c722c996cf1f01bda/MyFiles/picture/screenshot/Version1.1/display.png
--------------------------------------------------------------------------------
/MyFiles/picture/screenshot/Version1.1/login.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RSMung/RSMungMusic/69604871803c311798a01c4c722c996cf1f01bda/MyFiles/picture/screenshot/Version1.1/login.png
--------------------------------------------------------------------------------
/MyFiles/picture/screenshot/Version1.1/playHistory.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RSMung/RSMungMusic/69604871803c311798a01c4c722c996cf1f01bda/MyFiles/picture/screenshot/Version1.1/playHistory.png
--------------------------------------------------------------------------------
/MyFiles/picture/screenshot/Version1.1/play_music.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RSMung/RSMungMusic/69604871803c311798a01c4c722c996cf1f01bda/MyFiles/picture/screenshot/Version1.1/play_music.png
--------------------------------------------------------------------------------
/MyFiles/picture/screenshot/Version1.1/searchMusic.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RSMung/RSMungMusic/69604871803c311798a01c4c722c996cf1f01bda/MyFiles/picture/screenshot/Version1.1/searchMusic.png
--------------------------------------------------------------------------------
/MyFiles/picture/screenshot/Version1.2/automaticStop.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RSMung/RSMungMusic/69604871803c311798a01c4c722c996cf1f01bda/MyFiles/picture/screenshot/Version1.2/automaticStop.png
--------------------------------------------------------------------------------
/MyFiles/picture/screenshot/Version1.2/display.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RSMung/RSMungMusic/69604871803c311798a01c4c722c996cf1f01bda/MyFiles/picture/screenshot/Version1.2/display.png
--------------------------------------------------------------------------------
/MyFiles/picture/screenshot/Version1.2/playHistory.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RSMung/RSMungMusic/69604871803c311798a01c4c722c996cf1f01bda/MyFiles/picture/screenshot/Version1.2/playHistory.png
--------------------------------------------------------------------------------
/MyFiles/picture/screenshot/Version1.2/searchMusic.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RSMung/RSMungMusic/69604871803c311798a01c4c722c996cf1f01bda/MyFiles/picture/screenshot/Version1.2/searchMusic.png
--------------------------------------------------------------------------------
/MyFiles/picture/screenshot/Version1.2/setting.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RSMung/RSMungMusic/69604871803c311798a01c4c722c996cf1f01bda/MyFiles/picture/screenshot/Version1.2/setting.png
--------------------------------------------------------------------------------
/MyFiles/picture/screenshot/Version1.3/automaticStop.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RSMung/RSMungMusic/69604871803c311798a01c4c722c996cf1f01bda/MyFiles/picture/screenshot/Version1.3/automaticStop.png
--------------------------------------------------------------------------------
/MyFiles/picture/screenshot/Version1.3/display.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RSMung/RSMungMusic/69604871803c311798a01c4c722c996cf1f01bda/MyFiles/picture/screenshot/Version1.3/display.png
--------------------------------------------------------------------------------
/MyFiles/picture/screenshot/Version1.3/notification.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RSMung/RSMungMusic/69604871803c311798a01c4c722c996cf1f01bda/MyFiles/picture/screenshot/Version1.3/notification.png
--------------------------------------------------------------------------------
/MyFiles/picture/screenshot/Version1.3/playHistory.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RSMung/RSMungMusic/69604871803c311798a01c4c722c996cf1f01bda/MyFiles/picture/screenshot/Version1.3/playHistory.png
--------------------------------------------------------------------------------
/MyFiles/picture/screenshot/Version1.3/playMode.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RSMung/RSMungMusic/69604871803c311798a01c4c722c996cf1f01bda/MyFiles/picture/screenshot/Version1.3/playMode.png
--------------------------------------------------------------------------------
/MyFiles/picture/screenshot/Version1.3/searchMusic.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RSMung/RSMungMusic/69604871803c311798a01c4c722c996cf1f01bda/MyFiles/picture/screenshot/Version1.3/searchMusic.png
--------------------------------------------------------------------------------
/MyFiles/picture/screenshot/Version1.3/setting.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RSMung/RSMungMusic/69604871803c311798a01c4c722c996cf1f01bda/MyFiles/picture/screenshot/Version1.3/setting.png
--------------------------------------------------------------------------------
/MyFiles/picture/screenshot/Version1.4/detail.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RSMung/RSMungMusic/69604871803c311798a01c4c722c996cf1f01bda/MyFiles/picture/screenshot/Version1.4/detail.png
--------------------------------------------------------------------------------
/MyFiles/picture/screenshot/Version1.4/love_songs.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RSMung/RSMungMusic/69604871803c311798a01c4c722c996cf1f01bda/MyFiles/picture/screenshot/Version1.4/love_songs.png
--------------------------------------------------------------------------------
/MyFiles/picture/screenshot/Version1.4/main.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RSMung/RSMungMusic/69604871803c311798a01c4c722c996cf1f01bda/MyFiles/picture/screenshot/Version1.4/main.png
--------------------------------------------------------------------------------
/MyFiles/picture/screenshot/Version1.4/menu.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RSMung/RSMungMusic/69604871803c311798a01c4c722c996cf1f01bda/MyFiles/picture/screenshot/Version1.4/menu.png
--------------------------------------------------------------------------------
/MyFiles/picture/screenshot/Version1.4/playMode.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RSMung/RSMungMusic/69604871803c311798a01c4c722c996cf1f01bda/MyFiles/picture/screenshot/Version1.4/playMode.png
--------------------------------------------------------------------------------
/MyFiles/picture/screenshot/Version1.4/search.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RSMung/RSMungMusic/69604871803c311798a01c4c722c996cf1f01bda/MyFiles/picture/screenshot/Version1.4/search.png
--------------------------------------------------------------------------------
/MyFiles/picture/screenshot/Version1.4/share.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RSMung/RSMungMusic/69604871803c311798a01c4c722c996cf1f01bda/MyFiles/picture/screenshot/Version1.4/share.png
--------------------------------------------------------------------------------
/MyFiles/picture/screenshot/Version1.4/stop_with_time.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RSMung/RSMungMusic/69604871803c311798a01c4c722c996cf1f01bda/MyFiles/picture/screenshot/Version1.4/stop_with_time.png
--------------------------------------------------------------------------------
/MyFiles/picture/图标/music.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RSMung/RSMungMusic/69604871803c311798a01c4c722c996cf1f01bda/MyFiles/picture/图标/music.png
--------------------------------------------------------------------------------
/MyFiles/picture/图标/music_false.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RSMung/RSMungMusic/69604871803c311798a01c4c722c996cf1f01bda/MyFiles/picture/图标/music_false.png
--------------------------------------------------------------------------------
/MyFiles/picture/图标/music_true.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RSMung/RSMungMusic/69604871803c311798a01c4c722c996cf1f01bda/MyFiles/picture/图标/music_true.png
--------------------------------------------------------------------------------
/MyFiles/picture/图标/next_1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RSMung/RSMungMusic/69604871803c311798a01c4c722c996cf1f01bda/MyFiles/picture/图标/next_1.png
--------------------------------------------------------------------------------
/MyFiles/picture/图标/pause.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RSMung/RSMungMusic/69604871803c311798a01c4c722c996cf1f01bda/MyFiles/picture/图标/pause.png
--------------------------------------------------------------------------------
/MyFiles/picture/图标/play_2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RSMung/RSMungMusic/69604871803c311798a01c4c722c996cf1f01bda/MyFiles/picture/图标/play_2.png
--------------------------------------------------------------------------------
/MyFiles/picture/图标/user.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RSMung/RSMungMusic/69604871803c311798a01c4c722c996cf1f01bda/MyFiles/picture/图标/user.png
--------------------------------------------------------------------------------
/MyFiles/picture/图标/user_red.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RSMung/RSMungMusic/69604871803c311798a01c4c722c996cf1f01bda/MyFiles/picture/图标/user_red.png
--------------------------------------------------------------------------------
/MyFiles/startWindow.psd:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RSMung/RSMungMusic/69604871803c311798a01c4c722c996cf1f01bda/MyFiles/startWindow.psd
--------------------------------------------------------------------------------
/MyFiles/淘汰的代码.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RSMung/RSMungMusic/69604871803c311798a01c4c722c996cf1f01bda/MyFiles/淘汰的代码.txt
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | ## RSMungMusic
2 | *********---求赞---⭐---⭐---⭐---求赞---*********
3 | ### Android端本地音乐播放器
4 | (1). 目前有主界面,搜索界面,歌曲详情界面,喜欢的音乐界面,分享歌曲界面共五个activity;
5 | (2). 一个service用于实现后台播放功能
6 | (3). 版本1.3中删除了与服务器socket通信登录验证功能,目前计划通过https协议重写此功能
7 | (4).csdn博客https://blog.csdn.net/lvdoujack/article/details/84545289
8 | (5). 点个赞鼓励鼓励,谢谢。
9 | #### 基本功能:
10 | ~~1.与服务器使用socket通信验证账号密码//此功能已废弃~~
11 | 2.显示本地歌曲
12 | 3.播放本地歌曲(可后台播放)
13 | 4.记录播放历史
14 | 5.搜索本地歌曲
15 | 6.定时停止播放
16 | 7.播放模式选择
17 | 8.进度条显示歌曲播放进度
18 | 9.显示歌曲详情页并且可以添加歌曲到我喜爱的歌曲歌单中
19 | 10.制作歌曲海报用于分享
20 | #### 截图展示:
21 |
22 |
23 |
24 |
25 | 
26 |
27 |
28 | 图1 显示本地歌曲
29 |
30 | |
31 |
32 |
33 | 
34 |
35 |
36 | 图2 歌曲详情页
37 |
38 | |
39 |
40 |
41 | 
42 |
43 |
44 | 图3 搜索本地歌曲
45 |
46 | |
47 |
48 |
49 |
50 |
51 | 
52 |
53 |
54 | 图4 侧边栏菜单
55 |
56 | |
57 |
58 |
59 | 
60 |
61 |
62 | 图5 定时停止播放
63 |
64 | |
65 |
66 |
67 | 
68 |
69 |
70 | 图6 播放模式选择
71 |
72 | |
73 |
74 |
75 |
76 |
77 | 
78 |
79 |
80 | 图7 通知栏
81 |
82 | |
83 |
84 |
85 | 
86 |
87 |
88 | 图8 制作海报分享歌曲
89 |
90 | |
91 |
92 |
93 | 
94 |
95 |
96 | 图9 我喜爱的歌曲
97 |
98 | |
99 |
100 |
101 |
102 | #### Copyright [2020] [RSMung]
103 |
104 | Licensed under the Apache License, Version 2.0 (the "License");
105 | you may not use this file except in compliance with the License.
106 | You may obtain a copy of the License at
107 |
108 | http://www.apache.org/licenses/LICENSE-2.0
109 |
110 | Unless required by applicable law or agreed to in writing, software
111 | distributed under the License is distributed on an "AS IS" BASIS,
112 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
113 | See the License for the specific language governing permissions and
114 | limitations under the License.
115 |
--------------------------------------------------------------------------------
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 28
5 | defaultConfig {
6 | applicationId "edu.whut.ruansong.musicplayer"
7 | minSdkVersion 21
8 | targetSdkVersion 28
9 | versionCode 1
10 | versionName "1.4.2"
11 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
12 | vectorDrawables.useSupportLibrary = true
13 | }
14 | buildTypes {
15 | release {
16 | minifyEnabled false
17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
18 | }
19 | }
20 |
21 | android.applicationVariants.all { variant ->
22 | variant.outputs.all {
23 | //在这里修改apk文件名,引号内的字符串都可以随便定义
24 | outputFileName = "RSMungMusic-${variant.name}-v${variant.versionName}.apk"
25 | }
26 | }
27 |
28 | }
29 | repositories {
30 | maven { url 'https://jitpack.io' }
31 | }
32 |
33 | dependencies {
34 | //loading动画框架
35 | implementation 'com.wang.avi:library:2.1.3'
36 |
37 | implementation fileTree(dir: 'libs', include: ['*.jar'])
38 | implementation 'com.android.support:appcompat-v7:28.0.0'
39 | implementation 'com.android.support.constraint:constraint-layout:1.1.3'
40 | implementation 'com.android.support:palette-v7:28.0.0'
41 |
42 | testImplementation 'junit:junit:4.13'
43 | androidTestImplementation 'com.android.support.test:runner:1.0.2'
44 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
45 | androidTestImplementation('com.android.support:support-annotations:28.0.0') {
46 |
47 | force = true
48 |
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/app/libs/httpclient-4.2.5.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RSMung/RSMungMusic/69604871803c311798a01c4c722c996cf1f01bda/app/libs/httpclient-4.2.5.jar
--------------------------------------------------------------------------------
/app/libs/httpcore-4.4.4.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RSMung/RSMungMusic/69604871803c311798a01c4c722c996cf1f01bda/app/libs/httpcore-4.4.4.jar
--------------------------------------------------------------------------------
/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
22 |
--------------------------------------------------------------------------------
/app/src/androidTest/java/edu/whut/ruansong/musicplayer/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package edu.whut.ruansong.musicplayer;
2 |
3 | import android.content.Context;
4 | import android.support.test.InstrumentationRegistry;
5 | import android.support.test.runner.AndroidJUnit4;
6 |
7 | import org.junit.Test;
8 | import org.junit.runner.RunWith;
9 |
10 | import static org.junit.Assert.*;
11 |
12 | /**
13 | * Instrumented test, which will execute on an Android device.
14 | *
15 | * @see Testing documentation
16 | */
17 | @RunWith(AndroidJUnit4.class)
18 | public class ExampleInstrumentedTest {
19 | @Test
20 | public void useAppContext() throws Exception {
21 | // Context of the app under test.
22 | Context appContext = InstrumentationRegistry.getTargetContext();
23 |
24 | assertEquals("edu.whut.ruansong.musicplayer", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
8 |
9 |
10 |
12 |
13 |
20 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
38 |
39 |
40 |
46 |
47 |
48 |
49 |
55 |
56 |
57 |
58 |
64 |
65 |
66 |
67 |
73 |
74 |
75 |
76 |
79 |
80 |
81 |
--------------------------------------------------------------------------------
/app/src/main/java/edu/whut/ruansong/musicplayer/activity/LoginActivity.java:
--------------------------------------------------------------------------------
1 | package edu.whut.ruansong.musicplayer.activity;
2 |
3 | import android.content.Intent;
4 | import android.content.SharedPreferences;
5 | import android.os.Bundle;
6 | import android.os.Handler;
7 | import android.view.View;
8 | import android.widget.Button;
9 | import android.widget.CheckBox;
10 | import android.widget.TextView;
11 | import android.widget.Toast;
12 |
13 | import edu.whut.ruansong.musicplayer.model.BaseActivity;
14 | import edu.whut.ruansong.musicplayer.R;
15 | import edu.whut.ruansong.musicplayer.tool.SocketLogin;
16 |
17 | public class LoginActivity extends BaseActivity {
18 |
19 | private static int login_status = 0;//登录状态,0是未登录,1是已登录
20 | private Button btn_login;//登录按钮
21 | private CheckBox remember_user, remember_password;//复选框
22 | private TextView login_pas; private String passwordStr;//密码
23 | private TextView login_user; private String userStr;//用户名
24 | private SharedPreferences.Editor sPreEditor_usr, sPreEditor_password;
25 |
26 | @Override
27 | protected void onCreate(Bundle savedInstanceState) {
28 | super.onCreate(savedInstanceState);
29 | // Log.w("LoginActivity", "onCreate被执行了");//调试语句
30 | // Log.w("LoginActivity", "statusMusicPlayer是" + login_status);
31 | if (login_status == 0) {//未登录情况
32 | setContentView(R.layout.activity_login);
33 | btn_login = findViewById(R.id.button_login);//登录按钮实例化
34 | initButtonDeal();//处理登录按钮的事件
35 | loadDefaultMsg();//加载默认用户名和密码
36 | } else {//已经登陆过 这样做是为了登录后退出app再进入不需要再次登录
37 | jumpToNextActivity();
38 | }
39 | }
40 | //onStart <-----
41 | //onResume |
42 | // onRestart
43 | //onPause |
44 | //onStop ---
45 | //onDestroy
46 |
47 | public void jumpToNextActivity() {
48 | Intent intent = new Intent(LoginActivity.this, DisplayActivity.class);
49 | startActivity(intent);
50 | }
51 |
52 | public void initButtonDeal() {
53 | //处理确定按钮的事件
54 | btn_login.setOnClickListener(new View.OnClickListener() {
55 | @Override
56 | public void onClick(View view) {
57 | login_pas = findViewById(R.id.login_pas);//密码文本框对象
58 | login_user = findViewById(R.id.login_edit_text_user);//用户名文本框对象
59 | userStr = login_user.getText().toString();//获得输入的用户名(文本)
60 | passwordStr = login_pas.getText().toString();//获得输入的密码(文本)
61 | if (!userStr.equals("") && !passwordStr.equals("")) {//如果都不为空
62 | /******保存用户名和密码*****/
63 | //检测是否想要记住用户名
64 | sPreEditor_usr = getSharedPreferences("username",
65 | MODE_PRIVATE).edit();
66 | if (remember_user.isChecked()) {
67 | sPreEditor_usr.putString("name",userStr);//存入数据
68 | } else {
69 | sPreEditor_usr.clear();//清除数据
70 | }
71 | sPreEditor_usr.apply();//生效
72 |
73 | //检测是否想要记住密码
74 | sPreEditor_password = getSharedPreferences("password",
75 | MODE_PRIVATE).edit();
76 | if (remember_password.isChecked()) {
77 | sPreEditor_password.putString("password",passwordStr);//保存
78 | } else {
79 | sPreEditor_password.clear();//清除
80 | }
81 | sPreEditor_password.apply();//生效
82 |
83 | /******使用socket与主机通信验证密码*****/
84 | // Log.w("LoginActivity", "使用的信息是" + userStr+""+passwordStr);
85 | final SocketLogin s1 = new SocketLogin(userStr, passwordStr);
86 | s1.start();
87 |
88 | new Handler().postDelayed(new Runnable() {//延时1000ms后获取主机返回的验证状态
89 | @Override
90 | public void run() {
91 | int login_state = s1.getRespond_state_int();//获取主机验证后返回的信息
92 | // Log.w("LoginActivity", "state is " + login_state);
93 | if(login_state == -1){
94 | Toast.makeText(LoginActivity.this, "服务器未响应或网络不好!", Toast.LENGTH_SHORT).show();
95 | }else if (login_state == 1) {//验证成功
96 | jumpToNextActivity();
97 | login_status = 1;
98 | } else {//验证失败
99 | Toast.makeText(LoginActivity.this, "账号验证失败,请重试!", Toast.LENGTH_SHORT).show();
100 | }
101 | s1.interrupt();
102 | }
103 | }, 1000);
104 | } else {
105 | Toast.makeText(LoginActivity.this, "账号、密码不能为空!", Toast.LENGTH_SHORT).show();
106 | }
107 | }
108 | });
109 | }
110 |
111 | public void loadDefaultMsg() {//加载默认用户名和密码
112 |
113 | remember_user = findViewById(R.id.remember_user);
114 | login_user = findViewById(R.id.login_edit_text_user);
115 | //加载默认用户名
116 | SharedPreferences pref = getSharedPreferences("username_data", MODE_PRIVATE);
117 | String default_name = pref.getString("name", "");
118 | if (!default_name.isEmpty()) {
119 | login_user.setText(default_name);
120 | }
121 |
122 | remember_password = findViewById(R.id.remember_password);
123 | login_pas = findViewById(R.id.login_pas);
124 | //加载默认密码
125 | SharedPreferences pref_pas = getSharedPreferences("password_data", MODE_PRIVATE);
126 | String default_password = pref_pas.getString("password", "");
127 | if (!default_password.isEmpty()) {
128 | login_pas.setText(default_password);
129 | }
130 | }
131 |
132 | public static void setLogin_status(int login_status) {//后台服务MusicService中有用到
133 | LoginActivity.login_status = login_status;
134 | }
135 |
136 | public static int getLogin_status() {
137 | return login_status;
138 | }
139 | }
--------------------------------------------------------------------------------
/app/src/main/java/edu/whut/ruansong/musicplayer/activity/MyLoveSongsActivity.java:
--------------------------------------------------------------------------------
1 | package edu.whut.ruansong.musicplayer.activity;
2 |
3 | import android.app.AlertDialog;
4 | import android.content.DialogInterface;
5 | import android.content.Intent;
6 | import android.os.Bundle;
7 | import android.support.v7.widget.Toolbar;
8 | import android.util.Log;
9 | import android.view.View;
10 | import android.widget.AdapterView;
11 | import android.widget.ListView;
12 | import android.widget.Toast;
13 |
14 | import java.util.ArrayList;
15 |
16 | import java.util.List;
17 |
18 | import edu.whut.ruansong.musicplayer.R;
19 | import edu.whut.ruansong.musicplayer.model.BaseActivity;
20 | import edu.whut.ruansong.musicplayer.model.Song;
21 | import edu.whut.ruansong.musicplayer.model.SongsCollector;
22 | import edu.whut.ruansong.musicplayer.service.MusicService;
23 | import edu.whut.ruansong.musicplayer.db.MyDbFunctions;
24 | import edu.whut.ruansong.musicplayer.tool.PictureDealHelper;
25 | import edu.whut.ruansong.musicplayer.tool.SongAdapter;
26 |
27 | public class MyLoveSongsActivity extends BaseActivity {
28 | private static List myLoveSongs = new ArrayList<>();//有序可重复
29 | private static MyDbFunctions myDbFunctions;
30 | private int current_number,current_status,actual_number;
31 | @Override
32 | protected void onCreate(Bundle saveInstanceState){
33 | super.onCreate(saveInstanceState);
34 | setContentView(R.layout.activity_my_love_songs);
35 | //toolbar相关
36 | Toolbar toolbar = findViewById(R.id.toolbar_activity_myLoveSongs);
37 | setSupportActionBar(toolbar);
38 | toolbar.setNavigationOnClickListener(new View.OnClickListener() {//toolbar回退键
39 | @Override
40 | public void onClick(View v) {
41 | Intent intent = new Intent(MyLoveSongsActivity.this, DisplayActivity.class);
42 | startActivity(intent);
43 | finish();
44 | }
45 | });
46 | //数据库相关
47 | myDbFunctions = MyDbFunctions.getInstance(this);
48 | //list相关
49 | myLoveSongs = myDbFunctions.loadMyLoveSongs();//从数据库加载,注意加载出来的这些Song对象没有设置专辑图片
50 | final SongAdapter adapter = new SongAdapter(this,R.layout.song_list_item,myLoveSongs);
51 | final ListView listView = findViewById(R.id.listView_activity_myLoveSongs);
52 | listView.setAdapter(adapter);
53 | current_number = MusicService.getCurrent_number();
54 | current_status = MusicService.getCurrent_status();
55 |
56 | //待修改,有BUG
57 | /***设置search_list歌曲item点击事件 以便可以点击搜素结果 播放歌曲*/
58 | listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
59 | @Override
60 | public void onItemClick(AdapterView> parent, View view, int position, long id) {
61 | //播放控制逻辑
62 | actual_number = SongsCollector.getSongIndex(myLoveSongs.get(position));
63 | if(current_status == MusicService.STATUS_PLAYING){//播放状态
64 | if(current_number == actual_number){//点击的正在播放的歌曲
65 | sendBroadcastOnCommand(MusicService.COMMAND_PAUSE);//暂停
66 | }else{//点击的别的歌曲
67 | current_number = actual_number;
68 | // Log.w("MyLoveSongsActivity","current_number: "+current_number);
69 | sendBroadcastOnCommand(MusicService.COMMAND_PLAY);
70 | }
71 | }else if(current_status == MusicService.STATUS_PAUSED){//暂停状态
72 | if(current_number == actual_number){
73 | //应恢复播放
74 | sendBroadcastOnCommand(MusicService.COMMAND_RESUME);
75 | }else{
76 | //点击的别的歌曲
77 | current_number = actual_number;
78 | sendBroadcastOnCommand(MusicService.COMMAND_PLAY);
79 | }
80 | }else {//停止状态
81 | current_number = actual_number;
82 | sendBroadcastOnCommand(MusicService.COMMAND_PLAY);
83 | }
84 | }
85 | });
86 | //设置more_options按钮
87 | adapter.setOnItemMoreOptionsClickListener(new SongAdapter.onItemMoreOptionsListener() {
88 | @Override
89 | public void onMoreOptionsClick(final int position) {
90 | AlertDialog.Builder builder = new AlertDialog.Builder(MyLoveSongsActivity.this)
91 | .setTitle("请确认!")
92 | .setIcon(R.drawable.danger)
93 | .setMessage("确认要从喜爱的歌曲列表中删除此歌曲吗?")
94 | .setPositiveButton("确定", new DialogInterface.OnClickListener() {
95 | @Override
96 | public void onClick(DialogInterface dialog, int which) {
97 | /*which
98 | *int BUTTON_POSITIVE = -1; int BUTTON_NEGATIVE = -2; int BUTTON_NEUTRAL = -3;*/
99 | // Toast.makeText(DisplayActivity.this,"你点击了确定"+position,Toast.LENGTH_SHORT).show();
100 | //判断是否该歌曲正在播放
101 | //从数据库中删除该歌曲的喜爱标志
102 | if(myDbFunctions != null){
103 | myDbFunctions.setLove(myLoveSongs.get(position).getDataPath(),"false");
104 | }
105 | //修改主列表中的喜爱标志
106 | SongsCollector.getSong(SongsCollector.getSongIndex(myLoveSongs.get(position))).setLove(false);
107 | //从内存喜爱的歌曲列表中删除该歌曲
108 | myLoveSongs.remove(position);
109 | //通知列表数据变化了
110 | if(adapter != null){
111 | adapter.notifyDataSetChanged();
112 | }
113 | if(listView != null){
114 | listView.invalidate();
115 | }
116 | Toast.makeText(MyLoveSongsActivity.this,"已删除",Toast.LENGTH_SHORT).show();
117 | }
118 | })
119 | .setNegativeButton("取消", new DialogInterface.OnClickListener() {
120 | @Override
121 | public void onClick(DialogInterface dialog, int which) {
122 | Toast.makeText(MyLoveSongsActivity.this,"下次不要点错了哦",Toast.LENGTH_SHORT).show();
123 | }
124 | })
125 | ;
126 | builder.create().show();
127 | }
128 | });
129 | }
130 | /***发送命令,控制音乐播放,参数定义在MusicService中*/
131 | private void sendBroadcastOnCommand(int command) {
132 | //1.创建intent
133 | Intent intent = new Intent(MusicService.BROADCAST_MUSICSERVICE_CONTROL);
134 | //2.封装数据
135 | intent.putExtra("command", command);
136 | switch (command) {
137 | case MusicService.COMMAND_PLAY:
138 | intent.putExtra("number" , current_number);//封装歌曲在list中的位置
139 | break;
140 | case MusicService.COMMAND_RESUME:
141 | case MusicService.COMMAND_PAUSE:
142 | default:
143 | break;
144 | }
145 | //3.发送广播
146 | sendBroadcast(intent);
147 | }
148 | }
149 |
--------------------------------------------------------------------------------
/app/src/main/java/edu/whut/ruansong/musicplayer/activity/ShareActivity.java:
--------------------------------------------------------------------------------
1 | package edu.whut.ruansong.musicplayer.activity;
2 |
3 | import android.Manifest;
4 | import android.content.Intent;
5 | import android.content.pm.PackageManager;
6 | import android.graphics.Bitmap;
7 | import android.graphics.BitmapFactory;
8 | import android.graphics.Canvas;
9 | import android.graphics.Matrix;
10 | import android.media.MediaMetadataRetriever;
11 | import android.net.Uri;
12 | import android.os.Build;
13 | import android.os.Bundle;
14 | import android.os.Environment;
15 | import android.support.v4.app.ActivityCompat;
16 | import android.support.v4.content.ContextCompat;
17 | import android.util.Log;
18 | import android.view.View;
19 | import android.widget.ImageView;
20 | import android.widget.LinearLayout;
21 | import android.widget.TextView;
22 | import android.widget.Toast;
23 |
24 | import java.io.File;
25 | import java.io.FileNotFoundException;
26 | import java.io.FileOutputStream;
27 | import java.io.IOException;
28 | import java.text.SimpleDateFormat;
29 | import java.util.Date;
30 | import java.util.Locale;
31 |
32 | import edu.whut.ruansong.musicplayer.R;
33 | import edu.whut.ruansong.musicplayer.model.BaseActivity;
34 | import edu.whut.ruansong.musicplayer.tool.PictureDealHelper;
35 |
36 | public class ShareActivity extends BaseActivity implements View.OnClickListener {
37 | private final int REQ_WRITE_EXTERNAL_STORAGE = 2;//权限请求码,1代表读取外部存储权限,2代表写存储
38 | private boolean flag_write_storage = false;
39 | @Override
40 | protected void onCreate(Bundle savedInstanceStated){
41 | super.onCreate(savedInstanceStated);
42 | setContentView(R.layout.activity_share);
43 | //关闭分享
44 | ImageView close = findViewById(R.id.close_share);
45 | close.setOnClickListener(this);
46 | //初始化UI
47 | Intent my_intent = getIntent();
48 | String dataPath = my_intent.getStringExtra("dataPath");
49 | String title = my_intent.getStringExtra("title");
50 | String artist = my_intent.getStringExtra("artist");
51 | ImageView album_icon = findViewById(R.id.share_album_icon);//专辑图片
52 | album_icon.setImageBitmap(PictureDealHelper.getAlbumPicture(this,dataPath,450,450));
53 | TextView title_view = findViewById(R.id.share_title),artist_view = findViewById(R.id.share_artist);//歌曲名字和歌手
54 | title_view.setText(title);
55 | artist_view.setText(artist);
56 | //保存按钮
57 | LinearLayout save_view = findViewById(R.id.save_share_activity);
58 | save_view.setOnClickListener(this);
59 | //请求写存储权限
60 | requestPermissionByHand();
61 | }
62 |
63 | @Override
64 | public void onClick(View v) {
65 | switch (v.getId()){
66 | case R.id.close_share:
67 | Intent intent = new Intent(ShareActivity.this,SongDetailActivity.class);
68 | startActivity(intent);
69 | finish();
70 | break;
71 | case R.id.save_share_activity:
72 | if(flag_write_storage){
73 | saveSharePicture();
74 | }else{
75 | Toast.makeText(ShareActivity.this,"请手动打开写存储权限",Toast.LENGTH_SHORT).show();
76 | }
77 | break;
78 | }
79 | }
80 | /**
81 | * 生成海报保存到本地用于分享*/
82 | public void saveSharePicture(){
83 | //获取对应bitmap
84 | LinearLayout main_share_picture = findViewById(R.id.main_share_picture);
85 | Bitmap bitmap = Bitmap.createBitmap(main_share_picture.getWidth(), main_share_picture.getHeight(), Bitmap.Config.ARGB_8888);
86 | Canvas canvas = new Canvas(bitmap);
87 | main_share_picture.draw(canvas);
88 | //保存到本地
89 | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd-HH:mm:ss", Locale.getDefault());
90 | Date date = new Date(System.currentTimeMillis());
91 | String picture_name = format.format(date)+".png";
92 | File share_picture_path = new File(Environment.getExternalStorageDirectory().getPath()+"/MungMusic/share_picture/");
93 | if (!share_picture_path.exists()) {//这个目录不存在则创建
94 | boolean flag = share_picture_path.mkdirs();
95 | if(!flag){//创建失败
96 | Toast.makeText(ShareActivity.this,"请授予写入本地权限",Toast.LENGTH_SHORT).show();
97 | return;
98 | }
99 | }
100 | File picture_path = new File(Environment.getExternalStorageDirectory().getPath()+"/MungMusic/share_picture",picture_name);
101 | if(picture_path.exists()){
102 | Toast.makeText(ShareActivity.this,"本地已有海报,快去分享吧",Toast.LENGTH_SHORT).show();
103 | return;
104 | }
105 | try {
106 | FileOutputStream out = new FileOutputStream(picture_path);
107 | bitmap.compress(Bitmap.CompressFormat.PNG, 90, out);
108 | out.flush();
109 | out.close();
110 | Toast.makeText(ShareActivity.this,"海报已经保存到"+picture_path+",快去分享吧",Toast.LENGTH_LONG).show();
111 | } catch (IOException e) {
112 | e.printStackTrace();
113 | }
114 | // 通知图库更新
115 | sendBroadcast(new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, Uri.parse("file://" + picture_path)));
116 | }
117 | /**
118 | * 向用户请求权限
119 | */
120 | public void requestPermissionByHand() {
121 | //判断当前系统的版本
122 | if (Build.VERSION.SDK_INT >= 23) {
123 | Log.w("ShareActivity","检查写存储权限");
124 | int checkWriteStoragePermission = ContextCompat.checkSelfPermission(
125 | ShareActivity.this, Manifest.permission.WRITE_EXTERNAL_STORAGE);
126 | //如果写入没有被授予
127 | if (checkWriteStoragePermission != PackageManager.PERMISSION_GRANTED) {
128 | ActivityCompat.requestPermissions(
129 | ShareActivity.this, new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE},
130 | REQ_WRITE_EXTERNAL_STORAGE);
131 | Log.w("ShareActivity","写存储权限,正在请求");
132 | }else{//已有权限
133 | flag_write_storage = true;
134 | }
135 | }
136 | }
137 | /**
138 | * 向用户请求权限后的回调
139 | */
140 | @Override
141 | public void onRequestPermissionsResult(int requestCode, final String[] permissions, int[] grantResults) {
142 | if (requestCode == REQ_WRITE_EXTERNAL_STORAGE) {
143 | // 如果请求被取消了,那么结果数组就是空的
144 | if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
145 | flag_write_storage = true;
146 | Toast.makeText(ShareActivity.this, "写存储权限申请成功", Toast.LENGTH_SHORT).show();
147 | }else{
148 | Toast.makeText(ShareActivity.this, "写存储权限申请失败", Toast.LENGTH_SHORT).show();
149 | }
150 | }
151 | }
152 | }
153 |
--------------------------------------------------------------------------------
/app/src/main/java/edu/whut/ruansong/musicplayer/activity/SplashActivity.java:
--------------------------------------------------------------------------------
1 | package edu.whut.ruansong.musicplayer.activity;
2 |
3 | import android.content.Intent;
4 | import android.os.Bundle;
5 |
6 | import edu.whut.ruansong.musicplayer.model.BaseActivity;
7 |
8 | /*用于解决应用启动有白屏的问题*/
9 | public class SplashActivity extends BaseActivity {
10 | @Override
11 | protected void onCreate(Bundle savedInstanceState) {
12 | super.onCreate(savedInstanceState);
13 | startActivity(new Intent(this,DisplayActivity.class));
14 | finish();
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/app/src/main/java/edu/whut/ruansong/musicplayer/db/MyDbFunctions.java:
--------------------------------------------------------------------------------
1 | package edu.whut.ruansong.musicplayer.db;
2 |
3 | import android.content.ContentValues;
4 | import android.content.Context;
5 | import android.database.Cursor;
6 | import android.database.sqlite.SQLiteDatabase;
7 | import android.util.Log;
8 |
9 | import java.lang.ref.WeakReference;
10 | import java.util.ArrayList;
11 | import java.util.List;
12 |
13 | import edu.whut.ruansong.musicplayer.model.Song;
14 | import edu.whut.ruansong.musicplayer.tool.PictureDealHelper;
15 |
16 | public class MyDbFunctions {
17 | //数据库名
18 | public static final String DB_NAME = "Mung_Music";
19 | //数据库版本
20 | public static final int VERSION = 1;
21 | private volatile static MyDbFunctions myDbFunctions;
22 | private SQLiteDatabase db;
23 | private WeakReference weakReference;//弱引用方式引入context
24 | //私有化构造方法,单例模式
25 | private MyDbFunctions(Context context){
26 | weakReference = new WeakReference<>(context);
27 | db = new MyDbHelper(weakReference.get(),DB_NAME,null,VERSION).getWritableDatabase();
28 | }
29 | /*双重锁模式*/
30 | public static MyDbFunctions getInstance(Context context){
31 | if(myDbFunctions == null){//为了避免不必要的同步
32 | synchronized (MyDbFunctions.class){
33 | if(myDbFunctions ==null){//为了在实例为空时才创建实例
34 | myDbFunctions = new MyDbFunctions(context);
35 | }
36 | }
37 | }
38 | return myDbFunctions;
39 | }
40 | /**
41 | * 将Song实例存储到数据库的SONGS表中*/
42 | public void saveSong(Song song){
43 | if(song != null && db != null){
44 | ContentValues values = new ContentValues();
45 | values.put("title",song.getTitle());
46 | values.put("artist",song.getArtist());
47 | values.put("duration",song.getDuration());
48 | values.put("dataPath",song.getDataPath());
49 | if(song.isLove())
50 | values.put("isLove","true");
51 | else
52 | values.put("isLove","false");
53 | if(song.isDefaultAlbumIcon())
54 | values.put("isDefaultAlbumIcon","true");
55 | else
56 | values.put("isDefaultAlbumIcon","false");
57 | db.insert("SONGS",null,values);
58 | }
59 | }
60 | /**
61 | * 将Song实例从数据库的MyLoveSongs表中删除*/
62 | public void removeSong(String dataPath){
63 | if(dataPath != null && db != null){
64 | //db.execSQL("delete from lxrData where name=?", new String[] { name });
65 | db.delete("SONGS","dataPath=?",new String[]{dataPath});
66 | }
67 | }
68 | /**
69 | * 给SONGS表中的某个歌曲修改isLove标志*/
70 | public void setLove(String dataPath,String flag){
71 | ContentValues values = new ContentValues();
72 | values.put("isLove",flag);
73 | db.update("SONGS",values,"dataPath=?",new String[]{dataPath});
74 | }
75 | /**
76 | * 从数据库读取SONGS表中所有的我喜爱的歌曲*/
77 | public ArrayList loadMyLoveSongs(){
78 | ArrayList list = new ArrayList<>();
79 | if(db != null){
80 | Cursor cursor = db.query("SONGS",null,"isLove =?",new String[]{"true"},null,null,null);
81 | if(cursor.moveToFirst()){
82 | do{
83 | Song song = new Song();
84 | song.setTitle(cursor.getString(cursor.getColumnIndex("title")));
85 | song.setArtist(cursor.getString(cursor.getColumnIndex("artist")));
86 | song.setDuration(cursor.getLong(cursor.getColumnIndex("duration")));
87 | song.setDataPath(cursor.getString(cursor.getColumnIndex("dataPath")));
88 | song.setLove(true);
89 | String flag2 = cursor.getString(cursor.getColumnIndex("isDefaultAlbumIcon"));
90 | if(flag2.equals("true"))
91 | song.setFlagDefaultAlbumIcon(true);
92 | else
93 | song.setFlagDefaultAlbumIcon(false);
94 | song.setAlbum_icon(PictureDealHelper.getAlbumPicture(weakReference.get(),song.getDataPath(),96,96));
95 | list.add(song);
96 | }while(cursor.moveToNext());
97 | }
98 | cursor.close();
99 | }
100 | return list;
101 | }
102 | /**
103 | * 读取数据库中的所有歌曲*/
104 | public ArrayList loadAllSongs(){
105 | ArrayList list = new ArrayList<>();
106 | if(db != null){
107 | Cursor cursor = db.query("SONGS",null,null,null,null,null,null);
108 | if(cursor.moveToFirst()){
109 | do{
110 | Song song = new Song();
111 | song.setTitle(cursor.getString(cursor.getColumnIndex("title")));
112 | song.setArtist(cursor.getString(cursor.getColumnIndex("artist")));
113 | song.setDuration(cursor.getLong(cursor.getColumnIndex("duration")));
114 | song.setDataPath(cursor.getString(cursor.getColumnIndex("dataPath")));
115 | String flag1 = cursor.getString(cursor.getColumnIndex("isLove"));
116 | if(flag1.equals("true"))
117 | song.setLove(true);
118 | else
119 | song.setLove(false);
120 | String flag2 = cursor.getString(cursor.getColumnIndex("isDefaultAlbumIcon"));
121 | if(flag2.equals("true")){
122 | song.setFlagDefaultAlbumIcon(true);
123 | // Log.w("MyDbFunctions","isDefaultAlbumIcon: "+flag2);
124 | }
125 | else{
126 | // Log.w("MyDbFunctions","isDefaultAlbumIcon: "+flag2);
127 | song.setFlagDefaultAlbumIcon(false);
128 | }
129 | song.setAlbum_icon(PictureDealHelper.getAlbumPicture(weakReference.get(),song.getDataPath(),96,96));
130 | list.add(song);
131 | }while(cursor.moveToNext());
132 | }
133 | cursor.close();
134 | }
135 | return list;
136 | }
137 |
138 | /**
139 | * 判断当前SONGS表中是否有数据*/
140 | public boolean isSONGS_Null(){
141 | if(db != null){
142 | Cursor cursor = db.query("SONGS",null,null,null,null,null,null);
143 | if(cursor.moveToFirst()){
144 | return false;//不为空
145 | }
146 | cursor.close();
147 | }
148 | return true;//空
149 | }
150 | }
151 |
--------------------------------------------------------------------------------
/app/src/main/java/edu/whut/ruansong/musicplayer/db/MyDbHelper.java:
--------------------------------------------------------------------------------
1 | package edu.whut.ruansong.musicplayer.db;
2 |
3 | import android.content.Context;
4 | import android.database.sqlite.SQLiteDatabase;
5 | import android.database.sqlite.SQLiteOpenHelper;
6 |
7 | public class MyDbHelper extends SQLiteOpenHelper {
8 | private static final String CREATE_SONGS =
9 | "create table SONGS ("
10 | + "id integer primary key autoincrement, "
11 | + "title text, "//歌名
12 | + "artist text, "//歌手
13 | + "duration integer,"//时长
14 | + "dataPath text, "//文件路径
15 | + "isLove text,"//是否是喜爱的歌曲
16 | + "isDefaultAlbumIcon text)";//是否使用的默认专辑图片
17 | private Context mContext;
18 | public MyDbHelper(Context context, String name, SQLiteDatabase.CursorFactory factory, int version) {
19 | super(context, name, factory, version);
20 | mContext = context;
21 | }
22 |
23 | @Override
24 | public void onCreate(SQLiteDatabase db) {
25 | db.execSQL(CREATE_SONGS);//建表
26 | }
27 |
28 | @Override
29 | public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
30 | }
31 |
32 |
33 | }
34 |
--------------------------------------------------------------------------------
/app/src/main/java/edu/whut/ruansong/musicplayer/model/ActivityCollector.java:
--------------------------------------------------------------------------------
1 | package edu.whut.ruansong.musicplayer.model;
2 |
3 | import android.app.Activity;
4 |
5 | import java.util.ArrayList;
6 | import java.util.List;
7 |
8 | /**
9 | * Created by 阮 on 2018/11/17.
10 | * manage activities
11 | * add
12 | * remove
13 | * finishAll
14 | */
15 |
16 | public class ActivityCollector {
17 | private static List activities = new ArrayList<>();
18 |
19 | public static void addActivity(Activity activity) {
20 | activities.add(activity);
21 | }
22 |
23 | public static void removeActivity(Activity activity) {
24 | activities.remove(activity);
25 | }
26 |
27 | public static void finishAll() {
28 | for (Activity activity : activities) {
29 | if (!activity.isFinishing()) {
30 | activity.finish();
31 | }
32 | }
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/app/src/main/java/edu/whut/ruansong/musicplayer/model/BaseActivity.java:
--------------------------------------------------------------------------------
1 | package edu.whut.ruansong.musicplayer.model;
2 |
3 | import android.content.Context;
4 | import android.os.Bundle;
5 | import android.support.v7.app.AppCompatActivity;
6 | import android.util.Log;
7 |
8 | /**
9 | * Created by 阮 on 2018/11/17.
10 | */
11 |
12 | public class BaseActivity extends AppCompatActivity {
13 | private static Context context;//内存泄露风险,待解决
14 |
15 | /*活动首次创建的时候调用*/
16 | @Override
17 | protected void onCreate(Bundle savedInstanceState) {
18 | super.onCreate(savedInstanceState);
19 | Log.w("BaseActivity",getClass().getSimpleName()+"进入了onCreate");
20 | ActivityCollector.addActivity(this);//add oneself to the activity manager
21 | }
22 | /*活动由不可见变为可见的时候调用*/
23 | @Override
24 | protected void onStart(){
25 | super.onStart();
26 | Log.w("BaseActivity",getClass().getSimpleName()+"进入了onStart");
27 | }
28 | /*活动准备好和用户进行交互的时候调用*/
29 | @Override
30 | protected void onResume(){
31 | super.onResume();
32 | Log.w("BaseActivity",getClass().getSimpleName()+"进入了onResume");
33 | }
34 | /*系统准备去启动或者恢复另外一个活动的时候调用/*/
35 | @Override
36 | protected void onPause(){
37 | super.onPause();
38 | Log.w("BaseActivity",getClass().getSimpleName()+"进入了onPause");
39 | }
40 | /*活动完全不可见的时候调用*/
41 | @Override
42 | protected void onStop(){
43 | super.onStop();
44 | Log.w("BaseActivity",getClass().getSimpleName()+"进入了onStop");
45 | }
46 | /*活动被销毁之前调用*/
47 | @Override
48 | protected void onDestroy() {
49 | super.onDestroy();
50 | Log.w("BaseActivity",getClass().getSimpleName()+"进入了onDestroy");
51 | ActivityCollector.removeActivity(this);//remove oneself from the activity manager
52 | }
53 | /*停止状态变为运行状态前调用*/
54 | @Override
55 | protected void onRestart(){
56 | Log.w("BaseActivity",getClass().getSimpleName()+"进入了onRestart");
57 | super.onRestart();
58 | }
59 | @Override
60 | public void onBackPressed(){
61 | super.onBackPressed();
62 | Log.w("BaseActivity", getClass().getSimpleName()+"进入onBackPressed");
63 | }
64 | @Override
65 | public void onSaveInstanceState(Bundle savedInstanceState) {
66 | super.onSaveInstanceState(savedInstanceState);
67 | Log.w("BaseActivity", getClass().getSimpleName()+"进入onSaveInstanceState");
68 | }
69 | @Override
70 | public void onRestoreInstanceState(Bundle savedInstanceState){
71 | super.onRestoreInstanceState(savedInstanceState);
72 | Log.w("BaseActivity", getClass().getSimpleName()+"进入onRestoreInstanceState");
73 | }
74 | public static Context getContext() {
75 | return context;
76 | }
77 | }
78 |
--------------------------------------------------------------------------------
/app/src/main/java/edu/whut/ruansong/musicplayer/model/DrawerLayoutListViewItem.java:
--------------------------------------------------------------------------------
1 | package edu.whut.ruansong.musicplayer.model;
2 |
3 | /**侧滑栏ListView的item*/
4 | public class DrawerLayoutListViewItem {
5 | private int item_picture;//item图片
6 | private String item_title;//item标题
7 |
8 | public DrawerLayoutListViewItem(int item_picture, String item_title) {
9 | this.item_picture = item_picture;
10 | this.item_title = item_title;
11 | }
12 |
13 | public int getItem_picture() {
14 | return item_picture;
15 | }
16 |
17 | public void setItem_picture(int item_picture) {
18 | this.item_picture = item_picture;
19 | }
20 |
21 | public String getItem_title() {
22 | return item_title;
23 | }
24 |
25 | public void setItem_title(String item_title) {
26 | this.item_title = item_title;
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/app/src/main/java/edu/whut/ruansong/musicplayer/model/PlayHistory.java:
--------------------------------------------------------------------------------
1 | package edu.whut.ruansong.musicplayer.model;
2 |
3 | import java.util.ArrayList;
4 | import java.util.List;
5 |
6 | /**
7 | * Created by 阮阮 on 2018/11/18.
8 | * 历史播放记录
9 | */
10 |
11 | public class PlayHistory {
12 | private static List songs = new ArrayList<>();
13 | public static void addSong(Song song) {
14 | if(songs.contains(song))
15 | songs.remove(song);
16 | songs.add(song);
17 | }
18 | public static void removeSong(Song song) {
19 | songs.remove(song);
20 | }
21 |
22 | public static List getSongs() {
23 | return songs;
24 | }
25 |
26 | public static void removeAll() {
27 | for (Song song : songs) {
28 | removeSong(song);
29 | }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/app/src/main/java/edu/whut/ruansong/musicplayer/model/Song.java:
--------------------------------------------------------------------------------
1 | package edu.whut.ruansong.musicplayer.model;
2 |
3 | import android.graphics.Bitmap;
4 |
5 | /**
6 | * Created by 阮 on 2018/11/17.
7 | */
8 |
9 | public class Song {
10 | private String title;//歌名
11 | private String artist;// 歌手
12 | private long duration;//时长
13 | private String dataPath;//歌曲文件路径
14 | private boolean isLove;//是否是喜爱的歌曲
15 | private Bitmap album_icon;
16 | private boolean isDefaultAlbumIcon;
17 |
18 | public Song(){}
19 | //歌名,歌手,时长,专辑,图标资源id,歌曲文件路径,在DisplayActivity中的listview的位置
20 | public Song(
21 | String title,
22 | String artist,
23 | long duration,
24 | String dataPath,
25 | boolean isLove,
26 | Bitmap album_icon,
27 | boolean isDefaultAlbumIcon
28 | )
29 | {
30 | this.title = title;
31 | this.artist = artist;
32 | this.duration = duration;
33 | this.dataPath = dataPath;
34 | this.isLove = isLove;
35 | this.album_icon = album_icon;
36 | this.isDefaultAlbumIcon = isDefaultAlbumIcon;
37 | }
38 |
39 | public Bitmap getAlbum_icon() {
40 | return album_icon;
41 | }
42 |
43 | public void setAlbum_icon(Bitmap album_icon) {
44 | this.album_icon = album_icon;
45 | }
46 |
47 | public void setLove(boolean love) {
48 | isLove = love;
49 | }
50 |
51 | public void setTitle(String str) { this.title = str; }
52 |
53 | public void setArtist(String str) { this.artist = str; }
54 |
55 | public void setDuration(long duration) { this.duration = duration; }
56 |
57 | public void setDataPath(String dataPath) { this.dataPath = dataPath; }
58 |
59 | public String getTitle() { return this.title; }
60 |
61 | public String getArtist() { return this.artist; }
62 |
63 | public long getDuration() { return duration; }
64 |
65 | public String getDataPath() { return dataPath; }
66 |
67 | public boolean isLove() {
68 | return isLove;
69 | }
70 |
71 | public boolean isDefaultAlbumIcon() {
72 | return isDefaultAlbumIcon;
73 | }
74 |
75 | public void setFlagDefaultAlbumIcon(boolean flagDefaultAlbumIcon) {
76 | isDefaultAlbumIcon = flagDefaultAlbumIcon;
77 | }
78 | }
79 |
--------------------------------------------------------------------------------
/app/src/main/java/edu/whut/ruansong/musicplayer/model/SongsCollector.java:
--------------------------------------------------------------------------------
1 | package edu.whut.ruansong.musicplayer.model;
2 |
3 | import java.util.ArrayList;
4 | import java.util.Iterator;
5 |
6 | public class SongsCollector {
7 | public static int song_total_number = 0;
8 | private static ArrayList mySongs = new ArrayList<>();//歌曲数据
9 | /**
10 | * 获取给定index的song*/
11 | public static Song getSong(int index){
12 | return mySongs.get(index);
13 | }
14 | /**
15 | * 向songs中添加Song对象*/
16 | public static void addSong(Song song){
17 | mySongs.add(song);
18 | song_total_number++;
19 | }
20 | /**
21 | * 从songs中移除Song对象*/
22 | public static void removeSong(int index){
23 | mySongs.remove(index);
24 | song_total_number--;
25 | }
26 | //重载
27 | public static void removeSong(String dataPath){
28 | for (int i=0; i < mySongs.size(); i++) {
29 | Song s = mySongs.get(i);
30 | if (s.getDataPath().equals(dataPath)) {
31 | mySongs.remove(i);
32 | song_total_number--;
33 | break;
34 | }
35 | }
36 | }
37 | /**
38 | * 获取song数量*/
39 | public static int size(){
40 | return song_total_number;
41 | }
42 | /**
43 | * 返回songs_list对象*/
44 | public static ArrayList getSongsList(){
45 | return mySongs;
46 | }
47 | /**
48 | * 设置songs_list对象*/
49 | public static void setSongsList(ArrayList songs){
50 | mySongs = songs;
51 | song_total_number = songs.size();
52 | }
53 |
54 | /**
55 | * 判断是否已经有这首歌曲*/
56 | public static boolean isContainSong(String dataPath){
57 | for (Song mySong : mySongs) {
58 | if (mySong.getDataPath().equals(dataPath)) {
59 | return true;
60 | }
61 | }
62 | return false;
63 | }
64 |
65 | public static int getSongIndex(Song song){
66 | int result = 0;
67 | for(int i=0; i < mySongs.size(); i++){
68 | if(mySongs.get(i).getDataPath().equals(song.getDataPath())){
69 | result = i;
70 | break;
71 | }
72 | }
73 | return result;
74 | }
75 | }
76 |
--------------------------------------------------------------------------------
/app/src/main/java/edu/whut/ruansong/musicplayer/service/MungNotification.java:
--------------------------------------------------------------------------------
1 | package edu.whut.ruansong.musicplayer.service;
2 |
3 | import android.app.Notification;
4 | import android.app.NotificationChannel;
5 | import android.app.NotificationManager;
6 | import android.app.PendingIntent;
7 | import android.content.Context;
8 | import android.content.Intent;
9 | import android.graphics.Bitmap;
10 | import android.graphics.BitmapFactory;
11 | import android.graphics.Matrix;
12 | import android.media.MediaMetadataRetriever;
13 | import android.os.Build;
14 | import android.support.v4.app.NotificationCompat;
15 | import android.util.Log;
16 | import android.widget.RemoteViews;
17 |
18 | import edu.whut.ruansong.musicplayer.R;
19 | import edu.whut.ruansong.musicplayer.activity.DisplayActivity;
20 | import edu.whut.ruansong.musicplayer.model.Song;
21 |
22 | public class MungNotification {
23 | private static final int NOTIFY_ID = 0x0277;
24 | private static NotificationManager mNotificationManager;
25 | private int current_number = 0;
26 | private int current_status = MusicService.STATUS_STOPPED;
27 | private String channelId = "Mung音乐播放器";
28 | private String channelName = "Mung音乐播放器";
29 |
30 | /**
31 | * 构造函数
32 | */
33 | public MungNotification(MusicService context) {
34 | Log.w("MungNotification","进入MungNotification构造函数");
35 | mNotificationManager = ((NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE));
36 | }
37 |
38 | /**
39 | * 显示通知
40 | */
41 | public void notifyPlay(MusicService context) {
42 | Log.w("MungNotification","进入notifyPlay");
43 | Notification myNotification = buildNotification(context);
44 | if (myNotification != null) {
45 | context.startForeground(NOTIFY_ID, myNotification);
46 | }
47 | }
48 |
49 | /**
50 | * 停止通知了后又重新构建通知并发送
51 | */
52 | public void notifyPause(MusicService context) {
53 | Log.w("MungNotification","进入notifyPause");
54 | context.stopForeground(false);
55 | Notification myNotification = buildNotification(context);
56 | if (myNotification != null) {
57 | mNotificationManager.notify(NOTIFY_ID, myNotification);
58 | }
59 | }
60 |
61 | /**
62 | * 取消所有通知
63 | */
64 | public void stopNotify(MusicService context) {
65 | Log.w("MungNotification","进入stopNotify");
66 | context.stopForeground(true);
67 | mNotificationManager.cancelAll();
68 | }
69 |
70 | /**
71 | * 构建通知
72 | */
73 | private Notification buildNotification(MusicService context) {
74 | Log.w("MungNotification","进入buildNotification");
75 | Notification myNotification = null;
76 | current_number = MusicService.getCurrent_number();
77 | //跳转到display_activity事件
78 | PendingIntent contentIntent = PendingIntent.getActivity(context,
79 | 0, new Intent(context, DisplayActivity.class), PendingIntent.FLAG_UPDATE_CURRENT);
80 | // boolean isPlaying = MusicService.getCurrent_status() == MusicService.STATUS_PLAYING;
81 | Song current_song = context.getSong();
82 | Bitmap album_icon = getAlbumPicture(current_song.getDataPath(),context);
83 | if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.O){//适配Android8及以上
84 | NotificationChannel myChannel = new NotificationChannel(channelId,channelName,NotificationManager.IMPORTANCE_DEFAULT);
85 | myChannel.setDescription("Mung音乐播放器");
86 | myChannel.enableLights(false);//呼吸灯
87 | myChannel.enableVibration(false);//震动
88 | myChannel.setVibrationPattern(new long[]{0});//1000,500,2000---->震动1s停止0.5s再震动2s
89 | myChannel.setSound(null, null);//声音
90 | mNotificationManager.createNotificationChannel(myChannel);
91 | }
92 | NotificationCompat.Builder builder = new NotificationCompat.Builder(context);
93 | builder.setSmallIcon(R.drawable.logo)
94 | .setLargeIcon(album_icon)
95 | .setContentTitle(current_song.getTitle())
96 | .setContentText(current_song.getArtist())
97 | .setShowWhen(false)//不显示时间
98 | .setOngoing(false)
99 | .setContentIntent(contentIntent)
100 | .setPriority(Notification.PRIORITY_MAX)
101 | .setVisibility(NotificationCompat.VISIBILITY_PUBLIC)
102 | .setDefaults(NotificationCompat.FLAG_ONLY_ALERT_ONCE)
103 | .setVibrate(new long[]{0})
104 | .setSound(null)
105 | .setChannelId(channelId);
106 | myNotification = builder.build();
107 | return myNotification;
108 | }
109 |
110 | /**********获取歌曲专辑图片*************/
111 | public Bitmap getAlbumPicture(String dataPath,MusicService musicService) {
112 | android.media.MediaMetadataRetriever mmr = new MediaMetadataRetriever();
113 | mmr.setDataSource(dataPath);
114 | byte[] data = mmr.getEmbeddedPicture();
115 | Bitmap albumPicture;
116 | if (data != null) {
117 | //获取bitmap对象
118 | albumPicture = BitmapFactory.decodeByteArray(data, 0, data.length);
119 | //获取宽高
120 | int width = albumPicture.getWidth();
121 | int height = albumPicture.getHeight();
122 | //Log.w("DisplayActivity","width = "+width+" height = "+height);
123 | // 创建操作图片用的Matrix对象
124 | Matrix matrix = new Matrix();
125 | // 计算缩放比例
126 | float sx = ((float) 120 / width);
127 | float sy = ((float) 120 / height);
128 | // 设置缩放比例
129 | matrix.postScale(sx, sy);
130 | // 建立新的bitmap,其内容是对原bitmap的缩放后的图
131 | albumPicture = Bitmap.createBitmap(albumPicture, 0, 0, width, height, matrix, false);
132 | return albumPicture;
133 | } else {
134 | albumPicture = BitmapFactory.decodeResource(musicService.getResources(), R.drawable.default_album_icon);
135 | int width = albumPicture.getWidth();
136 | int height = albumPicture.getHeight();
137 | //Log.w("DisplayActivity", "width = " + width + " height = " + height);
138 | // 创建操作图片用的Matrix对象
139 | Matrix matrix = new Matrix();
140 | // 计算缩放比例
141 | float sx = ((float) 120 / width);
142 | float sy = ((float) 120 / height);
143 | // 设置缩放比例
144 | matrix.postScale(sx, sy);
145 | // 建立新的bitmap,其内容是对原bitmap的缩放后的图
146 | albumPicture = Bitmap.createBitmap(albumPicture, 0, 0, width, height, matrix, false);
147 | return albumPicture;
148 | }
149 | }
150 |
151 | /**
152 | * 构建PendingIntent
153 | */
154 | // private PendingIntent createBroadcast(MusicService context, int action) {
155 | // Intent intent = new Intent(MusicService.BROADCAST_MUSICSERVICE_CONTROL);
156 | // intent.putExtra("command", action);
157 | // current_number = MusicService.getCurrent_number();
158 | // intent.putExtra("number",current_number);
159 | // PendingIntent pendingIntent = PendingIntent.getBroadcast(context, 0, intent, PendingIntent.FLAG_ONE_SHOT);
160 | // return pendingIntent;
161 | // }
162 | }
163 |
--------------------------------------------------------------------------------
/app/src/main/java/edu/whut/ruansong/musicplayer/tool/DrawerLayoutListViewAdapter.java:
--------------------------------------------------------------------------------
1 | package edu.whut.ruansong.musicplayer.tool;
2 |
3 | import android.content.Context;
4 | import android.support.annotation.NonNull;
5 | import android.support.annotation.Nullable;
6 | import android.view.LayoutInflater;
7 | import android.view.View;
8 | import android.view.ViewGroup;
9 | import android.widget.ArrayAdapter;
10 | import android.widget.ImageView;
11 | import android.widget.TextView;
12 |
13 | import java.util.List;
14 |
15 | import edu.whut.ruansong.musicplayer.R;
16 | import edu.whut.ruansong.musicplayer.model.DrawerLayoutListViewItem;
17 |
18 | public class DrawerLayoutListViewAdapter extends ArrayAdapter {
19 | private int resourceId;//用来放置布局文件的id
20 | //适配器的构造函数
21 | public DrawerLayoutListViewAdapter(Context context, int textViewResourceId, List objects) {
22 | super(context, textViewResourceId, objects);
23 | resourceId = textViewResourceId;
24 | }
25 | class ViewHolder {
26 |
27 | ImageView itemImage;
28 |
29 | TextView itemTitle;
30 |
31 | }
32 |
33 | @NonNull
34 | @Override
35 | public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) {
36 | DrawerLayoutListViewItem item = getItem(position); // 获取当前项的item实例
37 | View view;//子项布局对象
38 | ViewHolder viewHolder;//内部类对象
39 | if(convertView == null){//第一次加载
40 | view = LayoutInflater.from(getContext()).inflate(resourceId,parent,false);
41 | viewHolder = new ViewHolder();
42 | viewHolder.itemImage = view.findViewById(R.id.drawer_layout_list_item_image);
43 | viewHolder.itemTitle = view.findViewById(R.id.drawer_layout_list_item_title);
44 | }else{//不是第一次,即布局文件已经加载,可以利用
45 | view = convertView;
46 | viewHolder = (ViewHolder) view.getTag();
47 | }
48 | if(item != null && viewHolder!= null){
49 | viewHolder.itemImage.setImageResource(item.getItem_picture());
50 | viewHolder.itemTitle.setText(item.getItem_title());
51 | }
52 | return view;
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/app/src/main/java/edu/whut/ruansong/musicplayer/tool/PictureDealHelper.java:
--------------------------------------------------------------------------------
1 | package edu.whut.ruansong.musicplayer.tool;
2 |
3 | import android.content.Context;
4 | import android.graphics.Bitmap;
5 | import android.graphics.BitmapFactory;
6 | import android.graphics.Canvas;
7 | import android.graphics.Matrix;
8 | import android.graphics.drawable.VectorDrawable;
9 | import android.media.MediaMetadataRetriever;
10 |
11 | import edu.whut.ruansong.musicplayer.R;
12 |
13 | public class PictureDealHelper {
14 | /**********获取歌曲专辑图片*************/
15 | public static Bitmap getAlbumPicture(Context context,String dataPath, int scale_height, int scale_width) {
16 | android.media.MediaMetadataRetriever mmr = new MediaMetadataRetriever();
17 | mmr.setDataSource(dataPath);
18 | byte[] data = mmr.getEmbeddedPicture();
19 | Bitmap albumPicture = null;
20 | if (data != null) {
21 | //获取bitmap对象
22 | albumPicture = BitmapFactory.decodeByteArray(data, 0, data.length);
23 | albumPicture = scale(albumPicture,scale_width,scale_height);
24 | } else {
25 | VectorDrawable album_svg_32 = (VectorDrawable) context.getResources().getDrawable(R.drawable.album_svg_32);
26 | Bitmap bitmap = Bitmap.createBitmap(album_svg_32.getIntrinsicWidth(), album_svg_32.getIntrinsicHeight(), Bitmap.Config.ARGB_8888);
27 | Canvas canvas = new Canvas(bitmap);
28 | album_svg_32.setBounds(0, 0, canvas.getWidth(), canvas.getHeight());
29 | album_svg_32.draw(canvas);
30 | albumPicture = scale(bitmap,scale_width,scale_height);
31 | }
32 | return albumPicture;
33 | }
34 | //重载
35 | public static Bitmap getAlbumPicture(String dataPath, int scale_height, int scale_width) {
36 | android.media.MediaMetadataRetriever mmr = new MediaMetadataRetriever();
37 | mmr.setDataSource(dataPath);
38 | byte[] data = mmr.getEmbeddedPicture();
39 | Bitmap albumPicture = null;
40 | if (data != null) {
41 | //获取bitmap对象
42 | albumPicture = BitmapFactory.decodeByteArray(data, 0, data.length);
43 | albumPicture = scale(albumPicture,scale_width,scale_height);
44 | } else {
45 | albumPicture = null;
46 | }
47 | return albumPicture;
48 | }
49 | /**
50 | * 对bitmap进行缩放*/
51 | public static Bitmap scale(Bitmap bitmap,int scale_width,int scale_height){
52 | if(bitmap == null)
53 | return null;
54 | int width = bitmap.getWidth();
55 | int height = bitmap.getHeight();
56 | // 创建操作图片用的Matrix对象
57 | Matrix matrix = new Matrix();
58 | // 计算缩放比例
59 | float sx = ((float) scale_width / width);
60 | float sy = ((float) scale_width / height);
61 | // 设置缩放比例
62 | matrix.postScale(sx, sy);
63 | // 建立新的bitmap,其内容是对原bitmap的缩放后的图
64 | return Bitmap.createBitmap(bitmap, 0, 0, width, height, matrix, false);
65 | }
66 | }
67 |
--------------------------------------------------------------------------------
/app/src/main/java/edu/whut/ruansong/musicplayer/tool/PlayPauseBtn.java:
--------------------------------------------------------------------------------
1 | package edu.whut.ruansong.musicplayer.tool;
2 |
3 | import android.content.Context;
4 | import android.util.AttributeSet;
5 | import android.view.View;
6 | import android.widget.LinearLayout;
7 |
8 | import edu.whut.ruansong.musicplayer.R;
9 |
10 | public class PlayPauseBtn extends LinearLayout {
11 | //命名空间
12 | private static String NAMESPACE = "http://schemas.android.com/apk/res/edu.whut.ruansong.musicplayer.tool";
13 | private int playImage = 0;
14 | private int pauseImage = 0;
15 | private boolean isPlay = true;
16 |
17 | /**
18 | * 构造函数1
19 | * @param context
20 | * 组件没有属性没有样式时
21 | */
22 | public PlayPauseBtn(Context context) {
23 | super(context);
24 | initView();
25 | }
26 |
27 | /**
28 | * 构造函数2
29 | * @param context
30 | * 该组件在声明时调用了样式
31 | */
32 | public PlayPauseBtn(Context context, AttributeSet attrs, int defStyleAttr) {
33 | super(context, attrs, defStyleAttr);
34 | initView();
35 | }
36 |
37 | /**
38 | * 构造函数2
39 | * @param context
40 | * 该组件在声明时只有属性
41 | */
42 | public PlayPauseBtn(Context context, AttributeSet attrs) {
43 | super(context, attrs);
44 | // 获取图片的Int值
45 | playImage = attrs.getAttributeResourceValue(NAMESPACE, "play", R.drawable.play_5_gray);
46 | pauseImage = attrs.getAttributeResourceValue(NAMESPACE, "pause", R.drawable.pause_5_gray);
47 | initView();
48 | }
49 |
50 | public boolean isPlay(){
51 | return isPlay;
52 | }
53 | /**
54 | * 初始化函数
55 | */
56 | private void initView(){
57 | View.inflate(getContext(), R.layout.play_pause_btn, this);
58 | this.setClickable(true);
59 | if(pauseImage == 0){
60 | return ;
61 | }else{
62 | setIsStart(isPlay);
63 | }
64 | }
65 | /**
66 | * 通过传进一个boolean值,设置按钮的状态
67 | * @param isStart 设置开始或者暂停的状态
68 | */
69 | public void setIsStart(boolean isStart){
70 | this.isPlay = isStart;
71 | if(isStart){
72 | this.setBackgroundResource(playImage);
73 | }
74 | else{
75 | this.setBackgroundResource(pauseImage);
76 | }
77 | }
78 | }
79 |
--------------------------------------------------------------------------------
/app/src/main/java/edu/whut/ruansong/musicplayer/tool/SocketLogin.java:
--------------------------------------------------------------------------------
1 | package edu.whut.ruansong.musicplayer.tool;
2 |
3 | import android.util.Log;
4 |
5 | import java.io.InputStream;
6 | import java.io.OutputStream;
7 | import java.net.Socket;
8 | import java.nio.charset.StandardCharsets;
9 |
10 | /**
11 | * Created by Android Studio.
12 | * User: lvdou-jack
13 | * Date: 2019/6/6
14 | * Time: 21:16
15 | * 使用socket与本机进行通信实现密码验证
16 | */
17 | public class SocketLogin extends Thread{
18 | private String user,password;
19 | private String ip = "112.124.66.85";
20 | //本地服务器ip 192.168.31.174
21 | //云服务器ip 112.124.66.85
22 | private int port = 1998;
23 | private String return_state_string;//用于保存主机返回的密码验证状态
24 | private int respond_state_int = -1;
25 | public SocketLogin(String user, String password){
26 | this.user = user;
27 | this.password = password;
28 | }
29 | public int getRespond_state_int(){
30 | return respond_state_int;
31 | }
32 | @Override
33 | public void run(){
34 | Log.w("SocketLogin", "进入run方法");
35 | Socket socket = null;
36 | OutputStream outputStream = null;
37 | InputStream inputStream = null;
38 | try{
39 | //创建客户端socket对象
40 | socket = new Socket(ip,port);
41 | //获取输出流
42 | outputStream = socket.getOutputStream();
43 |
44 | //先发送用户名,再发送密码
45 | // 首先需要计算得知消息的长度
46 | byte[] userBytes = user.getBytes(StandardCharsets.UTF_8);
47 | // 然后将消息的长度优先发送出去
48 | outputStream.write(userBytes.length >> 8);
49 | outputStream.write(userBytes.length);
50 | //然后将消息发送出去
51 | outputStream.write(userBytes);
52 | outputStream.flush();
53 |
54 | //发送密码
55 | byte[] passwordBytes = password.getBytes(StandardCharsets.UTF_8);
56 | outputStream.write(passwordBytes.length >> 8);
57 | outputStream.write(passwordBytes.length);
58 |
59 | outputStream.write(passwordBytes);
60 | outputStream.flush();
61 |
62 | //接收主机返回的密码验证信息
63 | inputStream = socket.getInputStream();
64 | //先读长度信息
65 | int L1 = 0;
66 | int L2 = 0;
67 | int length = 0;
68 | while(true) {
69 | //获取数据的长度
70 | // Log.w("SocketLogin", "read上");
71 | L1 = inputStream.read();//先读第一个字节
72 | // Log.w("SocketLogin", "read下");
73 | if (L1 == -1)
74 | break;
75 | L2 = inputStream.read();
76 | length = (L1 << 8) + L2;
77 | //接收数据
78 | //构造一个该长度的数组
79 | byte[] bytes = new byte[length];
80 | //读取该长度的信息
81 | inputStream.read(bytes);
82 | return_state_string = new String(bytes, StandardCharsets.UTF_8);
83 | Log.w("SocketLogin","return_state_string is "+ return_state_string);
84 | if(return_state_string.equals("true"))
85 | respond_state_int = 1;
86 | else if(return_state_string.equals("false"))
87 | respond_state_int = 0;
88 | Log.w("SocketLogin","state is "+ respond_state_int);
89 | }
90 | }catch (Exception e){
91 | Log.w("SocketLogin",e);
92 | }finally {
93 | try {//关闭资源
94 | if(outputStream != null)
95 | outputStream.close();
96 | if(socket != null)
97 | socket.close();
98 | }catch (Exception e){
99 | Log.w("SocketLogin",e);
100 | }
101 | }
102 | }
103 | }
104 |
--------------------------------------------------------------------------------
/app/src/main/java/edu/whut/ruansong/musicplayer/tool/SongAdapter.java:
--------------------------------------------------------------------------------
1 | package edu.whut.ruansong.musicplayer.tool;
2 |
3 | import android.content.Context;
4 | import android.graphics.Typeface;
5 | import android.view.LayoutInflater;
6 | import android.view.View;
7 | import android.view.ViewGroup;
8 | import android.widget.ArrayAdapter;
9 | import android.widget.ImageView;
10 | import android.widget.TextView;
11 |
12 | import java.util.List;
13 |
14 | import edu.whut.ruansong.musicplayer.R;
15 | import edu.whut.ruansong.musicplayer.model.Song;
16 |
17 | /**
18 | * Created by 阮 on 2018/11/17.
19 | */
20 |
21 | public class SongAdapter extends ArrayAdapter {
22 | private int resourceId;//用来放置布局文件的id
23 | private Context context;
24 |
25 | //适配器的构造函数
26 | public SongAdapter(Context context, int resourceId, List objects) {
27 | super(context, resourceId, objects);
28 | this.context = context;
29 | this.resourceId = resourceId;
30 | }
31 |
32 | static class ViewHolder {
33 |
34 | ImageView songImage;
35 |
36 | TextView songName;
37 |
38 | TextView songAuthor;
39 |
40 | ImageView more_options;
41 |
42 | }
43 |
44 | //这个方法在每个子项被滚动到屏幕内的时候会被调用
45 | @Override
46 | public View getView(final int position, View convertView, ViewGroup parent) {
47 | Song song = getItem(position); // 获取当前项的Song实例
48 | View view;//子项布局对象
49 | ViewHolder viewHolder;//内部类对象
50 | if (convertView == null) {//如果是第一次加载
51 | view = LayoutInflater.from(getContext()).inflate(resourceId, parent, false);//布局对象化
52 | viewHolder = new ViewHolder();
53 |
54 | //把布局文件里面的4个对象加载出来
55 | viewHolder.songImage = view.findViewById(R.id.song_image);
56 | viewHolder.songName = view.findViewById (R.id.title);
57 | viewHolder.songAuthor=view.findViewById(R.id.artist);
58 | viewHolder.more_options = view.findViewById(R.id.more_options);
59 | view.setTag(viewHolder); // 将ViewHolder存储在View中
60 | } else {//不是第一次加载,即布局文件已经加载,可以利用
61 | view = convertView;
62 | viewHolder = (ViewHolder) view.getTag(); // 重新获取ViewHolder
63 | }
64 | if(song!=null && viewHolder!=null){
65 | //传入具体信息
66 | viewHolder.songImage.setImageBitmap(song.getAlbum_icon());//列表每一项的图标
67 | viewHolder.songName.setText(song.getTitle());//歌名
68 | viewHolder.songAuthor.setText(song.getArtist());//歌手
69 |
70 | //设置两个文本的字体style
71 | viewHolder.songName.setTypeface(Typeface.DEFAULT_BOLD);
72 | viewHolder.songAuthor.setTypeface(Typeface.DEFAULT_BOLD);
73 |
74 | //设定更多选项按钮的点击事件
75 | viewHolder.more_options.setOnClickListener(new View.OnClickListener() {
76 | @Override
77 | public void onClick(View v) {
78 | if(m != null){
79 | m.onMoreOptionsClick(position);
80 | }
81 | }
82 | });
83 | }
84 | return view;
85 | }
86 |
87 | /*
88 | * 经典接口回调
89 | * 外部调用setOnItemMoreOptionsClickListener时势必会传入onItemMoreOptionsListener的实例
90 | * 所以其中的抽象方法onMoreOptionsClick也会要求重写
91 | * */
92 | public interface onItemMoreOptionsListener {
93 | void onMoreOptionsClick(int position);
94 | }
95 |
96 | private onItemMoreOptionsListener m;
97 |
98 | public void setOnItemMoreOptionsClickListener(onItemMoreOptionsListener m) {
99 | this.m = m;
100 | }
101 | }
102 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v24/ic_launcher_foreground.xml:
--------------------------------------------------------------------------------
1 |
7 |
12 |
13 |
19 |
22 |
25 |
26 |
27 |
28 |
34 |
35 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/about.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RSMung/RSMungMusic/69604871803c311798a01c4c722c996cf1f01bda/app/src/main/res/drawable/about.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/album_icon_test.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RSMung/RSMungMusic/69604871803c311798a01c4c722c996cf1f01bda/app/src/main/res/drawable/album_icon_test.jpg
--------------------------------------------------------------------------------
/app/src/main/res/drawable/album_svg_32.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
12 |
15 |
18 |
21 |
24 |
25 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/back.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RSMung/RSMungMusic/69604871803c311798a01c4c722c996cf1f01bda/app/src/main/res/drawable/back.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/back_detail_activity.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RSMung/RSMungMusic/69604871803c311798a01c4c722c996cf1f01bda/app/src/main/res/drawable/back_detail_activity.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/background_gradient.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/btn_play_click.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
7 |
8 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/btn_rounded_corner_black_stroke.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
5 |
6 |
8 |
9 |
11 |
12 |
15 |
16 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/btn_rounded_corner_shape.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
7 |
8 |
10 |
11 |
14 |
15 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/checkbox_false.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RSMung/RSMungMusic/69604871803c311798a01c4c722c996cf1f01bda/app/src/main/res/drawable/checkbox_false.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/checkbox_style.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/checkbox_true.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RSMung/RSMungMusic/69604871803c311798a01c4c722c996cf1f01bda/app/src/main/res/drawable/checkbox_true.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/close.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RSMung/RSMungMusic/69604871803c311798a01c4c722c996cf1f01bda/app/src/main/res/drawable/close.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/close_black_32.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RSMung/RSMungMusic/69604871803c311798a01c4c722c996cf1f01bda/app/src/main/res/drawable/close_black_32.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/close_gray.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RSMung/RSMungMusic/69604871803c311798a01c4c722c996cf1f01bda/app/src/main/res/drawable/close_gray.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/cycle_32.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RSMung/RSMungMusic/69604871803c311798a01c4c722c996cf1f01bda/app/src/main/res/drawable/cycle_32.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/danger.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RSMung/RSMungMusic/69604871803c311798a01c4c722c996cf1f01bda/app/src/main/res/drawable/danger.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/default_album_icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RSMung/RSMungMusic/69604871803c311798a01c4c722c996cf1f01bda/app/src/main/res/drawable/default_album_icon.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/default_album_icon2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RSMung/RSMungMusic/69604871803c311798a01c4c722c996cf1f01bda/app/src/main/res/drawable/default_album_icon2.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/default_album_icon_detail_activity.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RSMung/RSMungMusic/69604871803c311798a01c4c722c996cf1f01bda/app/src/main/res/drawable/default_album_icon_detail_activity.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/default_album_icon_gray.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RSMung/RSMungMusic/69604871803c311798a01c4c722c996cf1f01bda/app/src/main/res/drawable/default_album_icon_gray.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/exit.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RSMung/RSMungMusic/69604871803c311798a01c4c722c996cf1f01bda/app/src/main/res/drawable/exit.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/exit_2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RSMung/RSMungMusic/69604871803c311798a01c4c722c996cf1f01bda/app/src/main/res/drawable/exit_2.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/full_love_32.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RSMung/RSMungMusic/69604871803c311798a01c4c722c996cf1f01bda/app/src/main/res/drawable/full_love_32.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/head_login_80.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RSMung/RSMungMusic/69604871803c311798a01c4c722c996cf1f01bda/app/src/main/res/drawable/head_login_80.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/history_32.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RSMung/RSMungMusic/69604871803c311798a01c4c722c996cf1f01bda/app/src/main/res/drawable/history_32.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_launcher_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
10 |
15 |
20 |
25 |
30 |
35 |
40 |
45 |
50 |
55 |
60 |
65 |
70 |
75 |
80 |
85 |
90 |
95 |
100 |
105 |
110 |
115 |
120 |
125 |
130 |
135 |
140 |
145 |
150 |
155 |
160 |
165 |
170 |
171 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/list_view_rounded_corner.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
8 |
9 |
12 |
13 |
15 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/login_background.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RSMung/RSMungMusic/69604871803c311798a01c4c722c996cf1f01bda/app/src/main/res/drawable/login_background.jpg
--------------------------------------------------------------------------------
/app/src/main/res/drawable/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RSMung/RSMungMusic/69604871803c311798a01c4c722c996cf1f01bda/app/src/main/res/drawable/logo.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/love.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RSMung/RSMungMusic/69604871803c311798a01c4c722c996cf1f01bda/app/src/main/res/drawable/love.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/menu_gray.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RSMung/RSMungMusic/69604871803c311798a01c4c722c996cf1f01bda/app/src/main/res/drawable/menu_gray.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/more_options.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RSMung/RSMungMusic/69604871803c311798a01c4c722c996cf1f01bda/app/src/main/res/drawable/more_options.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/next_32.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RSMung/RSMungMusic/69604871803c311798a01c4c722c996cf1f01bda/app/src/main/res/drawable/next_32.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/next_5_gray.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RSMung/RSMungMusic/69604871803c311798a01c4c722c996cf1f01bda/app/src/main/res/drawable/next_5_gray.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/next_black_48.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RSMung/RSMungMusic/69604871803c311798a01c4c722c996cf1f01bda/app/src/main/res/drawable/next_black_48.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/order_32.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RSMung/RSMungMusic/69604871803c311798a01c4c722c996cf1f01bda/app/src/main/res/drawable/order_32.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/password_white_login_25.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RSMung/RSMungMusic/69604871803c311798a01c4c722c996cf1f01bda/app/src/main/res/drawable/password_white_login_25.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/pause_32.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RSMung/RSMungMusic/69604871803c311798a01c4c722c996cf1f01bda/app/src/main/res/drawable/pause_32.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/pause_5_gray.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RSMung/RSMungMusic/69604871803c311798a01c4c722c996cf1f01bda/app/src/main/res/drawable/pause_5_gray.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/pause_black_64.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RSMung/RSMungMusic/69604871803c311798a01c4c722c996cf1f01bda/app/src/main/res/drawable/pause_black_64.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/play_32.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RSMung/RSMungMusic/69604871803c311798a01c4c722c996cf1f01bda/app/src/main/res/drawable/play_32.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/play_5_gray.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RSMung/RSMungMusic/69604871803c311798a01c4c722c996cf1f01bda/app/src/main/res/drawable/play_5_gray.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/play_black_64.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RSMung/RSMungMusic/69604871803c311798a01c4c722c996cf1f01bda/app/src/main/res/drawable/play_black_64.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/playing_grass_green.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RSMung/RSMungMusic/69604871803c311798a01c4c722c996cf1f01bda/app/src/main/res/drawable/playing_grass_green.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/playing_violet.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RSMung/RSMungMusic/69604871803c311798a01c4c722c996cf1f01bda/app/src/main/res/drawable/playing_violet.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/pre_black.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RSMung/RSMungMusic/69604871803c311798a01c4c722c996cf1f01bda/app/src/main/res/drawable/pre_black.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/pre_black_48.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RSMung/RSMungMusic/69604871803c311798a01c4c722c996cf1f01bda/app/src/main/res/drawable/pre_black_48.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/random_32.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RSMung/RSMungMusic/69604871803c311798a01c4c722c996cf1f01bda/app/src/main/res/drawable/random_32.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/refresh.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RSMung/RSMungMusic/69604871803c311798a01c4c722c996cf1f01bda/app/src/main/res/drawable/refresh.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/save_32.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RSMung/RSMungMusic/69604871803c311798a01c4c722c996cf1f01bda/app/src/main/res/drawable/save_32.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/scrollbar_track.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
5 |
6 |
9 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/scrollbars.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
8 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/search.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RSMung/RSMungMusic/69604871803c311798a01c4c722c996cf1f01bda/app/src/main/res/drawable/search.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/search_view.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
8 |
9 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/setting.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RSMung/RSMungMusic/69604871803c311798a01c4c722c996cf1f01bda/app/src/main/res/drawable/setting.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/share_detail_activity.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RSMung/RSMungMusic/69604871803c311798a01c4c722c996cf1f01bda/app/src/main/res/drawable/share_detail_activity.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/song_item_picture.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RSMung/RSMungMusic/69604871803c311798a01c4c722c996cf1f01bda/app/src/main/res/drawable/song_item_picture.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/start_window.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RSMung/RSMungMusic/69604871803c311798a01c4c722c996cf1f01bda/app/src/main/res/drawable/start_window.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/stop_with_time.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RSMung/RSMungMusic/69604871803c311798a01c4c722c996cf1f01bda/app/src/main/res/drawable/stop_with_time.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/user_white_login_25.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RSMung/RSMungMusic/69604871803c311798a01c4c722c996cf1f01bda/app/src/main/res/drawable/user_white_login_25.png
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_display.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
16 |
17 |
25 |
35 |
36 |
39 |
40 |
51 |
60 |
61 |
67 |
68 |
77 |
78 |
87 |
88 |
100 |
101 |
114 |
115 |
116 |
125 |
126 |
135 |
136 |
145 |
146 |
147 |
152 |
153 |
154 |
155 |
156 |
164 |
170 |
178 |
184 |
185 |
186 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_login.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
16 |
17 |
21 |
27 |
28 |
29 |
34 |
41 |
42 |
53 |
54 |
55 |
60 |
67 |
68 |
81 |
82 |
83 |
87 |
88 |
97 |
98 |
109 |
110 |
111 |
118 |
119 |
126 |
136 |
137 |
138 |
143 |
150 |
151 |
152 |
153 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_my_love_songs.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
15 |
25 |
26 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_search_detail.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
17 |
18 |
25 |
26 |
30 |
31 |
40 |
41 |
49 |
50 |
51 |
55 |
56 |
57 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_share.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
16 |
23 |
29 |
36 |
45 |
54 |
55 |
61 |
65 |
72 |
73 |
74 |
75 |
82 |
86 |
91 |
92 |
93 |
94 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_song_detail.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
16 |
22 |
30 |
31 |
37 |
43 |
44 |
50 |
57 |
64 |
71 |
72 |
78 |
85 |
92 |
99 |
106 |
113 |
114 |
119 |
120 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/dialog_feedback.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
15 |
25 |
35 |
45 |
55 |
56 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/dialog_stop_with_time.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
15 |
16 |
26 |
27 |
32 |
33 |
39 |
40 |
48 |
49 |
50 |
51 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/drawer_layout_list_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
14 |
15 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/my_history_view.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
15 |
16 |
21 |
22 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/notification.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
16 |
17 |
26 |
27 |
39 |
40 |
53 |
54 |
55 |
64 |
65 |
73 |
81 |
82 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/play_pause_btn.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/song_list_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
14 |
15 |
16 |
24 |
25 |
33 |
34 |
41 |
42 |
50 |
51 |
52 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/menu_display.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/menu_play_mode.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/menu_search_detail_activity.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/menu_song_detail_activity.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RSMung/RSMungMusic/69604871803c311798a01c4c722c996cf1f01bda/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RSMung/RSMungMusic/69604871803c311798a01c4c722c996cf1f01bda/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RSMung/RSMungMusic/69604871803c311798a01c4c722c996cf1f01bda/app/src/main/res/mipmap-hdpi/logo.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/pause.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RSMung/RSMungMusic/69604871803c311798a01c4c722c996cf1f01bda/app/src/main/res/mipmap-hdpi/pause.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/play_2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RSMung/RSMungMusic/69604871803c311798a01c4c722c996cf1f01bda/app/src/main/res/mipmap-hdpi/play_2.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RSMung/RSMungMusic/69604871803c311798a01c4c722c996cf1f01bda/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RSMung/RSMungMusic/69604871803c311798a01c4c722c996cf1f01bda/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RSMung/RSMungMusic/69604871803c311798a01c4c722c996cf1f01bda/app/src/main/res/mipmap-mdpi/logo.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RSMung/RSMungMusic/69604871803c311798a01c4c722c996cf1f01bda/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RSMung/RSMungMusic/69604871803c311798a01c4c722c996cf1f01bda/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RSMung/RSMungMusic/69604871803c311798a01c4c722c996cf1f01bda/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RSMung/RSMungMusic/69604871803c311798a01c4c722c996cf1f01bda/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RSMung/RSMungMusic/69604871803c311798a01c4c722c996cf1f01bda/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RSMung/RSMungMusic/69604871803c311798a01c4c722c996cf1f01bda/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #101010
4 | #101010
5 | #00d8a0
6 |
7 | #101010
8 | #AF101010
9 | #00fbf8f8
10 | #6a4c9c
11 | #ccff00
12 | #00d8a0
13 | #fbf8f8
14 | #eb0b0b
15 | #0630d8
16 | #ebeded
17 | #dcd6f7
18 | #a6b1e1
19 | #edffea
20 | #d1cebd
21 |
22 |
--------------------------------------------------------------------------------
/app/src/main/res/values/dimen.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 5dp
4 | 8dp
5 | 10dp
6 | 15dp
7 | 20dp
8 | 30dp
9 | 35dp
10 | 40dp
11 | 45dp
12 | 60dp
13 |
14 | 10sp
15 | 15sp
16 | 20sp
17 |
18 | 5px
19 |
20 |
--------------------------------------------------------------------------------
/app/src/main/res/values/gramophoneView_attr.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/app/src/main/res/values/play_pause_btn_attr.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | RSMungMusic
3 |
4 | 退出
5 | 确定
6 | 密码错误,请重试!
7 | 欢迎您
8 | 用户名为空!
9 | 历史播放记录
10 | 定时停止播放
11 | 定时关机
12 | 请输入时间
13 | 播放模式
14 | 搜索
15 | 请输入时间(单位:分钟)
16 | 剩余时间(单位:分钟)
17 | 建立任务
18 | 取消任务
19 | 搜索本地歌曲
20 | 搜索结果
21 |
22 | 这首音乐的专辑图片
23 |
24 | 我的音乐
25 | 分享
26 | 关于
27 | 刷新
28 | 1.Mung音乐播放器_版本1.4.2
29 | 2.开发者: RSMung
30 | 3.Email: \n rs249310509@163.com
31 | 4.隐私政策: \n https://blog.csdn.net/lvdoujack/article/details/104106734
32 | 5.其它: \n 个人开发,兴趣所在,您的鼓励支持就是我最大的动力;反应问题可Email我,RSMung在这里十分感谢
33 |
34 | 用户名
35 | 密码
36 | 记住用户名
37 | 记住密码
38 | 登录
39 | register
40 | ForgetPassword"?"
41 |
42 |
43 | 顺序播放
44 | 单曲循环
45 | 随机播放
46 |
47 | 保存
48 |
49 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
21 |
24 |
25 |
35 |
36 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/app/src/test/java/edu/whut/ruansong/musicplayer/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package edu.whut.ruansong.musicplayer;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() throws Exception {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 |
5 | repositories {
6 | google()
7 | jcenter()
8 | }
9 | dependencies {
10 | classpath 'com.android.tools.build:gradle:4.0.0'
11 |
12 |
13 | // NOTE: Do not place your application dependencies here; they belong
14 | // in the individual module build.gradle files
15 | }
16 | }
17 |
18 | allprojects {
19 | repositories {
20 | google()
21 | jcenter()
22 | }
23 | }
24 |
25 | task clean(type: Delete) {
26 | delete rootProject.buildDir
27 | }
28 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | org.gradle.jvmargs=-Xmx1536m
13 |
14 | # When configured, Gradle will run in incubating parallel mode.
15 | # This option should only be used with decoupled projects. More details, visit
16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
17 | # org.gradle.parallel=true
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RSMung/RSMungMusic/69604871803c311798a01c4c722c996cf1f01bda/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Mon Jun 22 10:46:28 CST 2020
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
7 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
10 | DEFAULT_JVM_OPTS=""
11 |
12 | APP_NAME="Gradle"
13 | APP_BASE_NAME=`basename "$0"`
14 |
15 | # Use the maximum available, or set MAX_FD != -1 to use that value.
16 | MAX_FD="maximum"
17 |
18 | warn ( ) {
19 | echo "$*"
20 | }
21 |
22 | die ( ) {
23 | echo
24 | echo "$*"
25 | echo
26 | exit 1
27 | }
28 |
29 | # OS specific support (must be 'true' or 'false').
30 | cygwin=false
31 | msys=false
32 | darwin=false
33 | case "`uname`" in
34 | CYGWIN* )
35 | cygwin=true
36 | ;;
37 | Darwin* )
38 | darwin=true
39 | ;;
40 | MINGW* )
41 | msys=true
42 | ;;
43 | esac
44 |
45 | # Attempt to set APP_HOME
46 | # Resolve links: $0 may be a link
47 | PRG="$0"
48 | # Need this for relative symlinks.
49 | while [ -h "$PRG" ] ; do
50 | ls=`ls -ld "$PRG"`
51 | link=`expr "$ls" : '.*-> \(.*\)$'`
52 | if expr "$link" : '/.*' > /dev/null; then
53 | PRG="$link"
54 | else
55 | PRG=`dirname "$PRG"`"/$link"
56 | fi
57 | done
58 | SAVED="`pwd`"
59 | cd "`dirname \"$PRG\"`/" >/dev/null
60 | APP_HOME="`pwd -P`"
61 | cd "$SAVED" >/dev/null
62 |
63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
64 |
65 | # Determine the Java command to use to start the JVM.
66 | if [ -n "$JAVA_HOME" ] ; then
67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
68 | # IBM's JDK on AIX uses strange locations for the executables
69 | JAVACMD="$JAVA_HOME/jre/sh/java"
70 | else
71 | JAVACMD="$JAVA_HOME/bin/java"
72 | fi
73 | if [ ! -x "$JAVACMD" ] ; then
74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
75 |
76 | Please set the JAVA_HOME variable in your environment to match the
77 | location of your Java installation."
78 | fi
79 | else
80 | JAVACMD="java"
81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
82 |
83 | Please set the JAVA_HOME variable in your environment to match the
84 | location of your Java installation."
85 | fi
86 |
87 | # Increase the maximum file descriptors if we can.
88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
89 | MAX_FD_LIMIT=`ulimit -H -n`
90 | if [ $? -eq 0 ] ; then
91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
92 | MAX_FD="$MAX_FD_LIMIT"
93 | fi
94 | ulimit -n $MAX_FD
95 | if [ $? -ne 0 ] ; then
96 | warn "Could not set maximum file descriptor limit: $MAX_FD"
97 | fi
98 | else
99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
100 | fi
101 | fi
102 |
103 | # For Darwin, add options to specify how the application appears in the dock
104 | if $darwin; then
105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
106 | fi
107 |
108 | # For Cygwin, switch paths to Windows format before running java
109 | if $cygwin ; then
110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
112 | JAVACMD=`cygpath --unix "$JAVACMD"`
113 |
114 | # We build the pattern for arguments to be converted via cygpath
115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
116 | SEP=""
117 | for dir in $ROOTDIRSRAW ; do
118 | ROOTDIRS="$ROOTDIRS$SEP$dir"
119 | SEP="|"
120 | done
121 | OURCYGPATTERN="(^($ROOTDIRS))"
122 | # Add a user-defined pattern to the cygpath arguments
123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
125 | fi
126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
127 | i=0
128 | for arg in "$@" ; do
129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
131 |
132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
134 | else
135 | eval `echo args$i`="\"$arg\""
136 | fi
137 | i=$((i+1))
138 | done
139 | case $i in
140 | (0) set -- ;;
141 | (1) set -- "$args0" ;;
142 | (2) set -- "$args0" "$args1" ;;
143 | (3) set -- "$args0" "$args1" "$args2" ;;
144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
150 | esac
151 | fi
152 |
153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
154 | function splitJvmOpts() {
155 | JVM_OPTS=("$@")
156 | }
157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
159 |
160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
161 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
--------------------------------------------------------------------------------