master
尹宏利 2 years ago
parent bc475e90e0
commit a507924254

@ -0,0 +1,15 @@
*.iml
.gradle
/local.properties
/.idea/caches
/.idea/libraries
/.idea/modules.xml
/.idea/workspace.xml
/.idea/navEditor.xml
/.idea/assetWizardSettings.xml
.DS_Store
/build
/captures
.externalNativeBuild
.cxx
local.properties

@ -0,0 +1,3 @@
# Default ignored files
/shelf/
/workspace.xml

@ -0,0 +1 @@
My Application

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<bytecodeTargetLevel target="11" />
</component>
</project>

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GradleMigrationSettings" migrationVersion="1" />
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="testRunner" value="GRADLE" />
<option name="distributionType" value="DEFAULT_WRAPPED" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="gradleHome" value="$PROJECT_DIR$/../environment/gradle/gradle-7.5.1" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />
<option value="$PROJECT_DIR$/app" />
<option value="$PROJECT_DIR$/testmusic" />
</set>
</option>
</GradleProjectSettings>
</option>
</component>
</project>

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="true" project-jdk-name="Android Studio default JDK" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">
<option name="id" value="Android" />
</component>
</project>

@ -0,0 +1,11 @@
@startuml
class com.example.music.SongsFragment {
~ RecyclerView recyclerView
~ MusicAdapter musicAdapter
+ <<Create>> SongsFragment()
+ View onCreateView(LayoutInflater,ViewGroup,Bundle)
}
androidx.fragment.app.Fragment <|-- com.example.music.SongsFragment
@enduml

@ -0,0 +1,10 @@
@startuml
class com.example.music.AlbumsFragment {
~ RecyclerView recyclerView
~ AlbumAdapter albumAdapter
+ View onCreateView(LayoutInflater,ViewGroup,Bundle)
}
androidx.fragment.app.Fragment <|-- com.example.music.AlbumsFragment
@enduml

@ -0,0 +1,10 @@
@startuml
class com.example.music.SongsFragment {
~ RecyclerView recyclerView
~ MusicAdapter musicAdapter
+ View onCreateView(LayoutInflater,ViewGroup,Bundle)
}
androidx.fragment.app.Fragment <|-- com.example.music.SongsFragment
@enduml

@ -0,0 +1,5 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
id 'com.android.application' version '7.4.1' apply false
id 'com.android.library' version '7.4.1' apply false
}

@ -0,0 +1,47 @@
@startuml
class com.example.music.MusicAdapter {
- Context mContext
- ArrayList<MusicFiles> mFiles
~ <<Create>> MusicAdapter(Context,ArrayList<MusicFiles>)
+ MyVieHolder onCreateViewHolder(ViewGroup,int)
+ void onBindViewHolder(MyVieHolder,int)
- void deleteFlie(int,View)
+ int getItemCount()
- byte[] getAlbumArt(String)
}
class com.example.music.MusicAdapter$MyVieHolder {
~ TextView file_name
~ ImageView album_art
+ <<Create>> MyVieHolder(View)
}
class com.example.music.AlbumAdapter {
- Context mContext
- ArrayList<MusicFiles> albumFiles
~ View view
+ <<Create>> AlbumAdapter(Context,ArrayList<MusicFiles>)
+ MyHolder onCreateViewHolder(ViewGroup,int)
+ void onBindViewHolder(MyHolder,int)
+ int getItemCount()
- byte[] getAlbumArt(String)
}
class com.example.music.AlbumAdapter$MyHolder {
~ ImageView album_image
~ TextView album_name
+ <<Create>> MyHolder(View)
}
class com.example.music.PagerAdapter {
- int tabsNumber
+ <<Create>> PagerAdapter(FragmentManager,int,int)
+ Fragment getItem(int)
+ int getCount()
}
com.example.music.Adapter <|-- com.example.music.MusicAdapter
com.example.music.MusicAdapter +.. com.example.music.MusicAdapter$MyVieHolder
com.example.music.ViewHolder <|-- com.example.music.MusicAdapter$MyVieHolder
com.example.music.Adapter <|-- com.example.music.AlbumAdapter
com.example.music.AlbumAdapter +.. com.example.music.AlbumAdapter$MyHolder
com.example.music.ViewHolder <|-- com.example.music.AlbumAdapter$MyHolder
androidx.fragment.app.FragmentPagerAdapter <|-- com.example.music.PagerAdapter
@enduml

@ -0,0 +1,23 @@
# Project-wide Gradle settings.
# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
# AndroidX package structure to make it clearer which packages are bundled with the
# Android operating system, and which are packaged with your app's APK
# https://developer.android.com/topic/libraries/support-library/androidx-rn
android.useAndroidX=true
# Enables namespacing of each library's R class so that its R class includes only the
# resources declared in the library itself and none from the library's dependencies,
# thereby reducing the size of the R class for that library
android.nonTransitiveRClass=true
android.enableJetifier=true
org.gradle.unsafe.configuration-cache=true

@ -0,0 +1,6 @@
#Mon Mar 13 18:03:20 CST 2023
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME

@ -0,0 +1,185 @@
#!/usr/bin/env sh
#
# Copyright 2015 the original author or authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn () {
echo "$*"
}
die () {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin or MSYS, switch paths to Windows format before running java
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=`expr $i + 1`
done
case $i in
0) set -- ;;
1) set -- "$args0" ;;
2) set -- "$args0" "$args1" ;;
3) set -- "$args0" "$args1" "$args2" ;;
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
# Escape application args
save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=`save "$@"`
# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
exec "$JAVACMD" "$@"

@ -0,0 +1,89 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto execute
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega

@ -0,0 +1,20 @@
@startuml
class com.example.music.AlbumAdapter {
- Context mContext
- ArrayList<MusicFiles> albumFiles
~ View view
+ MyHolder onCreateViewHolder(ViewGroup,int)
+ void onBindViewHolder(MyHolder,int)
+ int getItemCount()
- byte[] getAlbumArt(String)
}
class com.example.music.AlbumAdapter$MyHolder {
~ ImageView album_image
~ TextView album_name
}
com.example.music.Adapter <|-- com.example.music.AlbumAdapter
com.example.music.AlbumAdapter +.. com.example.music.AlbumAdapter$MyHolder
com.example.music.ViewHolder <|-- com.example.music.AlbumAdapter$MyHolder
@enduml

@ -0,0 +1,24 @@
@startuml
class com.example.music.MainActivity {
~ DrawerLayout drawerLayout
~ ActionBarDrawerToggle toggle
~ NavigationView navigationView
~ ViewPager pager
~ TabLayout mTabLayout
~ TabItem songs
~ PagerAdapter pagerAdapter
+ {static} int REQUEST_CODE
~ {static} ArrayList<MusicFiles> musicFiles
~ {static} boolean shuffleBoolean
# void onCreate(Bundle)
- void initViewPager()
- void permission()
+ void onRequestPermissionsResult(int,String[],int[])
+ boolean onNavigationItemSelected(MenuItem)
+ {static} ArrayList<MusicFiles> getAllAudio(Context)
}
com.example.music.OnNavigationItemSelectedListener <|.. com.example.music.MainActivity
androidx.appcompat.app.AppCompatActivity <|-- com.example.music.MainActivity
@enduml

@ -0,0 +1,20 @@
@startuml
class com.example.music.AlbumAdapter {
- Context mContext
- ArrayList<MusicFiles> albumFiles
~ View view
+ MyHolder onCreateViewHolder(ViewGroup,int)
+ void onBindViewHolder(MyHolder,int)
+ int getItemCount()
- byte[] getAlbumArt(String)
}
class com.example.music.AlbumAdapter$MyHolder {
~ ImageView album_image
~ TextView album_name
}
com.example.music.Adapter <|-- com.example.music.AlbumAdapter
com.example.music.AlbumAdapter +.. com.example.music.AlbumAdapter$MyHolder
com.example.music.ViewHolder <|-- com.example.music.AlbumAdapter$MyHolder
@enduml

