From 1ed45dcc3dac831cd5b8c7fd5243e381473d6a00 Mon Sep 17 00:00:00 2001 From: tibbi Date: Tue, 6 Dec 2016 22:35:37 +0100 Subject: [PATCH] update the actionbar title after renaming an item --- .../gallery/activities/ViewPagerActivity.kt | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt index 181761f44..b0e8ec9e2 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt @@ -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,7 +289,9 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View } private fun updateActionbarTitle() { - title = mMedia[mPos].path.getFilenameFromPath() + runOnUiThread { + title = mMedia[mPos].path.getFilenameFromPath() + } } private fun getCurrentMedium(): Medium? {