update the actionbar title after renaming an item

This commit is contained in:
tibbi 2016-12-06 22:35:37 +01:00
parent 6c5a428b40
commit 1ed45dcc3d

View file

@ -124,7 +124,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
true
}
R.id.menu_rename -> {
editMedium()
renameFile()
true
}
R.id.menu_edit -> {
@ -233,9 +233,9 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
false
}
private fun editMedium() {
private fun renameFile() {
RenameFileDialog(this, getCurrentFile()) {
mMedia[view_pager.currentItem].path = it.absolutePath
mMedia[mPos].path = it.absolutePath
updateActionbarTitle()
}
}
@ -289,8 +289,10 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
}
private fun updateActionbarTitle() {
runOnUiThread {
title = mMedia[mPos].path.getFilenameFromPath()
}
}
private fun getCurrentMedium(): Medium? {
return if (mMedia.isEmpty())