@ -0,0 +1,159 @@
@startuml
class com.example.music.Adapter.MusicAdapter {
- Context mContext
- ArrayList<MusicFiles> mFiles
+ MyVieHolder onCreateViewHolder(ViewGroup,int)
+ void onBindViewHolder(MyVieHolder,int)
- void deleteFlie(int,View)
+ int getItemCount()
- byte[] getAlbumArt(String)
}
class com.example.music.Adapter.MusicAdapter$MyVieHolder {
~ TextView file_name
~ ImageView album_art
}
class com.example.music.Activity.PlayerActivity {
~ TextView song_name
~ ImageView cover_art
~ FloatingActionButton playPauseBtn
~ SeekBar seekBar
~ int position
~ {static} ArrayList<MusicFiles> listSongs
~ {static} Uri uri
~ {static} MediaPlayer mediaPlayer
- Handler handler
- Thread playThread
# void onCreate(Bundle)
# void onResume()
- void prevThreadBtn()
- void prevBtnClicked()
- void nextThreadBtn()
- void nextBtnClicked()
- int getRandom(int)
- void playThreadBtn()
- void playPauseBtnClicked()
- String formattedTime(int)
- void getIntentMethod()
- void initView()
- void metaData(Uri)
+ void ImageAnimation(Context,ImageView,Bitmap)
+ void onCompletion(MediaPlayer)
}
class com.example.music.databases.DaBa {
- {static} int VERSION
- {static} String DBNAME
- Context mContext
+ void onCreate(SQLiteDatabase)
+ void onUpgrade(SQLiteDatabase,int,int)
}
class com.example.music.Activity.RegisterActivity {
~ Button button_submit
~ DaBa daBa
~ EditText index_username
~ EditText index_password
~ SQLiteDatabase sqLiteDatabase
# void onCreate(Bundle)
}
class com.example.music.Adapter.AlbumAdapter {
- Context mContext
- ArrayList<MusicFiles> albumFiles
~ View view
+ MyHolder onCreateViewHolder(ViewGroup,int)
+ void onBindViewHolder(MyHolder,int)
+ int getItemCount()
- byte[] getAlbumArt(String)
}
class com.example.music.Adapter.AlbumAdapter$MyHolder {
~ ImageView album_image
~ TextView album_name
}
class com.example.music.Fragment.AlbumsFragment {
~ RecyclerView recyclerView
~ AlbumAdapter albumAdapter
+ View onCreateView(LayoutInflater,ViewGroup,Bundle)
}
class com.example.music.Activity.LoginActivity {
~ EditText usernameInput
~ EditText passwordInput
~ Button button_login
~ Button button_index
~ Context that
- CheckBox RePassword
- CheckBox AutoLogin
- String Tag
- String SP_Name
- String SP_Password
- String SP_IsRemember
- SharedPreferences sharedPreferences
- boolean status
# void onCreate(Bundle)
- void initData()
- void initUI()
}
class com.example.music.MusicFiles {
- String path
- String title
- String artist
- String album
- String duration
- String id
+ String getPath()
+ void setPath(String)
+ String getTitle()
+ void setTitle(String)
+ String getArtist()
+ void setArtist(String)
+ String getAlbum()
+ void setAlbum(String)
+ String getDuration()
+ void setDuration(String)
+ String getId()
+ void setId(String)
}
class com.example.music.Adapter.PagerAdapter {
- int tabsNumber
+ Fragment getItem(int)
+ int getCount()
}
class com.example.music.Activity.MainActivity {
~ DrawerLayout drawerLayout
~ ActionBarDrawerToggle toggle
~ NavigationView navigationView
~ ViewPager pager
~ TabLayout mTabLayout
~ TabItem songs
~ PagerAdapter pagerAdapter
+ {static} int REQUEST_CODE
~ {static} ArrayList<MusicFiles> musicFiles
~ {static} boolean shuffleBoolean
# void onCreate(Bundle)
- void initViewPager()
- void permission()
+ void onRequestPermissionsResult(int,String[],int[])
+ boolean onNavigationItemSelected(MenuItem)
+ {static} ArrayList<MusicFiles> getAllAudio(Context)
}
class com.example.music.Fragment.SongsFragment {
~ RecyclerView recyclerView
~ MusicAdapter musicAdapter
+ View onCreateView(LayoutInflater,ViewGroup,Bundle)
}
com.example.music.Adapter.Adapter <|-- com.example.music.Adapter.MusicAdapter
com.example.music.Adapter.MusicAdapter +.. com.example.music.Adapter.MusicAdapter$MyVieHolder
com.example.music.Adapter.ViewHolder <|-- com.example.music.Adapter.MusicAdapter$MyVieHolder
com.example.music.Activity.OnCompletionListener <|.. com.example.music.Activity.PlayerActivity
androidx.appcompat.app.AppCompatActivity <|-- com.example.music.Activity.PlayerActivity
android.database.sqlite.SQLiteOpenHelper <|-- com.example.music.databases.DaBa
androidx.appcompat.app.AppCompatActivity <|-- com.example.music.Activity.RegisterActivity
com.example.music.Adapter.Adapter <|-- com.example.music.Adapter.AlbumAdapter
com.example.music.Adapter.AlbumAdapter +.. com.example.music.Adapter.AlbumAdapter$MyHolder
com.example.music.Adapter.ViewHolder <|-- com.example.music.Adapter.AlbumAdapter$MyHolder
androidx.fragment.app.Fragment <|-- com.example.music.Fragment.AlbumsFragment
androidx.appcompat.app.AppCompatActivity <|-- com.example.music.Activity.LoginActivity
androidx.fragment.app.FragmentPagerAdapter <|-- com.example.music.Adapter.PagerAdapter
com.example.music.Activity.OnNavigationItemSelectedListener <|.. com.example.music.Activity.MainActivity
androidx.appcompat.app.AppCompatActivity <|-- com.example.music.Activity.MainActivity
androidx.fragment.app.Fragment <|-- com.example.music.Fragment.SongsFragment
@enduml

@ -0,0 +1,13 @@
@startuml
class com.example.music.databases.DaBa {
- {static} int VERSION
- {static} String DBNAME
- Context mContext
+ <<Create>> DaBa(Context)
+ void onCreate(SQLiteDatabase)
+ void onUpgrade(SQLiteDatabase,int,int)
}
android.database.sqlite.SQLiteOpenHelper <|-- com.example.music.databases.DaBa
@enduml

@ -0,0 +1,17 @@
@startuml
class com.example.music.AlbumsFragment {
~ RecyclerView recyclerView
~ AlbumAdapter albumAdapter
+ View onCreateView(LayoutInflater,ViewGroup,Bundle)
}
class com.example.music.SongsFragment {
~ RecyclerView recyclerView
~ MusicAdapter musicAdapter
+ <<Create>> SongsFragment()
+ View onCreateView(LayoutInflater,ViewGroup,Bundle)
}
androidx.fragment.app.Fragment <|-- com.example.music.AlbumsFragment
androidx.fragment.app.Fragment <|-- com.example.music.SongsFragment
@enduml

@ -0,0 +1,81 @@
@startuml
class com.example.music.PlayerActivity {
~ TextView song_name
~ ImageView cover_art
~ FloatingActionButton playPauseBtn
~ SeekBar seekBar
~ int position
~ {static} ArrayList<MusicFiles> listSongs
~ {static} Uri uri
~ {static} MediaPlayer mediaPlayer
- Handler handler
- Thread playThread
# void onCreate(Bundle)
# void onResume()
- void prevThreadBtn()
- void prevBtnClicked()
- void nextThreadBtn()
- void nextBtnClicked()
- int getRandom(int)
- void playThreadBtn()
- void playPauseBtnClicked()
- String formattedTime(int)
- void getIntentMethod()
- void initView()
- void metaData(Uri)
+ void ImageAnimation(Context,ImageView,Bitmap)
+ void onCompletion(MediaPlayer)
}
class com.example.music.RegisterActivity {
~ Button button_submit
~ DaBa daBa
~ EditText index_username
~ EditText index_password
~ SQLiteDatabase sqLiteDatabase
# void onCreate(Bundle)
}
class com.example.music.LoginActivity {
~ EditText usernameInput
~ EditText passwordInput
~ Button button_login
~ Button button_index
~ Context that
- CheckBox RePassword
- CheckBox AutoLogin
- String Tag
- String SP_Name
- String SP_Password
- String SP_IsRemember
- SharedPreferences sharedPreferences
- boolean status
# void onCreate(Bundle)
- void initData()
- void initUI()
}
class com.example.music.MainActivity {
~ DrawerLayout drawerLayout
~ ActionBarDrawerToggle toggle
~ NavigationView navigationView
~ ViewPager pager
~ TabLayout mTabLayout
~ TabItem songs
~ PagerAdapter pagerAdapter
+ {static} int REQUEST_CODE
~ {static} ArrayList<MusicFiles> musicFiles
~ {static} boolean shuffleBoolean
# void onCreate(Bundle)
- void initViewPager()
- void permission()
+ void onRequestPermissionsResult(int,String[],int[])
+ boolean onNavigationItemSelected(MenuItem)
+ {static} ArrayList<MusicFiles> getAllAudio(Context)
}
com.example.music.OnCompletionListener <|.. com.example.music.PlayerActivity
androidx.appcompat.app.AppCompatActivity <|-- com.example.music.PlayerActivity
androidx.appcompat.app.AppCompatActivity <|-- com.example.music.RegisterActivity
androidx.appcompat.app.AppCompatActivity <|-- com.example.music.LoginActivity
com.example.music.OnNavigationItemSelectedListener <|.. com.example.music.MainActivity
androidx.appcompat.app.AppCompatActivity <|-- com.example.music.MainActivity
@enduml

@ -0,0 +1,24 @@
@startuml
class com.example.music.MainActivity {
~ DrawerLayout drawerLayout
~ ActionBarDrawerToggle toggle
~ NavigationView navigationView
~ ViewPager pager
~ TabLayout mTabLayout
~ TabItem songs
~ PagerAdapter pagerAdapter
+ {static} int REQUEST_CODE
~ {static} ArrayList<MusicFiles> musicFiles
~ {static} boolean shuffleBoolean
# void onCreate(Bundle)
- void initViewPager()
- void permission()
+ void onRequestPermissionsResult(int,String[],int[])
+ boolean onNavigationItemSelected(MenuItem)
+ {static} ArrayList<MusicFiles> getAllAudio(Context)
}
com.example.music.OnNavigationItemSelectedListener <|.. com.example.music.MainActivity
androidx.appcompat.app.AppCompatActivity <|-- com.example.music.MainActivity
@enduml

