修复了播放器无播放列表闪退

音乐搜索,
歌词UI显示,
主页报错,
优化了一些体验上面的功能!
This commit is contained in:
muqing 2023-11-22 18:11:08 +08:00
parent e84f9aaa85
commit 533cc2d0aa
68 changed files with 1278 additions and 3128 deletions

3
.idea/.gitignore vendored
View File

@ -1,3 +0,0 @@
# 默认忽略的文件
/shelf/
/workspace.xml

View File

@ -1 +0,0 @@
Cloud_music

View File

@ -1,13 +1,19 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="AndroidLintContentDescription" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="AndroidLintHardcodedText" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="AutoCloseableResource" enabled="true" level="WARNING" enabled_by_default="true">
<option name="METHOD_MATCHER_CONFIG" value="java.util.Formatter,format,java.io.Writer,append,com.google.common.base.Preconditions,checkNotNull,org.hibernate.Session,close,java.io.PrintWriter,printf,java.io.PrintStream,printf,android.app.DownloadManager,query" />
<option name="METHOD_MATCHER_CONFIG" value="java.util.Formatter,format,java.io.Writer,append,com.google.common.base.Preconditions,checkNotNull,org.hibernate.Session,close,java.io.PrintWriter,printf,java.io.PrintStream,printf,okhttp3.Call,execute,android.app.DownloadManager,query" />
</inspection_tool>
<inspection_tool class="DataFlowIssue" enabled="false" level="WARNING" enabled_by_default="false">
<option name="SUGGEST_NULLABLE_ANNOTATIONS" value="false" />
<option name="DONT_REPORT_TRUE_ASSERT_STATEMENTS" value="false" />
</inspection_tool>
<inspection_tool class="IgnoreResultOfCall" enabled="false" level="WARNING" enabled_by_default="false">
<option name="m_reportAllNonLibraryCalls" value="false" />
<option name="callCheckString" value="java.io.File,.*,java.io.InputStream,read|skip|available|markSupported,java.io.Reader,read|skip|ready|markSupported,java.lang.AbstractStringBuilder,capacity|codePointAt|codePointBefore|codePointCount|indexOf|lastIndexOf|offsetByCodePoints|substring|subSequence,java.lang.Boolean,.*,java.lang.Byte,.*,java.lang.Character,.*,java.lang.Double,.*,java.lang.Float,.*,java.lang.Integer,.*,java.lang.Long,.*,java.lang.Math,.*,java.lang.Object,equals|hashCode|toString,java.lang.Short,.*,java.lang.StrictMath,.*,java.lang.String,.*,java.lang.Thread,interrupted,java.math.BigDecimal,.*,java.math.BigInteger,.*,java.net.InetAddress,.*,java.net.URI,.*,java.nio.channels.AsynchronousChannelGroup,.*,java.util.Arrays,.*,java.util.Collections,(?!addAll).*,java.util.List,of,java.util.Map,of|ofEntries|entry,java.util.Set,of,java.util.UUID,.*,java.util.concurrent.BlockingQueue,offer|remove,java.util.concurrent.CountDownLatch,await|getCount,java.util.concurrent.ExecutorService,awaitTermination|isShutdown|isTerminated,java.util.concurrent.ForkJoinPool,awaitQuiescence,java.util.concurrent.Semaphore,tryAcquire|availablePermits|isFair|hasQueuedThreads|getQueueLength|getQueuedThreads,java.util.concurrent.locks.Condition,await|awaitNanos|awaitUntil,java.util.concurrent.locks.Lock,tryLock|newCondition,java.util.regex.Matcher,pattern|toMatchResult|start|end|group|groupCount|matches|find|lookingAt|quoteReplacement|replaceAll|replaceFirst|regionStart|regionEnd|hasTransparentBounds|hasAnchoringBounds|hitEnd|requireEnd,java.util.regex.Pattern,.*,java.util.stream.BaseStream,.*,java.util.stream.DoubleStream,.*,java.util.stream.IntStream,.*,java.util.stream.LongStream,.*,java.util.stream.Stream,.*" />
</inspection_tool>
<inspection_tool class="SpellCheckingInspection" enabled="false" level="TYPO" enabled_by_default="false">
<option name="processCode" value="true" />
<option name="processLiterals" value="true" />

View File

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="KotlinJpsPluginSettings">
<option name="version" value="1.6.20" />
</component>
</project>

View File

@ -1,9 +1,4 @@
<project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="jbr-17" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">
<option name="id" value="Android" />
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="jbr-17" project-jdk-type="JavaSDK" />
</project>

View File

