|
@ -19,12 +19,16 @@
|
|||
|
||||
package org.mariotaku.twidere.util
|
||||
|
||||
import android.accounts.AccountManager
|
||||
import android.accounts.OnAccountsUpdateListener
|
||||
import android.app.Application
|
||||
import android.os.Build
|
||||
import com.crashlytics.android.Crashlytics
|
||||
import io.fabric.sdk.android.Fabric
|
||||
import org.mariotaku.ktextension.addOnAccountsUpdatedListenerSafe
|
||||
import org.mariotaku.twidere.BuildConfig
|
||||
import org.mariotaku.twidere.Constants
|
||||
import java.util.*
|
||||
|
||||
/**
|
||||
* Created by mariotaku on 15/7/8.
|
||||
|
@ -49,6 +53,10 @@ class TwidereBugReporter : BugReporter(), Constants {
|
|||
Crashlytics.setString("build.manufacturer", Build.MANUFACTURER)
|
||||
Crashlytics.setString("build.model", Build.MODEL)
|
||||
Crashlytics.setString("build.product", Build.PRODUCT)
|
||||
val am = AccountManager.get(application)
|
||||
am.addOnAccountsUpdatedListenerSafe(OnAccountsUpdateListener { accounts ->
|
||||
Crashlytics.setString("twidere.accounts", Arrays.toString(accounts))
|
||||
}, updateImmediately = true)
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -38,15 +38,13 @@ class CreateUserListDialogFragment : BaseDialogFragment(), DialogInterface.OnCli
|
|||
when (which) {
|
||||
DialogInterface.BUTTON_POSITIVE -> {
|
||||
val alertDialog = dialog as AlertDialog
|
||||
val args = arguments
|
||||
val accountKey = args.getParcelable<UserKey>(EXTRA_ACCOUNT_KEY)
|
||||
val editName = alertDialog.findViewById(R.id.name) as MaterialEditText?
|
||||
val editDescription = alertDialog.findViewById(R.id.description) as MaterialEditText?
|
||||
val editPublic = alertDialog.findViewById(R.id.is_public) as CheckBox?
|
||||
assert(editName != null && editDescription != null && editPublic != null)
|
||||
val name = ParseUtils.parseString(editName!!.text)
|
||||
val description = ParseUtils.parseString(editDescription!!.text)
|
||||
val isPublic = editPublic!!.isChecked
|
||||
val accountKey: UserKey = arguments.getParcelable(EXTRA_ACCOUNT_KEY)
|
||||
val editName = alertDialog.findViewById(R.id.name) as MaterialEditText
|
||||
val editDescription = alertDialog.findViewById(R.id.description) as MaterialEditText
|
||||
val editPublic = alertDialog.findViewById(R.id.is_public) as CheckBox
|
||||
val name = ParseUtils.parseString(editName.text)
|
||||
val description = ParseUtils.parseString(editDescription.text)
|
||||
val isPublic = editPublic.isChecked
|
||||
if (TextUtils.isEmpty(name)) return
|
||||
twitterWrapper.createUserListAsync(accountKey, name, isPublic, description)
|
||||
}
|
||||
|
@ -64,10 +62,8 @@ class CreateUserListDialogFragment : BaseDialogFragment(), DialogInterface.OnCli
|
|||
val dialog = builder.create()
|
||||
dialog.setOnShowListener { dialog ->
|
||||
val alertDialog = dialog as AlertDialog
|
||||
val editName = alertDialog.findViewById(R.id.name) as MaterialEditText?
|
||||
val editDescription = alertDialog.findViewById(R.id.description) as MaterialEditText?
|
||||
val publicCheckBox = alertDialog.findViewById(R.id.is_public) as CheckBox?
|
||||
editName!!.addValidator(UserListNameValidator(getString(R.string.invalid_list_name)))
|
||||
val editName = alertDialog.findViewById(R.id.name) as MaterialEditText
|
||||
editName.addValidator(UserListNameValidator(getString(R.string.invalid_list_name)))
|
||||
}
|
||||
return dialog
|
||||
}
|
||||
|
|
|
@ -77,9 +77,9 @@ class TrendsSuggestionsFragment : AbsContentListViewFragment<TrendsAdapter>(), L
|
|||
if (multiSelectManager.isActive) return
|
||||
val trend: String?
|
||||
if (view is ListView) {
|
||||
trend = adapter!!.getItem(position - view.headerViewsCount)
|
||||
trend = adapter.getItem(position - view.headerViewsCount)
|
||||
} else {
|
||||
trend = adapter!!.getItem(position)
|
||||
trend = adapter.getItem(position)
|
||||
|
||||
}
|
||||
if (trend == null) return
|
||||
|
@ -87,11 +87,11 @@ class TrendsSuggestionsFragment : AbsContentListViewFragment<TrendsAdapter>(), L
|
|||
}
|
||||
|
||||
override fun onLoaderReset(loader: Loader<Cursor>) {
|
||||
adapter!!.swapCursor(null)
|
||||
adapter.swapCursor(null)
|
||||
}
|
||||
|
||||
override fun onLoadFinished(loader: Loader<Cursor>, cursor: Cursor) {
|
||||
adapter!!.swapCursor(cursor)
|
||||
adapter.swapCursor(cursor)
|
||||
showContent()
|
||||
}
|
||||
|
||||
|
|
Before Width: | Height: | Size: 4.0 KiB After Width: | Height: | Size: 3.8 KiB |
Before Width: | Height: | Size: 5.9 KiB After Width: | Height: | Size: 5.8 KiB |
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.2 KiB |
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 3.3 KiB |
Before Width: | Height: | Size: 5.4 KiB After Width: | Height: | Size: 5.1 KiB |
Before Width: | Height: | Size: 8.2 KiB After Width: | Height: | Size: 7.9 KiB |
Before Width: | Height: | Size: 9.1 KiB After Width: | Height: | Size: 8.6 KiB |
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 20 KiB |