@ -0,0 +1,24 @@
@startuml
class com.example.music.MainActivity {
~ DrawerLayout drawerLayout
~ ActionBarDrawerToggle toggle
~ NavigationView navigationView
~ ViewPager pager
~ TabLayout mTabLayout
~ TabItem songs
~ PagerAdapter pagerAdapter
+ {static} int REQUEST_CODE
~ {static} ArrayList<MusicFiles> musicFiles
~ {static} boolean shuffleBoolean
# void onCreate(Bundle)
- void initViewPager()
- void permission()
+ void onRequestPermissionsResult(int,String[],int[])
+ boolean onNavigationItemSelected(MenuItem)
+ {static} ArrayList<MusicFiles> getAllAudio(Context)
}
com.example.music.OnNavigationItemSelectedListener <|.. com.example.music.MainActivity
androidx.appcompat.app.AppCompatActivity <|-- com.example.music.MainActivity
@enduml

@ -0,0 +1,17 @@
pluginManagement {
repositories {
google()
mavenCentral()
gradlePluginPortal()
}
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
}
}
rootProject.name = "My Application"
include ':app'
include ':testmusic'

@ -0,0 +1,3 @@
# Default ignored files
/shelf/
/workspace.xml

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GradleMigrationSettings" migrationVersion="1" />
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="testRunner" value="GRADLE" />
<option name="distributionType" value="LOCAL" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="gradleHome" value="$PROJECT_DIR$/../../environment/gradle/gradle-7.5.1" />
<option name="gradleJvm" value="1.8" />
</GradleProjectSettings>
</option>
</component>
</project>

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" project-jdk-name="Android API 33 Platform" project-jdk-type="Android SDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">
<option name="id" value="jpab" />
</component>
</project>

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/testmusic.iml" filepath="$PROJECT_DIR$/.idea/testmusic.iml" />
</modules>
</component>
</project>

@ -0,0 +1,55 @@
apply plugin: 'com.android.application'
android {
compileSdkVersion 30
buildToolsVersion "30.0.0"
defaultConfig {
applicationId "com.example.music"
minSdkVersion 22
targetSdkVersion 30
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.palette:palette:1.0.0'
testImplementation 'junit:junit:4.13'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
// Material design
implementation 'com.google.android.material:material:1.3.0-alpha01'
//Rounded Image View
implementation 'com.makeramen:roundedimageview:2.3.0'
//Navigation Component
implementation 'androidx.navigation:navigation-fragment-ktx:2.2.2'
implementation 'androidx.navigation:navigation-ui-ktx:2.2.2'
//noinspection GradleCompatible
implementation 'com.android.support:design:27.1.1'
//noinspection GradleCompatible
implementation 'com.android.support:support-v4:27.1.1'
androidTestImplementation 'androidx.test:rules:1.3.0-rc01'
//glide
implementation 'com.github.bumptech.glide:glide:4.11.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.11.0'
}

@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile

@ -0,0 +1,26 @@
package com.example.music;
import android.content.Context;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
assertEquals("com.example.music", appContext.getPackageName());
}
}

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.music">
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme.NoActionBar">
<activity android:name=".PlayerActivity"></activity>
<activity
android:name=".MainActivity"
android:theme="@style/AppTheme.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".LoginActivity" android:exported="true"/>
<activity android:name=".RegisterActivity" android:exported="true"/>
</application>
</manifest>

@ -0,0 +1,72 @@
package com.example.music;
import android.content.Context;
import android.media.MediaMetadataRetriever;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.bumptech.glide.Glide;
import java.util.ArrayList;
public class AlbumAdapter extends RecyclerView.Adapter<AlbumAdapter.MyHolder> {
private Context mContext;
private ArrayList<MusicFiles> albumFiles;
View view;
public AlbumAdapter(Context mContext, ArrayList<MusicFiles> albumFiles) {
this.mContext = mContext;
this.albumFiles = albumFiles;
}
@NonNull
@Override
public MyHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
view= LayoutInflater.from(mContext).inflate(R.layout.album_items,parent,false);
return new MyHolder(view);
}
@Override
public void onBindViewHolder(@NonNull MyHolder holder, int position) {
holder.album_name.setText(albumFiles.get(position).getAlbum());
byte[] image=getAlbumArt(albumFiles.get(position).getPath());
if (image!=null){
Glide.with(mContext).asBitmap()
.load(image)
.into(holder.album_image);
}else {
Glide.with(mContext)
.load(R.drawable.customer)
.into(holder.album_image);
}
}
@Override
public int getItemCount() {
return albumFiles.size();
}
public class MyHolder extends RecyclerView.ViewHolder {
ImageView album_image;
TextView album_name;
public MyHolder(@NonNull View itemView) {
super(itemView);
album_image=itemView.findViewById(R.id.album_image);
album_name=itemView.findViewById(R.id.album_name);
}
}
private byte[] getAlbumArt(String uri){
MediaMetadataRetriever retriever=new MediaMetadataRetriever();
retriever.setDataSource(uri);
byte[] art=retriever.getEmbeddedPicture();
retriever.release();
return art;
}
}

@ -0,0 +1,35 @@
package com.example.music;
import android.os.Bundle;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import static com.example.music.MainActivity.musicFiles;
public class AlbumsFragment extends Fragment {
RecyclerView recyclerView;
AlbumAdapter albumAdapter;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View view=inflater.inflate(R.layout.fragment_albums, container, false);
recyclerView=view.findViewById(R.id.recyclerView);
recyclerView.setHasFixedSize(true);
if (!(musicFiles.size()<1)){
albumAdapter=new AlbumAdapter(getContext(),musicFiles);
recyclerView.setAdapter(albumAdapter);
recyclerView.setLayoutManager(new GridLayoutManager(getContext(),2));
}
return view;
}
}

@ -0,0 +1,188 @@
package com.example.music;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.View;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.Toast;
import androidx.appcompat.app.AppCompatActivity;
public class LoginActivity extends AppCompatActivity {
EditText usernameInput;
EditText passwordInput;
Button button_login;
Button button_index;
Context that = this;
private CheckBox RePassword;
private CheckBox AutoLogin;
private String Tag = "Page1Activity";
private String SP_Name = "sp_name";
private String SP_Password = "sp_password";
private String SP_IsRemember = "sp_isremember";
private SharedPreferences sharedPreferences;
private boolean status = false;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
usernameInput = findViewById(R.id.act_login_username);
passwordInput = findViewById(R.id.act_login_password);
button_login = findViewById(R.id.act_login_button);
button_index = findViewById(R.id.act_index_button);
button_index.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent= new Intent(LoginActivity.this, RegisterActivity.class);
startActivity(intent);
}
});
SQLiteDatabase database = openOrCreateDatabase("EndHomework.db", MODE_PRIVATE, null);
button_login.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String username = usernameInput.getText().toString();
String password = passwordInput.getText().toString();
/* if (username.equals("0001") && password.equals("0001")) {
Toast.makeText(that, "管理员登录", Toast.LENGTH_SHORT).show();
Intent intent= new Intent(that, AdminActivity.class);
intent.putExtra("username", username);
startActivity(intent);
} else if (username.equals("0000") && password.equals("0000")) {
Toast.makeText(that, "服务员登录", Toast.LENGTH_SHORT).show();
Intent intent= new Intent(that, MainActivity.class);
intent.putExtra("username", username);
startActivity(intent);
} else {
Toast.makeText(that, "用户账号或密码错误", Toast.LENGTH_SHORT).show();
}*/
if (username.equals(" ")||password.equals(" ")){
Toast.makeText(that, "账号或密码为空", Toast.LENGTH_SHORT).show();
}
Cursor cursor = database.query("user", new String[]{"name,password"}, null, null, null, null, null);
if (cursor.getCount() == 0) {
Toast.makeText(LoginActivity.this, "请先注册账号!", Toast.LENGTH_SHORT).show();
}else {
while (cursor.moveToNext()){
if (username.equals(cursor.getString(cursor.getColumnIndex("name"))) && password.equals(cursor.getString(cursor.getColumnIndex("password")))) {
Toast.makeText(LoginActivity.this, "登录成功", Toast.LENGTH_SHORT).show();
Intent intent = new Intent(LoginActivity.this, MainActivity.class);
startActivity(intent);
break;
}else {
Toast.makeText(that, "账号或密码错误", Toast.LENGTH_SHORT).show();
}
}
}
}
});
//初始化控件
initUI();
//初始化数据
initData();
}
private void initData(){
//实例化
if (sharedPreferences == null){
sharedPreferences = getApplicationContext().getSharedPreferences("config", Context.MODE_PRIVATE);
}
//回显数据
usernameInput.setText(sharedPreferences.getString(SP_Name,""));
passwordInput.setText(sharedPreferences.getString(SP_Password,""));
status = sharedPreferences.getBoolean(SP_IsRemember,false);
RePassword.setChecked(status);
}
private void initUI(){
usernameInput = (EditText) findViewById(R.id.act_login_username);
passwordInput.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
}
@Override
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
}
@Override
public void afterTextChanged(Editable editable) {
if (RePassword.isChecked()){
//文本改变之后记录用户名
//如果为空实例化SharedPreferences对象
if (sharedPreferences == null){
sharedPreferences = getApplicationContext().getSharedPreferences("config", Context.MODE_PRIVATE);
}
//实例化SharedPreferences的编辑者对象
SharedPreferences.Editor editor = sharedPreferences.edit();
editor.putString(SP_Name,usernameInput.getText().toString());
editor.commit();
}
}
});
passwordInput= (EditText) findViewById(R.id.act_login_password);
passwordInput.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
}
@Override
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
}
@Override
public void afterTextChanged(Editable editable) {
if (RePassword.isChecked()){
//文本改变之后记录密码
//如果为空实例化SharedPreferences对象
if (sharedPreferences == null){
sharedPreferences = getApplicationContext().getSharedPreferences("config", Context.MODE_PRIVATE);
}
//实例化SharedPreferences的编辑者对象
SharedPreferences.Editor editor = sharedPreferences.edit();
editor.putString(SP_Password,passwordInput.getText().toString());
editor.commit();
}
}
});
RePassword = findViewById(R.id.remember_password);
RePassword.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (RePassword.isChecked()){
//如果为空实例化SharedPreferences对象
if (sharedPreferences == null){
sharedPreferences = getApplicationContext().getSharedPreferences("config", Context.MODE_PRIVATE);
}
//实例化SharedPreferences的编辑者对象
SharedPreferences.Editor editor = sharedPreferences.edit();
//存储数据
editor.putString(SP_Name,usernameInput.getText().toString());
editor.putString(SP_Password,passwordInput.getText().toString());
editor.putBoolean(SP_IsRemember,RePassword.isChecked());
editor.commit();
}
}
});
}
}