@ -1,9 +1,15 @@
plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
id 'maven-publish'
}
android {
signingConfigs {
debug {
storeFile file('F:\\muqing.jks')
storePassword 'muqing153'
keyAlias 'muqing'
keyPassword 'muqing153'
}
}
namespace 'com.muqingbfq'
compileSdk 33
defaultConfig {
@ -12,23 +18,18 @@ android {
//noinspection OldTargetApi
targetSdk 31
versionCode 1
versionName "1.5.1"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
versionName "1.6.6"
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
buildFeatures {
viewBinding true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
android.applicationVariants.configureEach {
variant ->
variant.outputs.configureEach {
@ -36,32 +37,19 @@ android {
outputFileName = "Cloud_music-${variant.name}-v${variant.versionName}.apk"
}
}
kotlinOptions {
jvmTarget = '1.8'
}
}
dependencies {
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'com.google.android.material:material:1.9.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.recyclerview:recyclerview:1.3.0'
implementation 'com.google.code.gson:gson:2.9.1'
implementation 'com.squareup.okhttp3:okhttp:4.11.0'
implementation 'com.github.bumptech.glide:glide:4.16.0'
implementation 'com.github.Moriafly:LyricViewX:1.4.0-alpha02'
implementation 'com.google.android.flexbox:flexbox:3.0.0'
api "com.github.cy745:EaseView:e11c3208a9"
implementation "androidx.dynamicanimation:dynamicanimation-ktx:1.0.0-alpha03"
}
afterEvaluate {
publishing {
publications {
release(MavenPublication) {
groupId = 'com.github.Moriafly'
artifactId = 'LyricViewX'
version = '1.4.0-alpha02'
}
}
}
implementation("androidx.media3:media3-exoplayer:1.1.1")
implementation("androidx.media3:media3-session:1.1.1")
}

View File

@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
tools:ignore="CoarseFineLocation,WrongManifestParent">
xmlns:tools="http://schemas.android.com/tools">
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
<uses-permission android:name="android.permission.VIBRATE" />
@ -22,6 +21,10 @@
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<!--悬浮窗权限-->
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
<uses-permission android:name="android.permission.SYSTEM_OVERLAY_WINDOW" />
<application
android:name=".main"
android:allowBackup="true"
@ -29,65 +32,50 @@
android:fullBackupContent="@xml/backup_rules"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:launchMode="singleTask"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.云音乐"
android:usesCleartextTraffic="true"
tools:targetApi="32">
tools:targetApi="31">
<activity
android:name=".start"
android:configChanges="uiMode"
android:exported="true"
android:launchMode="singleTop"
android:theme="@style/Theme.main">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter tools:ignore="AppLinkUrlError">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/plain" />
</intent-filter>
</activity>
<activity
android:name=".login.enroll" />
<activity
android:name=".activity_search" />
<activity android:name=".login.enroll" />
<activity android:name=".activity_search" />
<activity
android:name=".bfq"
android:noHistory="true"
android:configChanges="screenSize|smallestScreenSize|orientation|screenLayout"
android:exported="true"
android:theme="@style/fragment_dialog">
<intent-filter>
<action android:name="transparent.text.SECONDACTIVITY" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity android:name=".fragment.mp3"
android:noHistory="true" />
<activity
android:name=".activity_about_software" />
<activity
android:name=".login.user_logs" />
<activity
android:name=".sz" />
android:theme="@style/fragment_dialog" />
<activity android:name=".fragment.mp3" />
<activity android:name=".activity_about_software" />
<activity android:name=".login.user_logs" />
<activity android:name=".sz" />
<activity
android:name=".home"
android:configChanges="screenSize|smallestScreenSize|orientation|screenLayout"
android:exported="false"
android:launchMode="singleTask" />
android:exported="false" />
<activity android:name=".mq.llq" />
<activity android:name=".fragment.baseactivity" />
<activity android:name=".yc" />
<service android:name=".bfqkz"
<service
android:name=".bfqkz"
android:exported="false"
android:permission="TODO">
<intent-filter>
<action android:name="android.media.browse.MediaBrowserService" />
<action android:name="androidx.media3.session.MediaSessionService" />
</intent-filter>
</service>
<service android:name=".mq.floating" />
<receiver
android:name=".MyButtonClickReceiver"
android:enabled="true"

View File

@ -1,257 +0,0 @@
package com.dirror.lyricviewx
import android.graphics.Typeface
import android.graphics.drawable.Drawable
import android.text.Layout
import androidx.annotation.ColorInt
import androidx.annotation.FloatRange
import androidx.annotation.Px
import java.io.File
const val GRAVITY_CENTER = 0 // 居中
const val GRAVITY_LEFT = 1 // 左
const val GRAVITY_RIGHT = 2 // 右
fun Int.toLayoutAlign(): Layout.Alignment {
return when (this) {
GRAVITY_LEFT -> Layout.Alignment.ALIGN_NORMAL
GRAVITY_CENTER -> Layout.Alignment.ALIGN_CENTER
GRAVITY_RIGHT -> Layout.Alignment.ALIGN_OPPOSITE
else -> Layout.Alignment.ALIGN_CENTER
}
}
/**
* LyricViewX 接口
* LyricViewX 提取方便管理
*
* @author Moriafly
* @since 2021年1月28日16:29:16
*/
interface LyricViewXInterface {
/**
* 设置整句之间的间隔高度
* @param height px
*/
fun setSentenceDividerHeight(@Px height: Float)
/**
* 设置原句与翻译之间的间隔高度
* @param height px
*/
fun setTranslateDividerHeight(@Px height: Float)
/**
* 设置歌词整体的垂直偏移值配合[setHorizontalOffsetPercent]使用
* @param offset px
*
* @see [setHorizontalOffsetPercent]
*/
fun setHorizontalOffset(@Px offset: Float)
/**
* 设置歌词整体的垂直偏移相对于控件高度的百分比,0.5f即表示居中配合[setHorizontalOffset]使用
*
* @param percent 0.0f ~ 1.0f
*
* @see [setHorizontalOffset]
*/
fun setHorizontalOffsetPercent(@FloatRange(from = 0.0, to = 1.0) percent: Float)
/**
* 设置翻译相对与原词之间的缩放比例值
* @param scaleValue 一般来说 0.8f 是个不错的值
*/
fun setTranslateTextScaleValue(@FloatRange(from = 0.1, to = 2.0) scaleValue: Float)
/**
* 设置文字的对齐方向
*/
fun setTextGravity(gravity: Int)
/**
* 设置非当前行歌词字体颜色 [normalColor]
*/
fun setNormalColor(@ColorInt normalColor: Int)
/**
* 普通歌词文本字体大小 [size]单位 px
*/
fun setNormalTextSize(@Px size: Float)
/**
* 当前歌词文本字体大小
*/
fun setCurrentTextSize(size: Float)
/**
* 设置当前行歌词的字体颜色
*/
fun setCurrentColor(currentColor: Int)
/**
* 设置拖动歌词时选中歌词的字体颜色
*/
fun setTimelineTextColor(timelineTextColor: Int)
/**
* 设置拖动歌词时时间线的颜色
*/
fun setTimelineColor(timelineColor: Int)
/**
* 设置拖动歌词时右侧时间字体颜色
*/
fun setTimeTextColor(timeTextColor: Int)
/**
* 设置歌词为空时屏幕中央显示的文字 [label]暂无歌词
*/
fun setLabel(label: String)
/**
* 加载歌词文本
* 两种语言的歌词时间戳需要一致
*
* @param mainLyricText 第一种语言歌词文本
* @param secondLyricText 可选第二种语言歌词文本
*/
fun loadLyric(mainLyricText: String?, secondLyricText: String? = null)
/**
* 加载歌词 [LyricEntry] 集合
* 如果你在 Service 等地方自行解析歌词包装成 [LyricEntry] 集合那么可以使用此方法载入歌词
*
* @param lyricEntries 歌词集合
* @since 1.3.1
*/
fun loadLyric(lyricEntries: List<LyricEntry>)
/**
* 刷新歌词
*
* @param time 当前播放时间
*/
fun updateTime(time: Long, force: Boolean = false)
/**
* 设置歌词是否允许拖动
*
* @param draggable 是否允许拖动
* @param onPlayClickListener 设置歌词拖动后播放按钮点击监听器如果允许拖动则不能为 null
*/
fun setDraggable(draggable: Boolean, onPlayClickListener: OnPlayClickListener?)
/**
* 设置单击
*/
fun setOnSingerClickListener(onSingerClickListener: OnSingleClickListener?)
/**
* 获取当前歌词每句实体可用于歌词分享
*
* @return LyricEntry 集合
*/
fun getLyricEntryList(): List<LyricEntry>
/**
* 设置当前歌词每句实体
*/
fun setLyricEntryList(newList: List<LyricEntry>)
/**
* 获取当前行歌词
*/
fun getCurrentLineLyricEntry(): LyricEntry?
/**
* 为歌词设置自定义的字体
*
* @param file 字体文件
*/
fun setLyricTypeface(file: File)
/**
* 为歌词设置自定义的字体
*
* @param path 字体文件路径
*/
fun setLyricTypeface(path: String)
/**
* 为歌词设置自定义的字体可为空若为空则应清除字体
*
* @param typeface 字体对象
*/
fun setLyricTypeface(typeface: Typeface?)
/**
* 为歌词的过渡动画设置阻尼比数值越大回弹次数越多
*
* @param dampingRatio 阻尼比 详见[androidx.dynamicanimation.animation.SpringForce]
*/
fun setDampingRatioForLyric(dampingRatio: Float)
/**
* 为歌词视图的滚动动画设置阻尼比数值越大回弹次数越多
*
* @param dampingRatio 阻尼比 详见[androidx.dynamicanimation.animation.SpringForce]
*/
fun setDampingRatioForViewPort(dampingRatio: Float)
/**
* 为歌词的过渡动画设置刚度数值越大动画越短
*
* @param stiffness 刚度 详见[androidx.dynamicanimation.animation.SpringForce]
*/
fun setStiffnessForLyric(stiffness: Float)
/**
* 为歌词视图的滚动动画设置刚度数值越大动画越短
*
* @param stiffness 刚度 详见[androidx.dynamicanimation.animation.SpringForce]
*/
fun setStiffnessForViewPort(stiffness: Float)
/**
* 设置跳转播放按钮
*/
fun setPlayDrawable(drawable: Drawable)
/**
* 设置是否绘制歌词翻译
*/
fun setIsDrawTranslation(isDrawTranslation: Boolean)
/**
* 是否开启特定的模糊效果
*/
fun setIsEnableBlurEffect(isEnableBlurEffect: Boolean)
/**
* 设置元素的偏移百分比0.5f即表示居中
*
* @param itemOffsetPercent 0f ~ 1f 偏移百分比
*/
fun setItemOffsetPercent(@FloatRange(from = 0.0, to = 1.0) itemOffsetPercent: Float)
}
/**
* 播放按钮点击监听器点击后应该跳转到指定播放位置
*/
interface OnPlayClickListener {
/**
* 播放按钮被点击应该跳转到指定播放位置
*
* @return 是否成功消费该事件如果成功消费则会更新UI
*/
fun onPlayClick(time: Long): Boolean
}
/**
* 点击歌词布局
*/
interface OnSingleClickListener {
fun onClick()
}

View File

@ -1,82 +0,0 @@
package com.dirror.lyricviewx
import android.os.Build
import android.text.Layout
import android.text.StaticLayout
import android.text.TextPaint
/**
* 一行歌词实体
* @since 2021年1月19日09:51:40 Moriafly 基于 LrcEntry 改造转换为 kt 移除部分过时方法
* @param time 歌词时间
* @param text 歌词文本
*/
class LyricEntry(val time: Long, val text: String) : Comparable<LyricEntry> {
/**
* 第二文本
*/
var secondText: String? = null
/**
* staticLayout
*/
var staticLayout: StaticLayout? = null
private set
var secondStaticLayout: StaticLayout? = null
private set
@Deprecated("存在不显示翻译的情况会导致offset发生改变故不再固定存储offset")
/**
* 歌词距离视图顶部的距离
*/
var offset = Float.MIN_VALUE
/**
* 初始化
* @param textPaint 文本画笔
* @param width 宽度
* @param align 位置
*/
fun init(
textPaint: TextPaint,
secondTextPaint: TextPaint,
width: Int, align: Layout.Alignment
) {
staticLayout = createStaticLayout(text, textPaint, width, align)
secondStaticLayout = createStaticLayout(secondText, secondTextPaint, width, align)
offset = Float.MIN_VALUE
}
/**
* 继承 Comparable 比较
* @param other LyricEntry
* @return 时间差
*/
override fun compareTo(other: LyricEntry): Int {
return (time - other.time).toInt()
}
companion object {
fun createStaticLayout(
text: String?,
paint: TextPaint,
width: Number,
align: Layout.Alignment
): StaticLayout? {
if (text == null || text.isEmpty()) return null
return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
StaticLayout.Builder
.obtain(text, 0, text.length, paint, width.toInt())
.setAlignment(align)
.setLineSpacing(0f, 1f)
.setIncludePad(false)
.build()
} else {
StaticLayout(text, paint, width.toInt(), align, 1f, 0f, false)
}
}
}
}

View File

@ -1,289 +0,0 @@
package com.dirror.lyricviewx
import android.animation.ArgbEvaluator
import android.animation.ValueAnimator
import android.annotation.SuppressLint
import android.graphics.Rect
import android.text.TextUtils
import android.text.format.DateUtils
import android.view.MotionEvent
import java.io.*
import java.net.HttpURLConnection
import java.net.URL
import java.nio.charset.StandardCharsets
import java.util.*
import java.util.regex.Pattern
/**
* 工具类
* LrcUtils Kotlin
*/
object LyricUtil {
private val PATTERN_LINE = Pattern.compile("((\\[\\d\\d:\\d\\d\\.\\d{2,3}])+)(.+)")
private val PATTERN_TIME = Pattern.compile("\\[(\\d\\d):(\\d\\d)\\.(\\d{2,3})]")
private val argbEvaluator = ArgbEvaluator()
/**
* 从文件解析双语歌词
*/
fun parseLrc(lrcFiles: Array<out File?>?): List<LyricEntry>? {
if (lrcFiles == null || lrcFiles.size != 2 || lrcFiles[0] == null) {
return null
}
val mainLrcFile = lrcFiles[0]
val secondLrcFile = lrcFiles[1]
val mainEntryList = parseLrc(mainLrcFile)
val secondEntryList = parseLrc(secondLrcFile)
if (mainEntryList != null && secondEntryList != null) {
for (mainEntry in mainEntryList) {
for (secondEntry in secondEntryList) {
if (mainEntry.time == secondEntry.time) {
mainEntry.secondText = secondEntry.text
}
}
}
}
return mainEntryList
}
/**
* 从文件解析歌词
*/
private fun parseLrc(lrcFile: File?): List<LyricEntry>? {
if (lrcFile == null || !lrcFile.exists()) {
return null
}
val entryList: MutableList<LyricEntry> = ArrayList()
try {
val br =
BufferedReader(InputStreamReader(FileInputStream(lrcFile), StandardCharsets.UTF_8))
var line: String
while (br.readLine().also { line = it } != null) {
val list = parseLine(line)
if (list != null && list.isNotEmpty()) {
entryList.addAll(list)
}
}
br.close()
} catch (e: IOException) {
e.printStackTrace()
}
entryList.sort()
return entryList
}
/**
* 从文本解析双语歌词
*/
fun parseLrc(lrcTexts: Array<out String?>?): List<LyricEntry>? {
if (lrcTexts == null || lrcTexts.size != 2 || TextUtils.isEmpty(lrcTexts[0])) {
return null
}
val mainLrcText = lrcTexts[0]
val secondLrcText = lrcTexts[1]
val mainEntryList = mainLrcText?.let { parseLrc(it) }
/**
* 当输入的secondLrcText为空时,按如下格式解析歌词
* 音乐标签下载的第二种歌词格式
*
* [00:21.11]いつも待ち合わせより15分前集合
* [00:21.11]总会比相约时间早15分钟集合
* [00:28.32]駅の改札ぬける
* [00:28.32]穿过车站的检票口
* [00:31.39]ざわめきにわくわくだね
* [00:31.39]嘈杂声令内心兴奋不已
* [00:35.23]どこへ向かうかなんて
* [00:35.23]不在意接下来要去哪里
*/
if (TextUtils.isEmpty(secondLrcText)) {
var lastEntry: LyricEntry? = null
return mainEntryList?.filter { now ->
if (lastEntry == null) {
lastEntry = now
return@filter true
}
if (lastEntry!!.time == now.time) {
lastEntry!!.secondText = now.text
lastEntry = null
return@filter false
}
lastEntry = now
true
}
}
val secondEntryList = secondLrcText?.let { parseLrc(it) }
if (mainEntryList != null && secondEntryList != null) {
for (mainEntry in mainEntryList) {
for (secondEntry in secondEntryList) {
if (mainEntry.time == secondEntry.time) {
mainEntry.secondText = secondEntry.text
}
}
}
}
return mainEntryList
}
/**
* 从文本解析歌词
*/
private fun parseLrc(lrcText: String): List<LyricEntry>? {
var lyricText = lrcText.trim()
if (TextUtils.isEmpty(lyricText)) return null
if (lyricText.startsWith("\uFEFF")) {
lyricText = lyricText.replace("\uFEFF", "")
}
// 针对传入 Language="Media Monkey Format"; Lyrics="......"; 的情况
lyricText = lyricText.substringAfter("Lyrics=\"")
.substringBeforeLast("\";")
val entryList: MutableList<LyricEntry> = ArrayList()
val array = lyricText.split("\\n".toRegex()).toTypedArray()
for (line in array) {
val list = parseLine(line)
if (!list.isNullOrEmpty()) {
entryList.addAll(list)
}
}
entryList.sort()
return entryList
}
/**
* 获取网络文本需要在工作线程中执行
*/
fun getContentFromNetwork(url: String?, charset: String?): String? {
var lrcText: String? = null
try {
val url = URL(url)
val conn = url.openConnection() as HttpURLConnection
conn.requestMethod = "GET"
conn.connectTimeout = 10000
conn.readTimeout = 10000
if (conn.responseCode == 200) {
val `is` = conn.inputStream
val bos = ByteArrayOutputStream()
val buffer = ByteArray(1024)
var len: Int
while (`is`.read(buffer).also { len = it } != -1) {
bos.write(buffer, 0, len)
}
`is`.close()
bos.close()
lrcText = bos.toString(charset)
}
} catch (e: Exception) {
e.printStackTrace()
}
return lrcText
}
/**
* 解析一行歌词
*/
private fun parseLine(line: String): List<LyricEntry>? {
var lyricLine = line
if (TextUtils.isEmpty(lyricLine)) {
return null
}
lyricLine = lyricLine.trim { it <= ' ' }
// [00:17.65]让我掉下眼泪的
val lineMatcher = PATTERN_LINE.matcher(lyricLine)
if (!lineMatcher.matches()) {
return null
}
val times = lineMatcher.group(1)!!
val text = lineMatcher.group(3)!!
val entryList: MutableList<LyricEntry> = ArrayList()
// [00:17.65]
val timeMatcher = PATTERN_TIME.matcher(times)
while (timeMatcher.find()) {
val min = timeMatcher.group(1)!!.toLong()
val sec = timeMatcher.group(2)!!.toLong()
val milString = timeMatcher.group(3)!!
var mil = milString.toLong()
// 如果毫秒是两位数,需要乘以 10when 新增支持 1 - 6 位毫秒,很多获取的歌词存在不同的毫秒位数
when (milString.length) {
1 -> mil *= 100
2 -> mil *= 10
4 -> mil /= 10
5 -> mil /= 100
6 -> mil /= 1000
}
val time = min * DateUtils.MINUTE_IN_MILLIS + sec * DateUtils.SECOND_IN_MILLIS + mil
entryList.add(LyricEntry(time, text))
}
return entryList
}
/**
* 转为[:]
*/
fun formatTime(milli: Long): String {
val m = (milli / DateUtils.MINUTE_IN_MILLIS).toInt()
val s = (milli / DateUtils.SECOND_IN_MILLIS % 60).toInt()
val mm = String.format(Locale.getDefault(), "%02d", m)
val ss = String.format(Locale.getDefault(), "%02d", s)
return "$mm:$ss"
}
/**
* BUG java.lang.NoSuchFieldException: No field sDurationScale in class Landroid/animation/ValueAnimator; #3
*/
@SuppressLint("SoonBlockedPrivateApi")
@Deprecated("")
fun resetDurationScale() {
try {
val mField = ValueAnimator::class.java.getDeclaredField("sDurationScale")
mField.isAccessible = true
mField.setFloat(null, 1f)
} catch (e: Exception) {
e.printStackTrace()
}
}
/**
* 结合fraction计算两个值之间的比例
*/
fun calcScaleValue(a: Float, b: Float, f: Float, reverse: Boolean = false): Float {
if (b == 0f) return 1f
return 1f + ((a - b) / b) * (if (reverse) 1f - f else f)
}
/**
* 颜色值插值函数
*/
fun lerpColor(a: Int, b: Int, f: Float): Int {
return argbEvaluator.evaluate(f, a, b) as Int
}
/**
* 简单的插值函数
*/
fun lerp(from: Float, to: Float, fraction: Float): Float {
return from + (to - from) * fraction
}
/**
* 判断MotionEvent是否发生在Rect中
*/
fun MotionEvent.insideOf(rect: Rect?): Boolean {
rect ?: return false
return rect.contains(x.toInt(), y.toInt())
}
fun normalize(min: Float, max: Float, value: Float, limit: Boolean = false): Float {
if (min == max) return 1f
return ((value - min) / (max - min)).let {
if (limit) it.coerceIn(0f, 1f) else it
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,51 +0,0 @@
package com.dirror.lyricviewx
import androidx.annotation.IntDef
const val STATE_CREATED = 1
const val STATE_INITIALIZING = 2
const val STATE_INITIALIZED = 3
const val STATE_ERROR = 4
@IntDef(
STATE_CREATED,
STATE_INITIALIZING,
STATE_INITIALIZED,
STATE_ERROR
)
@Retention(AnnotationRetention.SOURCE)
annotation class ReadyState
/**
* 简单的状态机根据 [readyState] 的状态决定当前任务的执行或延后与否
*/
open class ReadyHelper {
private var readyCallback: (Boolean) -> Unit = {}
@ReadyState
var readyState: Int = STATE_CREATED
set(value) {
if (field == value) return
when (value) {
STATE_INITIALIZED,
STATE_ERROR -> synchronized(readyCallback) {
field = value
readyCallback.invoke(value != STATE_ERROR)
}
else -> field = value
}
}
fun whenReady(performAction: (Boolean) -> Unit): Boolean {
return when (readyState) {
STATE_CREATED, STATE_INITIALIZING -> {
readyCallback = performAction
false
}
else -> {
performAction(readyState != STATE_ERROR)
true
}
}
}
}

View File

@ -1,15 +0,0 @@
package com.dirror.lyricviewx.extension
import android.graphics.BlurMaskFilter
import android.util.SparseArray
class BlurMaskFilterExt {
private val maskFilterCache = SparseArray<BlurMaskFilter>()
fun get(radius: Int): BlurMaskFilter? {
if (radius == 0 || radius > 25) return null
return maskFilterCache[radius] ?: BlurMaskFilter(radius.toFloat(), BlurMaskFilter.Blur.NORMAL)
.also { maskFilterCache.put(radius, it) }
}
}

View File

@ -1,115 +1,156 @@
package com.muqingbfq;
import static com.muqingbfq.bfqkz.xm;
import android.annotation.SuppressLint;
import android.graphics.Bitmap;
import android.view.View;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.media3.common.MediaItem;
import androidx.media3.common.PlaybackException;
import androidx.media3.common.Player;
import androidx.media3.exoplayer.ExoPlayer;
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.DataSource;
import com.bumptech.glide.load.engine.GlideException;
import com.bumptech.glide.request.RequestListener;
import com.bumptech.glide.request.target.Target;
import com.muqingbfq.api.url;
import com.muqingbfq.fragment.Media;
import com.muqingbfq.fragment.bfq_db;
import com.muqingbfq.fragment.mp3;
import com.muqingbfq.mq.gj;
import java.io.IOException;
import java.util.Timer;
import java.util.TimerTask;
public class MediaPlayer {
public ExoPlayer build;
// 每秒更新一次进度
public Runnable updateSeekBar = new Runnable() {
@Override
public void run() {
if (build != null && build.isPlaying() && Media.getlrcView() != null) {
long position = build.getCurrentPosition();
Media.setProgress((int) position);
}
main.handler.postDelayed(this, 1000); // 每秒更新一次进度
}
};
public class MediaPlayer extends android.media.MediaPlayer {
@SuppressLint("UnsafeOptInUsageError")
public MediaPlayer() {
this.setOnCompletionListener(mediaPlayer -> {
/* if (!home.db.view.isShown()) {
home.db.view.setVisibility(View.VISIBLE);
}*/
int i = bfqkz.getmti(bfqkz.ms);
bfqkz.xm = bfqkz.list.get(i);
new Thread() {
@Override
public void run() {
super.run();
bfqkz.mp3(url.hq(bfqkz.xm));
}
}.start();
});
this.setOnErrorListener((mediaPlayer, i, i1) -> {
bfqkz.list.remove(bfqkz.xm);
return false;
});
resumeTimer();
}
@Override
public void pause() throws IllegalStateException {
if (isPlaying()) {
super.pause();
//暂停
if (bfq.kg != null) {
bfq.kg.setImageResource(R.drawable.zt);
}
bfq_db.txa.setImageResource(R.drawable.zt);
bfqkz.updateNotification();
}
}
public Timer timer;
public TimerTask timerTask;
public void pauseTimer() {
if (timer != null) {
timer.cancel();
}
}
public void resumeTimer() {
timer = new Timer();//定时器
timerTask = new TimerTask() {
build = new ExoPlayer.Builder(home.appCompatActivity).build();
build.addListener(new Player.Listener() {
@Override
public void run() {
if (bfqkz.mt.isPlaying() && bfq.getVisibility()) {
int currentPosition = bfqkz.mt.getCurrentPosition();
bfq.tdt.setProgress(currentPosition);
bfq.lrcView.updateTime(currentPosition, true);
public void onPlaybackStateChanged(@Player.State int state) {
switch (state) {
case Player.STATE_READY:
bfui();
break;
case Player.STATE_ENDED:
int i = bfqkz.getmti(bfqkz.ms);
bfqkz.xm = bfqkz.list.get(i);
new Thread() {
@Override
public void run() {
super.run();
bfqkz.mp3(com.muqingbfq.api.
url.hq(bfqkz.xm));
}
}.start();
break;
case Player.STATE_BUFFERING:
case Player.STATE_IDLE:
break;
}
if (Media.view != null) {
main.handler.removeCallbacks(updateSeekBar); // 在播放开始时启动更新进度
long duration = build.getDuration();
Media.setMax((int) build.getDuration());
Media.setTime_a(bfq_an.getTime(duration));
long position = build.getCurrentPosition();
Media.setProgress((int) position);
main.handler.post(updateSeekBar); // 在播放开始时启动更新进度
}
// 在这里将进度更新到UI上
}
};
timer.scheduleAtFixedRate(timerTask, 0, 500);
@Override
public void onPlayerError(@NonNull PlaybackException error) {
gj.sc(error);
bfqkz.list.remove(bfqkz.xm);
Player.Listener.super.onPlayerError(error);
int i = bfqkz.getmti(bfqkz.ms);
bfqkz.xm = bfqkz.list.get(i);
new Thread() {
@Override
public void run() {
super.run();
bfqkz.mp3(com.muqingbfq.api.
url.hq(bfqkz.xm));
}
}.start();
}
@Override
public void onIsPlayingChanged(boolean isPlaying) {
Media.setbf(isPlaying);
}
});
}
@Override
public void start() throws IllegalStateException {
super.start();
public void pause(){
if (build.isPlaying()) {
build.pause();
}
}
public void start(){
if (bfqkz.xm == null) {
bfq_an.xyq();
if (bfqkz.list != null && bfqkz.list.size() > 0) {
bfq_an.xyq();
}
return;
}
//开始
if (bfq.kg != null) {
bfq.kg.setImageResource(R.drawable.bf);
}
bfq_db.txa.setImageResource(R.drawable.bf);
bfqkz.updateNotification();
build.play();
}
@SuppressLint("NotifyDataSetChanged")
@Override
public void setDataSource(String path) throws IOException, IllegalArgumentException, IllegalStateException, SecurityException {
super.setDataSource(path);
prepare();
bfqkz.tdt_max = getDuration();
bfqkz.tdt_wz = getCurrentPosition();
public void setDataSource(String path) {
MediaItem mediaItem = MediaItem.fromUri(path);
main.handler.post(() -> {
build.setMediaItem(mediaItem);
build.prepare();
build.setPlayWhenReady(true);
start();
});
}
public boolean isPlaying() {
if (build == null) {
return false;
}
return build.isPlaying();
}
public void seekTo(long a) {
build.seekTo(a);
}
@SuppressLint("NotifyDataSetChanged")
private void bfui() {
Glide.with(home.appCompatActivity)
.asBitmap()
.load(bfqkz.xm.picurl)
.addListener(new RequestListener<Bitmap>() {
.listener(new RequestListener<Bitmap>() {
@Override
public boolean onLoadFailed(@Nullable GlideException e, Object model,
@NonNull Target<Bitmap> target, boolean isFirstResource) {
bfqkz.notify.setBitmap(null);
return false;
}
@Override
public boolean onResourceReady(@NonNull Bitmap bitmap, @NonNull Object model, Target<Bitmap> target,
@NonNull DataSource dataSource, boolean isFirstResource) {
@ -118,21 +159,23 @@ public class MediaPlayer extends android.media.MediaPlayer {
}
})
.submit();
start();
main.handler.post(() -> {
if (bfq.name != null) {
bfq.tdt.setMax((int) bfqkz.tdt_max);
bfq.tdt.setProgress((int) bfqkz.tdt_wz);
bfq.time_a.setText(bfq_an.getTime(bfqkz.tdt_max));
bfq.name.setText(bfqkz.xm.name);
bfq.zz.setText(bfqkz.xm.zz);
bfq_an.islike(bfq.like.getContext());
}
bfq_db.name.setText(bfqkz.xm.name);
bfq_db.zz.setText(bfqkz.xm.zz);
if (mp3.lbspq != null) {
mp3.lbspq.notifyDataSetChanged();
}
});
String name = xm.name, zz = bfqkz.xm.zz;
if (Media.view != null) {
Media.setProgress(0);
Media.setname(name);
Media.setzz(zz);
bfq_an.islike(Media.view.getContext());
}
bfq_db.setname(name);
bfq_db.setzz(zz);
if (bfqkz.notify.notificationManager != null) {
bfqkz.notify.notificationBuilder.setContentTitle(name);
bfqkz.notify.notificationBuilder.setContentText(zz);
bfqkz.notify.notificationManager_notify();
}
if (com.muqingbfq.fragment.mp3.lbspq != null) {
com.muqingbfq.fragment.mp3.lbspq.notifyDataSetChanged();
}
}
}
}

View File

@ -6,11 +6,13 @@ import android.content.Context;
import android.content.Intent;
import android.view.KeyEvent;
import com.muqingbfq.mq.gj;
import java.util.Timer;
import java.util.TimerTask;
public class MyButtonClickReceiver extends BroadcastReceiver {
private Timer timer = new Timer();
private final Timer timer = new Timer();
private static int clickCount;
public MyButtonClickReceiver() {
@ -130,8 +132,11 @@ public class MyButtonClickReceiver extends BroadcastReceiver {
* 对蓝牙 播放-暂停
*/
public static void playOrPause() {
// gj.sc(isMusicServiceBound);
// 播放/暂停按钮点击事件 if (isMusicServiceBound)
if (bfqkz.mt == null) {
return;
}
gj.sc(bfqkz.mt);
// gj.sc(isMusicServiceBound);播放/暂停按钮点击事件 if (isMusicServiceBound)
if (bfqkz.mt.isPlaying()) {
bfqkz.mt.pause();
} else {

View File

@ -8,6 +8,9 @@ import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import com.muqingbfq.mq.gj;
import com.muqingbfq.mq.wj;
public class activity_about_software extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
@ -16,12 +19,28 @@ public class activity_about_software extends AppCompatActivity {
Toolbar toolbar = findViewById(R.id.toolbar);
try {
String versionName = getPackageManager().getPackageInfo(getPackageName(), 0).versionName;
toolbar.setSubtitle(versionName + " Base");
toolbar.setSubtitle(versionName + " Bate");
} catch (PackageManager.NameNotFoundException e) {
yc.start(this, e);
}
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
findViewById(R.id.button1).setOnClickListener(view -> {
wj.sc(wj.filesdri + "gx.mq");
new Thread() {
@Override
public void run() {
super.run();
int jianchagengxin = gj.jianchagengxin(activity_about_software.this);
if (jianchagengxin == 400) {
gj.xcts(activity_about_software.this, "无网络");
} else if (jianchagengxin == 0) {
gj.xcts(activity_about_software.this, "已经是最新的客户端了");
}
}
}.start();
});
}
@Override

View File

@ -3,6 +3,7 @@ package com.muqingbfq;
import android.annotation.SuppressLint;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.view.Menu;
import android.view.MenuItem;
@ -17,10 +18,12 @@ import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentTransaction;
import androidx.recyclerview.widget.RecyclerView;
import com.google.android.flexbox.AlignItems;
import com.google.android.flexbox.FlexDirection;
import com.google.android.flexbox.FlexWrap;
import com.google.android.flexbox.FlexboxLayoutManager;
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import com.muqingbfq.fragment.search;
import com.muqingbfq.mq.gj;
@ -39,7 +42,7 @@ public class activity_search extends AppCompatActivity {
private ArrayAdapter<String> adapter;
private JSONObject json = new JSONObject();
private List<String> json_list = new ArrayList<>();
private final List<String> json_list = new ArrayList<>();
private final List<String> list = new ArrayList<>();
ListView listPopupWindow;
public static AppCompatActivity appCompatActivity;
@ -54,6 +57,13 @@ public class activity_search extends AppCompatActivity {
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
RecyclerView recyclerView = findViewById(R.id.list_recycler);
FlexboxLayoutManager manager = new FlexboxLayoutManager(this);
//设置主轴排列方式
manager.setFlexDirection(FlexDirection.ROW);
//设置是否换行
manager.setFlexWrap(FlexWrap.WRAP);
manager.setAlignItems(AlignItems.STRETCH);
recyclerView.setLayoutManager(manager);
SearchRecordAdapter recordAdapter = new SearchRecordAdapter();
recyclerView.setAdapter(recordAdapter);
@ -62,7 +72,6 @@ public class activity_search extends AppCompatActivity {
if (actionId == EditorInfo.IME_ACTION_SEARCH) {
String str = v.getText().toString();
if (!str.equals("")) {
// 退出activity并返回str数据
start(str);
}
}
@ -81,6 +90,7 @@ public class activity_search extends AppCompatActivity {
})
.show());
listPopupWindow = findViewById(R.id.search_recycler);
//历史记录的LayoutManager
adapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, list);
listPopupWindow.setAdapter(adapter);
@ -98,11 +108,7 @@ public class activity_search extends AppCompatActivity {
start(editText.getText().toString());
});
editText.setOnFocusChangeListener((view, b) -> {
if (b) {
dismiss();
}
});
Object o = new Object();
editText.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
@ -110,47 +116,40 @@ public class activity_search extends AppCompatActivity {
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
if (TextUtils.isEmpty(s)){
dismiss();
return;
}
list.clear();
if (s.length() < 1) {
list.clear();
adapter.notifyDataSetChanged();
editText.clearFocus();
dismiss();
return;
if (listPopupWindow.getVisibility() == View.GONE) {
listPopupWindow.setVisibility(View.VISIBLE);
}
if (!editText.hasFocus()) {
dismiss();
return;
}
listPopupWindow.setVisibility(View.VISIBLE);
new Thread() {
@Override
public void run() {
String hq = wl.hq("/search/suggest?keywords=" + s + "&type=mobile");
try {
JSONArray jsonArray = new JSONObject(hq).getJSONObject("result")
.getJSONArray("allMatch");
int length = jsonArray.length();
for (int i = 0; i < length; i++) {
JSONObject jsonObject = jsonArray.getJSONObject(i);
String keyword = jsonObject.getString("keyword");
list.add(keyword);
synchronized (o) {
String hq = wl.hq("/search/suggest?keywords=" + s + "&type=mobile");
try {
JSONArray jsonArray = new JSONObject(hq).getJSONObject("result")
.getJSONArray("allMatch");
int length = jsonArray.length();
for (int i = 0; i < length; i++) {
JSONObject jsonObject = jsonArray.getJSONObject(i);
String keyword = jsonObject.getString("keyword");
list.add(keyword);
}
main.handler.post(() -> adapter.notifyDataSetChanged());
} catch (Exception e) {
gj.sc(e);
}
main.handler.post(() -> adapter.notifyDataSetChanged());
} catch (Exception e) {
gj.ts(activity_search.this, e);
}
super.run();
}
}.start();
}
@Override
public void afterTextChanged(Editable s) {
}
});
fragmentManager = getSupportFragmentManager();
fragmentTransaction = fragmentManager.beginTransaction();
}
public void dismiss() {
@ -159,6 +158,9 @@ public class activity_search extends AppCompatActivity {
private void addSearchRecord(String name) {
try {
if (!findViewById(R.id.xxbj1).isShown()) {
findViewById(R.id.xxbj1).setVisibility(View.VISIBLE);
}
if (!json.has("list")) {
json.put("list", new JSONArray());
}
@ -171,7 +173,7 @@ public class activity_search extends AppCompatActivity {
adapter.notifyDataSetChanged();
}
} catch (JSONException e) {
e.printStackTrace();
gj.sc(e);
}
}
@ -192,27 +194,14 @@ public class activity_search extends AppCompatActivity {
return super.onOptionsItemSelected(item);
}
FragmentManager fragmentManager;
FragmentTransaction fragmentTransaction;
com.muqingbfq.fragment.search search;
public void start(String name) {
dismiss();
if (name.equals("")) {
return;
}
if (search == null) {
search = new search(name);
}
if (!search.isVisible()) {
getSupportFragmentManager().beginTransaction()
.add(R.id.search_fragment, search)
.addToBackStack(null).commit();
} else {
if (!TextUtils.isEmpty(name)) {
search search = (com.muqingbfq.fragment.search) getSupportFragmentManager().
findFragmentById(R.id.search_fragment);
search.setStart(name);
addSearchRecord(name);
}
addSearchRecord(name);
}
class SearchRecordAdapter extends RecyclerView.Adapter<SearchRecordAdapter.ViewHolder> {
@ -239,7 +228,7 @@ public class activity_search extends AppCompatActivity {
@NonNull
@Override
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View view = View.inflate(parent.getContext(), android.R.layout.simple_list_item_1, null);
View view = View.inflate(parent.getContext(), R.layout.list_text, null);
return new ViewHolder(view);
}
@ -263,8 +252,23 @@ public class activity_search extends AppCompatActivity {
public ViewHolder(View itemView) {
super(itemView);
recordTextView = itemView.findViewById(android.R.id.text1);
recordTextView = itemView.findViewById(R.id.button);
}
}
}
@Override
public void onBackPressed() {
end();
}
private void end() {
search search = (com.muqingbfq.fragment.search) getSupportFragmentManager().
findFragmentById(R.id.search_fragment);
if (search.getVisibility()) {
search.setVisibility(false);
} else {
finish();
}
}
}

View File

@ -2,7 +2,6 @@ package com.muqingbfq.api;
import android.annotation.SuppressLint;
import com.muqingbfq.bfqkz;
import com.muqingbfq.fragment.gd;
import com.muqingbfq.fragment.mp3;
import com.muqingbfq.main;
@ -19,13 +18,6 @@ import java.util.List;
public class playlist extends Thread {
public static final String api = "/playlist/track/all?id=";
private String uid;
public playlist(String uid) {
this.uid = uid;
start();
}
@SuppressLint("NotifyDataSetChanged")
public static boolean hq(List<xm> list, String uid) {
list.clear();
@ -102,23 +94,4 @@ public class playlist extends Thread {
wj.sc(wj.mp3_xz);
}
}
@Override
public void run() {
super.run();
/* if (uid.equals(wj.mp3_xz)) {
playlist.hq_xz(mp3.list);
} else if (uid.equals(wj.mp3_like)) {
playlist.hq_like(mp3
.list);
} else {
playlist.hq(mp3.list, uid);
}
if (bfqkz.list == null || bfqkz.list.isEmpty()) {
int size = mp3.list.size();
for (int i = 0; i < size; i++) {
bfqkz.list.add(mp3.list.get(i));
}
}*/
}
}

View File

@ -1,5 +1,7 @@
package com.muqingbfq.api;
import android.text.TextUtils;
import com.muqingbfq.R;
import com.muqingbfq.main;
import com.muqingbfq.start;
@ -12,35 +14,28 @@ import org.json.JSONObject;
import java.util.Iterator;
import java.util.List;
import com.muqingbfq.xm;
public class resource {
public static void recommend(List<xm> list) {
String hq;
JSONObject json;
try {
if (wj.cz(wj.gd_json)&& start.time>System.currentTimeMillis()-3600000) {
hq = wl.hq("/recommend/resource?cookie=" + wl.Cookie);
if (TextUtils.isEmpty(hq) && wj.cz(wj.gd_json)) {
hq = wj.dqwb(wj.gd_json);
json = new JSONObject(hq);
} else {
hq = wl.hq("/recommend/resource?cookie="+wl.Cookie);
if (hq == null && wj.cz(wj.gd_json)) {
hq = wj.dqwb(wj.gd_json);
json = new JSONObject(hq);
}
json = new JSONObject(hq);
if (json.getInt("code") == 200) {
wj.xrwb(wj.gd_json, hq);
start.time = System.currentTimeMillis();
main.edit.putLong(main.Time, start.time);
main.edit.commit();
}
}
JSONArray recommend = json.getJSONArray("recommend");
int length = recommend.length();
for (int i = 0; i < length; i++) {
JSONObject jsonObject = recommend.getJSONObject(i);
add(jsonObject, list);
json = new JSONObject(hq);
if (json.getInt("code") == 200) {
wj.xrwb(wj.gd_json, hq);
JSONArray recommend = json.getJSONArray("recommend");
int length = recommend.length();
for (int i = 0; i < length; i++) {
JSONObject jsonObject = recommend.getJSONObject(i);
add(jsonObject, list);
}
}
} catch (Exception e) {
gj.sc("resource tuijian" + e);

View File

@ -1,10 +1,6 @@
package com.muqingbfq.api;
import android.view.View;
import com.muqingbfq.bfq;
import com.muqingbfq.home;
import com.muqingbfq.main;
import com.muqingbfq.fragment.Media;
import com.muqingbfq.mq.gj;
import com.muqingbfq.mq.wj;
import com.muqingbfq.mq.wl;
@ -25,32 +21,29 @@ public class url extends Thread {
}
public static String hq(xm x) {
if (bfq.getVisibility() && bfq.lrcView != null && bfq.lrcView.getVisibility() == View.VISIBLE) {
if (Media.getlrcView() != null) {
gc(x.id);
} else {
lrc = null;
}
try {
if (wj.cz(wj.mp3 + x.id)) {
return wj.mp3 + x.id;
}
String level = "standard";
if (gj.isWiFiConnected()) {
boolean wiFiConnected = gj.isWiFiConnected();
if (wiFiConnected) {
level = "exhigh";
}
String hq = wl.hq(api + "?id=" + x.id + "&level=" +
level + "&cookie=" + wl.Cookie);
gj.sc(hq);
if (hq == null) {
return null;
}
JSONObject json = new JSONObject(hq);
JSONArray data = json.getJSONArray("data");
JSONObject jsonObject = data.getJSONObject(0);
String url = jsonObject.getString("url");
if (wl.xz(url, x)) {
url = wj.mp3 + x.id;
if (wiFiConnected) {
new wl.xz(url, x);
}
return url;
} catch (JSONException e) {
@ -66,24 +59,17 @@ public class url extends Thread {
}
public static String lrc, tlyric;
public static void gc(String id) {
lrc = null;
tlyric = null;
JSONObject jsonObject = new JSONObject();
String lrc = null, tlyric = null;
JSONObject jsonObject;
try {
jsonObject = new JSONObject(wl.hq("/lyric?id=" + id));
lrc = jsonObject.getJSONObject("lrc").getString("lyric");
tlyric = jsonObject.getJSONObject("tlyric").getString("lyric");
} catch (JSONException e) {
gj.sc("url gc(int id) lrc: " + e);
}
try {
tlyric = jsonObject.getJSONObject("tlyric").getString("lyric");
} catch (JSONException e) {
gj.sc("url gc(int id) tlyric: " + e);
}
bfq.lrcView.loadLyric(lrc, tlyric);
Media.loadLyric(lrc, tlyric);
}
public static String picurl(String id) {

View File

@ -1,193 +1,51 @@
package com.muqingbfq;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.SeekBar;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import androidx.core.content.ContextCompat;
import androidx.fragment.app.Fragment;
import com.bumptech.glide.Glide;
import org.json.JSONObject;
import com.muqingbfq.fragment.Media;
public class bfq extends AppCompatActivity {
@SuppressLint("StaticFieldLeak")
public static SeekBar tdt;
@SuppressLint("StaticFieldLeak")
public static TextView name, zz, time_a, time_b;
@SuppressLint("StaticFieldLeak")
public static ImageView tx;
@SuppressLint("StaticFieldLeak")
public static ImageView kg, syq, xyq, like;
public static com.dirror.lyricviewx.LyricViewX lrcView;
@SuppressLint("ResourceType")
public static AppCompatActivity context;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
FrameLayout frameLayout = new FrameLayout(this);
// 设置 FrameLayout 的布局参数可以根据自己的需要进行设置
FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(
FrameLayout.LayoutParams.MATCH_PARENT, // 宽度为 Match Parent
FrameLayout.LayoutParams.MATCH_PARENT); // 高度为 Match Parent
frameLayout.setLayoutParams(params);
frameLayout.setId(1);
setContentView(frameLayout);
getSupportFragmentManager().beginTransaction()
.add(frameLayout.getId(), new fragment(this))
.commit();
/* TypedValue typedValue = new TypedValue();
getTheme().resolveAttribute(android.R.attr.windowBackground, typedValue, true);
// 设置背景颜色
bj = typedValue.data;*/
context = this;
setContentView(R.layout.activity_bfq);
Toolbar toolbar = findViewById(R.id.toolbar);
toolbar.setNavigationIcon(R.drawable.end);
toolbar.setNavigationOnClickListener(view1 -> finish());
toolbar.inflateMenu(R.menu.bfq);
toolbar.setOnMenuItemClickListener(item -> {
if (item.getItemId() == R.id.fx) {
if (bfqkz.xm != null) {
com.muqingbfq.mq.gj.fx(this,
"音乐名称:" + bfqkz.xm.name +
"\n 作者:" + bfqkz.xm.zz +
"\n 链接https://music.163.com/#/song?id=" + bfqkz.xm.id);
}
}
return false;
});
}
@SuppressLint("StaticFieldLeak")
public static View inflate;
private static AppCompatActivity context;
public static Bitmap bitmap;
public static class fragment extends Fragment {
public fragment(AppCompatActivity context) {
bfq.context = context;
}
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
@Nullable Bundle savedInstanceState) {
if (inflate != null) {
tx.setImageBitmap(bitmap);
return inflate;
}
inflate = inflater.inflate(R.layout.fragment_bfq, container, false);
lrcView = inflate.findViewById(R.id.gc);
lrcView.setVisibility(View.GONE);
Toolbar toolbar = inflate.findViewById(R.id.toolbar);
name = inflate.findViewById(R.id.name);
zz = inflate.findViewById(R.id.zz);
kg = inflate.findViewById(R.id.kg);
xyq = inflate.findViewById(R.id.xyq);
syq = inflate.findViewById(R.id.syq);
tx = inflate.findViewById(R.id.mttx);
tdt = inflate.findViewById(R.id.tdt);
time_a = inflate.findViewById(R.id.time_a);
time_b = inflate.findViewById(R.id.time_b);
// lrcView.setIsEnableBlurEffect(true);
View kp = inflate.findViewById(R.id.kp1);
kp.setOnClickListener(v -> {
if (lrcView != null) {
v.setVisibility(View.GONE);
lrcView.setVisibility(View.VISIBLE);
if (com.muqingbfq.api.url.lrc == null) {
new Thread() {
@Override
public void run() {
super.run();
com.muqingbfq.api.url.gc(bfqkz.xm.id);
}
}.start();
}
}
});
toolbar.setNavigationIcon(R.drawable.end);
toolbar.setNavigationOnClickListener(view1 -> context.finish());
toolbar.inflateMenu(R.menu.bfq);
toolbar.setOnMenuItemClickListener(item -> {
if (item.getItemId() == R.id.fx) {
com.muqingbfq.mq.gj.fx(context,
"音乐名称:" + name.getText().toString() +
"\n 作者:" + zz.getText().toString() +
"\n 链接https://music.163.com/#/song?id=" + bfqkz.id);
}
return false;
});
lrcView.setDraggable(true, (time) -> {
com.muqingbfq.bfqkz.mt.seekTo(Math.toIntExact(time));
return true;
});
lrcView.setOnSingerClickListener(() -> {
lrcView.setVisibility(View.GONE);
kp.setVisibility(View.VISIBLE);
});
inflate.findViewById(R.id.bfq_list_mp3).
setOnClickListener(view1 -> com.muqingbfq.fragment.bflb_db.start(context));
bfq_an.kz kz = new bfq_an.kz();
kg.setOnClickListener(kz);
syq.setOnClickListener(kz);
xyq.setOnClickListener(kz);
like = inflate.findViewById(R.id.like);
ImageView control = inflate.findViewById(R.id.control);
control.setOnClickListener(new bfq_an.control(control));
UI(inflate);
return inflate;
}
private void UI(View view) {
// tdt.getProgressDrawable().
// setColorFilter(ContextCompat.getColor(this, R.color.text_tm), PorterDuff.Mode.MULTIPLY);
// tdt.getThumb().
// setColorFilter(ContextCompat.getColor(this, R.color.text), PorterDuff.Mode.SRC_IN);
tdt.setOnSeekBarChangeListener(new bfq_an.tdt());
like.setOnClickListener(view1 -> {
try {
if (bfqkz.like_bool) {
like.setImageTintList(ContextCompat.getColorStateList(view.getContext(), R.color.text));
com.muqingbfq.fragment.gd.like.remove(String.valueOf(bfqkz.xm.id));
} else {
like.setImageTintList(ContextCompat.
getColorStateList(view.getContext(), android.R.color.holo_red_dark));
JSONObject json = new JSONObject();
json.put("name", bfqkz.xm.name);
json.put("zz", bfqkz.xm.zz);
json.put("picUrl", bfqkz.xm.picurl);
com.muqingbfq.fragment.gd.like.put(String.valueOf(bfqkz.xm.id), json);
}
com.muqingbfq.mq.wj.xrwb(com.muqingbfq.mq.wj.mp3_like,
com.muqingbfq.fragment.gd.like.toString());
bfqkz.like_bool = !bfqkz.like_bool;
} catch (Exception e) {
e.printStackTrace();
}
});
if (bfqkz.xm != null) {
xm xm = bfqkz.xm;
name.setText(xm.name);
zz.setText(xm.zz);
time_a.setText(bfq_an.getTime(bfqkz.tdt_max));
tdt.setMax((int) bfqkz.tdt_max);
if (bfqkz.mt.isPlaying()) {
kg.setImageResource(R.drawable.bf);
}
bfq_an.islike(context);
Glide.with(context).load(xm.picurl)
.placeholder(R.drawable.icon)
.into(tx);
}
}
}
public static void start(AppCompatActivity context) {
Intent intent = new Intent(context, bfq.class);
public static void start(Context context) {
Intent intent = new Intent();
intent.setClass(context, bfq.class);
intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
context.startActivity(intent);
// home.dialog.show(context.getSupportFragmentManager(), "bfq");
}
public static boolean getVisibility() {
if (inflate == null) {
if (Media.view == null) {
return false;
}
return inflate.isShown();
return Media.view.isShown();
}
}

View File

@ -4,14 +4,10 @@ import android.annotation.SuppressLint;
import android.content.Context;
import android.view.View;
import android.widget.ImageView;
import android.widget.SeekBar;
import androidx.core.content.ContextCompat;
import com.muqingbfq.api.url;
import com.muqingbfq.fragment.Media;
import com.muqingbfq.fragment.gd;
import com.muqingbfq.fragment.mp3;
import com.muqingbfq.mq.gj;
import java.text.SimpleDateFormat;
import java.util.Date;
@ -42,6 +38,9 @@ public class bfq_an {
}
public static void xyq() {
if (bfqkz.list == null) {
return;
}
bfqkz.mt.pause();
int ms = bfqkz.ms;
if (bfqkz.ms == 0) {
@ -50,32 +49,6 @@ public class bfq_an {
bfqkz.xm = bfqkz.list.get(bfqkz.getmti(ms));
new url(bfqkz.xm);
}
public static class tdt implements SeekBar.OnSeekBarChangeListener {
// SimpleDateFormat simpleDateFormat = new SimpleDateFormat("HH:mm");
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
bfq.time_b.setText(getTime(progress));
// bfq.time_b.setText(simpleDateFormat.format(new Date(progress)));
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
// 暂停播放
bfqkz.mt.pauseTimer();
// bfqkz.mt.pause();
}
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
// 播放音乐到指定位置
bfqkz.mt.seekTo(seekBar.getProgress());
bfqkz.mt.resumeTimer();
// bfqkz.mt.start();
}
}
public static class control implements View.OnClickListener {
public control(ImageView imageView) {
switch (bfqkz.ms) {
@ -122,25 +95,14 @@ public class bfq_an {
public static String getTime(long time) {
return simpleDateFormat.format(new Date(time));
}
public static void UI(boolean bool) {
if (bfq.getVisibility()) {
bfq.xyq.setEnabled(bool);
bfq.syq.setEnabled(bool);
bfq.kg.setEnabled(bool);
bfq.tdt.setEnabled(bool);
}
}
public static void islike(Context context) {
try {
gd.like.getJSONObject(String.valueOf(bfqkz.xm.id));
bfq.like.setImageTintList(ContextCompat.
getColorStateList(context, android.R.color.holo_red_dark));
bfqkz.like_bool = true;
Media.setlike(true);
} catch (Exception e) {
bfq.like.setImageTintList(ContextCompat.getColorStateList(context, R.color.text));
gj.sc("bfq_an islike() :" + e);
bfqkz.like_bool = false;
Media.setlike(false);
}
}
}

View File

@ -12,6 +12,7 @@ import androidx.annotation.Nullable;
import androidx.media.MediaBrowserServiceCompat;
import com.muqingbfq.api.url;
import com.muqingbfq.mq.BluetoothMusicController;
import com.muqingbfq.mq.gj;
import java.util.ArrayList;
@ -19,10 +20,8 @@ import java.util.List;
import java.util.Random;
public class bfqkz extends MediaBrowserServiceCompat {
public static com.muqingbfq.MediaPlayer mt = new com.muqingbfq.MediaPlayer();
public static String id;
public static com.muqingbfq.MediaPlayer mt;
public static List<xm> list = new ArrayList<>();
public static long tdt_max, tdt_wz;
public static int ms;
// 0 循环 1 顺序 2 随机
public static xm xm;
@ -52,31 +51,31 @@ public class bfqkz extends MediaBrowserServiceCompat {
if (xm.picurl == null || xm.picurl.equals("")) {
xm.picurl = url.picurl(xm.id);
}
mt.reset();
mt.setDataSource(id);
} catch (Exception e) {
gj.sc("bfqkz mp3(String id) :" + e);
yc.start(home.appCompatActivity, "bfqkz mp3(" + id + ") :" + e);
}
}
public static MediaSessionCompat mSession;
public static MediaMetadataCompat build;
public static PlaybackStateCompat playback;
@Override
public void onCreate() {
super.onCreate();
if (mt == null) {
mt = new com.muqingbfq.MediaPlayer();
new BluetoothMusicController(this);
}
mSession = new MediaSessionCompat(this, "MusicService");
playback=new PlaybackStateCompat.Builder()
.setState(PlaybackStateCompat.STATE_NONE,0,1.0f)
.build();
mSession.setCallback(new MediaSessionCompat.Callback() {
/* mSession.setCallback(new MediaSessionCompat.Callback() {
@Override
public void onPlay() {
mt.start();
}
@Override
public void onPause() {
// 处理暂停音乐逻辑
@ -98,15 +97,15 @@ public class bfqkz extends MediaBrowserServiceCompat {
public void onSkipToPrevious() {
// 处理切换到上一首音乐逻辑
}
});//设置回调
});*/
build = new MediaMetadataCompat.Builder()
.build();
mSession.setMetadata(build);
mSession.setPlaybackState(playback);
mSession.setFlags(MediaSessionCompat.FLAG_HANDLES_TRANSPORT_CONTROLS);
mSession.setActive(true);
setSessionToken(mSession.getSessionToken());
notify = new com.muqingbfq.mq.NotificationManagerCompat(this);
}
@Nullable

View File

@ -75,7 +75,6 @@ public class bflb_db extends BottomSheetDialog {
holder.name.setTextColor(color);
holder.zz.setTextColor(color);
holder.view.setOnClickListener(view -> {
bfqkz.id = x.id;
if (bfqkz.xm != x) {
bfqkz.xm = x;
new url(x);

View File

@ -2,7 +2,6 @@ package com.muqingbfq.fragment;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
@ -10,9 +9,9 @@ import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import com.muqingbfq.R;
import com.muqingbfq.bfq;
@ -26,35 +25,61 @@ import java.util.List;
public class bfq_db extends Fragment {
@SuppressLint("StaticFieldLeak")
public static View view;
public static TextView name, zz;
public static ImageView txa;
private static View view;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
if (view == null) {
String jsonList = this.getContext().getSharedPreferences("list", Context.MODE_PRIVATE)
.getString("listData", null); // 获取保存的 JSON 字符串
if (jsonList != null) {
Type type = new TypeToken<List<xm>>() {
}.getType();
bfqkz.list = new com.google.gson.Gson().fromJson(jsonList, type); // JSON 字符串转换回列表数据
}
}
view = inflater.inflate(R.layout.fragment_bfq_db, container, false);
name = view.findViewById(R.id.name);
zz = view.findViewById(R.id.zz);
txa = view.findViewById(R.id.kg);
txa.setOnClickListener(new bfq_an.kz());
TextView name = view.findViewById(R.id.name);
TextView zz = view.findViewById(R.id.zz);
view.findViewById(R.id.kg).setOnClickListener(new bfq_an.kz());
view.findViewById(R.id.txb).setOnClickListener(view -> bflb_db.start(getContext()));
view.setOnClickListener(view12 -> bfq.start(home.appCompatActivity));
view.setOnClickListener(vw -> bfq.start(home.appCompatActivity));
// 恢复列表数据
SharedPreferences sharedPreferences = this.getContext().getSharedPreferences("MyPrefs", Context.MODE_PRIVATE);
String jsonList = sharedPreferences.getString("listData", ""); // 获取保存的 JSON 字符串
if (!jsonList.isEmpty()) {
Gson gson = new Gson();
Type type = new TypeToken<List<xm>>() {
}.getType();
bfqkz.list = gson.fromJson(jsonList, type); // JSON 字符串转换回列表数据
} else {
view.setVisibility(View.GONE);
if (bfqkz.xm != null) {
name.setText(bfqkz.xm.name);
zz.setText(bfqkz.xm.zz);
}
if (bfqkz.mt != null) {
Media.setbf(bfqkz.mt.isPlaying());
}
return view;
}
private static <T extends View> T findViewById(int id) {
return view.findViewById(id);
}
public static void setkg(boolean bool) {
if (view != null) {
ImageView imageView = findViewById(R.id.kg);
if (bool) {
imageView.setImageResource(R.drawable.bf);
} else {
imageView.setImageResource(R.drawable.zt);
}
}
}
public static void setname(String str) {
if (view != null) {
TextView textView = findViewById(R.id.name);
textView.setText(str);
}
}
public static void setzz(String str) {
if (view != null) {
TextView textView = findViewById(R.id.zz);
textView.setText(str);
}
}
}

View File

@ -39,7 +39,7 @@ import com.muqingbfq.xm;
public class gd extends Fragment {
public static String gdid;
public static BaseAdapter lbspq;
public static List<xm> list = new ArrayList<>();
public static List<xm> list;
public static JSONObject like = new JSONObject();
GridView gridView;
@ -47,6 +47,7 @@ public class gd extends Fragment {
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_gd, container, false);
list = new ArrayList<>();
lbspq = new baseadapter(view.getContext());
gridView = view.findViewById(R.id.wgbj);
gridView.setAdapter(lbspq);
@ -54,7 +55,6 @@ public class gd extends Fragment {
gdid = main.mp3_csh;
}
TabLayout tabLayout = view.findViewById(R.id.tablayout);
// tabLayout.removeAllTabs();
for (String name : new String[]{"推荐", "排行榜", "下载"}) {
TabLayout.Tab tab = tabLayout.newTab();
tab.setText(name);
@ -68,11 +68,9 @@ public class gd extends Fragment {
lbspq.notifyDataSetChanged();
new thread(tab.getText().toString());
}
@Override
public void onTabUnselected(TabLayout.Tab tab) {
}
@Override
public void onTabReselected(TabLayout.Tab tab) {
}

View File

@ -22,6 +22,7 @@ import com.muqingbfq.api.playlist;
import com.muqingbfq.api.url;
import com.muqingbfq.bfq;
import com.muqingbfq.bfqkz;
import com.muqingbfq.home;
import com.muqingbfq.list.MyViewHoder;
import com.muqingbfq.main;
import com.muqingbfq.xm;
@ -49,6 +50,8 @@ public class mp3 extends AppCompatActivity {
lb.setAdapter(lbspq);
String id = intent.getStringExtra("id");
new start(id);
/* getSupportFragmentManager().beginTransaction()
.add(R.id.bfq_db,home.bfq_db).commit();*/
}
@SuppressLint("NotifyDataSetChanged")
@ -105,12 +108,10 @@ public class mp3 extends AppCompatActivity {
holder.name.setTextColor(color);
holder.zz.setTextColor(color);
holder.view.setOnClickListener(view -> {
bfqkz.id = x.id;
if (bfqkz.xm == null || !bfqkz.xm.id.equals(x.id)) {
bfqkz.xm = x;
new url(x);
}
// if (!gd.gdid.equals(bflb_db.gdid)) {
bfqkz.list.clear();
int size = list.size();
for (int i = 0; i < size; i++) {

View File

@ -32,13 +32,6 @@ import java.util.ArrayList;
import java.util.List;
public class search extends Fragment {
String name;
public search(String name) {
this.name = name;
}
View view;
RecyclerView.Adapter<MyViewHoder> lbspq;
List<xm> list = new ArrayList<>();
@ -56,20 +49,36 @@ public class search extends Fragment {
lb.setLayoutManager(manager);
lbspq = new spq();
lb.setAdapter(lbspq);
new start().start();
setVisibility(false);
return view;
}
@SuppressLint("NotifyDataSetChanged")
public void setStart(String name) {
this.name = name;
list.clear();
lbspq.notifyDataSetChanged();
new start().start();
public void setVisibility(boolean bool) {
if (bool) {
view.setVisibility(View.VISIBLE);
} else {
view.setVisibility(View.GONE);
}
}
public boolean getVisibility() {
return view.isShown();
}
public void setStart(String name) {
setVisibility(true);
list.clear();
new start(name);
}
public class start extends Thread {
String name;
public start(String name) {
this.name = name;
start();
}
@SuppressLint("NotifyDataSetChanged")
@Override
public void run() {
@ -124,7 +133,6 @@ public class search extends Fragment {
holder.name.setTextColor(color);
holder.zz.setTextColor(color);
holder.view.setOnClickListener(view1 -> {
bfqkz.id = x.id;
if (bfqkz.xm == null || !bfqkz.xm.id.equals(x.id)) {
bfqkz.xm = x;
new url(x);

View File

@ -2,9 +2,11 @@ package com.muqingbfq.fragment;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.net.Uri;
import android.view.View;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
@ -14,11 +16,16 @@ import com.muqingbfq.activity_about_software;
import com.muqingbfq.home;
import com.muqingbfq.login.user_logs;
import com.muqingbfq.login.user_message;
import com.muqingbfq.main;
import com.muqingbfq.mq.EditViewDialog;
import com.muqingbfq.mq.gj;
import com.muqingbfq.mq.wj;
import com.muqingbfq.mq.wl;
public class sz {
import org.json.JSONException;
import org.json.JSONObject;
public class sz {
@SuppressLint("StaticFieldLeak")
public static TextView name, jieshao;
@SuppressLint("StaticFieldLeak")
@ -32,13 +39,94 @@ public class sz {
imageView = view.findViewById(R.id.image);
view.findViewById(R.id.xdbj).
setOnClickListener(v -> {
if (name.getText().equals("登录")) {
if (!wj.cz(wj.filesdri + "user")) {
context.startActivity(new Intent(context, user_logs.class));
}
});
name.setOnClickListener(vw -> {
if (main.user == null) {
context.startActivity(new Intent(context, user_logs.class));
return;
}
EditViewDialog dialog = new EditViewDialog(vw.getContext(), "修改名称");
dialog.setPositiveButton("确定", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
EditText viewById = dialog.getEditText();
String s = viewById.getText().toString();
new Thread() {
@Override
public void run() {
super.run();
String s1 = wl.get(main.http + "/setname?user=" + main.user + "&name=" + s);
try {
JSONObject jsonObject = new JSONObject(s1);
if (jsonObject.getInt("code") == 200) {
setname(s);
}
gj.xcts(home.appCompatActivity, jsonObject.getString("msg"));
} catch (JSONException e) {
throw new RuntimeException(e);
}
}
}.start();
}
});
dialog.show();
});
jieshao.setOnClickListener(vw -> {
if (main.user == null) {
context.startActivity(new Intent(context, user_logs.class));
return;
}
EditViewDialog dialog = new EditViewDialog(vw.getContext(), "修改签名");
dialog.setPositiveButton("确定", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
EditText viewById = dialog.getEditText();
String s = viewById.getText().toString();
new Thread() {
@Override
public void run() {
super.run();
String s1 = wl.get(main.http + "/setqianming?user=" + main.user + "&qianming=" + s);
try {
JSONObject jsonObject = new JSONObject(s1);
if (jsonObject.getInt("code") == 200) {
setqianming(s);
}
gj.xcts(home.appCompatActivity, jsonObject.getString("msg"));
} catch (JSONException e) {
throw new RuntimeException(e);
}
}
}.start();
}
});
dialog.show();
});
imageView.setOnClickListener(vw -> {
if (main.user == null) {
context.startActivity(new Intent(context, user_logs.class));
return;
}
});
new user_message();
}
public static void setname(String string) {
main.handler.post(() -> name.setText(string));
}
public static void setqianming(String string) {
main.handler.post(() -> {
if (string == null) {
jieshao.setText("");
} else {
jieshao.setText(string);
}
});
}
public static void switch_sz(Context context, int id) {
if (id == R.id.a) {
gj.llq(context, "https://rust.coldmint.top/ftp/muqing/");
@ -72,8 +160,9 @@ public class sz {
context.startActivity(new Intent(context, activity_about_software.class));
// 关于软件
} else if (id == R.id.g) {
new com.muqingbfq.login.visitor();
home.appCompatActivity.finish();
wj.sc(wj.filesdri + "user");
setname("未登录");
setqianming(null);
}
}
}

View File

@ -5,13 +5,10 @@ import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.res.Configuration;
import android.os.Bundle;
import android.os.RemoteException;
import android.support.v4.media.MediaBrowserCompat;
import android.support.v4.media.session.MediaControllerCompat;
import android.text.Spannable;
import android.text.SpannableString;
import android.text.style.LeadingMarginSpan;
import android.view.Menu;
import android.view.MenuItem;
@ -22,95 +19,121 @@ import androidx.appcompat.widget.Toolbar;
import androidx.drawerlayout.widget.DrawerLayout;
import com.google.android.material.navigation.NavigationView;
import com.google.gson.Gson;
import com.muqingbfq.fragment.Media;
import com.muqingbfq.fragment.bfq_db;
import com.muqingbfq.mq.gj;
import java.util.List;
public class home extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener {
public Toolbar toolbar;
public static AppCompatActivity appCompatActivity;
@SuppressLint("CommitTransaction")
@SuppressLint("StaticFieldLeak")
public static Context appCompatActivity;
@SuppressLint({"CommitTransaction", "ObsoleteSdkInt"})
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_home);
appCompatActivity = this;
try {
toolbar = findViewById(R.id.toolbar);
//初始化工具栏
Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
DrawerLayout drawerLayout = findViewById(R.id.chct);
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
this, drawerLayout, toolbar, R.string.app_name, R.string.app_name);
drawerLayout.addDrawerListener(toggle);
toggle.syncState();
//初始化侧滑
NavigationView chb = findViewById(R.id.chb);
chb.setNavigationItemSelectedListener(this);
Menu menu = chb.getMenu();
for (int i = 0; i < menu.size(); i++) {
MenuItem item = menu.getItem(i);
SpannableString spannableString = new SpannableString(item.getTitle());
spannableString.setSpan(new LeadingMarginSpan.Standard(
26, 26), 0, spannableString.length(), Spannable.SPAN_INCLUSIVE_INCLUSIVE);
item.setTitle(spannableString);
}
new com.muqingbfq.fragment.sz(this, chb.getHeaderView(0));
getSupportFragmentManager().beginTransaction()
.add(R.id.bfq_db, new bfq_db()).commit();
mediaBrowser = new MediaBrowserCompat(this,
new ComponentName(this, bfqkz.class), new MediaBrowserCompat.ConnectionCallback() {
//初始化播放器组件
if (mediaBrowser == null) {
mediaBrowser = new MediaBrowserCompat(this,
new ComponentName(this, bfqkz.class),
connectionCallbacks,
null);
mediaBrowser.connect();
}
//检测更新
new gj.jianchagengxin(this);
} catch (Exception e) {
yc.tc(this, e);
}
}
public static MediaBrowserCompat mediaBrowser;
private MediaBrowserCompat.ConnectionCallback connectionCallbacks =
new MediaBrowserCompat.ConnectionCallback() {
@Override
public void onConnected() {
// 连接成功后执行的操作
MediaControllerCompat mediaController;
try {
mediaController = new MediaControllerCompat(home.this,
mediaBrowser.getSessionToken());
} catch (RemoteException e) {
throw new RuntimeException(e);
}
MediaControllerCompat.setMediaController(home.this, mediaController);
// 已连接到服务可以开始浏览媒体内容
// 订阅媒体内容
mediaBrowser.subscribe("mediaId", subscriptionCallback);
// 请求当前播放状态
MediaControllerCompat mediaController = new MediaControllerCompat(home.this, mediaBrowser.getSessionToken());
MediaControllerCompat.TransportControls transportControls = mediaController.getTransportControls();
// 执行媒体控制操作
transportControls.play();
}
@Override
public void onConnectionSuspended() {
// 连接暂停时执行的操作
// gj.ts(home.this,"zangting");
// 与服务的连接暂停或断开
// 取消订阅媒体内容
mediaBrowser.unsubscribe("mediaId", subscriptionCallback);
// 清除播放状态
MediaControllerCompat mediaController = new MediaControllerCompat(home.this, mediaBrowser.getSessionToken());
MediaControllerCompat.TransportControls transportControls = mediaController.getTransportControls();
// 执行媒体控制操作
transportControls.stop();
}
@Override
public void onConnectionFailed() {
// 连接失败时执行的操作
// gj.ts(home.this,"shibai");
// 与服务的连接失败
// 尝试重新连接服务或显示错误信息等
}
};
private MediaBrowserCompat.SubscriptionCallback subscriptionCallback =
new MediaBrowserCompat.SubscriptionCallback() {
@Override
public void onChildrenLoaded(@NonNull String parentId, @NonNull List<MediaBrowserCompat.MediaItem> children) {
// 媒体内容加载完成
// 处理每个媒体项
// ...
}
}, null);
mediaBrowser.connect();
} catch (Exception e) {
gj.sc(e);
}
}
MediaBrowserCompat mediaBrowser;
@Override
public void onError(@NonNull String parentId) {
// 媒体内容加载失败
// 处理加载失败的情况
}
};
@Override
protected void onPause() {
super.onPause();
//在销毁 Activity 之前系统会先调用 onDestroy()系统调用此回调的原因如下
// 保存列表数据
SharedPreferences sharedPreferences = getSharedPreferences("MyPrefs", Context.MODE_PRIVATE);
SharedPreferences sharedPreferences = getSharedPreferences("list", Context.MODE_PRIVATE);
SharedPreferences.Editor editor = sharedPreferences.edit();
Gson gson = new Gson();
String jsonList = gson.toJson(bfqkz.list); // 将列表数据转换为 JSON 字符串
editor.putString("listData", jsonList); // 保存 JSON 字符串到 SharedPreferences
String jsonList = new com.google.gson.Gson().toJson(bfqkz.list);
editor.putString("listData", jsonList);
editor.apply();
}
@Override
protected void onDestroy() {
super.onDestroy();
// mediaBrowser.disconnect();
protected void onResume() {
super.onResume();
getSupportFragmentManager().beginTransaction()
.add(R.id.bfq_db, new bfq_db()).commit();
}
private long time;
private long time;
@SuppressLint("StaticFieldLeak")
public static com.muqingbfq.fragment.bfq_db bfq_db = new bfq_db();
@Override
public void onBackPressed() {
if (bfqkz.mt.isPlaying()) {
@ -126,13 +149,11 @@ public class home extends AppCompatActivity implements NavigationView.OnNavigati
}
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.home, menu);
return super.onCreateOptionsMenu(menu);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() == R.id.menu_search) {
@ -141,12 +162,14 @@ public class home extends AppCompatActivity implements NavigationView.OnNavigati
}
return super.onOptionsItemSelected(item);
}
@Override
public boolean onNavigationItemSelected(@NonNull MenuItem item) {
com.muqingbfq.fragment.sz.switch_sz(this, item.getItemId());
return false;
}
@Override
public void onConfigurationChanged(@NonNull Configuration newConfig) {
super.onConfigurationChanged(newConfig);
Media.view = null;
}
}

View File

@ -18,7 +18,7 @@ import org.json.JSONObject;
public class enroll extends AppCompatActivity {
EditText eduser,edpassword;
String user, password;
String user , name , password;
@Override
protected void onCreate(Bundle savedInstanceState) {
@ -27,10 +27,13 @@ public class enroll extends AppCompatActivity {
setSupportActionBar(findViewById(R.id.toolbar));
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
Intent intent = getIntent();
//获取UID编辑框
eduser = findViewById(R.id.edit_user);
eduser.setText(
intent.getStringExtra("user"));
//设置密码编辑框
edpassword = findViewById(R.id.edit_password);
findViewById(R.id.edit_cookie).setOnClickListener(view -> new user_logs.erweima(view.getContext()));
findViewById(R.id.enroll).setOnClickListener(view -> a());
}
@ -65,8 +68,11 @@ public class enroll extends AppCompatActivity {
@Override
public void run() {
super.run();
String s = wl.get("http://139.196.224.229/muqing/enroll.php?user=" + user + "&password=" + password
+ "&cookie" + wl.Cookie);
String get = "user=" + user
+ "&name=" + name
+ "&password=" + password
+ "&cookie" + wl.Cookie;
String s = wl.get("http://139.196.224.229/muqing/enroll.php?" + get);
try {
JSONObject jsonObject = new JSONObject(s);
int code = jsonObject.getInt("code");
@ -80,6 +86,4 @@ public class enroll extends AppCompatActivity {
}
}
}
}

View File

@ -17,7 +17,6 @@ import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
@ -25,10 +24,14 @@ import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import com.muqingbfq.R;
import com.muqingbfq.main;
import com.muqingbfq.mq.gj;
import com.muqingbfq.mq.wj;
import com.muqingbfq.mq.wl;
import com.muqingbfq.yc;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.File;
import java.util.Objects;
public class user_logs extends AppCompatActivity {
@ -120,7 +123,7 @@ public class user_logs extends AppCompatActivity {
new visitor();
}
wl.setcookie(cookie);
new user_message();
new user_message(user);
user_logs.this.finish();
}
} catch (Exception e) {
@ -132,7 +135,7 @@ public class user_logs extends AppCompatActivity {
public static class erweima extends Thread {
int code = 800;
String unikey, qrimg, hq;
private long time=0;
private long time = 0;
ImageView imageView;
TextView textView;
MaterialAlertDialogBuilder materialAlertDialogBuilder;

View File

@ -1,40 +1,55 @@
package com.muqingbfq.login;
import android.text.TextUtils;
import com.bumptech.glide.Glide;
import com.muqingbfq.R;
import com.muqingbfq.fragment.sz;
import com.muqingbfq.main;
import com.muqingbfq.mq.gj;
import com.muqingbfq.mq.wj;
import com.muqingbfq.mq.wl;
import com.muqingbfq.yc;
import org.json.JSONObject;
public class user_message extends Thread {
public user_message() {
public user_message(String user) {
main.user = user;
start();
}
public user_message() {
main.user=wj.dqwb(wj.filesdri + "user");
start();
}
String name = "未登录", signature = "游客模式";
@Override
public void run() {
super.run();
String hq = wl.hq("/user/account" + "?cookie=" + wl.Cookie);
try {
JSONObject jsonObject = new JSONObject(hq).getJSONObject("profile");
String nickname = jsonObject.getString("nickname");
String signature = jsonObject.getString("signature");
String avatarUrl = jsonObject.getString("avatarUrl");
main.handler.post(() -> {
sz.name.setText(nickname);
sz.jieshao.setText(signature);
Glide.with(sz.imageView)
.load(avatarUrl)
if (main.user != null) {
String hq = wl.get(main.http + "/getid.php?" + "user=" + main.user);
if (!TextUtils.isEmpty(hq)) {
JSONObject json = new JSONObject(hq);
if (json.getInt("code") == 200) {
name = json.getString("name");
signature = json.getString("qianming");
json.put("name", name);
json.put("qianming", signature);
json.put("user", main.user);
wj.xrwb(wj.filesdri + "user", main.user);
}
}
}
main.handler.post(() -> {
sz.name.setText(name);
sz.jieshao.setText(signature);
Glide.with(sz.imageView)
.load(main.http + "/picurl/" + main.user + ".jpg")
.placeholder(R.drawable.icon)//图片加载出来前显示的图片
.error(R.drawable.deleat)//图片加载失败后显示的图片
.error(R.drawable.icon)//图片加载失败后显示的图片
.into(sz.imageView);
});
} catch (Exception e) {
yc.start(e);
gj.sc(e);
}
}
}

View File

@ -15,6 +15,7 @@ public class visitor extends Thread {
AppCompatActivity activity;
Intent intent;
public visitor(AppCompatActivity activity, Intent intent) {
this.activity = activity;
this.intent = intent;
@ -24,6 +25,7 @@ public class visitor extends Thread {
public visitor() {
start();
}
@Override
public void run() {
super.run();
@ -31,23 +33,10 @@ public class visitor extends Thread {
try {
JSONObject jsonObject = new JSONObject(hq);
wl.setcookie(jsonObject.getString("cookie"));
if (wj.filesdri == null) {
new wj(activity);
}
if (activity != null) {
activity.startActivity(intent);
activity.finish();
}
} catch (JSONException e) {
yc.start(activity, e);
}
try {
sleep(1000);
} catch (InterruptedException e) {
yc.start(activity,e);
}
if (activity != null) {
activity.finish();
} catch (Exception e) {
com.muqingbfq.mq.gj.sc(e);
}
activity.startActivity(intent);
activity.finish();
}
}

View File

@ -19,7 +19,7 @@ public class main extends Application {
public static SharedPreferences.Editor edit;
public static String mp3 = "mp3", mp3_csh,
Time = "Time", Cookie = "Cookie";
Cookie = "Cookie", user;
@Override
public void onCreate() {
@ -27,10 +27,6 @@ public class main extends Application {
new wj(this);
sp = getSharedPreferences("Set_up", MODE_PRIVATE);
edit = sp.edit();
if (sp.getLong(Time, 0) == 0) {
edit.putLong(Time, System.currentTimeMillis());
}
start.time = sp.getLong(Time, System.currentTimeMillis());
boolean bj = false;
try {
mp3_csh = sp.getString(mp3, "");
@ -56,6 +52,5 @@ public class main extends Application {
if (bj) {
edit.commit();
}
// 创建全局异常处理器实例 设置全局异常处理器
}
}

View File

@ -16,15 +16,12 @@ public class BluetoothMusicController {
public BluetoothMusicController(Context context) {
this.context = context;
// bluetoothReceiver.setOnHeadsetListener(this);
IntentFilter intentFilter = new IntentFilter();
intentFilter.addAction(BluetoothAdapter.ACTION_CONNECTION_STATE_CHANGED);
intentFilter.addAction("android.intent.action.HEADSET_PLUG");
context.registerReceiver(new MyButtonClickReceiver(), intentFilter);
registerHeadsetReceiver();
// audioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
// setupMediaSession();
}
public void stop() {

View File

@ -1,7 +1,5 @@
package com.muqingbfq.mq;
import static com.muqingbfq.bfqkz.xm;
import android.Manifest;
import android.annotation.SuppressLint;
import android.app.NotificationChannel;
@ -15,7 +13,6 @@ import android.content.pm.PackageManager;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Build;
import android.support.v4.media.MediaMetadataCompat;
import android.support.v4.media.session.PlaybackStateCompat;
import androidx.core.app.ActivityCompat;
@ -25,11 +22,8 @@ import androidx.media.session.MediaButtonReceiver;
import com.muqingbfq.MyButtonClickReceiver;
import com.muqingbfq.R;
import com.muqingbfq.bfq;
import com.muqingbfq.bfq_an;
import com.muqingbfq.bfqkz;
import com.muqingbfq.fragment.bfq_db;
import com.muqingbfq.fragment.mp3;
import com.muqingbfq.home;
import com.muqingbfq.fragment.Media;
import com.muqingbfq.start;
import com.muqingbfq.yc;
@ -62,7 +56,6 @@ public class NotificationManagerCompat {
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK
| Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);// 关键的一步设置启动模式两种情况
PendingIntent pendingIntent = getActivity(context, intent);
// PendingIntent.getActivity(context, 0, intent, flag);
Intent my = new Intent(context, MyButtonClickReceiver.class);
pendingIntent_kg = getBroadcast(context, my.
setAction("kg"));
@ -133,15 +126,10 @@ public class NotificationManagerCompat {
R.drawable.icon);
}
if (notificationManager != null) {
notificationBuilder.setContentTitle(xm.name);
notificationBuilder.setContentText(xm.zz);
notificationBuilder.setLargeIcon(bitmap);
notificationManager.notify(1, notificationBuilder.build());
}
if (bfq.tx != null) {
bfq.tx.setImageBitmap(bitmap);
}
Media.setImageBitmap(bitmap);
}
private NotificationCompat.Builder getNotificationBuilder(Context context) {

View File

@ -2,22 +2,17 @@ package com.muqingbfq.mq;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.res.Configuration;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffXfermode;
import android.graphics.Rect;
import android.graphics.RectF;
import android.net.Uri;
import android.util.Log;
import android.widget.Toast;
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import com.muqingbfq.main;
import com.muqingbfq.yc;
import org.json.JSONObject;
import java.net.NetworkInterface;
import java.net.SocketException;
import java.util.Collections;
@ -35,7 +30,8 @@ public class gj {
if (a == null) {
a = "null";
}
Log.d("云音乐", String.valueOf(a));
Log.d("云音乐", a.toString());
floating.addtext(a.toString());
}
public static void llq(Context context, String str) {
@ -49,11 +45,6 @@ public class gj {
context.startActivity(shareIntent);
}
public static int isDarkTheme(Context context) {
return context.getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK;
// return flag == Configuration.UI_MODE_NIGHT_YES;
}
public static boolean isWiFiConnected() {
try {
for (NetworkInterface networkInterface : Collections.list(NetworkInterface.getNetworkInterfaces())) {
@ -71,24 +62,50 @@ public class gj {
return false; // 默认为流量网络
}
public static Bitmap getRoundedCornerBitmap(Bitmap bitmap, int cornerRadius) {
Bitmap output = Bitmap.createBitmap(bitmap.getWidth(), bitmap.getHeight(), Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(output);
public static class jianchagengxin extends Thread {
Context context;
final int color = 0xff424242;
final Paint paint = new Paint();
final Rect rect = new Rect(0, 0, bitmap.getWidth(), bitmap.getHeight());
final RectF rectF = new RectF(rect);
public jianchagengxin(Context context) {
this.context = context;
if (!wj.cz(wj.filesdri + "gx.mq")) {
start();
}
}
paint.setAntiAlias(true);
canvas.drawARGB(0, 0, 0, 0);
paint.setColor(color);
canvas.drawRoundRect(rectF, cornerRadius, cornerRadius, paint);
paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_IN));
canvas.drawBitmap(bitmap, rect, rect, paint);
return output;
@Override
public void run() {
super.run();
jianchagengxin(context);
}
}
}
public static int jianchagengxin(Context context) {
try {
String versionName = context.getPackageManager()
.getPackageInfo(context.getPackageName(), 0).versionName;
String hq = wl.get(main.http + "/muqingbfq?bb=" + versionName);
final JSONObject jsonObject = new JSONObject(hq);
boolean code = jsonObject.getInt("code") == 1;
String msg = jsonObject.getString("msg");
if (code) {
String url = jsonObject.getString("url");
String bb = jsonObject.getString("bb");
main.handler.post(() -> new MaterialAlertDialogBuilder(context)
.setTitle("更新" + bb)
.setMessage(msg+"\n"+"取消后不再提示更新你需要到关于软件手动检测")
.setNegativeButton("取消", (dialogInterface, i) -> {
wj.xrwb(wj.filesdri + "gx.mq", null);
})
.setPositiveButton("更新", (dialogInterface, i) -> context.startActivity(new Intent(Intent.ACTION_VIEW,
Uri.parse(url))))
// new ApkDownloader(context).downloadAndInstall(url, wj.filesdri))
.show());
}
//1表示需要更新
return code ? 1 : 0;
} catch (Exception e) {
sc(e);
}
return 400;
}
}

View File

@ -1,7 +1,6 @@
package com.muqingbfq.mq;
import android.Manifest;
import android.annotation.SuppressLint;
import android.app.DownloadManager;
import android.content.BroadcastReceiver;
import android.content.Context;
@ -32,19 +31,15 @@ import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import com.muqingbfq.R;
import java.io.File;
import java.util.Locale;
public class llq extends AppCompatActivity {
WebView web;
Toolbar toolbar;
@SuppressLint({"DefaultLocale", "ObsoleteSdkInt"})
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_llq);
Intent intent = getIntent();
toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
@ -136,7 +131,6 @@ public class llq extends AppCompatActivity {
@Override
public void onProgressChanged(WebView view, int newProgress) {
super.onProgressChanged(view, newProgress);
gj.sc(newProgress);
if (newProgress == 100) {
progressBar.setVisibility(View.GONE);
} else {

View File

@ -8,7 +8,6 @@ import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
@ -34,39 +33,24 @@ public class wj {
mp3_xz = gd + mp3_xz;
mp3_like = gd + mp3_like;
tx = filesdri + tx;
if (!new File(mp3).exists()) {
new File(mp3).mkdirs();
}
if (!new File(gd).exists()) {
new File(gd).mkdirs();
}
} catch (Exception e) {
yc.start(context, e);
}
}
public static boolean new_wj(String string) {
File file = new File(string);
if (file.getParentFile().exists()) {
file.getParentFile().mkdirs();
}
try {
return file.createNewFile();
} catch (IOException e) {
gj.sc(e);
}
return false;
}
/*
* 这里定义的是一个文件保存的方法写入到文件中所以是输出流
* */
public static boolean xrwb(String url, String text) {
if (text == null) {
text = "";
}
File file = new File(url);
//如果文件不存在创建文件
try {
if (file.getParentFile().exists()) {
file.getParentFile().mkdirs();
File parentFile = file.getParentFile();
if (!parentFile.exists()) {
parentFile.mkdirs();
}
if (!file.exists())
file.createNewFile();
@ -104,6 +88,10 @@ public class wj {
return new File(url).exists();
}
public static boolean cz(File file) {
return file.exists();
}
public static boolean sc(String url) {
File file = new File(url);
return file.delete();
@ -145,20 +133,4 @@ public class wj {
}
return null;
}
public static class xrwb extends Thread {
String url, text;
public xrwb(String url, String text) {
this.url = url;
this.text = text;
start();
}
@Override
public void run() {
super.run();
xrwb(url, text);
}
}
}

View File

@ -27,8 +27,9 @@ public class wl {
}
public static boolean iskong() {
return Cookie.equals("") || Cookie == null;
return Cookie.equals("");
}
public static String hq(String url) {
try {
OkHttpClient client = new OkHttpClient();
@ -74,57 +75,59 @@ public class wl {
@Override
public void run() {
super.run();
xz(url, x);
try {
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
//访问路径
.url(url)
.build();
Call call = client.newCall(request);
Response response = call.execute();
if (response.isSuccessful()) {
ResponseBody body = response.body();
if (body != null) {
File file = new File(wj.mp3, String.valueOf(x.id));
if (!file.getParentFile().exists()) {
file.getParentFile().mkdirs();
}
InputStream inputStream = body.byteStream();
FileOutputStream fileOutputStream =
new FileOutputStream(file);
// 替换为实际要保存的文件路径
byte[] buffer = new byte[4096];
int bytesRead;
while ((bytesRead = inputStream.read(buffer)) != -1) {
fileOutputStream.write(buffer, 0, bytesRead);
}
fileOutputStream.close();
inputStream.close();
}
}
JSONObject jsonObject = new JSONObject();
if (wj.cz(wj.mp3_xz)) {
jsonObject = new JSONObject(wj.dqwb(wj.mp3_xz));
} else {
jsonObject.put("songs", new JSONArray());
}
JSONArray songs = jsonObject.getJSONArray("songs");
if (songs.length() > 30) {
songs.remove(0);
String id = songs.getJSONObject(0).getString("id");
gj.sc(wj.mp3 + id);
new File(wj.mp3+id).delete();
}
File file = new File(wj.mp3);
JSONObject json = new JSONObject();
json.put("id", x.id);
json.put("name", x.name);
json.put("zz", x.zz);
json.put("picUrl", x.picurl);
songs.put(json);
wj.xrwb(wj.mp3_xz, jsonObject.toString());
} catch (Exception e) {
gj.sc("wl xz " + e);
}
}
}
public static boolean xz(String url, final xm x) {
try {
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
//访问路径
.url(url)
.build();
Call call = client.newCall(request);
Response response = call.execute();
if (response.isSuccessful()) {
ResponseBody body = response.body();
if (body != null) {
File file = new File(wj.mp3, String.valueOf(x.id));
InputStream inputStream = body.byteStream();
FileOutputStream fileOutputStream =
new FileOutputStream(file);
// 替换为实际要保存的文件路径
byte[] buffer = new byte[4096];
int bytesRead;
while ((bytesRead = inputStream.read(buffer)) != -1) {
fileOutputStream.write(buffer, 0, bytesRead);
}
fileOutputStream.close();
inputStream.close();
}
}
JSONObject jsonObject = new JSONObject();
if (wj.cz(wj.mp3_xz)) {
jsonObject = new JSONObject(wj.dqwb(wj.mp3_xz));
} else {
jsonObject.put("songs", new JSONArray());
}
JSONArray songs = jsonObject.getJSONArray("songs");
if (songs.length() > 30) {
songs.remove(0);
}
JSONObject json = new JSONObject();
json.put("id", x.id);
json.put("name", x.name);
json.put("zz", x.zz);
json.put("picUrl", x.picurl);
songs.put(json);
wj.xrwb(wj.mp3_xz, jsonObject.toString());
return true;
} catch (Exception e) {
gj.sc("wl xz " + e);
}
return false;
}
}

View File

@ -1,171 +1,51 @@
package com.muqingbfq;
import android.Manifest;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.content.res.Resources;
import android.media.MediaPlayer;
import android.os.Build;
import android.os.Bundle;
import android.os.Environment;
import android.provider.Settings;
import android.util.DisplayMetrics;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.annotation.RequiresApi;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.app.AppCompatDelegate;
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;
import com.muqingbfq.login.visitor;
import com.muqingbfq.mq.gj;
import com.muqingbfq.mq.wj;
import com.muqingbfq.mq.wl;
public class start extends AppCompatActivity {
public static int ztl, dhl;
Intent home;
@RequiresApi(api = Build.VERSION_CODES.O)
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
try {
home = new Intent(this, home.class);
ztl = getNavigationBarHeight(this);
dhl = getStatusBarHeight(this);
DisplayMetrics dm = getResources().getDisplayMetrics();
main.k = dm.widthPixels;
main.g = dm.heightPixels;
} catch (Exception e) {
yc.start(this, e);
}
if (Build.VERSION.SDK_INT >= 33) {
int checkPermission =
ContextCompat.checkSelfPermission(this, Manifest.permission.POST_NOTIFICATIONS);
if (checkPermission != PackageManager.PERMISSION_GRANTED) {
//动态申请
ActivityCompat.requestPermissions(this, new String[]{
Manifest.permission.POST_NOTIFICATIONS}, REQUEST_EXTERNAL_STORAGE);
} else {
startApp();
}
} else {
startApp();
}
// checkPermission();
}
public static long time;
@Override
protected void onResume() {
super.onResume();
}
public static int getStatusBarHeight(Context context) {
int result = 0;
@SuppressLint({"InternalInsetResource", "DiscouragedApi"}) int resourceId = context.getResources().getIdentifier("status_bar_height", "dimen", "android");
if (resourceId > 0) {
result = context.getResources().getDimensionPixelSize(resourceId);
}
return result;
}
private int getNavigationBarHeight(Context context) {
Resources resources = context.getResources();
@SuppressLint({"InternalInsetResource", "DiscouragedApi"}) int resourceId = resources.getIdentifier("navigation_bar_height", "dimen", "android");
return resources.getDimensionPixelSize(resourceId);
}
private static final int REQUEST_EXTERNAL_STORAGE = 1;
private static final String[] PERMISSIONS_STORAGE = {android.Manifest.permission.READ_EXTERNAL_STORAGE, android.Manifest.permission.WRITE_EXTERNAL_STORAGE};
private AlertDialog dialog;
@SuppressLint("ObsoleteSdkInt")
private void checkPermission() {
//检查权限NEED_PERMISSION是否被授权 PackageManager.PERMISSION_GRANTED表示同意授权
if (Build.VERSION.SDK_INT >= 30) {
if (!Environment.isExternalStorageManager()) {
if (dialog != null) {
dialog.dismiss();
dialog = null;
}
dialog = new AlertDialog.Builder(this).setTitle("提示")//设置标题
.setMessage("请开启文件访问权限,否则无法正常使用本应用!").setNegativeButton("取消", (dialog, i) -> dialog.dismiss()).setPositiveButton("确定", (dialog, which) -> {
dialog.dismiss();
Intent intent = new Intent(Settings.ACTION_MANAGE_ALL_FILES_ACCESS_PERMISSION);
startActivity(intent);
}).create();
dialog.show();
} else {
gj.sc("Android 11以上当前已有权限");
startApp();
}
} else {
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.M) {
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
//申请权限
if (dialog != null) {
dialog.dismiss();
dialog = null;
}
dialog = new AlertDialog.Builder(this).setTitle("提示")//设置标题
.setMessage("请开启文件访问权限,否则无法正常使用本应用!").setPositiveButton("确定", (dialog, which) -> {
dialog.dismiss();
ActivityCompat.requestPermissions(this, PERMISSIONS_STORAGE, REQUEST_EXTERNAL_STORAGE);
}).create();
dialog.show();
} else {
gj.sc("Android 6.0以上11以下当前已有权限");
startApp();
}
} else {
gj.sc("Android 6.0以下,已获取权限");
startApp();
}
}
}
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
if (requestCode == REQUEST_EXTERNAL_STORAGE) {
if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
Toast.makeText(this, "授权成功!", Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(this, "授权被拒绝!", Toast.LENGTH_SHORT).show();
}
}
home = new Intent(this, home.class);
DisplayMetrics dm = getResources().getDisplayMetrics();
main.k = dm.widthPixels;
main.g = dm.heightPixels;
startApp();
}
private void startApp() {
SharedPreferences theme = getSharedPreferences("theme", MODE_PRIVATE);
@SuppressLint("CommitPrefEdits") SharedPreferences.Editor edit = theme.edit();
int i = theme.getInt("theme", AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM);
if (i == -1) {
edit.putInt("theme", AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM);
}
AppCompatDelegate.setDefaultNightMode(i);
wl.Cookie = main.sp.getString(main.Cookie, "");
if (wl.Cookie.equals("")) {
new visitor(this, home);
} else {
if (wj.filesdri == null) {
new wj(this);
}
startActivity(home);
finish();
}
private void startApp() {
SharedPreferences theme = getSharedPreferences("theme", MODE_PRIVATE);
@SuppressLint("CommitPrefEdits") SharedPreferences.Editor edit = theme.edit();
int i = theme.getInt("theme", AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM);
if (i == AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM) {
edit.putInt("theme", AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM);
edit.apply();
}
AppCompatDelegate.setDefaultNightMode(i);
wl.Cookie = main.sp.getString(main.Cookie, "");
if (wj.filesdri == null) {
new wj(this);
}
if (wl.Cookie.equals("")) {
new visitor(this, home);
} else {
startActivity(home);
finish();
}
}
}

View File

@ -1,9 +1,17 @@
package com.muqingbfq;
import android.annotation.SuppressLint;
import android.content.Intent;
import android.content.SharedPreferences;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.provider.Settings;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
@ -20,7 +28,15 @@ public class sz extends AppCompatActivity {
Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
UI();
// UI();
// kaifazhe();
}
/**
* 建立底部浮动栏的方法
*/
public void CreateFloatView(){
View mFloatView = LayoutInflater.from(getBaseContext()).inflate(R.layout.fragment_bfq_db,null);
}
@SuppressLint("ApplySharedPref")
@ -70,4 +86,32 @@ public class sz extends AppCompatActivity {
}
return super.onOptionsItemSelected(item);
}
public void kaifazhe() {
MaterialSwitch materialSwitch = findViewById(R.id.switch_kfz);
materialSwitch.setOnCheckedChangeListener((compoundButton, b) -> {
if (b) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M &&
!Settings.canDrawOverlays(this)) {
Intent intent = new Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION,
Uri.parse("package:" + getPackageName()));
startActivityForResult(intent, 114511);
} else {
com.muqingbfq.mq.floating.start(sz.this);
}
} else {
com.muqingbfq.mq.floating.end(sz.this);
}
});
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == 114511) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && Settings.canDrawOverlays(this)) {
com.muqingbfq.mq.floating.start(sz.this);
}
}
}
}

View File

@ -1,26 +1,49 @@
package com.muqingbfq;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.provider.Settings;
import android.util.DisplayMetrics;
import android.widget.TextView;
import android.widget.Toast;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
public class yc extends AppCompatActivity {
public static Object exception;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_yc);
TextView text = findViewById(R.id.text);
try {
text.setText(exception.toString());
} catch (Exception e) {
Toast.makeText(this, e.toString(), Toast.LENGTH_SHORT).show();
}
String deviceModel = Build.MODEL;
String deviceManufacturer = Build.MANUFACTURER;
String osVersion = Build.VERSION.RELEASE;
int sdkVersion = Build.VERSION.SDK_INT;
@SuppressLint("HardwareIds") String deviceId = Settings.Secure.getString(getContentResolver(), Settings.Secure.ANDROID_ID);
DisplayMetrics metrics = getResources().getDisplayMetrics();
int widthPixels = metrics.widthPixels;
int heightPixels = metrics.heightPixels;
float density = metrics.density;
int densityDpi = metrics.densityDpi;
// 假设你已经获取到了手机信息保存在相应的变量中
String wb = "设备型号:" + deviceModel + "\n"
+ "制造商:" + deviceManufacturer + "\n"
+ "设备ID" + deviceId + "\n"
+ "操作系统版本:" + osVersion + "\n"
+ "SDK版本" + sdkVersion + "\n"
+ "屏幕尺寸:" + widthPixels + "x" + heightPixels + "\n"
+ "屏幕密度:" + density + "\n"
+ "密度DPI" + densityDpi + "\n" +
"异常信息: " + exception.toString();
text.setText(wb);
}
public static void start(Object e) {
@ -29,6 +52,15 @@ public class yc extends AppCompatActivity {
public static void start(Context context, Object e) {
yc.exception = e;
context.startActivity(new Intent(context,yc.class));
context.startActivity(new Intent(context, yc.class));
}
public static void tc(Context context, Object exception) {
new MaterialAlertDialogBuilder(context)
.setTitle("不是特别重要的警告")
.setMessage(exception.toString())
.setNegativeButton("无视", null)
.setPositiveButton("分享", null)
.show();
}
}

View File

@ -5,6 +5,6 @@
android:viewportWidth="80"
android:viewportHeight="80">
<path
android:fillColor="@color/bj"
android:fillColor="#FFFFFF"
android:pathData="M0,0h80v80h-80z" />
</vector>

View File

@ -9,9 +9,9 @@
android:translateY="261.6889">
<path
android:pathData="M995,538.7c-13.8,-8.9 -30.3,-12 -46.4,-8.5l-182.9,39.3c-28.2,6.1 -48.6,31.4 -48.6,60.2v224.6c0,21.8 -17.7,39.5 -39.6,39.5 -21.8,0 -39.5,-17.7 -39.5,-39.5s17.7,-39.6 39.5,-39.6c15.4,0 27.8,-12.4 27.8,-27.8s-12.4,-27.8 -27.8,-27.8c-52.4,0 -95.1,42.7 -95.1,95.2 0,52.4 42.7,95.1 95.1,95.1 52.5,0 95.1,-42.7 95.1,-95.1V629.8c0,-2.9 2,-5.3 4.8,-5.9l182.9,-39.3c1.9,-0.5 3.6,0.2 4.5,0.8 1,0.6 2.2,1.8 2.7,5V814c0,21.8 -17.7,39.6 -39.6,39.6 -10.5,0 -20.5,-4.1 -27.9,-11.6 -7.5,-7.5 -11.6,-17.4 -11.6,-28 0,-21.8 17.7,-39.6 39.6,-39.6 15.4,0 27.8,-12.4 27.8,-27.8s-12.4,-27.8 -27.8,-27.8c-52.5,0 -95.1,42.7 -95.1,95.1 0,25.4 9.9,49.3 27.9,67.3s41.8,27.9 67.2,27.9c52.5,0 95.1,-42.7 95.1,-95.1V590.5c0,-4.4 -0.5,-8.7 -1.4,-12.9 -3.4,-16.1 -12.9,-29.9 -26.7,-38.9z"
android:fillColor="@color/text"/>
android:fillColor="#000000"/>
<path
android:pathData="M338.3,315.1c35.3,-63.9 90.4,-114.1 158.6,-143.6 81.4,-35.2 171.7,-36.6 254.1,-3.9 106.7,42.3 183,134.9 204.1,247.8 3.1,16.7 17.7,28.4 34.1,28.4 2.1,0 4.3,-0.2 6.4,-0.6 18.9,-3.5 31.3,-21.7 27.8,-40.5C997.9,266.2 905.7,154.1 776.6,103c-99.7,-39.5 -208.8,-37.8 -307.3,4.7 -92.5,40 -165.1,111.6 -206.4,202.8 -48.9,3.6 -96.2,19.8 -137.8,48C62.2,400.9 19.7,465.3 5.3,539.7c-14.4,74.4 1,150 43.5,212.9 52.9,78.3 140.8,125 235.2,125h153.3c19.2,0 34.7,-15.6 34.7,-34.7s-15.6,-34.7 -34.7,-34.7H284c-71.3,0 -137.7,-35.3 -177.7,-94.4C74.2,666.3 62.6,609.3 73.5,553c10.9,-56.2 43,-104.8 90.5,-136.9 47.5,-32.1 104.5,-43.7 160.8,-32.8 56.2,10.9 104.8,43 136.9,90.5 10.7,15.9 32.3,20.1 48.2,9.3 15.9,-10.7 20.1,-32.3 9.3,-48.2 -42.4,-62.8 -106.6,-105.3 -180.9,-119.8z"
android:fillColor="@color/text"/>
android:fillColor="#000000"/>
</group>
</vector>

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners
android:topLeftRadius="15dp"
android:topRightRadius="15dp" />
android:topLeftRadius="16dp"
android:topRightRadius="16dp" />
<solid android:color="@color/bj" />
</shape>

View File

@ -48,12 +48,21 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="6dp">
android:padding="6dp"
android:orientation="vertical">
<Button
android:id="@+id/button1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/jianchagegnxin"
android:textColor="@color/bj" />
<Button
android:id="@+id/button2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/juanzeng"
android:textColor="@color/bj"
tools:ignore="VisualLintButtonSize" />
android:textColor="@color/bj" />
</LinearLayout>
</LinearLayout>

View File

@ -18,39 +18,32 @@
android:id="@+id/user1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:orientation="vertical">
<com.google.android.material.textfield.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="50dp"
android:layout_marginEnd="16dp"
android:hint="用户名/账号">
android:layout_marginTop="20dp"
android:hint="UID">
<EditText
android:id="@+id/edit_user"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textEmailAddress" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="20dp"
android:layout_marginEnd="16dp"
app:passwordToggleEnabled="true"
android:hint="密码">
<EditText
android:id="@+id/edit_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textPassword" />
</com.google.android.material.textfield.TextInputLayout>
<Button
android:id="@+id/edit_cookie"
android:layout_width="wrap_content"
@ -58,8 +51,6 @@
android:text="绑定网易云音乐"
android:layout_margin="16dp"
android:layout_gravity="end"/>
<Button
android:id="@+id/enroll"
android:layout_width="match_parent"
@ -69,5 +60,5 @@
android:layout_marginEnd="16dp"
android:text="注册"
android:textColor="@color/bj" />
</LinearLayout>=
</LinearLayout>
</LinearLayout>

View File

@ -28,10 +28,12 @@
android:layout_weight="1"
android:name="com.muqingbfq.fragment.gd"
tools:layout="@layout/fragment_gd" />
<FrameLayout
<androidx.fragment.app.FragmentContainerView
android:id="@+id/bfq_db"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
android:layout_height="wrap_content"
android:name="com.muqingbfq.fragment.bfq_db"
tools:layout="@layout/fragment_bfq_db" />
</androidx.appcompat.widget.LinearLayoutCompat>
<com.google.android.material.navigation.NavigationView
android:id="@+id/chb"

View File

@ -1,6 +1,5 @@
<?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"
<LinearLayout 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"
@ -27,53 +26,60 @@
tools:ignore="TextContrastCheck,VisualLintTextFieldSize" />
</androidx.appcompat.widget.Toolbar>
<RelativeLayout
android:id="@+id/xxbj1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@id/toolbar"
android:orientation="vertical">
android:layout_height="0dp"
android:layout_weight="1">
<LinearLayout
android:id="@+id/xxbj2"
android:id="@+id/xxbj1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="6dp"
tools:ignore="UseCompoundDrawables">
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/lishijilu"
android:textColor="@color/text"
android:textSize="26sp" />
<ImageView
android:id="@+id/deleat"
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_marginEnd="16dp"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:contentDescription="@string/deleat"
android:src="@drawable/deleat" />
android:orientation="horizontal"
android:padding="6dp"
tools:ignore="UseCompoundDrawables">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/lishijilu"
android:textColor="@color/text"
android:textSize="26sp" />
<ImageView
android:id="@+id/deleat"
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_marginEnd="16dp"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:contentDescription="@string/deleat"
android:src="@drawable/deleat" />
</LinearLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/list_recycler"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"/>
</LinearLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/list_recycler"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_below="@id/xxbj2"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" />
<FrameLayout
<androidx.fragment.app.FragmentContainerView
android:id="@+id/search_fragment"
android:layout_width="match_parent"
android:layout_height="match_parent" />
android:layout_height="match_parent"
android:name="com.muqingbfq.fragment.search"
tools:layout="@layout/fragment_search" />
<ListView
android:id="@+id/search_recycler"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone"
android:background="@color/bj"/>
</RelativeLayout>
<ListView
android:id="@+id/search_recycler"
<androidx.fragment.app.FragmentContainerView
android:id="@+id/bfq_db"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@id/toolbar"
android:visibility="gone"
android:background="@color/bj"/>
android:layout_height="wrap_content"
android:name="com.muqingbfq.fragment.bfq_db"
tools:layout="@layout/fragment_bfq_db" />
</RelativeLayout>
</LinearLayout>

View File

@ -16,36 +16,57 @@
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="16dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="主题模式"
android:textSize="20dp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<com.google.android.material.materialswitch.MaterialSwitch
android:id="@+id/switch_a1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checked="true"
android:text="根据系统" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="主题模式"
android:textSize="20sp" />
<com.google.android.material.materialswitch.MaterialSwitch
android:id="@+id/switch_a2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="26dp"
android:enabled="false"
android:text="深色模式" />
<com.google.android.material.materialswitch.MaterialSwitch
android:id="@+id/switch_a1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checked="true"
android:text="根据系统" />
<com.google.android.material.materialswitch.MaterialSwitch
android:id="@+id/switch_a2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="26dp"
android:enabled="false"
android:text="深色模式" />
</LinearLayout>
<com.google.android.material.divider.MaterialDivider
android:id="@+id/materialDivider"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<com.google.android.material.materialswitch.MaterialSwitch
android:id="@+id/switch_kfz"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="开发者模式" />
</LinearLayout>
</LinearLayout>
</androidx.core.widget.NestedScrollView>
</LinearLayout>

View File

@ -33,7 +33,8 @@
android:layout_marginStart="16dp"
android:layout_marginTop="50dp"
android:layout_marginEnd="16dp"
android:hint="用户名/账号">
android:hint="UID">
<EditText
android:id="@+id/edit_user"
android:layout_width="match_parent"
@ -52,7 +53,8 @@
android:id="@+id/edit_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textPassword" />
android:inputType="textPassword"
android:textColorHint="#546E7A" />
</com.google.android.material.textfield.TextInputLayout>

View File

@ -4,16 +4,25 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:gravity="center"
android:padding="16dp"
tools:context=".yc">
<TextView
android:id="@+id/text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_width="match_parent"
android:layout_height="0dp"
android:textColor="@android:color/holo_red_dark"
android:textSize="18sp"
android:textStyle="bold"
android:gravity="center"
android:padding="16dp"
tools:text="出现异常" />
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/fx"/>
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/quxiao" />
</LinearLayout>

View File

@ -2,66 +2,65 @@
<LinearLayout 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/bfq"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:fillViewport="true"
android:orientation="vertical">
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:title="">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="@+id/name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:singleLine="true"
android:text="@string/name"
android:textColor="@color/text"
android:textSize="16sp" />
<TextView
android:id="@+id/zz"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:maxLines="2"
android:text="@string/zz" />
</LinearLayout>
</androidx.appcompat.widget.Toolbar>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="horizontal">
<LinearLayout
android:orientation="vertical">
<RelativeLayout
android:id="@+id/kp1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:layout_weight="1">
android:layout_weight="1"
android:gravity="center_vertical"
tools:ignore="NestedWeights">
<com.google.android.material.card.MaterialCardView
android:id="@+id/view1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:cardCornerRadius="16dp"
android:layout_centerHorizontal="true"
app:cardUseCompatPadding="true">
<ImageView
android:id="@+id/mttx"
android:layout_width="260dp"
android:layout_height="260dp"
android:importantForAccessibility="no"
android:scaleType="fitXY"
android:src="@drawable/icon" />
</com.google.android.material.card.MaterialCardView>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/view1"
android:layout_alignStart="@id/view1"
android:orientation="vertical">
<TextView
android:id="@+id/name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
android:text="@string/name"
android:textColor="@color/text"
android:textSize="26sp" />
<TextView
android:id="@+id/zz"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:maxLines="2"
android:text="@string/zz"
android:textSize="20sp" />
</LinearLayout>
</RelativeLayout>
<com.dirror.lyricviewx.LyricViewX
android:id="@+id/gc"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:layout_weight="3"
app:lrcCurrentTextColor="@color/text"
app:lrcLabel="@string/app_name"
app:lrcNormalTextSize="16sp"
@ -70,75 +69,85 @@
app:lrcTimelineTextColor="@color/text_tm"
tools:ignore="MissingConstraints" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingEnd="16dp"
android:paddingStart="16dp">
android:paddingStart="16dp"
android:paddingEnd="16dp">
<ImageView
android:id="@+id/like"
android:layout_width="36dp"
android:layout_height="36dp"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:src="@mipmap/like"
app:tint="@color/text" />
app:tint="@color/text"
tools:ignore="ContentDescription" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingStart="3dp"
android:paddingEnd="3dp"
android:orientation="horizontal">
android:paddingEnd="3dp">
<TextView
android:id="@+id/time_a"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/_00_00"/>
android:text="@string/_00_00" />
<SeekBar
android:id="@+id/tdt"
android:layout_width="0dp"
android:layout_height="48dp"
android:layout_weight="1"
android:clickable="true"
android:padding="6dp"
android:focusable="true" />
android:focusable="true"
android:padding="6dp" />
<TextView
android:id="@+id/time_b"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/_00_00"/>
android:text="@string/_00_00" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingEnd="20dp"
android:paddingStart="20dp"
android:paddingBottom="26dp"
android:gravity="center"
android:orientation="horizontal">
android:orientation="horizontal"
android:paddingStart="20dp"
android:paddingEnd="20dp"
android:paddingBottom="26dp">
<ImageView
android:id="@+id/control"
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_marginEnd="26dp"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:src="@drawable/mt_sx" />
android:src="@drawable/mt_sx"
tools:ignore="ContentDescription" />
<ImageView
android:id="@+id/syq"
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_marginEnd="12dp"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:src="@drawable/syq" />
android:src="@drawable/syq"
tools:ignore="ContentDescription" />
<ImageView
android:id="@+id/kg"
android:layout_width="46dp"
android:layout_height="46dp"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:src="@drawable/zt" />
android:src="@drawable/zt"
tools:ignore="ContentDescription" />
<ImageView
android:id="@+id/xyq"
@ -146,13 +155,16 @@
android:layout_height="36dp"
android:layout_marginStart="12dp"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:importantForAccessibility="no"
android:src="@drawable/xyq" />
<ImageView
android:id="@+id/bfq_list_mp3"
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_marginStart="26dp"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:src="@drawable/cd" />
android:src="@drawable/cd"
tools:ignore="ContentDescription" />
</LinearLayout>
</LinearLayout>

View File

@ -5,8 +5,7 @@
android:layout_height="wrap_content"
xmlns:app="http://schemas.android.com/apk/res-auto"
app:cardUseCompatPadding="true"
app:cardCornerRadius="16dp"
tools:context=".fragment.bfq_db">
app:cardCornerRadius="16dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
@ -56,9 +55,9 @@
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_margin="6dp"
app:tint="@color/text"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:src="@drawable/cd" />
</LinearLayout>
</LinearLayout>
</com.google.android.material.card.MaterialCardView>

View File

@ -3,7 +3,6 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<com.google.android.material.tabs.TabLayout
android:id="@+id/tablayout"
android:layout_width="match_parent"
@ -16,5 +15,4 @@
android:columnWidth="120dp"
android:numColumns="auto_fit"
android:stretchMode="columnWidth" />
</LinearLayout>

View File

@ -2,8 +2,8 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical">
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
@ -11,5 +11,12 @@
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/lb"
android:layout_width="match_parent"
android:layout_height="match_parent" />
android:layout_height="0dp"
android:layout_weight="1"/>
<androidx.fragment.app.FragmentContainerView
android:id="@+id/bfq_db"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:name="com.muqingbfq.fragment.bfq_db"
tools:layout="@layout/fragment_bfq_db" />
</LinearLayout>

View File

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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">

View File

@ -8,12 +8,13 @@
tools:context=".fragment.sz"
android:fitsSystemWindows="true"
android:focusable="true">
<RelativeLayout
<LinearLayout
android:id="@+id/xdbj"
android:layout_margin="6dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="6dp"
android:orientation="horizontal"
tools:ignore="UselessParent">
<com.google.android.material.card.MaterialCardView
android:id="@+id/cardview"
@ -27,21 +28,27 @@
android:layout_height="match_parent"
android:src="@drawable/icon" />
</com.google.android.material.card.MaterialCardView>
<TextView
android:id="@+id/sz_text1"
android:layout_width="match_parent"
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_toEndOf="@id/cardview"
android:text="@string/denglu"
android:textSize="26sp" />
<TextView
android:id="@+id/sz_text2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/sz_text1"
android:layout_marginTop="6dp"
android:layout_marginBottom="35dp"
android:layout_toEndOf="@id/cardview"
android:text="我是一名小小的游客" />
</RelativeLayout>
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:id="@+id/sz_text1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_toEndOf="@id/cardview"
android:text="@string/denglu"
android:textSize="26sp" />
<TextView
android:id="@+id/sz_text2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/sz_text1"
android:layout_marginTop="6dp"
android:layout_marginBottom="35dp"
android:layout_toEndOf="@id/cardview"
android:text="我是一名小小的游客" />
</LinearLayout>
</LinearLayout>
</androidx.appcompat.widget.LinearLayoutCompat>

View File

@ -2,14 +2,18 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/ui_editview"
android:layout_margin="6dp"
android:padding="16dp">
<TextView
xmlns:app="http://schemas.android.com/apk/res-auto">
<Button
android:id="@+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/text"
android:textColor="@color/text"
android:textSize="16sp"
android:text="@string/name"/>
android:text="@string/app_name"
android:backgroundTint="@android:color/transparent"
android:textColor="?attr/colorOnSurface"
android:textAppearance="?attr/textAppearanceLabelLarge"
android:layout_marginStart="6dp"
app:strokeColor="?attr/colorOnSurface"
app:strokeWidth="1dp"
app:elevation="0dp"
app:rippleColor="?attr/colorOnSurface"/>
</LinearLayout>

View File

@ -1,70 +0,0 @@
<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="wrap_content"
android:orientation="vertical">
<ImageView
android:id="@+id/logo"
android:layout_width="100dp"
android:layout_height="100dp"
android:padding="6dp"
android:src="@drawable/icon" />
<LinearLayout
android:id="@+id/xxbj1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_toEndOf="@+id/logo"
android:orientation="vertical">
<TextView
android:id="@+id/name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:singleLine="true"
android:text="@string/name"
android:textColor="@color/text"
android:textSize="16sp" />
<TextView
android:id="@+id/zz"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:singleLine="true"
android:text="@string/zz"
android:textSize="14sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/xxbj1"
android:layout_alignBottom="@id/logo"
android:layout_toEndOf="@+id/logo"
android:gravity="center">
<ImageView
android:id="@+id/syq"
android:layout_width="48dp"
android:layout_height="48dp"
android:background="@drawable/bw"
android:src="@drawable/syq" />
<ImageView
android:id="@+id/kg"
android:layout_width="48dp"
android:layout_height="48dp"
android:background="@drawable/bw"
android:src="@drawable/zt" />
<ImageView
android:id="@+id/xyq"
android:layout_width="48dp"
android:layout_height="48dp"
android:background="@drawable/bw"
android:src="@drawable/xyq" />
</LinearLayout>
</RelativeLayout>

View File

@ -24,7 +24,7 @@
<string name="tuichudenglu">退出登录</string>
<string name="search">搜索</string>
<string name="about">关于软件</string>
<string name="juanzeng">捐赠软件</string>
<string name="juanzeng">投币</string>
<string name="fuwuzhongxing">服务中心</string>
<string name="shezhizhongxing">设置中心</string>
<string name="chucunqingli">储存清理</string>
@ -37,6 +37,8 @@
<string name="_00_00">00:00</string>
<string name="music">音乐</string>
<string name="Playlist">歌单</string>
<string name="quxiao">取消</string>
<string name="jianchagegnxin">检查更新</string>
<string-array name="gd_list">
<item>下载歌单</item>
<item>收藏歌单(不可用)</item>

View File

@ -1,6 +1,4 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
id 'com.android.application' version '8.1.0' apply false
id 'com.android.library' version '7.1.3' apply false
id 'org.jetbrains.kotlin.android' version '1.6.20' apply false
}

Binary file not shown.

View File

@ -1,4 +1,4 @@
#Sat Oct 21 17:18:56 CST 2023
#Sat Nov 18 17:46:31 CST 2023
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip

275
gradlew vendored
View File

@ -1,7 +1,7 @@
#!/usr/bin/env sh
#!/bin/sh
#
# Copyright 2015 the original author or authors.
# Copyright © 2015-2021 the original authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@ -17,67 +17,101 @@
#
##############################################################################
##
## Gradle start up script for UN*X
##
#
# Gradle start up script for POSIX generated by Gradle.
#
# Important for running:
#
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
# noncompliant, but you have some other compliant shell such as ksh or
# bash, then to run this script, type that shell name before the whole
# command line, like:
#
# ksh Gradle
#
# Busybox and similar reduced shells will NOT work, because this script
# requires all of these POSIX shell features:
# * functions;
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
# * compound commands having a testable exit status, especially «case»;
# * various built-in commands including «command», «set», and «ulimit».
#
# Important for patching:
#
# (2) This script targets any POSIX shell, so it avoids extensions provided
# by Bash, Ksh, etc; in particular arrays are avoided.
#
# The "traditional" practice of packing multiple parameters into a
# space-separated string is a well documented source of bugs and security
# problems, so this is (mostly) avoided, by progressively accumulating
# options in "$@", and eventually passing that to Java.
#
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
# see the in-line comments for details.
#
# There are tweaks for specific operating systems such as AIX, CygWin,
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
#
##############################################################################
# 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
app_path=$0
# Need this for daisy-chained symlinks.
while
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
[ -h "$app_path" ]
do
ls=$( ls -ld "$app_path" )
link=${ls#*' -> '}
case $link in #(
/*) app_path=$link ;; #(
*) app_path=$APP_HOME$link ;;
esac
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
APP_BASE_NAME=${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"
MAX_FD=maximum
warn () {
echo "$*"
}
} >&2
die () {
echo
echo "$*"
echo
exit 1
}
} >&2
# 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
;;
case "$( uname )" in #(
CYGWIN* ) cygwin=true ;; #(
Darwin* ) darwin=true ;; #(
MSYS* | MINGW* ) msys=true ;; #(
NONSTOP* ) nonstop=true ;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
@ -87,9 +121,9 @@ CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
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"
JAVACMD=$JAVA_HOME/jre/sh/java
else
JAVACMD="$JAVA_HOME/bin/java"
JAVACMD=$JAVA_HOME/bin/java
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
@ -98,7 +132,7 @@ Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
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
@ -106,80 +140,101 @@ 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" ;;
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
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, stacking in reverse order:
# * args from the command line
# * the main class name
# * -classpath
# * -D...appname settings
# * --module-path (only if needed)
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
# 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"
# For Cygwin or MSYS, switch paths to Windows format before running java
if "$cygwin" || "$msys" ; then
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
JAVACMD=$( cygpath --unix "$JAVACMD" )
# Now convert the arguments - kludge to limit ourselves to /bin/sh
for arg do
if
case $arg in #(
-*) false ;; # don't mess with options #(
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
[ -e "$t" ] ;; #(
*) false ;;
esac
then
arg=$( cygpath --path --ignore --mixed "$arg" )
fi
# Roll the args list around exactly as many times as the number of
# args, so each arg winds up back in the position where it started, but
# possibly modified.
#
# NB: a `for` loop captures its iteration list before it begins, so
# changing the positional parameters here affects neither the number of
# iterations, nor the values presented in `arg`.
shift # remove old arg
set -- "$@" "$arg" # push replacement arg
done
fi
# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
# double quotes to make sure that they get re-expanded; and
# * put everything else in single quotes, so that it's not re-expanded.
set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
-classpath "$CLASSPATH" \
org.gradle.wrapper.GradleWrapperMain \
"$@"
# Stop when "xargs" is not available.
if ! command -v xargs >/dev/null 2>&1
then
die "xargs is not available"
fi
# Use "xargs" to parse quoted args.
#
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
#
# In Bash we could simply go:
#
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
# set -- "${ARGS[@]}" "$@"
#
# but POSIX shell has neither arrays nor command substitution, so instead we
# post-process each arg (as a line of input to sed) to backslash-escape any
# character that might be a shell metacharacter, then use eval to reverse
# that process (while maintaining the separation between arguments), and wrap
# the whole thing up as a single "set" statement.
#
# This will of course break if any of these variables contains a newline or
# an unmatched quote.
#
eval "set -- $(
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
xargs -n1 |
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
tr '\n' ' '
)" '"$@"'
exec "$JAVACMD" "$@"

14
gradlew.bat vendored
View File

@ -14,7 +14,7 @@
@rem limitations under the License.
@rem
@if "%DEBUG%" == "" @echo off
@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@ -25,7 +25,7 @@
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
if "%DIRNAME%"=="" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@ -40,7 +40,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto execute
if %ERRORLEVEL% equ 0 goto execute
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
@ -75,13 +75,15 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
if %ERRORLEVEL% equ 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
set EXIT_CODE=%ERRORLEVEL%
if %EXIT_CODE% equ 0 set EXIT_CODE=1
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
exit /b %EXIT_CODE%
:mainEnd
if "%OS%"=="Windows_NT" endlocal