|
|
|
|
@ -1,15 +1,19 @@
|
|
|
|
|
package org.tasks.preferences.fragments
|
|
|
|
|
|
|
|
|
|
import android.os.Bundle
|
|
|
|
|
import android.widget.Toast
|
|
|
|
|
import androidx.annotation.StringRes
|
|
|
|
|
import androidx.lifecycle.lifecycleScope
|
|
|
|
|
import androidx.preference.Preference
|
|
|
|
|
import at.bitfire.cert4android.CustomCertManager.Companion.resetCertificates
|
|
|
|
|
import com.todoroo.astrid.service.TaskCreator
|
|
|
|
|
import dagger.hilt.android.AndroidEntryPoint
|
|
|
|
|
import kotlinx.coroutines.launch
|
|
|
|
|
import org.tasks.R
|
|
|
|
|
import org.tasks.billing.BillingClient
|
|
|
|
|
import org.tasks.billing.Inventory
|
|
|
|
|
import org.tasks.data.createDueDate
|
|
|
|
|
import org.tasks.data.entity.Task
|
|
|
|
|
import org.tasks.extensions.Context.toast
|
|
|
|
|
import org.tasks.injection.InjectingPreferenceFragment
|
|
|
|
|
import org.tasks.preferences.Preferences
|
|
|
|
|
@ -24,6 +28,8 @@ class Debug : InjectingPreferenceFragment() {
|
|
|
|
|
@Inject lateinit var inventory: Inventory
|
|
|
|
|
@Inject lateinit var billingClient: BillingClient
|
|
|
|
|
@Inject lateinit var preferences: Preferences
|
|
|
|
|
@Inject lateinit var taskCreator: TaskCreator
|
|
|
|
|
@Inject lateinit var taskDao: com.todoroo.astrid.dao.TaskDao
|
|
|
|
|
|
|
|
|
|
override fun getPreferenceXml() = R.xml.preferences_debug
|
|
|
|
|
|
|
|
|
|
@ -69,6 +75,20 @@ class Debug : InjectingPreferenceFragment() {
|
|
|
|
|
preferences.warnQuietHoursDisabled = true
|
|
|
|
|
preferences.setBoolean(R.string.p_just_updated, true)
|
|
|
|
|
true
|
|
|
|
|
}
|
|
|
|
|
findPreference(R.string.debug_create_tasks).setOnPreferenceClickListener {
|
|
|
|
|
lifecycleScope.launch {
|
|
|
|
|
val count = 5000
|
|
|
|
|
for (i in 1..count) {
|
|
|
|
|
val task = taskCreator.createWithValues("")
|
|
|
|
|
taskDao.createNew(task)
|
|
|
|
|
task.title = "Task ${task.id}"
|
|
|
|
|
task.dueDate = createDueDate(Task.URGENCY_SPECIFIC_DAY, currentTimeMillis())
|
|
|
|
|
taskDao.save(task)
|
|
|
|
|
}
|
|
|
|
|
Toast.makeText(context, "Created $count tasks", Toast.LENGTH_SHORT).show()
|
|
|
|
|
}
|
|
|
|
|
false
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|