@ -0,0 +1,164 @@
package com.example.music;
import androidx.annotation.NonNull;
import androidx.appcompat.app.ActionBarDrawerToggle;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;
import androidx.core.view.GravityCompat;
import androidx.drawerlayout.widget.DrawerLayout;
import androidx.fragment.app.FragmentPagerAdapter;
import androidx.viewpager.widget.ViewPager;
import android.Manifest;
import android.content.Context;
import android.content.pm.PackageManager;
import android.database.Cursor;
import android.net.Uri;
import android.os.Bundle;
import android.provider.MediaStore;
import android.util.Log;
import android.view.MenuItem;
import com.google.android.material.navigation.NavigationView;
import com.google.android.material.tabs.TabItem;
import com.google.android.material.tabs.TabLayout;
import java.net.URL;
import java.security.Permission;
import java.util.ArrayList;
public class MainActivity extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener {
DrawerLayout drawerLayout;
ActionBarDrawerToggle toggle;
NavigationView navigationView;
ViewPager pager;
TabLayout mTabLayout;
TabItem songs,album;
PagerAdapter pagerAdapter;
public static final int REQUEST_CODE=1;
static ArrayList<MusicFiles> musicFiles;
static boolean shuffleBoolean=false,repeatBoolean=false;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
permission(); //调用获取权限的方法
}
//界面显示和控件绑定
private void initViewPager() {
Toolbar toolbar=findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
pager=findViewById(R.id.viewPager);
mTabLayout=findViewById(R.id.tabLayout);
songs=findViewById(R.id.songs);
album=findViewById(R.id.album);
drawerLayout=findViewById(R.id.drawer);
navigationView=findViewById(R.id.nav_view);
//添加监听事件
navigationView.setNavigationItemSelectedListener(this);
toggle=new ActionBarDrawerToggle(this,drawerLayout,toolbar,R.string.open,R.string.close);
drawerLayout.addDrawerListener(toggle);
toggle.setDrawerIndicatorEnabled(true);
toggle.syncState();
//创建适配器并设置
pagerAdapter=new PagerAdapter(getSupportFragmentManager(), FragmentPagerAdapter.BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT,mTabLayout.getTabCount());
pager.setAdapter(pagerAdapter);
//tab 选择监听事件
mTabLayout.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
@Override
public void onTabSelected(TabLayout.Tab tab) {
pager.setCurrentItem(tab.getPosition());
}
@Override
public void onTabUnselected(TabLayout.Tab tab) {
}
@Override
public void onTabReselected(TabLayout.Tab tab) {
}
});
pager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(mTabLayout));
}
//获取权限
private void permission() {
if (ContextCompat.checkSelfPermission(getApplicationContext(), Manifest.permission.WRITE_EXTERNAL_STORAGE)!= PackageManager.PERMISSION_GRANTED){
ActivityCompat.requestPermissions(MainActivity.this,new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE},REQUEST_CODE);
}else {
musicFiles=getAllAudio(this);
initViewPager();
}
}
//请求权限返回的结果事件
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
if (requestCode==REQUEST_CODE){
if (grantResults[0]==PackageManager.PERMISSION_GRANTED){
//Do whatever you want permission related
musicFiles=getAllAudio(this);
initViewPager();
}else {
ActivityCompat.requestPermissions(MainActivity.this,new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE},REQUEST_CODE);
}
}
}
//菜单栏点击事件
@Override
public boolean onNavigationItemSelected(@NonNull MenuItem item) {
drawerLayout.closeDrawer(GravityCompat.START);
return false;
}
//获取手机上的歌曲信息
public static ArrayList<MusicFiles> getAllAudio(Context context){
ArrayList<MusicFiles> tempAudioList=new ArrayList<>();
Uri uri= MediaStore.Audio.Media.EXTERNAL_CONTENT_URI;
String[] projection={
MediaStore.Audio.Media.ALBUM,
MediaStore.Audio.Media.TITLE,
MediaStore.Audio.Media.DURATION,
MediaStore.Audio.Media.DATA, //FOR PATH
MediaStore.Audio.Media.ARTIST,
MediaStore.Audio.Media._ID
};
Cursor cursor=context.getContentResolver().query(uri,projection,null,null,null);
if (cursor!=null){
while (cursor.moveToNext()){
String album=cursor.getString(0);
String title=cursor.getString(1);
String duration=cursor.getString(2);
String path=cursor.getString(3);
String artist=cursor.getString(4);
String id=cursor.getString(5);
MusicFiles musicFiles=new MusicFiles(path,title,artist,album,duration,id);
//take log.e check
Log.e("PATH:"+path,"Album:"+album);
tempAudioList.add(musicFiles);
}
cursor.close();
}
return tempAudioList;
}
}

@ -0,0 +1,132 @@
package com.example.music;
import android.content.ContentUris;
import android.content.Context;
import android.content.Intent;
import android.media.MediaMetadataRetriever;
import android.net.Uri;
import android.provider.MediaStore;
import android.support.v4.media.MediaMetadataCompat;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.PopupMenu;
import android.widget.TextView;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.bumptech.glide.Glide;
import com.google.android.material.snackbar.Snackbar;
import java.io.File;
import java.lang.reflect.Field;
import java.util.ArrayList;
public class MusicAdapter extends RecyclerView.Adapter<MusicAdapter.MyVieHolder> {
private Context mContext;
private ArrayList<MusicFiles> mFiles;
MusicAdapter(Context mContext,ArrayList<MusicFiles> mFiles){
this.mFiles=mFiles;
this.mContext=mContext;
}
@NonNull
@Override
public MyVieHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View view= LayoutInflater.from(mContext).inflate(R.layout.music_items,parent,false);
return new MyVieHolder(view);
}
@Override
public void onBindViewHolder(@NonNull MyVieHolder holder, final int position) {
holder.file_name.setText(mFiles.get(position).getTitle());
byte[] image=getAlbumArt(mFiles.get(position).getPath());
if (image!=null){
Glide.with(mContext).asBitmap()
.load(image)
.into(holder.album_art);
}else {
Glide.with(mContext)
.load(R.drawable.customer)
.into(holder.album_art);
}
holder.itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent=new Intent(mContext,PlayerActivity.class);
intent.putExtra("position",position);
mContext.startActivity(intent);
}
});
holder.menuMore.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(final View view) {
PopupMenu popupMenu=new PopupMenu(mContext,view);
popupMenu.getMenuInflater().inflate(R.menu.popup,popupMenu.getMenu());
popupMenu.show();
popupMenu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
switch (item.getItemId()){
case R.id.delete:
Toast.makeText(mContext,"Delete Clicked!",Toast.LENGTH_SHORT).show();
deleteFlie(position,view);
break;
}
return true;
}
});
}
});
}
private void deleteFlie(int position,View v){
Uri contentUri= ContentUris.withAppendedId(MediaStore.Audio.Media.EXTERNAL_CONTENT_URI,
Long.parseLong(mFiles.get(position).getId())); //content
File file=new File(mFiles.get(position).getPath());
boolean deleted=file.delete();//delete your file
if (deleted){
mContext.getContentResolver().delete(contentUri,null,null);
mFiles.remove(position);
notifyItemRemoved(position);
notifyItemRangeChanged(position,mFiles.size());
Snackbar.make(v,"File Deleted :",Snackbar.LENGTH_LONG).show();
}else {
//may be file in sd card
Snackbar.make(v,"Can't be Deleted :",Snackbar.LENGTH_LONG).show();
}
}
@Override
public int getItemCount() {
return mFiles.size();
}
public class MyVieHolder extends RecyclerView.ViewHolder{
TextView file_name;
ImageView album_art,menuMore;
public MyVieHolder(@NonNull View itemView) {
super(itemView);
file_name=itemView.findViewById(R.id.music_file_name);;
album_art=itemView.findViewById(R.id.music_img);
menuMore=itemView.findViewById(R.id.menuMore);
}
}
private byte[] getAlbumArt(String uri){
MediaMetadataRetriever retriever=new MediaMetadataRetriever();
retriever.setDataSource(uri);
byte[] art=retriever.getEmbeddedPicture();
retriever.release();
return art;
}
}

