reference the SupportActionBar title at updating it

This commit is contained in:
tibbi 2017-12-06 16:44:54 +01:00
parent 0285b97a17
commit bb2659d018
3 changed files with 5 additions and 5 deletions

View file

@ -151,7 +151,7 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener {
handlePermission(PERMISSION_WRITE_STORAGE) { handlePermission(PERMISSION_WRITE_STORAGE) {
if (it) { if (it) {
val dirName = getHumanizedFilename(mPath) val dirName = getHumanizedFilename(mPath)
title = if (mShowAll) resources.getString(R.string.all_folders) else dirName supportActionBar?.title = if (mShowAll) resources.getString(R.string.all_folders) else dirName
getMedia() getMedia()
setupLayoutManager() setupLayoutManager()
checkIfColorChanged() checkIfColorChanged()

View file

@ -79,7 +79,7 @@ open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentList
val bundle = Bundle() val bundle = Bundle()
val file = File(mUri.toString()) val file = File(mUri.toString())
mMedium = Medium(getFilenameFromUri(mUri!!), mUri.toString(), mIsVideo, 0, 0, file.length()) mMedium = Medium(getFilenameFromUri(mUri!!), mUri.toString(), mIsVideo, 0, 0, file.length())
title = mMedium!!.name supportActionBar?.title = mMedium!!.name
bundle.putSerializable(MEDIUM, mMedium) bundle.putSerializable(MEDIUM, mMedium)
if (savedInstanceState == null) { if (savedInstanceState == null) {

View file

@ -185,7 +185,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
showSystemUI() showSystemUI()
mDirectory = File(mPath).parent mDirectory = File(mPath).parent
title = mPath.getFilenameFromPath() supportActionBar?.title = mPath.getFilenameFromPath()
view_pager.onGlobalLayout { view_pager.onGlobalLayout {
if (!isActivityDestroyed()) { if (!isActivityDestroyed()) {
@ -463,7 +463,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
private fun toggleFileVisibility(hide: Boolean) { private fun toggleFileVisibility(hide: Boolean) {
toggleFileVisibility(getCurrentFile(), hide) { toggleFileVisibility(getCurrentFile(), hide) {
val newFileName = it.absolutePath.getFilenameFromPath() val newFileName = it.absolutePath.getFilenameFromPath()
title = newFileName supportActionBar?.title = newFileName
getCurrentMedium()!!.apply { getCurrentMedium()!!.apply {
name = newFileName name = newFileName
@ -835,7 +835,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
private fun updateActionbarTitle() { private fun updateActionbarTitle() {
runOnUiThread { runOnUiThread {
if (mPos < getCurrentMedia().size) { if (mPos < getCurrentMedia().size) {
title = getCurrentMedia()[mPos].path.getFilenameFromPath() supportActionBar?.title = getCurrentMedia()[mPos].path.getFilenameFromPath()
} }
} }
} }