|
|
|
@ -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
|
|
|
|
|
}
|
|
|
|
|