@ -0,0 +1,70 @@
package com.example.music;
public class MusicFiles {
private String path;
private String title;
private String artist;
private String album;
private String duration;
private String id;
public MusicFiles() {
}
public MusicFiles(String path, String title, String artist, String album, String duration,String id) {
this.path = path;
this.title = title;
this.artist = artist;
this.album = album;
this.duration = duration;
this.id=id;
}
public String getPath() {
return path;
}
public void setPath(String path) {
this.path = path;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getArtist() {
return artist;
}
public void setArtist(String artist) {
this.artist = artist;
}
public String getAlbum() {
return album;
}
public void setAlbum(String album) {
this.album = album;
}
public String getDuration() {
return duration;
}
public void setDuration(String duration) {
this.duration = duration;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
}

@ -0,0 +1,31 @@
package com.example.music;
import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentPagerAdapter;
public class PagerAdapter extends FragmentPagerAdapter {
private int tabsNumber;
public PagerAdapter(@NonNull FragmentManager fm, int behavior,int tabs) {
super(fm, behavior);
this.tabsNumber=tabs;
}
@NonNull
@Override
public Fragment getItem(int position) {
switch (position){
case 0:
return new SongsFragment();
case 1:
return new AlbumsFragment();
default: return null;
}
}
@Override
public int getCount() {
return tabsNumber;
}
}

@ -0,0 +1,490 @@
package com.example.music;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.palette.graphics.Palette;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Color;
import android.graphics.drawable.GradientDrawable;
import android.media.MediaMetadata;
import android.media.MediaMetadataRetriever;
import android.media.MediaParser;
import android.media.MediaPlayer;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.SeekBar;
import android.widget.TextView;
import com.bumptech.glide.Glide;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import java.util.ArrayList;
import java.util.Random;
import static com.example.music.MainActivity.musicFiles;
import static com.example.music.MainActivity.repeatBoolean;
import static com.example.music.MainActivity.shuffleBoolean;
public class PlayerActivity extends AppCompatActivity implements MediaPlayer.OnCompletionListener {
TextView song_name,artist_name,duration_player,duration_total;
ImageView cover_art,nextBtn,prevBtn,backBtn,shuffleBtn,repeatBtn;
FloatingActionButton playPauseBtn;
SeekBar seekBar;
int position=-1;
static ArrayList<MusicFiles> listSongs=new ArrayList<>();
static Uri uri;
static MediaPlayer mediaPlayer;
private Handler handler=new Handler();
private Thread playThread,prevThread,nextThread;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_player);
//绑定控件
initView();
//获取歌曲信息播放并绑定到 seekBar
getIntentMethod();
song_name.setText(listSongs.get(position).getTitle());
artist_name.setText(listSongs.get(position).getArtist());
mediaPlayer.setOnCompletionListener(this);
//seekBar 变化监听事件
seekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
if (mediaPlayer!=null && fromUser){
mediaPlayer.seekTo(progress * 1000);
}
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
}
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
}
});
PlayerActivity.this.runOnUiThread(new Runnable() {
@Override
public void run() {
if (mediaPlayer !=null){
int mCurrentPosition=mediaPlayer.getCurrentPosition() / 1000;
seekBar.setProgress(mCurrentPosition);
duration_player.setText(formattedTime(mCurrentPosition));
}
handler.postDelayed(this,1000);
}
});
shuffleBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (shuffleBoolean){
shuffleBoolean=false;
shuffleBtn.setImageResource(R.drawable.ic_shuffle_off);
}else {
shuffleBoolean=true;
shuffleBtn.setImageResource(R.drawable.ic_shuffle_on);
}
}
});
repeatBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (repeatBoolean){
repeatBoolean=false;
repeatBtn.setImageResource(R.drawable.ic_repeat_off);
}else {
repeatBoolean=true;
repeatBtn.setImageResource(R.drawable.ic_repeat_on);
}
}
});
}
@Override
protected void onResume() {
playThreadBtn();
prevThreadBtn();
nextThreadBtn();
super.onResume();
}
//上一个按钮线程事件
private void prevThreadBtn() {
prevThread=new Thread(){
@Override
public void run() {
super.run();
prevBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
prevBtnClicked();
}
});
}
};
prevThread.start();
}
//上一个按钮点击事件
private void prevBtnClicked() {
if (mediaPlayer.isPlaying()){
mediaPlayer.stop();
mediaPlayer.release();
if (shuffleBoolean && !repeatBoolean){
position=getRandom(listSongs.size() - 1);
}else if(!shuffleBoolean && !repeatBoolean){
position=((position - 1) < 0 ? (listSongs.size() - 1 ) : (position - 1));
}
uri=Uri.parse(listSongs.get(position).getPath());
mediaPlayer=MediaPlayer.create(getApplicationContext(),uri);
metaData(uri);
song_name.setText(listSongs.get(position).getTitle());
artist_name.setText(listSongs.get(position).getArtist());
seekBar.setMax(mediaPlayer.getDuration() / 1000);
PlayerActivity.this.runOnUiThread(new Runnable() {
@Override
public void run() {
if (mediaPlayer !=null){
int mCurrentPosition=mediaPlayer.getCurrentPosition() / 1000;
seekBar.setProgress(mCurrentPosition);
}
handler.postDelayed(this,1000);
}
});
mediaPlayer.setOnCompletionListener(this);
playPauseBtn.setBackgroundResource(R.drawable.ic_pause);
mediaPlayer.start();
}else {
mediaPlayer.stop();
mediaPlayer.release();
if (shuffleBoolean && !repeatBoolean){
position=getRandom(listSongs.size() - 1);
}else if(!shuffleBoolean && !repeatBoolean){
position=((position - 1) < 0 ? (listSongs.size() - 1 ) : (position - 1));
}
uri=Uri.parse(listSongs.get(position).getPath());
mediaPlayer=MediaPlayer.create(getApplicationContext(),uri);
metaData(uri);
song_name.setText(listSongs.get(position).getTitle());
artist_name.setText(listSongs.get(position).getArtist());
seekBar.setMax(mediaPlayer.getDuration() / 1000);
PlayerActivity.this.runOnUiThread(new Runnable() {
@Override
public void run() {
if (mediaPlayer !=null){
int mCurrentPosition=mediaPlayer.getCurrentPosition() / 1000;
seekBar.setProgress(mCurrentPosition);
}
handler.postDelayed(this,1000);
}
});
mediaPlayer.setOnCompletionListener(this);
playPauseBtn.setBackgroundResource(R.drawable.ic_play);
}
}
//下一个按钮线程事件
private void nextThreadBtn() {
nextThread=new Thread(){
@Override
public void run() {
super.run();
nextBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
nextBtnClicked();
}
});
}
};
nextThread.start();
}
//下一个按钮点击事件
private void nextBtnClicked() {
if (mediaPlayer.isPlaying()){
mediaPlayer.stop();
mediaPlayer.release();
if (shuffleBoolean && !repeatBoolean){
position=getRandom(listSongs.size() - 1);
}else if(!shuffleBoolean && !repeatBoolean){
position=((position + 1) % listSongs.size());
}
//else position will be position ..
uri=Uri.parse(listSongs.get(position).getPath());
mediaPlayer=MediaPlayer.create(getApplicationContext(),uri);
metaData(uri);
song_name.setText(listSongs.get(position).getTitle());
artist_name.setText(listSongs.get(position).getArtist());
seekBar.setMax(mediaPlayer.getDuration() / 1000);
PlayerActivity.this.runOnUiThread(new Runnable() {
@Override
public void run() {
if (mediaPlayer !=null){
int mCurrentPosition=mediaPlayer.getCurrentPosition() / 1000;
seekBar.setProgress(mCurrentPosition);
}
handler.postDelayed(this,1000);
}
});
mediaPlayer.setOnCompletionListener(this);
playPauseBtn.setBackgroundResource(R.drawable.ic_pause);
mediaPlayer.start();
}else {
mediaPlayer.stop();
mediaPlayer.release();
if (shuffleBoolean && !repeatBoolean){
position=getRandom(listSongs.size() - 1);
}else if(!shuffleBoolean && !repeatBoolean){
position=((position + 1) % listSongs.size());
}
uri=Uri.parse(listSongs.get(position).getPath());
mediaPlayer=MediaPlayer.create(getApplicationContext(),uri);
metaData(uri);
song_name.setText(listSongs.get(position).getTitle());
artist_name.setText(listSongs.get(position).getArtist());
seekBar.setMax(mediaPlayer.getDuration() / 1000);
PlayerActivity.this.runOnUiThread(new Runnable() {
@Override
public void run() {
if (mediaPlayer !=null){
int mCurrentPosition=mediaPlayer.getCurrentPosition() / 1000;
seekBar.setProgress(mCurrentPosition);
}
handler.postDelayed(this,1000);
}
});
mediaPlayer.setOnCompletionListener(this);
playPauseBtn.setBackgroundResource(R.drawable.ic_play);
}
}
private int getRandom(int i) {
Random random=new Random();
return random.nextInt(i + 1);
}
//播放暂停按钮线程事件
private void playThreadBtn() {
playThread=new Thread(){
@Override
public void run() {
super.run();
playPauseBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
playPauseBtnClicked();
}
});
}
};
playThread.start();
}
//播放暂停按钮点击事件
private void playPauseBtnClicked() {
if (mediaPlayer.isPlaying()){
playPauseBtn.setImageResource(R.drawable.ic_play);
mediaPlayer.pause();
seekBar.setMax(mediaPlayer.getDuration() / 1000);
PlayerActivity.this.runOnUiThread(new Runnable() {
@Override
public void run() {
if (mediaPlayer !=null){
int mCurrentPosition=mediaPlayer.getCurrentPosition() / 1000;
seekBar.setProgress(mCurrentPosition);
}
handler.postDelayed(this,1000);
}
});
}else {
playPauseBtn.setImageResource(R.drawable.ic_pause);
mediaPlayer.start();
seekBar.setMax(mediaPlayer.getDuration() / 1000);
PlayerActivity.this.runOnUiThread(new Runnable() {
@Override
public void run() {
if (mediaPlayer !=null){
int mCurrentPosition=mediaPlayer.getCurrentPosition() / 1000;
seekBar.setProgress(mCurrentPosition);
}
handler.postDelayed(this,1000);
}
});
}
}
//时间的初始化
private String formattedTime(int mCurrentPosition) {
String totalout ="";
String totalNew ="";
String seconds =String.valueOf(mCurrentPosition % 60);
String minutes=String.valueOf(mCurrentPosition / 60);
totalout=minutes+":"+seconds;
totalNew=minutes+":0"+seconds;
if (seconds.length()==1){
return totalNew;
}else {
return totalout;
}
}
private void getIntentMethod() {
position=getIntent().getIntExtra("position",-1);
listSongs=musicFiles;
if (listSongs!=null){
playPauseBtn.setImageResource(R.drawable.ic_pause);
uri=Uri.parse(listSongs.get(position).getPath());
}
if (mediaPlayer!=null){
mediaPlayer.stop();
mediaPlayer.release();
mediaPlayer=MediaPlayer.create(getApplicationContext(),uri);
mediaPlayer.start();
}else {
mediaPlayer=MediaPlayer.create(getApplicationContext(),uri);
mediaPlayer.start();
}
seekBar.setMax(mediaPlayer.getDuration() / 1000);
metaData(uri);
}
//UI 组件绑定
private void initView() {
song_name=findViewById(R.id.song_name);
artist_name=findViewById(R.id.song_artist);
duration_player=findViewById(R.id.durationPlayed);
duration_total=findViewById(R.id.durationTotal);
cover_art=findViewById(R.id.cover_art);
nextBtn=findViewById(R.id.id_next);
prevBtn=findViewById(R.id.id_prev);
backBtn=findViewById(R.id.back_btn);
shuffleBtn=findViewById(R.id.id_shuffle);
repeatBtn=findViewById(R.id.id_repeat);
playPauseBtn=findViewById(R.id.play_pause);
seekBar=findViewById(R.id.seekBar);
}
private void metaData(Uri uri) {
MediaMetadataRetriever retriever=new MediaMetadataRetriever();
retriever.setDataSource(uri.toString());
int durationTotal=Integer.parseInt(listSongs.get(position).getDuration()) / 1000;
duration_total.setText(formattedTime(durationTotal));
byte[] art=retriever.getEmbeddedPicture();
Bitmap bitmap;
if (art!=null){
bitmap= BitmapFactory.decodeByteArray(art,0,art.length);
ImageAnimation(this,cover_art,bitmap);
//更换背景色
Palette.from(bitmap).generate(new Palette.PaletteAsyncListener() {
@Override
public void onGenerated(@Nullable Palette palette) {
Palette.Swatch swatch=palette.getDominantSwatch();
if(swatch !=null){
ImageView gredient=findViewById(R.id.imageViewGredient);
RelativeLayout mContainer=findViewById(R.id.mContainer);
gredient.setBackgroundResource(R.drawable.gredient_bg);
mContainer.setBackgroundResource(R.drawable.main_bg);
GradientDrawable gradientDrawable = new GradientDrawable(GradientDrawable.Orientation.BOTTOM_TOP,
new int[]{swatch.getRgb(),0x00000000});
gredient.setBackground(gradientDrawable);
GradientDrawable gradientDrawableBg = new GradientDrawable(GradientDrawable.Orientation.BOTTOM_TOP,
new int[]{swatch.getRgb(),swatch.getRgb()});
mContainer.setBackground(gradientDrawableBg);
song_name.setTextColor(swatch.getTitleTextColor());
artist_name.setTextColor(swatch.getBodyTextColor());
}else {
ImageView gredient=findViewById(R.id.imageViewGredient);
RelativeLayout mContainer=findViewById(R.id.mContainer);
gredient.setBackgroundResource(R.drawable.gredient_bg);
mContainer.setBackgroundResource(R.drawable.main_bg);
GradientDrawable gradientDrawable = new GradientDrawable(GradientDrawable.Orientation.BOTTOM_TOP,
new int[]{0xff000000,0x00000000});
gredient.setBackground(gradientDrawable);
GradientDrawable gradientDrawableBg = new GradientDrawable(GradientDrawable.Orientation.BOTTOM_TOP,
new int[]{0xff000000,0xff000000});
mContainer.setBackground(gradientDrawableBg);
song_name.setTextColor(Color.WHITE);
artist_name.setTextColor(Color.DKGRAY);
}
}
});
}else {
Glide.with(this)
.asBitmap()
.load(R.drawable.customer)
.into(cover_art);
ImageView gredient=findViewById(R.id.imageViewGredient);
RelativeLayout mContainer=findViewById(R.id.mContainer);
gredient.setBackgroundResource(R.drawable.gredient_bg);
mContainer.setBackgroundResource(R.drawable.main_bg);
song_name.setTextColor(Color.WHITE);
artist_name.setTextColor(Color.DKGRAY);
}
}
//设置图片显示方式
public void ImageAnimation(final Context context, final ImageView imageView, final Bitmap bitmap){
Animation animOut= AnimationUtils.loadAnimation(context,android.R.anim.fade_out);
final Animation animIn= AnimationUtils.loadAnimation(context,android.R.anim.fade_in);
animOut.setAnimationListener(new Animation.AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
Glide.with(context).load(bitmap).into(imageView);
animIn.setAnimationListener(new Animation.AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
}
@Override
public void onAnimationRepeat(Animation animation) {
}
});
imageView.startAnimation(animIn);
}
@Override
public void onAnimationRepeat(Animation animation) {
}
});
imageView.startAnimation(animOut);
}
//切换下一个歌曲的事件
@Override
public void onCompletion(MediaPlayer mp) {
nextBtnClicked();
if (mediaPlayer !=null){
mediaPlayer=MediaPlayer.create(getApplicationContext(),uri);
mediaPlayer.start();
mediaPlayer.setOnCompletionListener(this);
}
}
}

