1
0
mirror of https://github.com/etesync/android synced 2024-11-25 17:38:13 +00:00

Import: mark progressDialog as non-null.

This commit is contained in:
Tom Hacohen 2019-05-01 13:26:59 +01:00
parent 7138766a63
commit e4b29832f5
2 changed files with 24 additions and 26 deletions

View File

@ -166,18 +166,18 @@ class LocalCalendarImportFragment : ListFragment() {
}
protected inner class ImportEvents : AsyncTask<LocalCalendar, Int, ResultFragment.ImportResult>() {
internal var progressDialog: ProgressDialog? = null
private lateinit var progressDialog: ProgressDialog
override fun onPreExecute() {
progressDialog = ProgressDialog(activity)
progressDialog!!.setTitle(R.string.import_dialog_title)
progressDialog!!.setMessage(getString(R.string.import_dialog_adding_entries))
progressDialog!!.setCanceledOnTouchOutside(false)
progressDialog!!.setCancelable(false)
progressDialog!!.isIndeterminate = false
progressDialog!!.setIcon(R.drawable.ic_import_export_black)
progressDialog!!.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL)
progressDialog!!.show()
progressDialog.setTitle(R.string.import_dialog_title)
progressDialog.setMessage(getString(R.string.import_dialog_adding_entries))
progressDialog.setCanceledOnTouchOutside(false)
progressDialog.setCancelable(false)
progressDialog.isIndeterminate = false
progressDialog.setIcon(R.drawable.ic_import_export_black)
progressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL)
progressDialog.show()
}
override fun doInBackground(vararg calendars: LocalCalendar): ResultFragment.ImportResult {
@ -185,12 +185,11 @@ class LocalCalendarImportFragment : ListFragment() {
}
override fun onProgressUpdate(vararg progress: Int?) {
if (progressDialog != null)
progressDialog!!.progress = progress[0]!!
progressDialog.progress = progress[0]!!
}
override fun onPostExecute(result: ResultFragment.ImportResult) {
progressDialog!!.dismiss()
progressDialog.dismiss()
(activity as ResultFragment.OnImportCallback).onImportResult(result)
}
@ -202,7 +201,7 @@ class LocalCalendarImportFragment : ListFragment() {
LocalCalendar.Factory, info!!.uid!!)
val localEvents = fromCalendar.findAll()
val total = localEvents.size
progressDialog!!.max = total
progressDialog.max = total
result.total = total.toLong()
var progress = 0
for (currentLocalEvent in localEvents) {

View File

@ -101,18 +101,18 @@ class LocalContactImportFragment : Fragment() {
}
protected inner class ImportContacts : AsyncTask<LocalAddressBook, Int, ResultFragment.ImportResult>() {
internal var progressDialog: ProgressDialog? = null
private lateinit var progressDialog: ProgressDialog
override fun onPreExecute() {
progressDialog = ProgressDialog(activity)
progressDialog!!.setTitle(R.string.import_dialog_title)
progressDialog!!.setMessage(getString(R.string.import_dialog_adding_entries))
progressDialog!!.setCanceledOnTouchOutside(false)
progressDialog!!.setCancelable(false)
progressDialog!!.isIndeterminate = false
progressDialog!!.setIcon(R.drawable.ic_import_export_black)
progressDialog!!.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL)
progressDialog!!.show()
progressDialog.setTitle(R.string.import_dialog_title)
progressDialog.setMessage(getString(R.string.import_dialog_adding_entries))
progressDialog.setCanceledOnTouchOutside(false)
progressDialog.setCancelable(false)
progressDialog.isIndeterminate = false
progressDialog.setIcon(R.drawable.ic_import_export_black)
progressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL)
progressDialog.show()
}
override fun doInBackground(vararg addressBooks: LocalAddressBook): ResultFragment.ImportResult {
@ -120,12 +120,11 @@ class LocalContactImportFragment : Fragment() {
}
override fun onProgressUpdate(vararg values: Int?) {
if (progressDialog != null)
progressDialog!!.progress = values[0]!!
progressDialog.progress = values[0]!!
}
override fun onPostExecute(result: ResultFragment.ImportResult) {
progressDialog!!.dismiss()
progressDialog.dismiss()
(activity as ResultFragment.OnImportCallback).onImportResult(result)
}
@ -139,7 +138,7 @@ class LocalContactImportFragment : Fragment() {
val localGroups = localAddressBook.findAllGroups()
val oldIdToNewId = HashMap<Long, Long>()
val total = localContacts.size + localGroups.size
progressDialog!!.max = total
progressDialog.max = total
result.total = total.toLong()
var progress = 0
for (currentLocalContact in localContacts) {