Skip to content

Commit

Permalink
Done For Beta Release
Browse files Browse the repository at this point in the history
  • Loading branch information
professorDeveloper committed Oct 6, 2024
1 parent 79430ad commit 9e68318
Show file tree
Hide file tree
Showing 8 changed files with 121 additions and 68 deletions.
2 changes: 2 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 0 additions & 7 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -217,13 +217,6 @@ dependencies {
implementation project(':library')
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.1"

// PlayBack
implementation("com.jaredrummler:colorpicker:1.1.0") // Subtitle Color Picker
implementation("com.github.recloudstream:media-ffmpeg:1.1.0") // Custom FF-MPEG Lib for Audio Codecs
implementation("com.github.teamnewpipe:NewPipeExtractor:v0.24.2") /* For Trailers
^ Update to Latest Commits if Trailers Misbehave, github.com/TeamNewPipe/NewPipeExtractor/commits/dev */
implementation("com.github.albfernandez:juniversalchardet:2.5.0") // Subtitle Decoding



}
Binary file modified app/release/app-release.apk
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ class AniWorld : AnimeParser() {
val episodeLinkElement =
episodeRow.select("td.season1EpisodeID a[itemprop=url]").first()
val episodeTitleElement = episodeRow.select("td.seasonEpisodeTitle a").first()
val episodeLink: String = episodeLinkElement.attr("href")
val episodeTitle: String = episodeTitleElement.text()
val episodeLink: String = episodeLinkElement!!.attr("href")
val episodeTitle: String = episodeTitleElement!!.text()


episodeList.add(Episode(count.toString(), episodeLink, episodeTitle))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,14 @@ import android.view.ViewGroup
import androidx.fragment.app.Fragment
import androidx.fragment.app.viewModels
import androidx.lifecycle.lifecycleScope
import androidx.navigation.fragment.findNavController
import androidx.recyclerview.widget.GridLayoutManager
import com.animestudios.animeapp.R
import com.animestudios.animeapp.anilist.api.common.Anilist
import com.animestudios.animeapp.databinding.FragmentGenreBinding
import com.animestudios.animeapp.readData
import com.animestudios.animeapp.settings.UISettings
import com.animestudios.animeapp.tools.animationTransaction
import com.animestudios.animeapp.ui.screen.browse.page.genre.adapter.GenreAdapter
import com.animestudios.animeapp.viewmodel.imp.GenresViewModelImp
import dagger.hilt.android.AndroidEntryPoint
Expand Down Expand Up @@ -46,6 +49,16 @@ class GenreFragment : Fragment() {
val screenWidth = resources.displayMetrics.run { widthPixels / density }
val adapter = GenreAdapter(true)

adapter.setItemListener {
val bundle = Bundle()
bundle.putString("type", "ANIME")
bundle.putString("genre", it)
bundle.putString("sortBy", "Trending")
bundle.putBoolean("search", true)
findNavController().navigate(
R.id.searchScreen, bundle, animationTransaction().build()
)
}
model.doneListener = {
MainScope().launch {
binding.mediaInfoGenresProgressBar.visibility = View.GONE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,25 @@ package com.animestudios.animeapp.ui.screen.browse.page.genre.adapter

import android.view.LayoutInflater
import android.view.ViewGroup
import android.widget.Toast
import androidx.core.view.updateLayoutParams
import androidx.recyclerview.widget.RecyclerView
import com.animestudios.animeapp.anilist.api.common.Anilist
import com.animestudios.animeapp.databinding.GenresItemBinding
import com.animestudios.animeapp.readData
import com.animestudios.animeapp.loadImage
import com.animestudios.animeapp.px
import com.animestudios.animeapp.readData
import com.animestudios.animeapp.settings.UISettings

class GenreAdapter(private val big: Boolean = false) :
RecyclerView.Adapter<GenreAdapter.GenreVh>() {
var genres = mutableMapOf<String, String>()
var pos = arrayListOf<String>()
private lateinit var initItemListener: (String,) -> Unit
fun setItemListener(listener: (String) -> Unit) {
initItemListener = listener
}

private val uiSettings =
readData<UISettings>("ui_settings") ?: UISettings()

Expand All @@ -23,6 +30,35 @@ class GenreAdapter(private val big: Boolean = false) :
val genre = genres[pos[bindingAdapterPosition]]
binding.genreTitle.text = pos[bindingAdapterPosition]
binding.genreImage.loadImage(genre)
binding.root.setOnClickListener {
initItemListener.invoke(pos[adapterPosition])
if (pos[bindingAdapterPosition].lowercase() == "hentai") {
if (!Anilist.adult) Toast.makeText(
itemView.context,
"Turn on 18+ Content from your Anilist Settings",
Toast.LENGTH_SHORT
).show()
}
// ContextCompat.startActivity(
// itemView.context,
// Intent(itemView.context, SearchScreen::class.java)
// .putExtra("type", type)
// .putExtra("genre", pos[bindingAdapterPosition])
// .putExtra("sortBy", "Trending")
// .putExtra("search", true)
// .also {
// if (pos[bindingAdapterPosition].lowercase() == "hentai") {
// if (!Anilist.adult) Toast.makeText(
// itemView.context,
// "Turn on 18+ Content from your Anilist Settings",
// Toast.LENGTH_SHORT
// ).show()
// it.putExtra("hentai", true)
// }
// },
// null
// )
}

}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,11 @@ class SearchScreen : Fragment() {
"ANIME",
isAdult = false,
onList = false,
genres = requireActivity().intent.getStringExtra("genre")
?.let { mutableListOf(it) },
tags = requireActivity().intent.getStringExtra("tag")?.let { mutableListOf(it) },
sort = requireActivity().intent.getStringExtra("sortBy"),

results = mutableListOf(),
hasNextPage = false
)
Expand Down Expand Up @@ -125,62 +130,7 @@ class SearchScreen : Fragment() {
speechRecognizer = SpeechRecognizer.createSpeechRecognizer(requireActivity())

binding.micSearch.setOnClickListener {

if (ContextCompat.checkSelfPermission(
requireActivity(),
Manifest.permission.RECORD_AUDIO
) != PackageManager.PERMISSION_GRANTED
) {
checkPermission();
}
// Initialize SpeechRecognizer
speechRecognizer.setRecognitionListener(object : RecognitionListener {
override fun onReadyForSpeech(params: Bundle?) {
// Called when the speech recognition service is ready for user input
}

override fun onBeginningOfSpeech() {
// Called when the user starts speaking
}

override fun onRmsChanged(rmsdB: Float) {
TODO("Not yet implemented")
}

override fun onBufferReceived(buffer: ByteArray?) {
TODO("Not yet implemented")
}

override fun onEndOfSpeech() {
// Called when the user stops speaking
}

override fun onResults(results: Bundle?) {
// Called when speech recognition results are available
val matches = results?.getStringArrayList(SpeechRecognizer.RESULTS_RECOGNITION)
if (!matches.isNullOrEmpty()) {
val recognizedText = matches[0]
// Handle the recognized text as needed
snackString(recognizedText)
}
}

override fun onPartialResults(partialResults: Bundle?) {
TODO("Not yet implemented")
}

override fun onEvent(eventType: Int, params: Bundle?) {
TODO("Not yet implemented")
}

// Implement other methods as needed

override fun onError(error: Int) {
// Called when there is an error in speech recognition
}
})
// speechRecognizer.startListening()

setUpVoiceMicSearch()
}
// hideNavigation()

Expand Down Expand Up @@ -311,6 +261,65 @@ class SearchScreen : Fragment() {
mediaAdaptor.notifyDataSetChanged()
}


private fun setUpVoiceMicSearch() {
if (ContextCompat.checkSelfPermission(
requireActivity(),
Manifest.permission.RECORD_AUDIO
) != PackageManager.PERMISSION_GRANTED
) {
checkPermission();
}
// Initialize SpeechRecognizer
speechRecognizer.setRecognitionListener(object : RecognitionListener {
override fun onReadyForSpeech(params: Bundle?) {
// Called when the speech recognition service is ready for user input
}

override fun onBeginningOfSpeech() {
// Called when the user starts speaking
}

override fun onRmsChanged(rmsdB: Float) {
}

override fun onBufferReceived(buffer: ByteArray?) {
}

override fun onEndOfSpeech() {
// Called when the user stops speaking
}

override fun onResults(results: Bundle?) {
// Called when speech recognition results are available
val matches = results?.getStringArrayList(SpeechRecognizer.RESULTS_RECOGNITION)
if (!matches.isNullOrEmpty()) {
val recognizedText = matches[0]
// Handle the recognized text as needed
model.searchResults.search=recognizedText
progressAdapter.notifyDataSetChanged()
search()
snackString(recognizedText)
}
}

override fun onPartialResults(partialResults: Bundle?) {
TODO("Not yet implemented")
}

override fun onEvent(eventType: Int, params: Bundle?) {
TODO("Not yet implemented")
}

// Implement other methods as needed

override fun onError(error: Int) {
// Called when there is an error in speech recognition
}
})
speechRecognizer.startListening(requireActivity().intent)
}

private fun initProgress(headerAdaptor: SearchAdapter) {
val notSet = model.notSet
progressAdapter = ProgressAdapter(searched = model.searched)
Expand All @@ -324,6 +333,7 @@ class SearchScreen : Fragment() {
}
} else
headerAdaptor.requestFocus?.run()
if (requireActivity().intent.getBooleanExtra("search", false)) search()

}
}
Expand Down
3 changes: 1 addition & 2 deletions app/src/main/res/layout/fragment_profile_screen.xml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@
android:layout_marginBottom="4dp"
android:visibility="gone"
android:scaleType="centerCrop"
android:src="@drawable/kbot09"
app:layout_constraintBottom_toBottomOf="@+id/profile_bg"
app:layout_constraintEnd_toEndOf="@+id/profile_bg"
app:layout_constraintStart_toStartOf="@+id/profile_bg" />
Expand All @@ -94,7 +93,7 @@
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:fontFamily="@font/inter_bold"
android:text="KBOT09"
android:text="User"
android:textColor="@color/white"
android:textSize="20sp"
app:layout_constraintEnd_toEndOf="@+id/circleImageView"
Expand Down

0 comments on commit 9e68318

Please # to comment.