2
0
mirror of https://github.com/fork-maintainers/iceraven-browser synced 2024-11-02 03:40:16 +00:00

Fixes #1886: Applies theme to toolbar onResume of library fragment (#1888)

This commit is contained in:
Sawyer Blatz 2019-04-23 07:23:27 -07:00 committed by GitHub
parent 334a3dc672
commit b54a1c9c57
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -12,11 +12,13 @@ import android.view.MenuItem
import android.view.View
import android.view.ViewGroup
import androidx.appcompat.app.AppCompatActivity
import androidx.appcompat.widget.Toolbar
import androidx.fragment.app.Fragment
import androidx.navigation.Navigation
import kotlinx.android.synthetic.main.fragment_library.*
import mozilla.appservices.places.BookmarkRoot
import org.mozilla.fenix.R
import org.mozilla.fenix.ext.getColorFromAttr
import org.mozilla.fenix.library.bookmarks.BookmarkFragmentArgs
class LibraryFragment : Fragment() {
@ -36,6 +38,8 @@ class LibraryFragment : Fragment() {
override fun onResume() {
super.onResume()
setToolbarColor()
(activity as AppCompatActivity).title = getString(R.string.library_title)
(activity as AppCompatActivity).supportActionBar?.show()
}
@ -69,4 +73,10 @@ class LibraryFragment : Fragment() {
else -> super.onOptionsItemSelected(item)
}
}
private fun setToolbarColor() {
val toolbar = (activity as AppCompatActivity).findViewById<Toolbar>(R.id.navigationToolbar)
toolbar.setBackgroundColor(R.attr.foundation.getColorFromAttr(context!!))
toolbar.setTitleTextColor(R.attr.primaryText.getColorFromAttr(context!!))
}
}