mirror of
https://github.com/etesync/android
synced 2024-12-24 07:28:09 +00:00
Fix a lot of kotlin warnings
This commit is contained in:
parent
15309911a5
commit
e005064be6
@ -134,7 +134,7 @@ class AccountSettingsActivity : BaseActivity() {
|
|||||||
|
|
||||||
val prefWifiOnly = findPreference("sync_wifi_only") as SwitchPreferenceCompat
|
val prefWifiOnly = findPreference("sync_wifi_only") as SwitchPreferenceCompat
|
||||||
prefWifiOnly.isChecked = settings.syncWifiOnly
|
prefWifiOnly.isChecked = settings.syncWifiOnly
|
||||||
prefWifiOnly.onPreferenceChangeListener = Preference.OnPreferenceChangeListener { preference, wifiOnly ->
|
prefWifiOnly.onPreferenceChangeListener = Preference.OnPreferenceChangeListener { _, wifiOnly ->
|
||||||
settings.setSyncWiFiOnly(wifiOnly as Boolean)
|
settings.setSyncWiFiOnly(wifiOnly as Boolean)
|
||||||
loaderManager.restartLoader(0, arguments, this@AccountSettingsFragment)
|
loaderManager.restartLoader(0, arguments, this@AccountSettingsFragment)
|
||||||
false
|
false
|
||||||
|
@ -67,7 +67,7 @@ class AppSettingsActivity : BaseActivity() {
|
|||||||
|
|
||||||
prefOverrideProxy = findPreference("override_proxy") as SwitchPreferenceCompat
|
prefOverrideProxy = findPreference("override_proxy") as SwitchPreferenceCompat
|
||||||
prefOverrideProxy.isChecked = settings.getBoolean(App.OVERRIDE_PROXY, false)
|
prefOverrideProxy.isChecked = settings.getBoolean(App.OVERRIDE_PROXY, false)
|
||||||
prefOverrideProxy.onPreferenceChangeListener = Preference.OnPreferenceChangeListener { preference, newValue ->
|
prefOverrideProxy.onPreferenceChangeListener = Preference.OnPreferenceChangeListener { _, newValue ->
|
||||||
settings.putBoolean(App.OVERRIDE_PROXY, newValue as Boolean)
|
settings.putBoolean(App.OVERRIDE_PROXY, newValue as Boolean)
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
@ -105,8 +105,8 @@ class CollectionMembersListFragment : ListFragment(), AdapterView.OnItemClickLis
|
|||||||
|
|
||||||
internal inner class MembersListAdapter(context: Context) : ArrayAdapter<JournalManager.Member>(context, R.layout.collection_members_list_item) {
|
internal inner class MembersListAdapter(context: Context) : ArrayAdapter<JournalManager.Member>(context, R.layout.collection_members_list_item) {
|
||||||
|
|
||||||
override fun getView(position: Int, v: View?, parent: ViewGroup): View {
|
override fun getView(position: Int, _v: View?, parent: ViewGroup): View {
|
||||||
var v = v
|
var v = _v
|
||||||
if (v == null)
|
if (v == null)
|
||||||
v = LayoutInflater.from(context).inflate(R.layout.collection_members_list_item, parent, false)
|
v = LayoutInflater.from(context).inflate(R.layout.collection_members_list_item, parent, false)
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ open class CreateCollectionActivity : BaseActivity() {
|
|||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
|
|
||||||
account = intent.extras!!.getParcelable(EXTRA_ACCOUNT)
|
account = intent.extras!!.getParcelable(EXTRA_ACCOUNT)!!
|
||||||
info = intent.extras!!.getSerializable(EXTRA_COLLECTION_INFO) as CollectionInfo
|
info = intent.extras!!.getSerializable(EXTRA_COLLECTION_INFO) as CollectionInfo
|
||||||
|
|
||||||
supportActionBar!!.setDisplayHomeAsUpEnabled(true)
|
supportActionBar!!.setDisplayHomeAsUpEnabled(true)
|
||||||
@ -101,27 +101,25 @@ open class CreateCollectionActivity : BaseActivity() {
|
|||||||
|
|
||||||
fun onCreateCollection(item: MenuItem) {
|
fun onCreateCollection(item: MenuItem) {
|
||||||
var ok = true
|
var ok = true
|
||||||
if (info == null) {
|
info = CollectionInfo()
|
||||||
info = CollectionInfo()
|
|
||||||
}
|
|
||||||
|
|
||||||
var edit = findViewById<View>(R.id.display_name) as EditText
|
var edit = findViewById<View>(R.id.display_name) as EditText
|
||||||
info!!.displayName = edit.text.toString()
|
info.displayName = edit.text.toString()
|
||||||
if (TextUtils.isEmpty(info!!.displayName)) {
|
if (TextUtils.isEmpty(info.displayName)) {
|
||||||
edit.error = getString(R.string.create_collection_display_name_required)
|
edit.error = getString(R.string.create_collection_display_name_required)
|
||||||
ok = false
|
ok = false
|
||||||
}
|
}
|
||||||
|
|
||||||
edit = findViewById<View>(R.id.description) as EditText
|
edit = findViewById<View>(R.id.description) as EditText
|
||||||
info!!.description = StringUtils.trimToNull(edit.text.toString())
|
info.description = StringUtils.trimToNull(edit.text.toString())
|
||||||
|
|
||||||
if (ok) {
|
if (ok) {
|
||||||
if (info!!.type == CollectionInfo.Type.CALENDAR) {
|
if (info.type == CollectionInfo.Type.CALENDAR) {
|
||||||
val view = findViewById<View>(R.id.color)
|
val view = findViewById<View>(R.id.color)
|
||||||
info!!.color = (view.background as ColorDrawable).color
|
info.color = (view.background as ColorDrawable).color
|
||||||
}
|
}
|
||||||
|
|
||||||
info!!.selected = true
|
info.selected = true
|
||||||
|
|
||||||
CreateCollectionFragment.newInstance(account, info).show(supportFragmentManager, null)
|
CreateCollectionFragment.newInstance(account, info).show(supportFragmentManager, null)
|
||||||
}
|
}
|
||||||
|
@ -50,7 +50,7 @@ class DeleteCollectionFragment : DialogFragment(), LoaderManager.LoaderCallbacks
|
|||||||
|
|
||||||
|
|
||||||
override fun onCreateLoader(id: Int, args: Bundle?): Loader<Exception> {
|
override fun onCreateLoader(id: Int, args: Bundle?): Loader<Exception> {
|
||||||
account = args!!.getParcelable(ARG_ACCOUNT)
|
account = args!!.getParcelable(ARG_ACCOUNT)!!
|
||||||
collectionInfo = args.getSerializable(ARG_COLLECTION_INFO) as CollectionInfo
|
collectionInfo = args.getSerializable(ARG_COLLECTION_INFO) as CollectionInfo
|
||||||
return DeleteCollectionLoader(context!!, account, collectionInfo)
|
return DeleteCollectionLoader(context!!, account, collectionInfo)
|
||||||
}
|
}
|
||||||
@ -120,12 +120,12 @@ class DeleteCollectionFragment : DialogFragment(), LoaderManager.LoaderCallbacks
|
|||||||
return AlertDialog.Builder(context!!)
|
return AlertDialog.Builder(context!!)
|
||||||
.setTitle(R.string.delete_collection_confirm_title)
|
.setTitle(R.string.delete_collection_confirm_title)
|
||||||
.setMessage(getString(R.string.delete_collection_confirm_warning, name))
|
.setMessage(getString(R.string.delete_collection_confirm_warning, name))
|
||||||
.setPositiveButton(android.R.string.yes) { dialog, which ->
|
.setPositiveButton(android.R.string.yes) { dialog, _ ->
|
||||||
val frag = DeleteCollectionFragment()
|
val frag = DeleteCollectionFragment()
|
||||||
frag.arguments = arguments
|
frag.arguments = arguments
|
||||||
frag.show(fragmentManager!!, null)
|
frag.show(fragmentManager!!, null)
|
||||||
}
|
}
|
||||||
.setNegativeButton(android.R.string.no) { dialog, which -> dismiss() }
|
.setNegativeButton(android.R.string.no) { _, _ -> dismiss() }
|
||||||
.create()
|
.create()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,16 +30,16 @@ class EditCollectionActivity : CreateCollectionActivity() {
|
|||||||
|
|
||||||
setTitle(R.string.edit_collection)
|
setTitle(R.string.edit_collection)
|
||||||
|
|
||||||
if (info!!.type == CollectionInfo.Type.CALENDAR) {
|
if (info.type == CollectionInfo.Type.CALENDAR) {
|
||||||
val colorSquare = findViewById<View>(R.id.color)
|
val colorSquare = findViewById<View>(R.id.color)
|
||||||
colorSquare.setBackgroundColor(info.color ?: LocalCalendar.defaultColor)
|
colorSquare.setBackgroundColor(info.color ?: LocalCalendar.defaultColor)
|
||||||
}
|
}
|
||||||
|
|
||||||
val edit = findViewById<View>(R.id.display_name) as EditText
|
val edit = findViewById<View>(R.id.display_name) as EditText
|
||||||
edit.setText(info!!.displayName)
|
edit.setText(info.displayName)
|
||||||
|
|
||||||
val desc = findViewById<View>(R.id.description) as EditText
|
val desc = findViewById<View>(R.id.description) as EditText
|
||||||
desc.setText(info!!.description)
|
desc.setText(info.description)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onCreateOptionsMenu(menu: Menu): Boolean {
|
override fun onCreateOptionsMenu(menu: Menu): Boolean {
|
||||||
@ -57,7 +57,7 @@ class EditCollectionActivity : CreateCollectionActivity() {
|
|||||||
|
|
||||||
fun onDeleteCollection(item: MenuItem) {
|
fun onDeleteCollection(item: MenuItem) {
|
||||||
val data = (application as App).data
|
val data = (application as App).data
|
||||||
val journalCount = data.count(JournalEntity::class.java).where(JournalEntity.SERVICE_MODEL.eq(info!!.getServiceEntity(data))).get().value()
|
val journalCount = data.count(JournalEntity::class.java).where(JournalEntity.SERVICE_MODEL.eq(info.getServiceEntity(data))).get().value()
|
||||||
|
|
||||||
if (journalCount < 2) {
|
if (journalCount < 2) {
|
||||||
AlertDialog.Builder(this)
|
AlertDialog.Builder(this)
|
||||||
|
@ -35,15 +35,15 @@ class ExceptionInfoFragment : DialogFragment() {
|
|||||||
val dialog = AlertDialog.Builder(context!!)
|
val dialog = AlertDialog.Builder(context!!)
|
||||||
.setIcon(R.drawable.ic_error_dark)
|
.setIcon(R.drawable.ic_error_dark)
|
||||||
.setTitle(title)
|
.setTitle(title)
|
||||||
.setMessage(exception.javaClass.canonicalName + "\n" + exception.localizedMessage)
|
.setMessage("${exception.javaClass.canonicalName}\n" + exception.localizedMessage)
|
||||||
.setNegativeButton(R.string.exception_show_details) { dialog, which ->
|
.setNegativeButton(R.string.exception_show_details) { _, _ ->
|
||||||
val intent = Intent(context, DebugInfoActivity::class.java)
|
val intent = Intent(context, DebugInfoActivity::class.java)
|
||||||
intent.putExtra(DebugInfoActivity.KEY_THROWABLE, exception)
|
intent.putExtra(DebugInfoActivity.KEY_THROWABLE, exception)
|
||||||
if (account != null)
|
if (account != null)
|
||||||
intent.putExtra(Constants.KEY_ACCOUNT, account)
|
intent.putExtra(Constants.KEY_ACCOUNT, account)
|
||||||
startActivity(intent)
|
startActivity(intent)
|
||||||
}
|
}
|
||||||
.setPositiveButton(android.R.string.ok) { dialog, which -> }
|
.setPositiveButton(android.R.string.ok) { _, _ -> }
|
||||||
.create()
|
.create()
|
||||||
isCancelable = false
|
isCancelable = false
|
||||||
return dialog
|
return dialog
|
||||||
|
@ -465,7 +465,7 @@ class JournalItemActivity : BaseActivity(), Refreshable {
|
|||||||
flagsTime = flagsTime or DateUtils.FORMAT_24HOUR
|
flagsTime = flagsTime or DateUtils.FORMAT_24HOUR
|
||||||
}
|
}
|
||||||
|
|
||||||
var datetimeString: String? = null
|
val datetimeString: String
|
||||||
if (allDay) {
|
if (allDay) {
|
||||||
// For multi-day allday events or single-day all-day events that are not
|
// For multi-day allday events or single-day all-day events that are not
|
||||||
// today or tomorrow, use framework formatter.
|
// today or tomorrow, use framework formatter.
|
||||||
|
@ -71,7 +71,7 @@ class RemoveMemberFragment : DialogFragment() {
|
|||||||
.setIcon(R.drawable.ic_error_dark)
|
.setIcon(R.drawable.ic_error_dark)
|
||||||
.setTitle(R.string.collection_members_remove_error)
|
.setTitle(R.string.collection_members_remove_error)
|
||||||
.setMessage(result.throwable.message)
|
.setMessage(result.throwable.message)
|
||||||
.setPositiveButton(android.R.string.yes) { dialog, which -> }.show()
|
.setPositiveButton(android.R.string.yes) { _, _ -> }.show()
|
||||||
}
|
}
|
||||||
dismiss()
|
dismiss()
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,7 @@ class StartupDialogFragment : DialogFragment() {
|
|||||||
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
|
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
|
||||||
isCancelable = false
|
isCancelable = false
|
||||||
|
|
||||||
val mode = Mode.valueOf(arguments!!.getString(ARGS_MODE))
|
val mode = Mode.valueOf(arguments!!.getString(ARGS_MODE)!!)
|
||||||
when (mode) {
|
when (mode) {
|
||||||
StartupDialogFragment.Mode.BATTERY_OPTIMIZATIONS -> return AlertDialog.Builder(activity!!)
|
StartupDialogFragment.Mode.BATTERY_OPTIMIZATIONS -> return AlertDialog.Builder(activity!!)
|
||||||
.setTitle(R.string.startup_battery_optimization)
|
.setTitle(R.string.startup_battery_optimization)
|
||||||
@ -87,7 +87,7 @@ class StartupDialogFragment : DialogFragment() {
|
|||||||
|
|
||||||
// battery optimization whitelisting
|
// battery optimization whitelisting
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && !HintManager.getHintSeen(context, HINT_BATTERY_OPTIMIZATIONS)) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && !HintManager.getHintSeen(context, HINT_BATTERY_OPTIMIZATIONS)) {
|
||||||
val powerManager = context.getSystemService(Context.POWER_SERVICE) as PowerManager
|
val powerManager = context.getSystemService(Context.POWER_SERVICE) as PowerManager?
|
||||||
if (powerManager != null && !powerManager.isIgnoringBatteryOptimizations(BuildConfig.APPLICATION_ID))
|
if (powerManager != null && !powerManager.isIgnoringBatteryOptimizations(BuildConfig.APPLICATION_ID))
|
||||||
dialogs.add(StartupDialogFragment.instantiate(Mode.BATTERY_OPTIMIZATIONS))
|
dialogs.add(StartupDialogFragment.instantiate(Mode.BATTERY_OPTIMIZATIONS))
|
||||||
}
|
}
|
||||||
|
@ -134,7 +134,7 @@ class ViewCollectionActivity : BaseActivity(), Refreshable {
|
|||||||
.setIcon(R.drawable.ic_info_dark)
|
.setIcon(R.drawable.ic_info_dark)
|
||||||
.setTitle(R.string.not_allowed_title)
|
.setTitle(R.string.not_allowed_title)
|
||||||
.setMessage(getString(R.string.edit_owner_only, journalEntity!!.owner))
|
.setMessage(getString(R.string.edit_owner_only, journalEntity!!.owner))
|
||||||
.setPositiveButton(android.R.string.yes) { dialog, which -> }.create()
|
.setPositiveButton(android.R.string.yes) { _, _ -> }.create()
|
||||||
dialog.show()
|
dialog.show()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -157,7 +157,7 @@ class ViewCollectionActivity : BaseActivity(), Refreshable {
|
|||||||
.setIcon(R.drawable.ic_info_dark)
|
.setIcon(R.drawable.ic_info_dark)
|
||||||
.setTitle(R.string.not_allowed_title)
|
.setTitle(R.string.not_allowed_title)
|
||||||
.setMessage(R.string.members_old_journals_not_allowed)
|
.setMessage(R.string.members_old_journals_not_allowed)
|
||||||
.setPositiveButton(android.R.string.yes) { dialog, which -> }.create()
|
.setPositiveButton(android.R.string.yes) { _, _ -> }.create()
|
||||||
dialog.show()
|
dialog.show()
|
||||||
} else if (isOwner) {
|
} else if (isOwner) {
|
||||||
startActivity(CollectionMembersActivity.newIntent(this, account, info))
|
startActivity(CollectionMembersActivity.newIntent(this, account, info))
|
||||||
@ -166,7 +166,7 @@ class ViewCollectionActivity : BaseActivity(), Refreshable {
|
|||||||
.setIcon(R.drawable.ic_info_dark)
|
.setIcon(R.drawable.ic_info_dark)
|
||||||
.setTitle(R.string.not_allowed_title)
|
.setTitle(R.string.not_allowed_title)
|
||||||
.setMessage(getString(R.string.members_owner_only, journalEntity!!.owner))
|
.setMessage(getString(R.string.members_owner_only, journalEntity!!.owner))
|
||||||
.setPositiveButton(android.R.string.yes) { dialog, which -> }.create()
|
.setPositiveButton(android.R.string.yes) { _, _ -> }.create()
|
||||||
dialog.show()
|
dialog.show()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -116,8 +116,8 @@ class WebViewActivity : BaseActivity() {
|
|||||||
mWebView!!.invalidate()
|
mWebView!!.invalidate()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun shouldOverrideUrl(uri: Uri): Boolean {
|
private fun shouldOverrideUrl(_uri: Uri): Boolean {
|
||||||
var uri = uri
|
var uri = _uri
|
||||||
if (isAllowedUrl(uri)) {
|
if (isAllowedUrl(uri)) {
|
||||||
if (uri.getQueryParameter(QUERY_KEY_EMBEDDED) != null) {
|
if (uri.getQueryParameter(QUERY_KEY_EMBEDDED) != null) {
|
||||||
return false
|
return false
|
||||||
|
@ -60,7 +60,7 @@ class CalendarAccount protected constructor(val account: Account) {
|
|||||||
|
|
||||||
var calendarAccount: CalendarAccount? = null
|
var calendarAccount: CalendarAccount? = null
|
||||||
|
|
||||||
val contentProviderClient = resolver.acquireContentProviderClient(CalendarContract.CONTENT_URI)
|
val contentProviderClient = resolver.acquireContentProviderClient(CalendarContract.CONTENT_URI)!!
|
||||||
while (cur.moveToNext()) {
|
while (cur.moveToNext()) {
|
||||||
if (getLong(cur, Calendars.DELETED) != 0L)
|
if (getLong(cur, Calendars.DELETED) != 0L)
|
||||||
continue
|
continue
|
||||||
@ -84,7 +84,7 @@ class CalendarAccount protected constructor(val account: Account) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
contentProviderClient!!.release()
|
contentProviderClient.release()
|
||||||
cur.close()
|
cur.close()
|
||||||
return calendarAccounts
|
return calendarAccounts
|
||||||
}
|
}
|
||||||
|
@ -47,7 +47,7 @@ class ImportFragment : DialogFragment() {
|
|||||||
isCancelable = false
|
isCancelable = false
|
||||||
retainInstance = true
|
retainInstance = true
|
||||||
|
|
||||||
account = arguments!!.getParcelable(KEY_ACCOUNT)
|
account = arguments!!.getParcelable(KEY_ACCOUNT)!!
|
||||||
info = arguments!!.getSerializable(KEY_COLLECTION_INFO) as CollectionInfo
|
info = arguments!!.getSerializable(KEY_COLLECTION_INFO) as CollectionInfo
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -118,9 +118,9 @@ class ImportFragment : DialogFragment() {
|
|||||||
intent.addCategory(Intent.CATEGORY_OPENABLE)
|
intent.addCategory(Intent.CATEGORY_OPENABLE)
|
||||||
intent.action = Intent.ACTION_GET_CONTENT
|
intent.action = Intent.ACTION_GET_CONTENT
|
||||||
|
|
||||||
if (info!!.type == CollectionInfo.Type.CALENDAR) {
|
if (info.type == CollectionInfo.Type.CALENDAR) {
|
||||||
intent.type = "text/calendar"
|
intent.type = "text/calendar"
|
||||||
} else if (info!!.type == CollectionInfo.Type.ADDRESS_BOOK) {
|
} else if (info.type == CollectionInfo.Type.ADDRESS_BOOK) {
|
||||||
intent.type = "text/x-vcard"
|
intent.type = "text/x-vcard"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -205,7 +205,7 @@ class ImportFragment : DialogFragment() {
|
|||||||
try {
|
try {
|
||||||
val importReader = FileReader(importFile!!)
|
val importReader = FileReader(importFile!!)
|
||||||
|
|
||||||
if (info!!.type == CollectionInfo.Type.CALENDAR) {
|
if (info.type == CollectionInfo.Type.CALENDAR) {
|
||||||
val events = Event.fromReader(importReader, null)
|
val events = Event.fromReader(importReader, null)
|
||||||
importReader.close()
|
importReader.close()
|
||||||
|
|
||||||
@ -219,10 +219,10 @@ class ImportFragment : DialogFragment() {
|
|||||||
|
|
||||||
finishParsingFile(events.size)
|
finishParsingFile(events.size)
|
||||||
|
|
||||||
val provider = context!!.contentResolver.acquireContentProviderClient(CalendarContract.CONTENT_URI)
|
val provider = context!!.contentResolver.acquireContentProviderClient(CalendarContract.CONTENT_URI)!!
|
||||||
val localCalendar: LocalCalendar?
|
val localCalendar: LocalCalendar?
|
||||||
try {
|
try {
|
||||||
localCalendar = LocalCalendar.findByName(account, provider, LocalCalendar.Factory, info!!.uid!!)
|
localCalendar = LocalCalendar.findByName(account, provider, LocalCalendar.Factory, info.uid!!)
|
||||||
if (localCalendar == null) {
|
if (localCalendar == null) {
|
||||||
throw FileNotFoundException("Failed to load local resource.")
|
throw FileNotFoundException("Failed to load local resource.")
|
||||||
}
|
}
|
||||||
@ -247,7 +247,7 @@ class ImportFragment : DialogFragment() {
|
|||||||
|
|
||||||
entryProcessed()
|
entryProcessed()
|
||||||
}
|
}
|
||||||
} else if (info!!.type == CollectionInfo.Type.ADDRESS_BOOK) {
|
} else if (info.type == CollectionInfo.Type.ADDRESS_BOOK) {
|
||||||
// FIXME: Handle groups and download icon?
|
// FIXME: Handle groups and download icon?
|
||||||
val downloader = ContactsSyncManager.ResourceDownloader(context!!)
|
val downloader = ContactsSyncManager.ResourceDownloader(context!!)
|
||||||
val contacts = Contact.fromReader(importReader, downloader)
|
val contacts = Contact.fromReader(importReader, downloader)
|
||||||
@ -263,7 +263,7 @@ class ImportFragment : DialogFragment() {
|
|||||||
finishParsingFile(contacts.size)
|
finishParsingFile(contacts.size)
|
||||||
|
|
||||||
val provider = context!!.contentResolver.acquireContentProviderClient(ContactsContract.RawContacts.CONTENT_URI)
|
val provider = context!!.contentResolver.acquireContentProviderClient(ContactsContract.RawContacts.CONTENT_URI)
|
||||||
val localAddressBook = LocalAddressBook.findByUid(context!!, provider!!, account, info!!.uid!!)
|
val localAddressBook = LocalAddressBook.findByUid(context!!, provider!!, account, info.uid!!)
|
||||||
|
|
||||||
for (contact in contacts) {
|
for (contact in contacts) {
|
||||||
try {
|
try {
|
||||||
|
@ -31,7 +31,7 @@ class LocalCalendarImportFragment : ListFragment() {
|
|||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
retainInstance = true
|
retainInstance = true
|
||||||
|
|
||||||
account = arguments!!.getParcelable(KEY_ACCOUNT)
|
account = arguments!!.getParcelable(KEY_ACCOUNT)!!
|
||||||
info = arguments!!.getSerializable(KEY_COLLECTION_INFO) as CollectionInfo
|
info = arguments!!.getSerializable(KEY_COLLECTION_INFO) as CollectionInfo
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -132,7 +132,7 @@ class LocalContactImportFragment : Fragment() {
|
|||||||
try {
|
try {
|
||||||
val addressBook = LocalAddressBook.findByUid(context!!,
|
val addressBook = LocalAddressBook.findByUid(context!!,
|
||||||
context!!.contentResolver.acquireContentProviderClient(ContactsContract.RawContacts.CONTENT_URI)!!,
|
context!!.contentResolver.acquireContentProviderClient(ContactsContract.RawContacts.CONTENT_URI)!!,
|
||||||
account, info!!.uid!!)
|
account, info.uid!!)
|
||||||
val localContacts = localAddressBook.findAll()
|
val localContacts = localAddressBook.findAll()
|
||||||
val total = localContacts.size
|
val total = localContacts.size
|
||||||
progressDialog!!.max = total
|
progressDialog!!.max = total
|
||||||
|
@ -94,15 +94,13 @@ class ListEntriesFragment : ListFragment(), AdapterView.OnItemClickListener {
|
|||||||
|
|
||||||
internal inner class EntriesListAdapter(context: Context) : ArrayAdapter<EntryEntity>(context, R.layout.journal_viewer_list_item) {
|
internal inner class EntriesListAdapter(context: Context) : ArrayAdapter<EntryEntity>(context, R.layout.journal_viewer_list_item) {
|
||||||
|
|
||||||
override fun getView(position: Int, v: View?, parent: ViewGroup): View {
|
override fun getView(position: Int, _v: View?, parent: ViewGroup): View {
|
||||||
var v = v
|
var v = _v
|
||||||
if (v == null)
|
if (v == null)
|
||||||
v = LayoutInflater.from(context).inflate(R.layout.journal_viewer_list_item, parent, false)
|
v = LayoutInflater.from(context).inflate(R.layout.journal_viewer_list_item, parent, false)!!
|
||||||
|
|
||||||
val entryEntity = getItem(position)
|
val entryEntity = getItem(position)
|
||||||
|
|
||||||
val tv = v!!.findViewById<View>(R.id.title) as TextView
|
|
||||||
|
|
||||||
// FIXME: hacky way to make it show sensible info
|
// FIXME: hacky way to make it show sensible info
|
||||||
val info = journalEntity!!.info
|
val info = journalEntity!!.info
|
||||||
setJournalEntryView(v, info, entryEntity!!.content)
|
setJournalEntryView(v, info, entryEntity!!.content)
|
||||||
|
Loading…
Reference in New Issue
Block a user