update
This commit is contained in:
parent
c7452c3016
commit
db1ef315a8
@ -35,10 +35,23 @@ android {
|
||||
dependencies {
|
||||
|
||||
implementation 'androidx.core:core-ktx:1.7.0'
|
||||
implementation 'androidx.appcompat:appcompat:1.4.1'
|
||||
implementation 'com.google.android.material:material:1.5.0'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
|
||||
implementation 'androidx.appcompat:appcompat:1.4.2'
|
||||
implementation 'com.google.android.material:material:1.6.1'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
|
||||
implementation 'androidx.recyclerview:recyclerview:1.2.1'
|
||||
testImplementation 'junit:junit:4.13.2'
|
||||
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
|
||||
//网络库 https://github.com/liangjingkanji/Net
|
||||
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.0" // 协程(版本自定)
|
||||
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.0'
|
||||
implementation 'com.squareup.okhttp3:okhttp:4.10.0' // 要求OkHttp4以上
|
||||
implementation 'com.github.liangjingkanji:Net:3.5.6'
|
||||
//媒体库
|
||||
implementation "androidx.media:media:1.6.0"
|
||||
implementation 'androidx.palette:palette-ktx:1.0.0'
|
||||
|
||||
implementation 'com.github.bumptech.glide:glide:4.12.0'
|
||||
implementation 'com.alibaba:fastjson:1.2.78'
|
||||
|
||||
}
|
@ -3,6 +3,7 @@
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
<application
|
||||
android:name=".App"
|
||||
android:allowBackup="true"
|
||||
android:dataExtractionRules="@xml/data_extraction_rules"
|
||||
android:fullBackupContent="@xml/backup_rules"
|
||||
@ -10,6 +11,7 @@
|
||||
android:label="@string/app_name"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/Theme.MusicPlayerForSubsonic"
|
||||
android:usesCleartextTraffic="true"
|
||||
tools:targetApi="31">
|
||||
<activity
|
||||
android:name=".MainActivity"
|
||||
|
9
app/src/main/java/com/yutou/musicplayer/App.kt
Normal file
9
app/src/main/java/com/yutou/musicplayer/App.kt
Normal file
@ -0,0 +1,9 @@
|
||||
package com.yutou.musicplayer
|
||||
|
||||
import android.app.Application
|
||||
|
||||
class App : Application() {
|
||||
override fun onCreate() {
|
||||
super.onCreate()
|
||||
}
|
||||
}
|
@ -2,10 +2,21 @@ package com.yutou.musicplayer
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import android.os.Bundle
|
||||
import android.util.Log
|
||||
import android.widget.TextView
|
||||
import android.widget.Toast
|
||||
import com.yutou.musicplayer.net.NetManager
|
||||
import com.yutou.musicplayer.net.NetManager.Companion.userLogin
|
||||
|
||||
class MainActivity : AppCompatActivity() {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_main)
|
||||
findViewById<TextView>(R.id.textView).setOnClickListener { view ->
|
||||
userLogin("yutou","34864394"){
|
||||
Log.i("登录信息", "onCreate: $it")
|
||||
(view as TextView).text=it
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
22
app/src/main/java/com/yutou/musicplayer/net/NetManager.kt
Normal file
22
app/src/main/java/com/yutou/musicplayer/net/NetManager.kt
Normal file
@ -0,0 +1,22 @@
|
||||
package com.yutou.musicplayer.net
|
||||
|
||||
import com.drake.net.Post
|
||||
import com.drake.net.utils.scopeNet
|
||||
import kotlinx.coroutines.launch
|
||||
|
||||
class NetManager {
|
||||
companion object {
|
||||
/**
|
||||
* 用户登录
|
||||
*/
|
||||
inline fun userLogin(uname: String, password: String, crossinline block: (String) -> Unit) {
|
||||
scopeNet {
|
||||
val data = Post<String>("http://music.cnmglz.com/auth/login") {
|
||||
json("{\"username\":\"$uname\",\"password\":\"$password\"}")
|
||||
}.await()
|
||||
block(data)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
@ -1,18 +1,19 @@
|
||||
<?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"
|
||||
<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"
|
||||
tools:context=".MainActivity">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Hello World!"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
@ -2,5 +2,5 @@
|
||||
plugins {
|
||||
id 'com.android.application' version '7.4.1' apply false
|
||||
id 'com.android.library' version '7.4.1' apply false
|
||||
id 'org.jetbrains.kotlin.android' version '1.8.0' apply false
|
||||
id 'org.jetbrains.kotlin.android' version '1.8.10' apply false
|
||||
}
|
6
gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
6
gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
#Sat Feb 18 11:18:42 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
|
@ -3,6 +3,7 @@ pluginManagement {
|
||||
google()
|
||||
mavenCentral()
|
||||
gradlePluginPortal()
|
||||
maven { url 'https://jitpack.io' }
|
||||
}
|
||||
}
|
||||
dependencyResolutionManagement {
|
||||
@ -10,6 +11,7 @@ dependencyResolutionManagement {
|
||||
repositories {
|
||||
google()
|
||||
mavenCentral()
|
||||
maven { url 'https://jitpack.io' }
|
||||
}
|
||||
}
|
||||
rootProject.name = "MusicPlayerForSubsonic"
|
||||
|
Loading…
Reference in New Issue
Block a user