Code Cleanup
This commit is contained in:
parent
e605b8c695
commit
af7997321c
3 changed files with 16 additions and 17 deletions
|
@ -61,10 +61,8 @@ class SavePlaylistDialog : DialogFragment() {
|
||||||
)
|
)
|
||||||
withContext(Dispatchers.Main) {
|
withContext(Dispatchers.Main) {
|
||||||
showToast(
|
showToast(
|
||||||
String.format(
|
requireContext().getString(R.string.saved_playlist_to,
|
||||||
requireContext().getString(R.string.saved_playlist_to),
|
data?.lastPathSegment),
|
||||||
data?.lastPathSegment
|
|
||||||
),
|
|
||||||
Toast.LENGTH_LONG
|
Toast.LENGTH_LONG
|
||||||
)
|
)
|
||||||
dismiss()
|
dismiss()
|
||||||
|
@ -88,7 +86,7 @@ class SavePlaylistDialog : DialogFragment() {
|
||||||
}
|
}
|
||||||
withContext(Dispatchers.Main) {
|
withContext(Dispatchers.Main) {
|
||||||
showToast(
|
showToast(
|
||||||
String.format(getString(R.string.saved_playlist_to), file),
|
getString(R.string.saved_playlist_to, file),
|
||||||
Toast.LENGTH_LONG
|
Toast.LENGTH_LONG
|
||||||
)
|
)
|
||||||
dismiss()
|
dismiss()
|
||||||
|
|
|
@ -122,7 +122,7 @@ fun View.focusAndShowKeyboard() {
|
||||||
*/
|
*/
|
||||||
fun View.drawAboveSystemBars(onlyPortrait: Boolean = true) {
|
fun View.drawAboveSystemBars(onlyPortrait: Boolean = true) {
|
||||||
if (PreferenceUtil.isFullScreenMode) return
|
if (PreferenceUtil.isFullScreenMode) return
|
||||||
if (onlyPortrait && RetroUtil.isLandscape()) return
|
if (onlyPortrait && RetroUtil.isLandscape) return
|
||||||
applyInsetter {
|
applyInsetter {
|
||||||
type(navigationBars = true) {
|
type(navigationBars = true) {
|
||||||
margin()
|
margin()
|
||||||
|
|
|
@ -18,7 +18,6 @@ import android.content.pm.PackageManager
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import androidx.core.app.ShareCompat
|
import androidx.core.app.ShareCompat
|
||||||
import androidx.core.view.updatePadding
|
|
||||||
import androidx.fragment.app.Fragment
|
import androidx.fragment.app.Fragment
|
||||||
import androidx.recyclerview.widget.DefaultItemAnimator
|
import androidx.recyclerview.widget.DefaultItemAnimator
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
|
@ -30,7 +29,7 @@ import code.name.monkey.retromusic.databinding.FragmentAboutBinding
|
||||||
import code.name.monkey.retromusic.extensions.openUrl
|
import code.name.monkey.retromusic.extensions.openUrl
|
||||||
import code.name.monkey.retromusic.fragments.LibraryViewModel
|
import code.name.monkey.retromusic.fragments.LibraryViewModel
|
||||||
import code.name.monkey.retromusic.util.NavigationUtil
|
import code.name.monkey.retromusic.util.NavigationUtil
|
||||||
import code.name.monkey.retromusic.util.RetroUtil
|
import dev.chrisbanes.insetter.applyInsetter
|
||||||
import org.koin.androidx.viewmodel.ext.android.sharedViewModel
|
import org.koin.androidx.viewmodel.ext.android.sharedViewModel
|
||||||
|
|
||||||
class AboutFragment : Fragment(R.layout.fragment_about), View.OnClickListener {
|
class AboutFragment : Fragment(R.layout.fragment_about), View.OnClickListener {
|
||||||
|
@ -44,29 +43,31 @@ class AboutFragment : Fragment(R.layout.fragment_about), View.OnClickListener {
|
||||||
binding.aboutContent.cardOther.version.setSummary(getAppVersion())
|
binding.aboutContent.cardOther.version.setSummary(getAppVersion())
|
||||||
setUpView()
|
setUpView()
|
||||||
loadContributors()
|
loadContributors()
|
||||||
// This is a workaround as CollapsingToolbarLayout consumes insets and
|
|
||||||
// insets are not passed to child views
|
binding.aboutContent.root.applyInsetter {
|
||||||
// https://github.com/material-components/material-components-android/issues/1310
|
type(navigationBars = true) {
|
||||||
if (!RetroUtil.isLandscape()) {
|
padding()
|
||||||
binding.aboutContent.root.updatePadding(bottom = RetroUtil.getNavigationBarHeight())
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setUpView() {
|
private fun setUpView() {
|
||||||
binding.aboutContent.cardRetroInfo.appGithub.setOnClickListener(this)
|
binding.aboutContent.cardRetroInfo.appGithub.setOnClickListener(this)
|
||||||
binding.aboutContent.cardRetroInfo.faqLink.setOnClickListener(this)
|
binding.aboutContent.cardRetroInfo.faqLink.setOnClickListener(this)
|
||||||
binding.aboutContent.cardSocial.telegramLink.setOnClickListener(this)
|
|
||||||
binding.aboutContent.cardRetroInfo.appRate.setOnClickListener(this)
|
binding.aboutContent.cardRetroInfo.appRate.setOnClickListener(this)
|
||||||
binding.aboutContent.cardRetroInfo.appTranslation.setOnClickListener(this)
|
binding.aboutContent.cardRetroInfo.appTranslation.setOnClickListener(this)
|
||||||
binding.aboutContent.cardRetroInfo.appShare.setOnClickListener(this)
|
binding.aboutContent.cardRetroInfo.appShare.setOnClickListener(this)
|
||||||
binding.aboutContent.cardRetroInfo.donateLink.setOnClickListener(this)
|
binding.aboutContent.cardRetroInfo.donateLink.setOnClickListener(this)
|
||||||
|
binding.aboutContent.cardRetroInfo.bugReportLink.setOnClickListener(this)
|
||||||
|
|
||||||
|
binding.aboutContent.cardSocial.telegramLink.setOnClickListener(this)
|
||||||
binding.aboutContent.cardSocial.instagramLink.setOnClickListener(this)
|
binding.aboutContent.cardSocial.instagramLink.setOnClickListener(this)
|
||||||
binding.aboutContent.cardSocial.twitterLink.setOnClickListener(this)
|
binding.aboutContent.cardSocial.twitterLink.setOnClickListener(this)
|
||||||
|
binding.aboutContent.cardSocial.pinterestLink.setOnClickListener(this)
|
||||||
|
binding.aboutContent.cardSocial.websiteLink.setOnClickListener(this)
|
||||||
|
|
||||||
binding.aboutContent.cardOther.changelog.setOnClickListener(this)
|
binding.aboutContent.cardOther.changelog.setOnClickListener(this)
|
||||||
binding.aboutContent.cardOther.openSource.setOnClickListener(this)
|
binding.aboutContent.cardOther.openSource.setOnClickListener(this)
|
||||||
binding.aboutContent.cardSocial.pinterestLink.setOnClickListener(this)
|
|
||||||
binding.aboutContent.cardRetroInfo.bugReportLink.setOnClickListener(this)
|
|
||||||
binding.aboutContent.cardSocial.websiteLink.setOnClickListener(this)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onClick(view: View) {
|
override fun onClick(view: View) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue