mirror of
https://github.com/etesync/android
synced 2024-11-22 07:58:09 +00:00
Import: mark progressDialog as non-null.
This commit is contained in:
parent
7138766a63
commit
e4b29832f5
@ -166,18 +166,18 @@ class LocalCalendarImportFragment : ListFragment() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected inner class ImportEvents : AsyncTask<LocalCalendar, Int, ResultFragment.ImportResult>() {
|
protected inner class ImportEvents : AsyncTask<LocalCalendar, Int, ResultFragment.ImportResult>() {
|
||||||
internal var progressDialog: ProgressDialog? = null
|
private lateinit var progressDialog: ProgressDialog
|
||||||
|
|
||||||
override fun onPreExecute() {
|
override fun onPreExecute() {
|
||||||
progressDialog = ProgressDialog(activity)
|
progressDialog = ProgressDialog(activity)
|
||||||
progressDialog!!.setTitle(R.string.import_dialog_title)
|
progressDialog.setTitle(R.string.import_dialog_title)
|
||||||
progressDialog!!.setMessage(getString(R.string.import_dialog_adding_entries))
|
progressDialog.setMessage(getString(R.string.import_dialog_adding_entries))
|
||||||
progressDialog!!.setCanceledOnTouchOutside(false)
|
progressDialog.setCanceledOnTouchOutside(false)
|
||||||
progressDialog!!.setCancelable(false)
|
progressDialog.setCancelable(false)
|
||||||
progressDialog!!.isIndeterminate = false
|
progressDialog.isIndeterminate = false
|
||||||
progressDialog!!.setIcon(R.drawable.ic_import_export_black)
|
progressDialog.setIcon(R.drawable.ic_import_export_black)
|
||||||
progressDialog!!.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL)
|
progressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL)
|
||||||
progressDialog!!.show()
|
progressDialog.show()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun doInBackground(vararg calendars: LocalCalendar): ResultFragment.ImportResult {
|
override fun doInBackground(vararg calendars: LocalCalendar): ResultFragment.ImportResult {
|
||||||
@ -185,12 +185,11 @@ class LocalCalendarImportFragment : ListFragment() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun onProgressUpdate(vararg progress: Int?) {
|
override fun onProgressUpdate(vararg progress: Int?) {
|
||||||
if (progressDialog != null)
|
progressDialog.progress = progress[0]!!
|
||||||
progressDialog!!.progress = progress[0]!!
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onPostExecute(result: ResultFragment.ImportResult) {
|
override fun onPostExecute(result: ResultFragment.ImportResult) {
|
||||||
progressDialog!!.dismiss()
|
progressDialog.dismiss()
|
||||||
(activity as ResultFragment.OnImportCallback).onImportResult(result)
|
(activity as ResultFragment.OnImportCallback).onImportResult(result)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -202,7 +201,7 @@ class LocalCalendarImportFragment : ListFragment() {
|
|||||||
LocalCalendar.Factory, info!!.uid!!)
|
LocalCalendar.Factory, info!!.uid!!)
|
||||||
val localEvents = fromCalendar.findAll()
|
val localEvents = fromCalendar.findAll()
|
||||||
val total = localEvents.size
|
val total = localEvents.size
|
||||||
progressDialog!!.max = total
|
progressDialog.max = total
|
||||||
result.total = total.toLong()
|
result.total = total.toLong()
|
||||||
var progress = 0
|
var progress = 0
|
||||||
for (currentLocalEvent in localEvents) {
|
for (currentLocalEvent in localEvents) {
|
||||||
|
@ -101,18 +101,18 @@ class LocalContactImportFragment : Fragment() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected inner class ImportContacts : AsyncTask<LocalAddressBook, Int, ResultFragment.ImportResult>() {
|
protected inner class ImportContacts : AsyncTask<LocalAddressBook, Int, ResultFragment.ImportResult>() {
|
||||||
internal var progressDialog: ProgressDialog? = null
|
private lateinit var progressDialog: ProgressDialog
|
||||||
|
|
||||||
override fun onPreExecute() {
|
override fun onPreExecute() {
|
||||||
progressDialog = ProgressDialog(activity)
|
progressDialog = ProgressDialog(activity)
|
||||||
progressDialog!!.setTitle(R.string.import_dialog_title)
|
progressDialog.setTitle(R.string.import_dialog_title)
|
||||||
progressDialog!!.setMessage(getString(R.string.import_dialog_adding_entries))
|
progressDialog.setMessage(getString(R.string.import_dialog_adding_entries))
|
||||||
progressDialog!!.setCanceledOnTouchOutside(false)
|
progressDialog.setCanceledOnTouchOutside(false)
|
||||||
progressDialog!!.setCancelable(false)
|
progressDialog.setCancelable(false)
|
||||||
progressDialog!!.isIndeterminate = false
|
progressDialog.isIndeterminate = false
|
||||||
progressDialog!!.setIcon(R.drawable.ic_import_export_black)
|
progressDialog.setIcon(R.drawable.ic_import_export_black)
|
||||||
progressDialog!!.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL)
|
progressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL)
|
||||||
progressDialog!!.show()
|
progressDialog.show()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun doInBackground(vararg addressBooks: LocalAddressBook): ResultFragment.ImportResult {
|
override fun doInBackground(vararg addressBooks: LocalAddressBook): ResultFragment.ImportResult {
|
||||||
@ -120,12 +120,11 @@ class LocalContactImportFragment : Fragment() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun onProgressUpdate(vararg values: Int?) {
|
override fun onProgressUpdate(vararg values: Int?) {
|
||||||
if (progressDialog != null)
|
progressDialog.progress = values[0]!!
|
||||||
progressDialog!!.progress = values[0]!!
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onPostExecute(result: ResultFragment.ImportResult) {
|
override fun onPostExecute(result: ResultFragment.ImportResult) {
|
||||||
progressDialog!!.dismiss()
|
progressDialog.dismiss()
|
||||||
(activity as ResultFragment.OnImportCallback).onImportResult(result)
|
(activity as ResultFragment.OnImportCallback).onImportResult(result)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -139,7 +138,7 @@ class LocalContactImportFragment : Fragment() {
|
|||||||
val localGroups = localAddressBook.findAllGroups()
|
val localGroups = localAddressBook.findAllGroups()
|
||||||
val oldIdToNewId = HashMap<Long, Long>()
|
val oldIdToNewId = HashMap<Long, Long>()
|
||||||
val total = localContacts.size + localGroups.size
|
val total = localContacts.size + localGroups.size
|
||||||
progressDialog!!.max = total
|
progressDialog.max = total
|
||||||
result.total = total.toLong()
|
result.total = total.toLong()
|
||||||
var progress = 0
|
var progress = 0
|
||||||
for (currentLocalContact in localContacts) {
|
for (currentLocalContact in localContacts) {
|
||||||
|
Loading…
Reference in New Issue
Block a user