From 2f782debebbb156099cf5922f18f3442e440acb4 Mon Sep 17 00:00:00 2001
From: Muntashir Al-Islam
Date: Sun, 15 May 2022 16:55:04 +0600
Subject: [PATCH] Fix about page
Signed-off-by: Muntashir Al-Islam
---
CODE_OF_CONDUCT.md | 76 -------
app/src/debug/res/values/donottranslate.xml | 2 +-
app/src/main/assets/contributors.json | 38 ----
app/src/main/assets/license.html | 3 -
.../github/muntashirakon/music/Constants.kt | 4 +-
.../github/muntashirakon/music/MainModule.kt | 4 -
.../music/adapter/ContributorAdapter.kt | 96 ---------
.../music/fragments/LibraryViewModel.kt | 4 -
.../music/fragments/about/AboutFragment.kt | 49 +----
.../music/repository/LocalDataRepository.kt | 25 ---
.../music/repository/Repository.kt | 4 -
.../layout-xlarge/fragment_about_content.xml | 44 ----
app/src/main/res/layout/card_credit.xml | 44 ----
app/src/main/res/layout/card_other.xml | 72 -------
app/src/main/res/layout/card_retro_info.xml | 203 ++++++++----------
app/src/main/res/layout/card_social.xml | 98 ---------
.../res/layout/fragment_about_content.xml | 12 --
app/src/main/res/values/contributor_attrs.xml | 22 --
18 files changed, 95 insertions(+), 705 deletions(-)
delete mode 100644 CODE_OF_CONDUCT.md
delete mode 100644 app/src/main/assets/contributors.json
delete mode 100644 app/src/main/java/io/github/muntashirakon/music/adapter/ContributorAdapter.kt
delete mode 100644 app/src/main/java/io/github/muntashirakon/music/repository/LocalDataRepository.kt
delete mode 100644 app/src/main/res/layout-xlarge/fragment_about_content.xml
delete mode 100644 app/src/main/res/layout/card_credit.xml
delete mode 100644 app/src/main/res/layout/card_other.xml
delete mode 100644 app/src/main/res/layout/card_social.xml
delete mode 100644 app/src/main/res/values/contributor_attrs.xml
diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md
deleted file mode 100644
index 810f53156..000000000
--- a/CODE_OF_CONDUCT.md
+++ /dev/null
@@ -1,76 +0,0 @@
-# Contributor Covenant Code of Conduct
-
-## Our Pledge
-
-In the interest of fostering an open and welcoming environment, we as
-contributors and maintainers pledge to making participation in our project and
-our community a harassment-free experience for everyone, regardless of age, body
-size, disability, ethnicity, sex characteristics, gender identity and expression,
-level of experience, education, socio-economic status, nationality, personal
-appearance, race, religion, or sexual identity and orientation.
-
-## Our Standards
-
-Examples of behavior that contributes to creating a positive environment
-include:
-
-* Using welcoming and inclusive language
-* Being respectful of differing viewpoints and experiences
-* Gracefully accepting constructive criticism
-* Focusing on what is best for the community
-* Showing empathy towards other community members
-
-Examples of unacceptable behavior by participants include:
-
-* The use of sexualized language or imagery and unwelcome sexual attention or
- advances
-* Trolling, insulting/derogatory comments, and personal or political attacks
-* Public or private harassment
-* Publishing others' private information, such as a physical or electronic
- address, without explicit permission
-* Other conduct which could reasonably be considered inappropriate in a
- professional setting
-
-## Our Responsibilities
-
-Project maintainers are responsible for clarifying the standards of acceptable
-behavior and are expected to take appropriate and fair corrective action in
-response to any instances of unacceptable behavior.
-
-Project maintainers have the right and responsibility to remove, edit, or
-reject comments, commits, code, wiki edits, issues, and other contributions
-that are not aligned to this Code of Conduct, or to ban temporarily or
-permanently any contributor for other behaviors that they deem inappropriate,
-threatening, offensive, or harmful.
-
-## Scope
-
-This Code of Conduct applies both within project spaces and in public spaces
-when an individual is representing the project or its community. Examples of
-representing a project or community include using an official project e-mail
-address, posting via an official social media account, or acting as an appointed
-representative at an online or offline event. Representation of a project may be
-further defined and clarified by project maintainers.
-
-## Enforcement
-
-Instances of abusive, harassing, or otherwise unacceptable behavior may be
-reported by contacting the project team at retromusicapp@gmail.com. All
-complaints will be reviewed and investigated and will result in a response that
-is deemed necessary and appropriate to the circumstances. The project team is
-obligated to maintain confidentiality with regard to the reporter of an incident.
-Further details of specific enforcement policies may be posted separately.
-
-Project maintainers who do not follow or enforce the Code of Conduct in good
-faith may face temporary or permanent repercussions as determined by other
-members of the project's leadership.
-
-## Attribution
-
-This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
-available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
-
-[homepage]: https://www.contributor-covenant.org
-
-For answers to common questions about this code of conduct, see
-https://www.contributor-covenant.org/faq
diff --git a/app/src/debug/res/values/donottranslate.xml b/app/src/debug/res/values/donottranslate.xml
index d9798fa6f..79e559838 100644
--- a/app/src/debug/res/values/donottranslate.xml
+++ b/app/src/debug/res/values/donottranslate.xml
@@ -1,4 +1,4 @@
- Retro Music-Debug
+ Metro Debug
\ No newline at end of file
diff --git a/app/src/main/assets/contributors.json b/app/src/main/assets/contributors.json
deleted file mode 100644
index 56450087b..000000000
--- a/app/src/main/assets/contributors.json
+++ /dev/null
@@ -1,38 +0,0 @@
-[
- {
- "name": "Hemanth Savarala",
- "summary": "Lead Developer & Designer",
- "link": "https://github.com/h4h13",
- "image": "https://i.imgur.com/AoVs9oj.jpg"
- },
- {
- "name": "Prathamesh More",
- "summary": "Developer",
- "link": "https://prathameshmm02.github.io",
- "image": "https://i.imgur.com/ZHoOrHx.jpg"
- },
- {
- "name": "Daksh P. Jain",
- "summary": "Website & GitHub Maintainer",
- "link": "https://daksh.eu.org",
- "image": "https://i.imgur.com/fnYpg65.jpg"
- },
- {
- "name": "Milind Goel",
- "summary": "Support Representative & Moderator",
- "link": "https://milindgoel15.github.io",
- "image": "https://i.imgur.com/hWL8t48.jpg"
- },
- {
- "name": "Lennart Glamann",
- "summary": "Play Store Banner & Images",
- "link": "https://telegram.me/FlixbusLennart",
- "image": "https://i.imgur.com/Q5Nsx1R.jpg"
- },
- {
- "name": "Haythem Gataa",
- "summary": "App Logo & Banners",
- "link": "https://dribbble.com/haythemgataa",
- "image": "https://i.imgur.com/g5RuIZq.jpg"
- }
-]
diff --git a/app/src/main/assets/license.html b/app/src/main/assets/license.html
index ff5e78bd2..2fd8ba5ed 100644
--- a/app/src/main/assets/license.html
+++ b/app/src/main/assets/license.html
@@ -42,9 +42,6 @@
by Aidan Michael Follestad
Material Contextual Action Bar by Aidan Michael Follestad
- Android In-App Billing v3 Library by
- Henning Dodenhof
Advanced RecyclerView by Haruki Hasegawa
-) : RecyclerView.Adapter() {
-
- override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
- return if (viewType == HEADER) {
- ViewHolder(
- LayoutInflater.from(parent.context).inflate(
- R.layout.item_contributor_header,
- parent,
- false
- )
- )
- } else ViewHolder(
- LayoutInflater.from(parent.context).inflate(
- R.layout.item_contributor,
- parent,
- false
- )
- )
- }
-
- companion object {
- const val HEADER: Int = 0
- const val ITEM: Int = 1
- }
-
- override fun getItemViewType(position: Int): Int {
- return if (position == 0) {
- HEADER
- } else {
- ITEM
- }
- }
-
- override fun onBindViewHolder(holder: ViewHolder, position: Int) {
- val contributor = contributors[position]
- holder.bindData(contributor)
- holder.itemView.setOnClickListener {
- it?.context?.openUrl(contributors[position].link)
- }
- }
-
- override fun getItemCount(): Int {
- return contributors.size
- }
-
- fun swapData(it: List) {
- contributors = it
- notifyDataSetChanged()
- }
-
- inner class ViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
- val title: TextView = itemView.findViewById(R.id.title)
- val text: TextView = itemView.findViewById(R.id.text)
- val image: RetroShapeableImageView = itemView.findViewById(R.id.icon)
-
- internal fun bindData(contributor: Contributor) {
- title.text = contributor.name
- text.text = contributor.summary
- Glide.with(image.context)
- .load(contributor.image)
- .error(R.drawable.ic_account)
- .placeholder(R.drawable.ic_account)
- .dontAnimate()
- .into(image)
- }
- }
-}
diff --git a/app/src/main/java/io/github/muntashirakon/music/fragments/LibraryViewModel.kt b/app/src/main/java/io/github/muntashirakon/music/fragments/LibraryViewModel.kt
index a36f846f4..5cc9539e0 100644
--- a/app/src/main/java/io/github/muntashirakon/music/fragments/LibraryViewModel.kt
+++ b/app/src/main/java/io/github/muntashirakon/music/fragments/LibraryViewModel.kt
@@ -278,10 +278,6 @@ class LibraryViewModel(
emit(repository.artistById(artistId))
}
- fun fetchContributors(): LiveData> = liveData(IO) {
- emit(repository.contributor())
- }
-
fun observableHistorySongs(): LiveData> {
viewModelScope.launch(IO) {
repository.historySong().forEach { song ->
diff --git a/app/src/main/java/io/github/muntashirakon/music/fragments/about/AboutFragment.kt b/app/src/main/java/io/github/muntashirakon/music/fragments/about/AboutFragment.kt
index 692e375dd..95326b4c6 100644
--- a/app/src/main/java/io/github/muntashirakon/music/fragments/about/AboutFragment.kt
+++ b/app/src/main/java/io/github/muntashirakon/music/fragments/about/AboutFragment.kt
@@ -23,7 +23,6 @@ import androidx.recyclerview.widget.DefaultItemAnimator
import androidx.recyclerview.widget.LinearLayoutManager
import io.github.muntashirakon.music.Constants
import io.github.muntashirakon.music.R
-import io.github.muntashirakon.music.adapter.ContributorAdapter
import io.github.muntashirakon.music.databinding.FragmentAboutBinding
import io.github.muntashirakon.music.extensions.openUrl
import io.github.muntashirakon.music.fragments.LibraryViewModel
@@ -39,9 +38,8 @@ class AboutFragment : Fragment(R.layout.fragment_about), View.OnClickListener {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
_binding = FragmentAboutBinding.bind(view)
- binding.aboutContent.cardOther.version.setSummary(getAppVersion())
+ binding.aboutContent.cardRetroInfo.version.setSummary(getAppVersion())
setUpView()
- loadContributors()
binding.aboutContent.root.applyInsetter {
type(navigationBars = true) {
@@ -53,71 +51,32 @@ class AboutFragment : Fragment(R.layout.fragment_about), View.OnClickListener {
private fun setUpView() {
binding.aboutContent.cardRetroInfo.appGithub.setOnClickListener(this)
binding.aboutContent.cardRetroInfo.faqLink.setOnClickListener(this)
- binding.aboutContent.cardRetroInfo.appRate.setOnClickListener(this)
binding.aboutContent.cardRetroInfo.appTranslation.setOnClickListener(this)
- binding.aboutContent.cardRetroInfo.appShare.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.twitterLink.setOnClickListener(this)
- binding.aboutContent.cardSocial.pinterestLink.setOnClickListener(this)
- binding.aboutContent.cardSocial.websiteLink.setOnClickListener(this)
-
- binding.aboutContent.cardOther.changelog.setOnClickListener(this)
- binding.aboutContent.cardOther.openSource.setOnClickListener(this)
+ binding.aboutContent.cardRetroInfo.changelog.setOnClickListener(this)
+ binding.aboutContent.cardRetroInfo.openSource.setOnClickListener(this)
}
override fun onClick(view: View) {
when (view.id) {
- R.id.pinterestLink -> openUrl(Constants.PINTEREST)
R.id.faqLink -> openUrl(Constants.FAQ_LINK)
- R.id.telegramLink -> openUrl(Constants.APP_TELEGRAM_LINK)
R.id.appGithub -> openUrl(Constants.GITHUB_PROJECT)
R.id.appTranslation -> openUrl(Constants.TRANSLATE)
- R.id.appRate -> openUrl(Constants.RATE_ON_GOOGLE_PLAY)
- R.id.appShare -> shareApp()
- R.id.instagramLink -> openUrl(Constants.APP_INSTAGRAM_LINK)
- R.id.twitterLink -> openUrl(Constants.APP_TWITTER_LINK)
R.id.changelog -> NavigationUtil.gotoWhatNews(requireActivity())
R.id.openSource -> NavigationUtil.goToOpenSource(requireActivity())
R.id.bugReportLink -> NavigationUtil.bugReport(requireActivity())
- R.id.websiteLink -> openUrl(Constants.WEBSITE)
}
}
private fun getAppVersion(): String {
return try {
- val isPro = "Pro"
- val packageInfo =
- requireActivity().packageManager.getPackageInfo(requireActivity().packageName, 0)
- "${packageInfo.versionName} $isPro"
+ requireActivity().packageManager.getPackageInfo(requireActivity().packageName, 0).versionName
} catch (e: PackageManager.NameNotFoundException) {
e.printStackTrace()
"0.0.0"
}
}
- private fun shareApp() {
- ShareCompat.IntentBuilder(requireActivity()).setType("text/plain")
- .setChooserTitle(R.string.share_app)
- .setText(String.format(getString(R.string.app_share), requireActivity().packageName))
- .startChooser()
- }
-
- private fun loadContributors() {
- val contributorAdapter = ContributorAdapter(emptyList())
- binding.aboutContent.cardCredit.recyclerView.apply {
- layoutManager = LinearLayoutManager(requireContext())
- itemAnimator = DefaultItemAnimator()
- adapter = contributorAdapter
- }
- libraryViewModel.fetchContributors().observe(viewLifecycleOwner) { contributors ->
- contributorAdapter.swapData(contributors)
- }
- }
-
override fun onDestroyView() {
super.onDestroyView()
_binding = null
diff --git a/app/src/main/java/io/github/muntashirakon/music/repository/LocalDataRepository.kt b/app/src/main/java/io/github/muntashirakon/music/repository/LocalDataRepository.kt
deleted file mode 100644
index ab28d7d24..000000000
--- a/app/src/main/java/io/github/muntashirakon/music/repository/LocalDataRepository.kt
+++ /dev/null
@@ -1,25 +0,0 @@
-package io.github.muntashirakon.music.repository
-
-import android.content.Context
-import io.github.muntashirakon.music.model.Contributor
-import com.google.gson.GsonBuilder
-import com.google.gson.reflect.TypeToken
-
-interface LocalDataRepository {
- fun contributors(): List
-}
-
-class RealLocalDataRepository(
- private val context: Context
-) : LocalDataRepository {
-
- override fun contributors(): List {
- val jsonString = context.assets.open("contributors.json")
- .bufferedReader().use { it.readText() }
-
- val gsonBuilder = GsonBuilder()
- val gson = gsonBuilder.create()
- val listContributorType = object : TypeToken>() {}.type
- return gson.fromJson(jsonString, listContributorType)
- }
-}
\ No newline at end of file
diff --git a/app/src/main/java/io/github/muntashirakon/music/repository/Repository.kt b/app/src/main/java/io/github/muntashirakon/music/repository/Repository.kt
index e1860ce82..727f4dc04 100644
--- a/app/src/main/java/io/github/muntashirakon/music/repository/Repository.kt
+++ b/app/src/main/java/io/github/muntashirakon/music/repository/Repository.kt
@@ -105,7 +105,6 @@ interface Repository {
suspend fun playCountSongs(): List
suspend fun blackListPaths(): List
suspend fun deleteSongs(songs: List)
- suspend fun contributor(): List
suspend fun searchArtists(query: String): List
suspend fun searchSongs(query: String): List
suspend fun searchAlbums(query: String): List
@@ -126,14 +125,11 @@ class RealRepository(
private val searchRepository: RealSearchRepository,
private val topPlayedRepository: TopPlayedRepository,
private val roomRepository: RoomRepository,
- private val localDataRepository: LocalDataRepository
) : Repository {
override suspend fun deleteSongs(songs: List) = roomRepository.deleteSongs(songs)
- override suspend fun contributor(): List = localDataRepository.contributors()
-
override suspend fun searchSongs(query: String): List = songRepository.songs(query)
override suspend fun searchAlbums(query: String): List = albumRepository.albums(query)
diff --git a/app/src/main/res/layout-xlarge/fragment_about_content.xml b/app/src/main/res/layout-xlarge/fragment_about_content.xml
deleted file mode 100644
index 6b763dbec..000000000
--- a/app/src/main/res/layout-xlarge/fragment_about_content.xml
+++ /dev/null
@@ -1,44 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/card_credit.xml b/app/src/main/res/layout/card_credit.xml
deleted file mode 100644
index 13bd142f5..000000000
--- a/app/src/main/res/layout/card_credit.xml
+++ /dev/null
@@ -1,44 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/card_other.xml b/app/src/main/res/layout/card_other.xml
deleted file mode 100644
index 5492708e2..000000000
--- a/app/src/main/res/layout/card_other.xml
+++ /dev/null
@@ -1,72 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/card_retro_info.xml b/app/src/main/res/layout/card_retro_info.xml
index df9131347..e5fbb4e35 100644
--- a/app/src/main/res/layout/card_retro_info.xml
+++ b/app/src/main/res/layout/card_retro_info.xml
@@ -1,125 +1,98 @@
-
+
-
+ app:layout_constrainedWidth="true"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintHorizontal_bias="0"
+ app:layout_constraintStart_toStartOf="parent"
+ app:listItemIcon="@drawable/ic_info_outline"
+ app:listItemSummary="@string/pref_summary_open_source_licences"
+ app:listItemTitle="@string/version"/>
-
+
-
+
-
+
+
-
+
-
+
-
-
-
-
-
-
-
-
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/card_social.xml b/app/src/main/res/layout/card_social.xml
deleted file mode 100644
index 5207bd33b..000000000
--- a/app/src/main/res/layout/card_social.xml
+++ /dev/null
@@ -1,98 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_about_content.xml b/app/src/main/res/layout/fragment_about_content.xml
index 3a2875463..1f87f927e 100644
--- a/app/src/main/res/layout/fragment_about_content.xml
+++ b/app/src/main/res/layout/fragment_about_content.xml
@@ -4,20 +4,8 @@
android:layout_height="wrap_content"
android:orientation="vertical">
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/values/contributor_attrs.xml b/app/src/main/res/values/contributor_attrs.xml
deleted file mode 100644
index 16855ef3d..000000000
--- a/app/src/main/res/values/contributor_attrs.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file