@ -0,0 +1,51 @@
package com.example.music;
import android.content.ContentValues;
import android.content.Intent;
import android.database.sqlite.SQLiteDatabase;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
import androidx.appcompat.app.AppCompatActivity;
import com.example.music.databases.DaBa;
public class RegisterActivity extends AppCompatActivity {
Button button_submit;
DaBa daBa = null;
EditText index_username;
EditText index_password;
SQLiteDatabase sqLiteDatabase;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_index);
button_submit = (Button) findViewById(R.id.submit_button);
index_username = (EditText) findViewById(R.id.index_username);
index_password = (EditText) findViewById(R.id.index_password);
button_submit.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
String userName;
String password;
daBa = new DaBa(RegisterActivity.this);
sqLiteDatabase = daBa.getWritableDatabase();
userName = String.valueOf(index_username.getText());
password = String.valueOf(index_password.getText());
ContentValues values = new ContentValues();
values.put("name",userName);
values.put("password",password);
sqLiteDatabase.insert("user",null,values);
Toast.makeText(RegisterActivity.this, "用户添加成功!", Toast.LENGTH_SHORT).show();
Intent intent= new Intent(RegisterActivity.this,LoginActivity.class);
startActivity(intent);
}
});
}
}

@ -0,0 +1,40 @@
package com.example.music;
import android.os.Bundle;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import static com.example.music.MainActivity.musicFiles;
public class SongsFragment extends Fragment {
RecyclerView recyclerView;
MusicAdapter musicAdapter;
public SongsFragment() {
// Required empty public constructor
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View view=inflater.inflate(R.layout.fragment_songs, container, false);
recyclerView=view.findViewById(R.id.recyclerView);
recyclerView.setHasFixedSize(true);
if (!(musicFiles.size()<1)){
musicAdapter=new MusicAdapter(getContext(),musicFiles);
recyclerView.setAdapter(musicAdapter);
recyclerView.setLayoutManager(new LinearLayoutManager(getContext(), RecyclerView.VERTICAL,false));
}
return view;
}
}

