Skip to content
This repository has been archived by the owner on Feb 28, 2022. It is now read-only.

Commit

Permalink
Small fixes and improvments
Browse files Browse the repository at this point in the history
  • Loading branch information
MGaetan89 committed May 17, 2018
1 parent bda89b1 commit 2bab3fd
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,9 @@ class EpisodeDetailFragment : MediaRouteDiscoveryFragment(), Callback<SingleEpis
it.saveEpisode(episode, this.show!!.indexerId, this.seasonNumber, this.episodeNumber)
it.close()
}

this.episode.removeAllChangeListeners()
this.episode = this.realm.getEpisode(episode.id, this)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -268,14 +268,20 @@ class ShowOverviewFragment : Fragment(), Callback<SingleShow>, View.OnClickListe
val colorStateList = ColorStateList.valueOf(colorPrimary)
val textColor = Utils.getContrastColor(colorPrimary)

ViewCompat.setBackgroundTintList(this.show_imdb, colorStateList)
this.show_imdb?.setTextColor(textColor)
this.show_imdb?.let {
ViewCompat.setBackgroundTintList(it, colorStateList)
it.setTextColor(textColor)
}

ViewCompat.setBackgroundTintList(this.show_the_tvdb, colorStateList)
this.show_the_tvdb?.setTextColor(textColor)
this.show_the_tvdb?.let {
ViewCompat.setBackgroundTintList(it, colorStateList)
it.setTextColor(textColor)
}

ViewCompat.setBackgroundTintList(this.show_web_search, colorStateList)
this.show_web_search?.setTextColor(textColor)
this.show_web_search?.let {
ViewCompat.setBackgroundTintList(it, colorStateList)
it.setTextColor(textColor)
}
}

override fun onImageError(imageView: ImageView, exception: Exception?, errorDrawable: Drawable?) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,8 @@ class ShowsFragment : TabbedFragment(), Callback<Shows>, View.OnClickListener, S
it.saveShows(showsList.toList())
it.close()
}

this.viewPager?.adapter = this.getAdapter()
}

override fun getAdapter() = ShowsPagerAdapter(this.childFragmentManager, this, this.splitShowsAnimes)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import android.os.Bundle
import android.support.design.widget.TabLayout
import android.support.v4.app.Fragment
import android.support.v4.view.PagerAdapter
import android.support.v4.view.ViewPager
import android.support.v4.widget.SwipeRefreshLayout
import android.view.LayoutInflater
import android.view.View
Expand All @@ -14,6 +15,9 @@ import kotlinx.android.synthetic.main.fragment_tabbed.swipe_refresh
import kotlinx.android.synthetic.main.fragment_tabbed.view_pager

abstract class TabbedFragment : Fragment(), SwipeRefreshLayout.OnRefreshListener {
protected var viewPager: ViewPager? = null
get() = this.view_pager

private var tabLayout: TabLayout? = null

override fun onActivityCreated(savedInstanceState: Bundle?) {
Expand All @@ -23,7 +27,7 @@ abstract class TabbedFragment : Fragment(), SwipeRefreshLayout.OnRefreshListener

if (this.tabLayout != null) {
this.tabLayout!!.tabMode = this.getTabMode()
this.tabLayout!!.setupWithViewPager(this.view_pager)
this.tabLayout!!.setupWithViewPager(this.viewPager)
}
}

Expand All @@ -45,7 +49,7 @@ abstract class TabbedFragment : Fragment(), SwipeRefreshLayout.OnRefreshListener
it.setOnRefreshListener(this)
}

this.view_pager?.adapter = this.getAdapter()
this.viewPager?.adapter = this.getAdapter()
}

protected abstract fun getAdapter(): PagerAdapter
Expand All @@ -61,7 +65,7 @@ abstract class TabbedFragment : Fragment(), SwipeRefreshLayout.OnRefreshListener
return
}

this.view_pager?.adapter?.notifyDataSetChanged()
this.viewPager?.adapter?.notifyDataSetChanged()

this.tabLayout?.visibility = if (empty) View.GONE else View.VISIBLE
}
Expand Down

0 comments on commit 2bab3fd

Please sign in to comment.