1
0
mirror of https://github.com/wulkanowy/wulkanowy.git synced 2024-09-20 03:29:08 -05:00

Replace Creators with Contributors (#675)

This commit is contained in:
stha 2020-03-03 18:07:38 +01:00 committed by GitHub
parent ab1d9b358e
commit 70e9f025bb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 30 additions and 30 deletions

View File

@ -16,7 +16,7 @@ import eu.davidea.flexibleadapter.common.SmoothScrollLinearLayoutManager
import eu.davidea.flexibleadapter.items.AbstractFlexibleItem import eu.davidea.flexibleadapter.items.AbstractFlexibleItem
import io.github.wulkanowy.R import io.github.wulkanowy.R
import io.github.wulkanowy.ui.base.BaseFragment import io.github.wulkanowy.ui.base.BaseFragment
import io.github.wulkanowy.ui.modules.about.creator.CreatorFragment import io.github.wulkanowy.ui.modules.about.contributor.ContributorFragment
import io.github.wulkanowy.ui.modules.about.license.LicenseFragment import io.github.wulkanowy.ui.modules.about.license.LicenseFragment
import io.github.wulkanowy.ui.modules.about.logviewer.LogViewerFragment import io.github.wulkanowy.ui.modules.about.logviewer.LogViewerFragment
import io.github.wulkanowy.ui.modules.main.MainActivity import io.github.wulkanowy.ui.modules.main.MainActivity
@ -155,7 +155,7 @@ class AboutFragment : BaseFragment(), AboutView, MainView.TitledView {
} }
override fun openCreators() { override fun openCreators() {
(activity as? MainActivity)?.pushView(CreatorFragment.newInstance()) (activity as? MainActivity)?.pushView(ContributorFragment.newInstance())
} }
override fun openPrivacyPolicy() { override fun openPrivacyPolicy() {

View File

@ -1,4 +1,4 @@
package io.github.wulkanowy.ui.modules.about.creator package io.github.wulkanowy.ui.modules.about.contributor
import android.os.Bundle import android.os.Bundle
import android.view.LayoutInflater import android.view.LayoutInflater
@ -18,18 +18,18 @@ import io.github.wulkanowy.utils.setOnItemClickListener
import kotlinx.android.synthetic.main.fragment_creator.* import kotlinx.android.synthetic.main.fragment_creator.*
import javax.inject.Inject import javax.inject.Inject
class CreatorFragment : BaseFragment(), CreatorView, MainView.TitledView { class ContributorFragment : BaseFragment(), ContributorView, MainView.TitledView {
@Inject @Inject
lateinit var presenter: CreatorPresenter lateinit var presenter: ContributorPresenter
@Inject @Inject
lateinit var creatorsAdapter: FlexibleAdapter<AbstractFlexibleItem<*>> lateinit var creatorsAdapter: FlexibleAdapter<AbstractFlexibleItem<*>>
override val titleStringId get() = R.string.creators_title override val titleStringId get() = R.string.contributors_title
companion object { companion object {
fun newInstance() = CreatorFragment() fun newInstance() = ContributorFragment()
} }
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
@ -53,7 +53,7 @@ class CreatorFragment : BaseFragment(), CreatorView, MainView.TitledView {
creatorSeeMore.setOnClickListener { presenter.onSeeMoreClick() } creatorSeeMore.setOnClickListener { presenter.onSeeMoreClick() }
} }
override fun updateData(data: List<CreatorItem>) { override fun updateData(data: List<ContributorItem>) {
creatorsAdapter.updateDataSet(data) creatorsAdapter.updateDataSet(data)
} }

View File

@ -1,4 +1,4 @@
package io.github.wulkanowy.ui.modules.about.creator package io.github.wulkanowy.ui.modules.about.contributor
import android.view.View import android.view.View
import coil.api.load import coil.api.load
@ -12,7 +12,8 @@ import io.github.wulkanowy.data.pojos.AppCreator
import kotlinx.android.extensions.LayoutContainer import kotlinx.android.extensions.LayoutContainer
import kotlinx.android.synthetic.main.item_creator.* import kotlinx.android.synthetic.main.item_creator.*
class CreatorItem(val creator: AppCreator) : AbstractFlexibleItem<CreatorItem.ViewHolder>() { class ContributorItem(val creator: AppCreator) :
AbstractFlexibleItem<ContributorItem.ViewHolder>() {
override fun getLayoutRes() = R.layout.item_creator override fun getLayoutRes() = R.layout.item_creator
@ -33,7 +34,7 @@ class CreatorItem(val creator: AppCreator) : AbstractFlexibleItem<CreatorItem.Vi
if (this === other) return true if (this === other) return true
if (javaClass != other?.javaClass) return false if (javaClass != other?.javaClass) return false
other as CreatorItem other as ContributorItem
if (creator != other.creator) return false if (creator != other.creator) return false

View File

@ -1,30 +1,28 @@
package io.github.wulkanowy.ui.modules.about.creator package io.github.wulkanowy.ui.modules.about.contributor
import eu.davidea.flexibleadapter.items.AbstractFlexibleItem import eu.davidea.flexibleadapter.items.AbstractFlexibleItem
import io.github.wulkanowy.data.pojos.AppCreator
import io.github.wulkanowy.data.repositories.appcreator.AppCreatorRepository import io.github.wulkanowy.data.repositories.appcreator.AppCreatorRepository
import io.github.wulkanowy.data.repositories.student.StudentRepository import io.github.wulkanowy.data.repositories.student.StudentRepository
import io.github.wulkanowy.ui.base.BasePresenter import io.github.wulkanowy.ui.base.BasePresenter
import io.github.wulkanowy.ui.base.ErrorHandler import io.github.wulkanowy.ui.base.ErrorHandler
import io.github.wulkanowy.utils.SchedulersProvider import io.github.wulkanowy.utils.SchedulersProvider
import io.reactivex.Single
import javax.inject.Inject import javax.inject.Inject
class CreatorPresenter @Inject constructor( class ContributorPresenter @Inject constructor(
schedulers: SchedulersProvider, schedulers: SchedulersProvider,
errorHandler: ErrorHandler, errorHandler: ErrorHandler,
studentRepository: StudentRepository, studentRepository: StudentRepository,
private val appCreatorRepository: AppCreatorRepository private val appCreatorRepository: AppCreatorRepository
) : BasePresenter<CreatorView>(errorHandler, studentRepository, schedulers) { ) : BasePresenter<ContributorView>(errorHandler, studentRepository, schedulers) {
override fun onAttachView(view: CreatorView) { override fun onAttachView(view: ContributorView) {
super.onAttachView(view) super.onAttachView(view)
view.initView() view.initView()
loadData() loadData()
} }
fun onItemSelected(item: AbstractFlexibleItem<*>) { fun onItemSelected(item: AbstractFlexibleItem<*>) {
if (item !is CreatorItem) return if (item !is ContributorItem) return
view?.openUserGithubPage(item.creator.githubUsername) view?.openUserGithubPage(item.creator.githubUsername)
} }
@ -34,7 +32,7 @@ class CreatorPresenter @Inject constructor(
private fun loadData() { private fun loadData() {
disposable.add(appCreatorRepository.getAppCreators() disposable.add(appCreatorRepository.getAppCreators()
.map { it.map { creator -> CreatorItem(creator) } } .map { it.map { creator -> ContributorItem(creator) } }
.subscribeOn(schedulers.backgroundThread) .subscribeOn(schedulers.backgroundThread)
.observeOn(schedulers.mainThread) .observeOn(schedulers.mainThread)
.doFinally { view?.showProgress(false) } .doFinally { view?.showProgress(false) }

View File

@ -1,12 +1,12 @@
package io.github.wulkanowy.ui.modules.about.creator package io.github.wulkanowy.ui.modules.about.contributor
import io.github.wulkanowy.ui.base.BaseView import io.github.wulkanowy.ui.base.BaseView
interface CreatorView : BaseView { interface ContributorView : BaseView {
fun initView() fun initView()
fun updateData(data: List<CreatorItem>) fun updateData(data: List<ContributorItem>)
fun openUserGithubPage(username: String) fun openUserGithubPage(username: String)

View File

@ -8,7 +8,7 @@ import dagger.android.ContributesAndroidInjector
import io.github.wulkanowy.R import io.github.wulkanowy.R
import io.github.wulkanowy.di.scopes.PerFragment import io.github.wulkanowy.di.scopes.PerFragment
import io.github.wulkanowy.ui.modules.about.AboutFragment import io.github.wulkanowy.ui.modules.about.AboutFragment
import io.github.wulkanowy.ui.modules.about.creator.CreatorFragment import io.github.wulkanowy.ui.modules.about.contributor.ContributorFragment
import io.github.wulkanowy.ui.modules.about.license.LicenseFragment import io.github.wulkanowy.ui.modules.about.license.LicenseFragment
import io.github.wulkanowy.ui.modules.about.license.LicenseModule import io.github.wulkanowy.ui.modules.about.license.LicenseModule
import io.github.wulkanowy.ui.modules.about.logviewer.LogViewerFragment import io.github.wulkanowy.ui.modules.about.logviewer.LogViewerFragment
@ -128,7 +128,7 @@ abstract class MainModule {
@PerFragment @PerFragment
@ContributesAndroidInjector() @ContributesAndroidInjector()
abstract fun bindCreatorsFragment(): CreatorFragment abstract fun bindContributorFragment(): ContributorFragment
@PerFragment @PerFragment
@ContributesAndroidInjector(modules = [SchoolAndTeachersModule::class]) @ContributesAndroidInjector(modules = [SchoolAndTeachersModule::class])

View File

@ -15,7 +15,7 @@
<string name="more_title">Więcej</string> <string name="more_title">Więcej</string>
<string name="about_title">O aplikacji</string> <string name="about_title">O aplikacji</string>
<string name="logviewer_title">Przeglądarka logów</string> <string name="logviewer_title">Przeglądarka logów</string>
<string name="creators_title">Twórcy</string> <string name="contributors_title">Twórcy</string>
<string name="license_title">Licencje</string> <string name="license_title">Licencje</string>
<string name="message_title">Wiadomości</string> <string name="message_title">Wiadomości</string>
<string name="send_message_title">Nowa wiadomość</string> <string name="send_message_title">Nowa wiadomość</string>

View File

@ -15,7 +15,7 @@
<string name="more_title">Ещё</string> <string name="more_title">Ещё</string>
<string name="about_title">О приложении</string> <string name="about_title">О приложении</string>
<string name="logviewer_title">Просмотр журнала</string> <string name="logviewer_title">Просмотр журнала</string>
<string name="creators_title">Творцы</string> <string name="contributors_title">Творцы</string>
<string name="license_title">Лицензии</string> <string name="license_title">Лицензии</string>
<string name="message_title">Сообщения</string> <string name="message_title">Сообщения</string>
<string name="send_message_title">Новое сообщение</string> <string name="send_message_title">Новое сообщение</string>

View File

@ -14,8 +14,8 @@
<string name="settings_title">Налаштування</string> <string name="settings_title">Налаштування</string>
<string name="more_title">Ще</string> <string name="more_title">Ще</string>
<string name="about_title">Про додаток</string> <string name="about_title">Про додаток</string>
<string name="logviewer_title">Log viewer</string> <string name="logviewer_title">Переглядач журналів</string>
<string name="creators_title">Creators</string> <string name="contributors_title">Творці</string>
<string name="license_title">Ліцензії</string> <string name="license_title">Ліцензії</string>
<string name="message_title">Повідомлення</string> <string name="message_title">Повідомлення</string>
<string name="send_message_title">Нове повідомлення</string> <string name="send_message_title">Нове повідомлення</string>

View File

@ -15,7 +15,7 @@
<string name="more_title">More</string> <string name="more_title">More</string>
<string name="about_title">About</string> <string name="about_title">About</string>
<string name="logviewer_title">Log viewer</string> <string name="logviewer_title">Log viewer</string>
<string name="creators_title">Creators</string> <string name="contributors_title">Contributors</string>
<string name="license_title">Licenses</string> <string name="license_title">Licenses</string>
<string name="message_title">Messages</string> <string name="message_title">Messages</string>
<string name="send_message_title">New message</string> <string name="send_message_title">New message</string>
@ -272,7 +272,7 @@
<!--About--> <!--About-->
<string name="about_version">App version</string> <string name="about_version">App version</string>
<string name="about_creator">Creators</string> <string name="about_creator">Contributors</string>
<string name="about_creator_summary">List of Wulkanowy developers</string> <string name="about_creator_summary">List of Wulkanowy developers</string>
<string name="about_feedback">Report a bug</string> <string name="about_feedback">Report a bug</string>
<string name="about_feedback_summary">Send a bug report via e-mail</string> <string name="about_feedback_summary">Send a bug report via e-mail</string>
@ -296,6 +296,7 @@
<string name="creator_avatar_description">Avatar</string> <string name="creator_avatar_description">Avatar</string>
<string name="creator_see_more">See more on GitHub</string> <string name="creator_see_more">See more on GitHub</string>
<!--Log viewer--> <!--Log viewer-->
<string name="logviewer_share">Share logs</string> <string name="logviewer_share">Share logs</string>
<string name="logviewer_refresh">Refresh</string> <string name="logviewer_refresh">Refresh</string>