@ -0,0 +1,29 @@
package com.example.music.databases;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
public class DaBa extends SQLiteOpenHelper {
private static final int VERSION=1;
private static final String DBNAME="EndHomework.db";
private Context mContext;
public DaBa(Context context){
super(context,DBNAME,null,VERSION);
mContext = context;
}
public void onCreate(SQLiteDatabase db){
db.execSQL("create table user(id integer primary key autoincrement, " +
" name varchar(10),password varchar(50))");
// db.execSQL("create table ");
}
public void onUpgrade(SQLiteDatabase db,int oldVersion,int newVersion)
{
db.execSQL("drop table if exists user");
onCreate(db);
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

@ -0,0 +1,30 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path android:pathData="M31,63.928c0,0 6.4,-11 12.1,-13.1c7.2,-2.6 26,-1.4 26,-1.4l38.1,38.1L107,108.928l-32,-1L31,63.928z">
<aapt:attr name="android:fillColor">
<gradient
android:endX="85.84757"
android:endY="92.4963"
android:startX="42.9492"
android:startY="49.59793"
android:type="linear">
<item
android:color="#44000000"
android:offset="0.0" />
<item
android:color="#00000000"
android:offset="1.0" />
</gradient>
</aapt:attr>
</path>
<path
android:fillColor="#FFFFFF"
android:fillType="nonZero"
android:pathData="M65.3,45.828l3.8,-6.6c0.2,-0.4 0.1,-0.9 -0.3,-1.1c-0.4,-0.2 -0.9,-0.1 -1.1,0.3l-3.9,6.7c-6.3,-2.8 -13.4,-2.8 -19.7,0l-3.9,-6.7c-0.2,-0.4 -0.7,-0.5 -1.1,-0.3C38.8,38.328 38.7,38.828 38.9,39.228l3.8,6.6C36.2,49.428 31.7,56.028 31,63.928h46C76.3,56.028 71.8,49.428 65.3,45.828zM43.4,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2c-0.3,-0.7 -0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C45.3,56.528 44.5,57.328 43.4,57.328L43.4,57.328zM64.6,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2s-0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C66.5,56.528 65.6,57.328 64.6,57.328L64.6,57.328z"
android:strokeWidth="1"
android:strokeColor="#00000000" />
</vector>

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 134 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 864 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 143 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 162 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 MiB

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient android:startColor="@color/colorBlack" android:angle="90" />
</shape>

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient android:startColor="@color/colorBlack" android:angle="270"/>
</shape>

@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M12,8c1.1,0 2,-0.9 2,-2s-0.9,-2 -2,-2 -2,0.9 -2,2 0.9,2 2,2zM12,10c-1.1,0 -2,0.9 -2,2s0.9,2 2,2 2,-0.9 2,-2 -0.9,-2 -2,-2zM12,16c-1.1,0 -2,0.9 -2,2s0.9,2 2,2 2,-0.9 2,-2 -0.9,-2 -2,-2z"/>
</vector>

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="#FFFFFF"
android:pathData="M15.41,7.41L14,6l-6,6 6,6 1.41,-1.41L10.83,12z"/>
</vector>

@ -0,0 +1,170 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path
android:fillColor="#3DDC84"
android:pathData="M0,0h108v108h-108z" />
<path
android:fillColor="#00000000"
android:pathData="M9,0L9,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,0L19,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M29,0L29,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M39,0L39,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M49,0L49,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M59,0L59,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M69,0L69,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M79,0L79,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M89,0L89,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M99,0L99,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,9L108,9"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,19L108,19"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,29L108,29"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,39L108,39"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,49L108,49"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,59L108,59"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,69L108,69"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,79L108,79"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,89L108,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,99L108,99"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,29L89,29"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,39L89,39"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,49L89,49"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,59L89,59"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,69L89,69"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,79L89,79"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M29,19L29,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M39,19L39,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M49,19L49,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M59,19L59,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M69,19L69,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M79,19L79,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
</vector>

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="@android:color/white"
android:pathData="M3,18h18v-2L3,16v2zM3,13h18v-2L3,11v2zM3,6v2h18L21,6L3,6z"/>
</vector>

@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M6,19h4L10,5L6,5v14zM14,5v14h4L18,5h-4z"/>
</vector>

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="@color/colorBlack"
android:pathData="M8,5v14l11,-7z"/>
</vector>

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="@android:color/white"
android:pathData="M7,7h10v3l4,-4 -4,-4v3L5,5v6h2L7,7zM17,17L7,17v-3l-4,4 4,4v-3h12v-6h-2v4z"/>
</vector>

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="#00DAC5"
android:pathData="M7,7h10v3l4,-4 -4,-4v3L5,5v6h2L7,7zM17,17L7,17v-3l-4,4 4,4v-3h12v-6h-2v4z"/>
</vector>

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="@android:color/white"
android:pathData="M10.59,9.17L5.41,4 4,5.41l5.17,5.17 1.42,-1.41zM14.5,4l2.04,2.04L4,18.59 5.41,20 17.96,7.46 20,9.5L20,4h-5.5zM14.83,13.41l-1.41,1.41 3.13,3.13L14.5,20L20,20v-5.5l-2.04,2.04 -3.13,-3.13z"/>
</vector>

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="#00DAC5"
android:pathData="M10.59,9.17L5.41,4 4,5.41l5.17,5.17 1.42,-1.41zM14.5,4l2.04,2.04L4,18.59 5.41,20 17.96,7.46 20,9.5L20,4h-5.5zM14.83,13.41l-1.41,1.41 3.13,3.13L14.5,20L20,20v-5.5l-2.04,2.04 -3.13,-3.13z"/>
</vector>

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="@android:color/white"
android:pathData="M6,18l8.5,-6L6,6v12zM16,6v12h2V6h-2z"/>
</vector>

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="@android:color/white"
android:pathData="M6,6h2v12L6,18zM9.5,12l8.5,6L18,6z"/>
</vector>

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/colorBlack"/>
</shape>

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<gradient
android:type="linear"
android:startColor="#E48989"
android:centerColor="#65E165"
android:endColor="#6B6BE3"/>
<corners android:radius="20dp"/>
<padding
android:left="10dp"
android:top="10dp"
android:right="10dp"
android:bottom="10dp"
/>
</shape>

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<gradient
android:type="linear"
android:startColor="#ECCC6C"
android:centerColor="#82C6E4"
android:endColor="#64DC68"/>
<corners android:radius="20dp"/>
<padding
android:left="10dp"
android:top="10dp"
android:right="10dp"
android:bottom="10dp"
/>
</shape>

@ -0,0 +1,65 @@
<?xml version="1.0" encoding="utf-8"?>
<TableLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal"
android:background="@drawable/bg1">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="注册用户"
android:textSize="30dp"
android:textStyle="bold"
android:gravity="center"/>
<TableRow
android:paddingTop="100dp">
<TextView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="用户名:"
android:textSize="20dp"/>
<EditText
android:id="@+id/index_username"
android:inputType="text"
android:layout_height="wrap_content"
android:layout_width="250dp"
android:hint="请输入用户名">
</EditText>
</TableRow>
<TableRow>
<TextView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="密码:"
android:textSize="20dp"/>
<EditText
android:id="@+id/index_password"
android:inputType="textPassword"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:hint="请输入密码">
</EditText>
</TableRow>
<TableRow android:paddingTop="100dp">
<Button
android:id="@+id/submit_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="提交"
android:layout_column="1"
android:textSize="20dp"
android:layout_marginTop="50dp"
android:layout_gravity="bottom"
android:background="@drawable/shape1">
</Button>
</TableRow>
</TableLayout>

@ -0,0 +1,88 @@
<?xml version="1.0" encoding="utf-8"?>
<TableLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal"
android:background="@drawable/bg6">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="用户登录"
android:textSize="30dp"
android:textStyle="bold"
android:gravity="center"/>
<TableRow
android:paddingTop="100dp">
<TextView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="用户名:"
android:textSize="20dp"/>
<EditText
android:id="@+id/act_login_username"
android:inputType="text"
android:layout_height="wrap_content"
android:layout_width="250dp"
android:hint="请输入用户名">
</EditText>
</TableRow>
<TableRow>
<TextView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="密码:"
android:textSize="20dp"/>
<EditText
android:id="@+id/act_login_password"
android:inputType="textPassword"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:hint="请输入密码">
</EditText>
</TableRow>
<CheckBox
android:id="@+id/remember_password"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="15dp"
android:text="记住密码"/>
<CheckBox
android:id="@+id/auto_login"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="15dp"
android:text="自动登录"/>
<TableRow android:paddingTop="50dp">
<Button
android:id="@+id/act_index_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="注册"
android:textSize="20dp"
android:layout_marginTop="50dp"
android:layout_column="1"
android:layout_gravity="bottom"
android:background="@drawable/shape2">
</Button>
</TableRow>
<TableRow>
<Button
android:id="@+id/act_login_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="登录"
android:layout_column="1"
android:textSize="20dp"
android:layout_marginTop="50dp"
android:layout_gravity="bottom"
android:background="@drawable/shape1">
</Button>
</TableRow>
</TableLayout>

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.drawerlayout.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/drawer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:theme="@android:style/Theme.NoTitleBar"
tools:context=".MainActivity">
<include
android:layout_width="match_parent"
android:layout_height="match_parent"
layout="@layout/content_main"/>
<com.google.android.material.navigation.NavigationView
android:id="@+id/nav_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:menu="@menu/nav_menu"
app:headerLayout="@layout/nav_header"
android:fitsSystemWindows="true"
android:layout_gravity="start"/>
</androidx.drawerlayout.widget.DrawerLayout>

@ -0,0 +1,165 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/mContainer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/main_bg"
android:orientation="vertical"
tools:context=".PlayerActivity">
<RelativeLayout
android:id="@+id/layout_top_btn"
android:layout_width="match_parent"
android:layout_height="50dp"
android:background="@drawable/gredient_bg_top"
android:layout_alignParentTop="true">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:text="正在播放"
android:textColor="@color/colorWhite"
android:layout_toEndOf="@+id/back_btn"
android:layout_toStartOf="@+id/menu_btn"
android:gravity="center_horizontal"
android:textSize="18sp"
android:textStyle="bold"/>
</RelativeLayout>
<RelativeLayout
android:id="@+id/card"
android:layout_width="match_parent"
android:layout_height="400dp"
android:layout_below="@+id/layout_top_btn">
<ImageView
android:id="@+id/cover_art"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/customer"
android:scaleType="centerCrop"/>
<ImageView
android:id="@+id/imageViewGredient"
android:layout_width="match_parent"
android:layout_height="300dp"
android:layout_alignParentBottom="true"/>
</RelativeLayout>
<TextView
android:id="@+id/song_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="歌曲名称"
android:layout_below="@+id/card"
android:textColor="@color/colorWhite"
android:gravity="center_horizontal"
android:textSize="22sp"
android:textStyle="bold"
android:ellipsize="end"
android:layout_marginStart="32dp"
android:layout_marginEnd="32dp"/>
<TextView
android:id="@+id/song_artist"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="作者"
android:layout_below="@+id/song_name"
android:textColor="@color/colorWhite"
android:gravity="center_horizontal"
android:textSize="18sp"
android:ellipsize="end"
android:layout_marginStart="40dp"
android:layout_marginEnd="40dp"/>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="60dp"
android:id="@+id/relative_layout_for_bottom"
android:layout_alignParentBottom="true"
android:layout_alignParentStart="true"
android:layout_alignParentEnd="true"
android:background="@drawable/gredient_bg">
<ImageView
android:id="@+id/id_shuffle"
android:layout_width="35dp"
android:layout_height="35dp"
android:src="@drawable/ic_shuffle_off"
android:layout_centerVertical="true"
android:layout_alignParentStart="true"
android:layout_marginStart="32dp"/>
<ImageView
android:id="@+id/id_prev"
android:layout_width="35dp"
android:layout_height="35dp"
android:src="@drawable/ic_skip_previous"
android:layout_centerVertical="true"
android:layout_toStartOf="@id/play_pause"
android:layout_marginEnd="16dp"/>
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/play_pause"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:clickable="true"
android:focusable="true"
android:src="@drawable/ic_play"
app:backgroundTint="#FFFFFF" />
<ImageView
android:id="@+id/id_next"
android:layout_width="35dp"
android:layout_height="35dp"
android:src="@drawable/ic_skip_next"
android:layout_centerVertical="true"
android:layout_toEndOf="@id/play_pause"
android:layout_marginStart="16dp"/>
<ImageView
android:id="@+id/id_repeat"
android:layout_width="35dp"
android:layout_height="35dp"
android:src="@drawable/ic_repeat_off"
android:layout_centerVertical="true"
android:layout_alignParentEnd="true"
android:layout_marginEnd="32dp"/>
</RelativeLayout>
<RelativeLayout
android:id="@+id/seek_bar_layout"
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_marginBottom="15dp"
android:layout_above="@id/relative_layout_for_bottom">
<TextView
android:id="@+id/durationPlayed"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="1:28"
android:textColor="@color/colorWhite"
android:layout_marginStart="10dp"
android:layout_alignParentStart="true"/>
<TextView
android:id="@+id/durationTotal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="4:28"
android:textColor="@color/colorWhite"
android:layout_marginEnd="10dp"
android:layout_alignParentEnd="true"/>
<SeekBar
android:id="@+id/seekBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_marginStart="20dp"
android:layout_marginEnd="20dp" />
</RelativeLayout>
</RelativeLayout>

@ -0,0 +1,36 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/album_items"
android:layout_width="170dp"
android:layout_height="200dp"
android:layout_margin="20dp"
app:cardCornerRadius="10dp"
app:cardElevation="10dp">
<RelativeLayout
android:id="@+id/relative_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/colorBlack">
<ImageView
android:id="@+id/album_image"
android:layout_width="match_parent"
android:layout_height="170dp"
android:src="@mipmap/ic_launcher"/>
<TextView
android:id="@+id/album_name"
android:layout_width="140dp"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:text="album"
android:textColor="#fff"
android:singleLine="true"
android:gravity="center_horizontal"
android:layout_centerHorizontal="true"
android:layout_marginEnd="10dp"
android:layout_marginTop="10dp"
android:textStyle="bold"/>
</RelativeLayout>
</androidx.cardview.widget.CardView>

@ -0,0 +1,52 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="#FAB2AD"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:theme="@style/ThemeOverlay.AppCompat.Dark" />
<com.google.android.material.tabs.TabLayout
android:id="@+id/tabLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#8AB5A2"
android:theme="@style/ThemeOverlay.AppCompat.Dark"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/toolbar">
<com.google.android.material.tabs.TabItem
android:id="@+id/songs"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="歌曲" />
<com.google.android.material.tabs.TabItem
android:id="@+id/album"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="专辑" />
</com.google.android.material.tabs.TabLayout>
<androidx.viewpager.widget.ViewPager
android:id="@+id/viewPager"
android:layout_width="match_parent"
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tabLayout" />
</androidx.constraintlayout.widget.ConstraintLayout>

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".SongsFragment$AlbumsFragment">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</RelativeLayout>

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".SongsFragment">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

@ -0,0 +1,32 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/audio_item"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp">
<ImageView
android:id="@+id/music_img"
android:layout_width="60dp"
android:layout_height="60dp"
android:src="@mipmap/ic_launcher_round"
android:padding="5dp"/>
<TextView
android:id="@+id/music_file_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="File Name"
android:layout_toEndOf="@+id/music_img"
android:layout_marginStart="10dp"
android:layout_centerVertical="true"
android:layout_toStartOf="@id/menuMore"
android:textColor="@color/colorBlack"/>
<ImageView
android:id="@+id/menuMore"
android:layout_width="60dp"
android:layout_height="60dp"
android:src="@drawable/ic_baseline_more"
android:layout_alignParentEnd="true"
android:padding="10dp"/>
</RelativeLayout>

@ -0,0 +1,49 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="20dp">
<com.makeramen.roundedimageview.RoundedImageView
android:id="@+id/imageProfile"
android:layout_width="70dp"
android:layout_height="70dp"
android:scaleType="centerCrop"
android:src="@drawable/customer"
tools:ignore="MissingConstraints"
app:riv_oval="true"/>
<View
android:id="@+id/viewSupporter"
android:layout_width="1dp"
android:layout_height="1dp"
app:layout_constraintBottom_toBottomOf="@+id/imageProfile"
app:layout_constraintEnd_toEndOf="@+id/imageProfile"
app:layout_constraintStart_toStartOf="@+id/imageProfile"
app:layout_constraintTop_toTopOf="@+id/imageProfile" />
<TextView
android:id="@+id/textView"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:text="@string/comepazzo"
android:textColor="@color/colorWhite"
android:textSize="18sp"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="@+id/viewSupporter"
app:layout_constraintStart_toEndOf="@+id/imageProfile" />
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:text="@string/verified"
android:textColor="@color/colorGreen"
android:textSize="16sp"
app:layout_constraintStart_toEndOf="@+id/imageProfile"
app:layout_constraintTop_toBottomOf="@+id/textView" />
</androidx.constraintlayout.widget.ConstraintLayout>

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
</menu>

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/delete"
android:title="删除"
app:showAsAction="never"/>
</menu>

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save