Skip to content

Commit

Permalink
优化 移除无用的日志输出。
Browse files Browse the repository at this point in the history
优化 Popup的弹出位置。
优化 部分文案及其对应的翻译。
修复 Spotify无法使用歌单ID或歌单链接来添加待转换歌单的问题。
修复 在转换结果页返回时,结果文件的路径信息未删除的问题。

Optimized: Removed useless log output.
Optimized: The pop-up position of Popup.
Optimized: Some copywriting and their corresponding translations.
Fixed: Issue where Spotify cannot use playlist ID or playlist link to add to be converted playlists.
Fixed: Issue where the path information of the result file is not deleted when returning from the conversion result page.
  • Loading branch information
Winnie0408 committed May 14, 2024
1 parent 4215d03 commit 4b08957
Show file tree
Hide file tree
Showing 11 changed files with 49 additions and 40 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ android {
minSdk = 26
// targetSdk = 28
targetSdk = 34
versionCode = 59
versionName = "1.4.4"
versionCode = 60
versionName = "1.4.5"

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1776,7 +1776,6 @@ class ConvertPage(
)
databaseFilePath.value = databaseFile.absolutePath

val playlistInfo = response.getJSONObject("items")
val cursor = db.rawQuery(
"SELECT COUNT(*) FROM ${sourceApp.songListTableName} WHERE ${sourceApp.songListId} = ?",
arrayOf(customPlaylistId)
Expand All @@ -1791,17 +1790,17 @@ class ConvertPage(
db.execSQL(
"INSERT INTO ${sourceApp.songListTableName} (${sourceApp.songListId}, ${sourceApp.songListName}, ${sourceApp.musicNum}) VALUES (?, ?, ?)",
arrayOf(
playlistInfo.getString("id"),
playlistInfo.getString("name"),
playlistInfo.getJSONObject("tracks").getInteger("total")
response.getString("id"),
response.getString("name"),
response.getJSONObject("tracks").getInteger("total")
)
)
db.close()
playlistShow.add(0, false)
playlistEnabled.add(0, 0)
playlistId.add(0, playlistInfo.getString("id"))
playlistName.add(0, playlistInfo.getString("name"))
playlistSum.add(0, playlistInfo.getJSONObject("tracks").getInteger("total"))
playlistId.add(0, response.getString("id"))
playlistName.add(0, response.getString("name"))
playlistSum.add(0, response.getJSONObject("tracks").getInteger("total"))
showCustomPlaylistDialog.value = false
showDialogProgressBar.value = false
MyVibrationEffect(
Expand Down Expand Up @@ -2594,7 +2593,6 @@ class ConvertPage(
if (songAlbum.isNullOrBlank() || songAlbum == "null") {
songAlbum = context.getString(R.string.unknown)
}
println(songId)

db.execSQL(
"INSERT INTO ${sourceApp.songListSongInfoTableName} (${sourceApp.songListSongInfoPlaylistId}, ${sourceApp.songListSongInfoSongId}, ${sourceApp.sortField}) VALUES (?, ?, ?)",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ fun ConvertPageUi(
showOriginalSonglist = 1
selectedMultiSourceApp = -1
convertPage.sourcePlaylistFileName.value = ""
convertPage.resultFileLocation.clear()
}
}

Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/com/hwinzniej/musichelper/ui/MySaltUi.kt
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ fun BasicDialog(

@UnstableSaltApi
@Composable
fun ItemPopup( //TODO 根据文字长度自动调整宽度;在对话框内点击,右侧弹出位置可能会出界;横屏点击最右侧,却在最左侧弹出
fun ItemPopup( //TODO 根据文字长度自动调整宽度
state: PopupState,
enabled: Boolean = true,
iconPainter: Painter? = null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ fun SettingsPageUi(
sub = stringResource(R.string.dynamic_color_switcher_sub),
enableHaptic = false,
iconPainter = painterResource(id = R.drawable.color),
iconPaddingValues = PaddingValues(all = 1.7.dp),
iconColor = SaltTheme.colors.text,
hapticStrength = hapticStrength.intValue
)
Expand Down Expand Up @@ -300,7 +301,7 @@ fun SettingsPageUi(
ItemPopup(
state = initialPagePopupMenuState,
iconPainter = painterResource(id = R.drawable.home_screen),
iconPaddingValues = PaddingValues(all = 1.5.dp),
iconPaddingValues = PaddingValues(all = 1.6.dp),
iconColor = SaltTheme.colors.text,
text = stringResource(R.string.home_screen),
selectedItem = if (targetSdkVersion <= 28) {
Expand Down
6 changes: 3 additions & 3 deletions app/src/main/java/com/hwinzniej/musichelper/utils/Tools.kt
Original file line number Diff line number Diff line change
Expand Up @@ -484,13 +484,13 @@ class Tools {
popupWidth: Int,
screenWidthDp: Int
): Float {
val temp = (clickOffsetX / density)
val temp = (clickOffsetX / (density + 0.245f))
return if (temp < 42 + popupWidth / 2) {
16f
} else if (temp > (screenWidthDp - popupWidth)) {
(screenWidthDp - popupWidth - 48).toFloat()
(screenWidthDp - popupWidth - 42).toFloat()
} else {
temp - popupWidth + 65
temp - popupWidth + 84
}
}

Expand Down
49 changes: 29 additions & 20 deletions app/src/main/res/drawable/color.xml
Original file line number Diff line number Diff line change
@@ -1,24 +1,33 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="200dp"
android:height="200dp"
android:viewportWidth="1024"
android:viewportHeight="1024">
<path
android:fillColor="#999999"
android:pathData="M475.2,903.2c-16.8,0 -34.4,-1.6 -53.6,-4l-4.8,-0.8c-136,-20.8 -228.8,-152.8 -232.8,-158.4 -131.2,-200 -65.6,-402.4 58.4,-514.4 123.2,-112 328.8,-160 508.8,-15.2C867.2,304 902.4,433.6 904,439.2v1.6c16.8,91.2 3.2,158.4 -40.8,201.6 -67.2,64.8 -178.4,44 -193.6,40.8 -20.8,-2.4 -36,4 -47.2,17.6 -12,15.2 -14.4,35.2 -10.4,47.2 11.2,33.6 12.8,59.2 4.8,78.4 -23.2,50.4 -70.4,76.8 -141.6,76.8zM424,850.4l4.8,0.8c77.6,12 124.8,-3.2 144,-46.4 0,-0.8 4,-11.2 -6.4,-43.2 -10.4,-28.8 -2.4,-66.4 18.4,-92 21.6,-27.2 53.6,-39.2 91.2,-35.2l2.4,0.8c0.8,0 100,21.6 151.2,-28 31.2,-30.4 40.8,-83.2 27.2,-156.8 -3.2,-10.4 -37.6,-123.2 -136.8,-202.4 -156.8,-128 -336.8,-85.6 -445.6,12.8C174.4,352 100.8,525.6 224,713.6c0.8,0 84.8,120 200,136.8z" />
<path
android:fillColor="#999999"
android:pathData="M284,526.4m-48,0a48,48 0,1 0,96 0,48 48,0 1,0 -96,0Z" />
<path
android:fillColor="#999999"
android:pathData="M340,382.4m-48,0a48,48 0,1 0,96 0,48 48,0 1,0 -96,0Z" />
<path
android:fillColor="#999999"
android:pathData="M484,302.4m-48,0a48,48 0,1 0,96 0,48 48,0 1,0 -96,0Z" />
<path
android:fillColor="#999999"
android:pathData="M644,342.4m-48,0a48,48 0,1 0,96 0,48 48,0 1,0 -96,0Z" />
<path
android:fillColor="#999999"
android:pathData="M724,470.4m-48,0a48,48 0,1 0,96 0,48 48,0 1,0 -96,0Z" />
android:viewportWidth="1931"
android:viewportHeight="1892">
<group>
<clip-path android:pathData="M0,0h1931v1892h-1931z" />
<path
android:fillColor="#999999"
android:fillType="evenOdd"
android:pathData="M877.7,1892C837.1,1892 794.6,1888.1 748.2,1882.3L736.6,1880.4C407.8,1830.1 183.5,1511.2 173.8,1497.6 -143.3,1014.3 15.3,525.2 315,254.5 612.8,-16.1 1109.8,-132.1 1544.8,217.8 1825.2,444 1910.3,757.2 1914.2,770.7L1914.2,774.6C1954.8,995 1921.9,1157.4 1815.6,1261.8 1653.1,1418.3 1384.3,1368.1 1347.6,1360.4 1297.3,1354.6 1260.6,1370 1233.5,1402.9 1204.5,1439.6 1198.7,1487.9 1208.4,1516.9 1235.4,1598.2 1239.3,1660 1220,1706.4 1163.9,1828.2 1049.8,1892 877.7,1892ZM753.9,1764.4 L765.6,1766.3C953.1,1795.3 1067.2,1758.6 1113.6,1654.2 1113.6,1652.3 1123.3,1627.2 1098.1,1549.8 1073,1480.2 1092.4,1389.3 1142.6,1327.5 1194.8,1261.8 1272.2,1232.8 1363.1,1242.4L1368.9,1244.4C1370.8,1244.4 1610.6,1296.6 1734.3,1176.7 1809.8,1103.2 1832.9,975.6 1800.1,797.8 1792.4,772.7 1709.2,500.1 1469.4,308.7 1090.4,-0.7 655.3,101.8 392.3,339.6 150.6,560 -27.3,979.5 270.5,1433.8 272.5,1433.8 475.5,1723.8 753.9,1764.4Z" />
<path
android:fillColor="#999999"
android:fillType="evenOdd"
android:pathData="M300,981C300,1045.1 351.9,1097 416,1097 480.1,1097 532,1045.1 532,981 532,916.9 480.1,865 416,865 351.9,865 300,916.9 300,981Z" />
<path
android:fillColor="#999999"
android:fillType="evenOdd"
android:pathData="M435,633C435,697.1 486.9,749 551,749 615.1,749 667,697.1 667,633 667,568.9 615.1,517 551,517 486.9,517 435,568.9 435,633Z" />
<path
android:fillColor="#999999"
android:fillType="evenOdd"
android:pathData="M783,440C783,504.1 834.9,556 899,556 963.1,556 1015,504.1 1015,440 1015,375.9 963.1,324 899,324 834.9,324 783,375.9 783,440Z" />
<path
android:fillColor="#999999"
android:fillType="evenOdd"
android:pathData="M1170,537C1170,601.1 1221.9,653 1286,653 1350.1,653 1402,601.1 1402,537 1402,472.9 1350.1,421 1286,421 1221.9,421 1170,472.9 1170,537Z" />
<path
android:fillColor="#999999"
android:fillType="evenOdd"
android:pathData="M1363,846C1363,910.1 1414.9,962 1479,962 1543.1,962 1595,910.1 1595,846 1595,781.9 1543.1,730 1479,730 1414.9,730 1363,781.9 1363,846Z" />
</group>
</vector>
2 changes: 1 addition & 1 deletion app/src/main/res/values-ko/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@
<string name="please_select_playlist_file">플레이리스트파일을 선택하십시오</string>
<string name="home_screen">시작 페이지</string>
<string name="spotify_token_error">Spotify API 토큰 획득에 실패했습니다. 다시 시도하세요.</string>
<string name="spotify_token_cf">Cloudflare는 이 작업을 지원하지 않으므로 설정에서 `암호화 서버`를 다른 서버로 변경하세요.</string>
<string name="spotify_token_cf">`Cloudflare`는 이 작업을 지원하지 않으므로 설정에서 `암호화 서버`를 다른 서버로 변경하세요.</string>
<string name="get_spotify_user_info_failed">Spotify 사용자 정보를 가져오는 데 실패했습니다</string>
<string name="spotify_user_id_wrong">입력한 Spotify 사용자 ID가 올바르지 않습니다</string>
<string name="spotify_user_id_login">사용자 ID</string>
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/res/values-zh-rCN/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@
<string name="timeout">超时</string>
<string name="optional_servers">服务器列表</string>
<string name="get_playlist_failed">获取歌单信息失败</string>
<string name="get_playlist_hidden">已隐藏#个空歌单</string>
<string name="get_playlist_hidden">已隐藏 # 个空歌单</string>
<string name="switch_account_logout">切换账号 / 退出登录</string>
<string name="not_yet_deployed">(暂未启用)</string>
<string name="unable_start_documentsui">「文件」启动失败</string>
Expand Down Expand Up @@ -376,7 +376,7 @@
<string name="please_select_playlist_file">请选择歌单文件</string>
<string name="home_screen">启动页</string>
<string name="spotify_token_error">Spotify API token获取失败,请重试。</string>
<string name="spotify_token_cf">Cloudflare不支持本操作,请在设置中将`加密服务器`更换为其他服务器。</string>
<string name="spotify_token_cf">`Cloudflare`不支持本操作,请在设置中将`加密服务器`更换为其他服务器。</string>
<string name="get_spotify_user_info_failed">获取Spotify用户信息失败</string>
<string name="spotify_user_id_wrong">输入的Spotify用户ID不正确</string>
<string name="spotify_user_id_login">用户ID</string>
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@
<color name="matched">#599E5E</color>
<color name="unmatched">#C94F4F</color>
<color name="manual">#3D76A7</color>
<color name="warning">#C29E4A</color>
<color name="warning">#E1A800</color>
</resources>
2 changes: 1 addition & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@
<string name="home_screen">Launch page</string>
<string name="source_spotify" translatable="false">Spotify</string>
<string name="spotify_token_error">Spotify API token get failed, please try again.</string>
<string name="spotify_token_cf">Cloudflare does not support this operation, please change the `Encryption Server` to another server in the settings.</string>
<string name="spotify_token_cf">`Cloudflare` does not support this operation, please change the `Encryption Server` to another server in the settings.</string>
<string name="get_spotify_user_info_failed">Failed to get Spotify user info</string>
<string name="spotify_user_id_wrong">Incorrect Spotify user ID entered</string>
<string name="spotify_user_id_login">User ID</string>
Expand Down

0 comments on commit 4b08957

Please sign in to comment.