Fix flickering old theme color when opening task

pull/1074/head
Alex Baker 4 years ago
parent b97b9d5ef4
commit 3ca6ccae1b

@ -16,7 +16,6 @@ import android.view.View
import android.view.inputmethod.InputMethodManager import android.view.inputmethod.InputMethodManager
import androidx.appcompat.view.ActionMode import androidx.appcompat.view.ActionMode
import androidx.drawerlayout.widget.DrawerLayout.SimpleDrawerListener import androidx.drawerlayout.widget.DrawerLayout.SimpleDrawerListener
import androidx.fragment.app.FragmentManager
import androidx.lifecycle.lifecycleScope import androidx.lifecycle.lifecycleScope
import com.todoroo.andlib.utility.AndroidUtilities import com.todoroo.andlib.utility.AndroidUtilities
import com.todoroo.astrid.activity.TaskEditFragment.Companion.newTaskEditFragment import com.todoroo.astrid.activity.TaskEditFragment.Companion.newTaskEditFragment
@ -243,7 +242,7 @@ class MainActivity : InjectingAppCompatActivity(), TaskListFragmentCallbackHandl
} }
if (isSinglePaneLayout) { if (isSinglePaneLayout) {
if (openTask || tef != null) { if (openTask || tef != null) {
openTask(null) openTask(filter)
} else { } else {
openTaskListFragment(filter, false) openTaskListFragment(filter, false)
} }
@ -273,12 +272,14 @@ class MainActivity : InjectingAppCompatActivity(), TaskListFragmentCallbackHandl
supportFragmentManager supportFragmentManager
.beginTransaction() .beginTransaction()
.replace(R.id.detail, newEmptyTaskEditFragment(it)) .replace(R.id.detail, newEmptyTaskEditFragment(it))
.runOnCommit {
if (isSinglePaneLayout) {
binding.master.visibility = View.VISIBLE
binding.detail.visibility = View.GONE
}
}
.commitNow() .commitNow()
} }
if (isSinglePaneLayout) {
binding.master.visibility = View.VISIBLE
binding.detail.visibility = View.GONE
}
} }
private fun setFilter(newFilter: Filter?) { private fun setFilter(newFilter: Filter?) {
@ -363,9 +364,8 @@ class MainActivity : InjectingAppCompatActivity(), TaskListFragmentCallbackHandl
filterColor) filterColor)
supportFragmentManager.beginTransaction() supportFragmentManager.beginTransaction()
.replace(R.id.detail, fragment, TaskEditFragment.TAG_TASKEDIT_FRAGMENT) .replace(R.id.detail, fragment, TaskEditFragment.TAG_TASKEDIT_FRAGMENT)
.addToBackStack(TaskEditFragment.TAG_TASKEDIT_FRAGMENT) .runOnCommit(this::showDetailFragment)
.commit() .commitNow()
showDetailFragment()
} }
override fun onNavigationIconClicked() { override fun onNavigationIconClicked() {
@ -412,9 +412,6 @@ class MainActivity : InjectingAppCompatActivity(), TaskListFragmentCallbackHandl
get() = !resources.getBoolean(R.bool.two_pane_layout) get() = !resources.getBoolean(R.bool.two_pane_layout)
fun removeTaskEditFragment() { fun removeTaskEditFragment() {
supportFragmentManager.popBackStack(
TaskEditFragment.TAG_TASKEDIT_FRAGMENT,
FragmentManager.POP_BACK_STACK_INCLUSIVE)
val removeTask = intent.removeTask val removeTask = intent.removeTask
val finishAffinity = intent.finishAffinity val finishAffinity = intent.finishAffinity
if (finishAffinity || taskListFragment == null) { if (finishAffinity || taskListFragment == null) {

Loading…
Cancel
Save