Skip to content

Commit

Permalink
Release v0.1.5-beta
Browse files Browse the repository at this point in the history
  • Loading branch information
maxrave-dev committed Nov 6, 2023
1 parent f067a12 commit f761490
Show file tree
Hide file tree
Showing 6 changed files with 4,426 additions and 28 deletions.
11 changes: 7 additions & 4 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ dependencies {
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.3")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-guava:1.7.3")
//Navigation
implementation("androidx.navigation:navigation-fragment-ktx:2.7.4")
implementation("androidx.navigation:navigation-ui-ktx:2.7.4")
implementation("androidx.navigation:navigation-fragment-ktx:2.7.5")
implementation("androidx.navigation:navigation-ui-ktx:2.7.5")

implementation("com.google.code.gson:gson:2.10.1")

Expand All @@ -126,7 +126,7 @@ dependencies {
implementation("androidx.preference:preference-ktx:1.2.1")

//fragment ktx
implementation("androidx.fragment:fragment-ktx:1.6.1")
implementation("androidx.fragment:fragment-ktx:1.6.2")
//Hilt
implementation("com.google.dagger:hilt-android:2.48.1")
ksp("com.google.dagger:hilt-compiler:2.48.1")
Expand Down Expand Up @@ -159,7 +159,7 @@ dependencies {
implementation("com.intuit.sdp:sdp-android:1.1.0")
implementation("com.intuit.ssp:ssp-android:1.1.0")

val latestAboutLibsRelease = "10.9.1"
val latestAboutLibsRelease = "10.9.2"
implementation ("com.mikepenz:aboutlibraries:${latestAboutLibsRelease}")

implementation("com.google.android.flexbox:flexbox:3.0.0")
Expand All @@ -168,3 +168,6 @@ dependencies {
hilt {
enableAggregatingTask = true
}
aboutLibraries {
registerAndroidTasks = false
}
Original file line number Diff line number Diff line change
Expand Up @@ -1020,8 +1020,10 @@ class MainRepository @Inject constructor(private val localDataSource: LocalDataS
runCatching {
// val q = query.replace(Regex("\\([^)]*?(feat.|ft.|cùng với|con)[^)]*?\\)"), "")
// .replace(" ", " ")
val q = query.replace(Regex("\\((feat\\.|ft.|cùng với|con) "), " ").replace(
Regex("( và | & | и | e | und |, )"), " ").replace(" ", " ").replace(Regex("([()])"), "").replace(".", " ")
val q =
query.replace(Regex("\\((feat\\.|ft.|cùng với|con|mukana|com|avec) "), " ").replace(
Regex("( và | & | и | e | und |, )"), " "
).replace(" ", " ").replace(Regex("([()])"), "").replace(".", " ")
Log.d("Lyrics", "query: $q")
var musixMatchUserToken = YouTube.musixmatchUserToken
if (musixMatchUserToken == null) {
Expand Down Expand Up @@ -1432,14 +1434,13 @@ class MainRepository @Inject constructor(private val localDataSource: LocalDataS
}

suspend fun getYouTubeSetVideoId(youtubePlaylistId: String): Flow<ArrayList<SetVideoIdEntity>?> = flow {
YouTube.playlist(youtubePlaylistId).onSuccess { playlistPage ->
YouTube.playlist(youtubePlaylistId).onSuccess {
flow {
runCatching {
var id = ""
if (!youtubePlaylistId.startsWith("VL")) {
id += "VL$youtubePlaylistId"
}
else {
} else {
id += youtubePlaylistId
}
Log.d("Repository", "playlist id: $id")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import com.maxrave.simpmusic.extension.navigateSafe
import com.maxrave.simpmusic.extension.setEnabledAll
import com.maxrave.simpmusic.viewModel.SettingsViewModel
import com.maxrave.simpmusic.viewModel.SharedViewModel
import com.mikepenz.aboutlibraries.Libs
import com.mikepenz.aboutlibraries.LibsBuilder
import dagger.hilt.android.AndroidEntryPoint
import dev.chrisbanes.insetter.applyInsetter
Expand All @@ -50,6 +51,7 @@ import java.time.LocalDateTime
import java.time.ZoneId
import java.time.format.DateTimeFormatter
import java.util.Locale
import java.util.Scanner


@UnstableApi
Expand Down Expand Up @@ -547,28 +549,31 @@ class SettingsFragment : Fragment() {

val dialog = MaterialAlertDialogBuilder(requireContext())
.setTitle("Category")
.setMultiChoiceItems(item, checked) { dialogInterface, i, b ->
.setMultiChoiceItems(item, checked) { _, i, b ->
if (b) {
if (!selectedItem.contains(SPONSOR_BLOCK.list[i].toString())) {
selectedItem.add(SPONSOR_BLOCK.list[i].toString())
}
}
else {
} else {
if (selectedItem.contains(SPONSOR_BLOCK.list[i].toString())) {
selectedItem.remove(SPONSOR_BLOCK.list[i].toString())
}
}
}
.setPositiveButton(getString(R.string.save)) { dialog , i ->
.setPositiveButton(getString(R.string.save)) { dialog, _ ->
viewModel.setSponsorBlockCategories(selectedItem)
Log.d("Check category", selectedItem.toString())
viewModel.getSponsorBlockCategories()
viewModel.sponsorBlockCategories.observe(viewLifecycleOwner) {
Toast.makeText(requireContext(), getString(R.string.saved), Toast.LENGTH_SHORT).show()
Toast.makeText(
requireContext(),
getString(R.string.saved),
Toast.LENGTH_SHORT
).show()
dialog.dismiss()
}
}
.setNegativeButton(R.string.cancel) {dialog , i ->
.setNegativeButton(R.string.cancel) { dialog, _ ->
dialog.dismiss()
}
dialog.show()
Expand All @@ -587,62 +592,77 @@ class SettingsFragment : Fragment() {
binding.btRestore.setOnClickListener {
restoreLauncher.launch(arrayOf("application/octet-stream"))
}
binding.swNormalizeVolume.setOnCheckedChangeListener { compoundButton, checked ->
binding.swNormalizeVolume.setOnCheckedChangeListener { _, checked ->
if (checked) {
viewModel.setNormalizeVolume(true)
} else {
viewModel.setNormalizeVolume(false)
}
}
binding.swSkipSilent.setOnCheckedChangeListener { compoundButton, checked ->
binding.swSkipSilent.setOnCheckedChangeListener { _, checked ->
if (checked) {
viewModel.setSkipSilent(true)
} else {
viewModel.setSkipSilent(false)
}
}
binding.swSavePlaybackState.setOnCheckedChangeListener { compoundButton, checked ->
binding.swSavePlaybackState.setOnCheckedChangeListener { _, checked ->
if (checked) {
viewModel.setSavedPlaybackState(true)
} else {
viewModel.setSavedPlaybackState(false)
}
}
binding.swSaveLastPlayed.setOnCheckedChangeListener { compoundButton, checked ->
binding.swSaveLastPlayed.setOnCheckedChangeListener { _, checked ->
if (checked) {
viewModel.setSaveLastPlayed(true)
} else {
viewModel.setSaveLastPlayed(false)
}
}
binding.swEnableSponsorBlock.setOnCheckedChangeListener { compoundButton, checked ->
binding.swEnableSponsorBlock.setOnCheckedChangeListener { _, checked ->
if (checked) {
viewModel.setSponsorBlockEnabled(true)
}
else {
} else {
viewModel.setSponsorBlockEnabled(false)
}
}
binding.swSaveHistory.setOnCheckedChangeListener { compoundButton, checked ->
binding.swSaveHistory.setOnCheckedChangeListener { _, checked ->
if (checked) {
viewModel.setSendBackToGoogle(true)
} else {
viewModel.setSendBackToGoogle(false)
}
}
binding.swUseMusixmatchTranslation.setOnCheckedChangeListener {_, checked ->
binding.swUseMusixmatchTranslation.setOnCheckedChangeListener { _, checked ->
if (checked) {
viewModel.setUseTranslation(true)
} else {
viewModel.setUseTranslation(false)
}
}
binding.bt3rdPartyLibraries.setOnClickListener {
LibsBuilder()
.start(requireContext())
}


val inputStream = requireContext().resources.openRawResource(R.raw.aboutlibraries)
val scanner = Scanner(inputStream).useDelimiter("\\A")
val stringBuilder = StringBuilder()
while (scanner.hasNextLine()) {
stringBuilder.append(scanner.nextLine())
}
Log.w("AboutLibraries", stringBuilder.toString())
val localLib = Libs.Builder().withJson(stringBuilder.toString()).build()
val intent = LibsBuilder()
.withLicenseShown(true)
.withVersionShown(true)
.withActivityTitle(getString(R.string.third_party_libraries))
.withSearchEnabled(true)
.withEdgeToEdge(true)
.withLibs(
localLib
)
.intent(requireContext())
startActivity(intent)
}
}
private fun browseFiles(dir: File): Long {
var dirSize: Long = 0
Expand Down
Loading

0 comments on commit f761490

Please sign in to comment.