Fix style issues related to parameters, little misc cleanup

This commit is contained in:
TacoTheDank 2020-06-08 19:48:04 -04:00
parent fd62c19ba6
commit 50ee094889
10 changed files with 46 additions and 18 deletions

View File

@ -395,7 +395,10 @@ class ComposeActivity : BaseActivity(), OnMenuItemClickListener, OnClickListener
REQUEST_TAKE_PHOTO, REQUEST_PICK_MEDIA -> {
if (resultCode == Activity.RESULT_OK && data != null) {
val src = MediaPickerActivity.getMediaUris(data)
TaskStarter.execute(AddMediaTask(this, src, null, false, false))
TaskStarter.execute(AddMediaTask(this, src, null,
copySrc = false,
deleteSrc = false
))
val extras = data.getBundleExtra(MediaPickerActivity.EXTRA_EXTRAS)
if (extras?.getBoolean(EXTRA_IS_POSSIBLY_SENSITIVE) == true) {
possiblySensitive = true

View File

@ -114,7 +114,10 @@ class UserSelectorActivity : BaseActivity(), OnItemClickListener, LoaderManager.
if (!fromCache) {
showProgress()
}
return CacheUserSearchLoader(this, accountKey, query, !fromCache, true, true)
return CacheUserSearchLoader(this, accountKey, query, !fromCache,
fromCache = true,
fromUser = true
)
}
override fun onLoaderReset(loader: Loader<List<ParcelableUser>>) {

View File

@ -220,7 +220,11 @@ fun Status.applyTo(accountKey: UserKey, accountType: String, profileImageSize: S
fun Status.formattedTextWithIndices(): StatusTextWithIndices {
val source = CodePointArray(this.fullText ?: this.text!!)
val builder = HtmlBuilder(source, false, true, false)
val builder = HtmlBuilder(source,
throwExceptions = false,
sourceIsEscaped = true,
shouldReEscape = false
)
builder.addEntities(this)
val textWithIndices = StatusTextWithIndices()
val (text, spans) = builder.buildWithIndices()

View File

@ -103,8 +103,10 @@ abstract class AbsActivitiesFragment protected constructor() :
registerForContextMenu(recyclerView)
navigationHelper = RecyclerViewNavigationHelper(recyclerView, layoutManager, adapter,
this)
pauseOnScrollListener = PauseRecyclerViewOnScrollListener(false, false,
requestManager)
pauseOnScrollListener = PauseRecyclerViewOnScrollListener(
pauseOnScroll = false, pauseOnFling = false,
requestManager = requestManager
)
val loaderArgs = Bundle(arguments)
loaderArgs.putBoolean(EXTRA_FROM_USER, true)

View File

@ -147,8 +147,10 @@ abstract class AbsStatusesFragment : AbsContentListRecyclerViewFragment<Parcelab
adapter.statusClickListener = this
registerForContextMenu(recyclerView)
navigationHelper = RecyclerViewNavigationHelper(recyclerView, layoutManager, adapter, this)
pauseOnScrollListener = PauseRecyclerViewOnScrollListener(false, false,
requestManager)
pauseOnScrollListener = PauseRecyclerViewOnScrollListener(
pauseOnScroll = false, pauseOnFling = false,
requestManager = requestManager
)
if (shouldInitLoader) {
initLoaderIfNeeded()

View File

@ -86,13 +86,13 @@ class TrendsSuggestionsFragment : AbsContentListViewFragment<TrendsAdapter>(), L
override fun onItemClick(view: AdapterView<*>, child: View, position: Int, id: Long) {
if (multiSelectManager.isActive) return
val trend: String? = if (view is ListView) {
val trend: String = (if (view is ListView) {
adapter.getItem(position - view.headerViewsCount)
} else {
adapter.getItem(position)
}
if (trend == null) return
})
?: return
activity?.let { openTweetSearch(it, accountKey, trend) }
}

View File

@ -131,7 +131,10 @@ class UserProfileEditorFragment : BaseFragment(), OnSizeChangedListener,
override fun onCreateLoader(id: Int, args: Bundle?): Loader<SingleResponse<ParcelableUser>> {
progressContainer.visibility = View.VISIBLE
editProfileContent.visibility = View.GONE
return ParcelableUserLoader(requireActivity(), accountKey, accountKey, null, arguments, false, false)
return ParcelableUserLoader(requireActivity(), accountKey, accountKey, null, arguments,
omitIntentExtra = false,
loadFromCache = false
)
}
override fun onLoadFinished(loader: Loader<SingleResponse<ParcelableUser>>,
@ -242,7 +245,8 @@ class UserProfileEditorFragment : BaseFragment(), OnSizeChangedListener,
val task = currentTask
if (task != null && !task.isFinished) return
currentTask = UpdateProfileBackgroundImageTaskInternal(this, accountKey,
data.data!!, false, true)
data.data!!, tile = false, deleteImage = true
)
}
REQUEST_UPLOAD_PROFILE_IMAGE -> {
val task = currentTask

View File

@ -231,7 +231,10 @@ class MessagesConversationFragment : AbsContentListRecyclerViewFragment<Messages
Activity.RESULT_OK -> if (data != null) {
val mediaUris = MediaPickerActivity.getMediaUris(data)
val types = data.getBundleExtra(MediaPickerActivity.EXTRA_EXTRAS)?.getIntArray(EXTRA_TYPES)
TaskStarter.execute(AddMediaTask(this, mediaUris, types, false, false))
TaskStarter.execute(AddMediaTask(this, mediaUris, types,
copySrc = false,
deleteSrc = false
))
}
RESULT_SEARCH_GIF -> {
val provider = gifShareProvider ?: return
@ -543,8 +546,10 @@ class MessagesConversationFragment : AbsContentListRecyclerViewFragment<Messages
} else {
ParcelableMedia.Type.IMAGE
}
val task = AddMediaTask(this, arrayOf(contentInfo.contentUri), intArrayOf(type), true,
false)
val task = AddMediaTask(this, arrayOf(contentInfo.contentUri), intArrayOf(type),
copySrc = true,
deleteSrc = false
)
task.callback = {
contentInfo.releasePermission()
}

View File

@ -34,8 +34,13 @@ open class UpdateProfileBackgroundImageTask<ResultHandler>(
override fun onExecute(account: AccountDetails, params: Any?): ParcelableUser {
val microBlog = account.newMicroBlogInstance(context, MicroBlog::class.java)
try {
UpdateStatusTask.getBodyFromMedia(context, imageUri, ParcelableMedia.Type.IMAGE, true,
true, null, false, null).use {
UpdateStatusTask.getBodyFromMedia(context, imageUri, ParcelableMedia.Type.IMAGE,
isDeleteAlways = true,
isDeleteOnSuccess = true,
sizeLimit = null,
chucked = false,
readListener = null
).use {
microBlog.updateProfileBackgroundImage(it.body, tile)
}
} catch (e: IOException) {

View File

@ -157,7 +157,7 @@ class HtmlBuilder(
if (display != null) {
sb.append(display, false, displayIsHtml)
} else {
sb.append(link, false, false)
sb.append(link, escapeText = false, textEscaped = false)
}
}