Fix two pane layout

pull/935/head
Alex Baker 5 years ago
parent 1d8f0c5b57
commit cb29478e71

@ -266,7 +266,7 @@ public class MainActivity extends InjectingAppCompatActivity
private void hideDetailFragment() {
getSupportFragmentManager()
.beginTransaction()
.replace(R.id.detail, new EmptyTaskEditFragment())
.replace(R.id.detail, EmptyTaskEditFragment.Companion.newEmptyTaskEditFragment(filter))
.commit();
if (isSinglePaneLayout()) {

@ -4,22 +4,43 @@ import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import com.todoroo.astrid.api.Filter
import org.tasks.databinding.FragmentTaskEditEmptyBinding
import org.tasks.injection.FragmentComponent
import org.tasks.injection.InjectingFragment
import org.tasks.themes.ThemeColor
import org.tasks.themes.ThemeColor.newThemeColor
import javax.inject.Inject
class EmptyTaskEditFragment : InjectingFragment() {
@Inject lateinit var themeColor: ThemeColor
companion object {
const val EXTRA_FILTER = "extra_filter"
fun newEmptyTaskEditFragment(filter: Filter): EmptyTaskEditFragment {
val arguments = Bundle()
arguments.putParcelable(EXTRA_FILTER, filter)
val fragment = EmptyTaskEditFragment()
fragment.arguments = arguments
return fragment
}
}
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?
): View? {
val binding = FragmentTaskEditEmptyBinding.inflate(inflater)
themeColor.apply(binding.toolbar.toolbar)
val tint = arguments?.getParcelable<Filter>(EXTRA_FILTER)?.tint
val color = newThemeColor(
context!!,
if (tint == null || tint == 0) themeColor.primaryColor else tint
)
color.apply(binding.toolbar.toolbar)
return binding.root
}

Loading…
Cancel
Save