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 -> { REQUEST_TAKE_PHOTO, REQUEST_PICK_MEDIA -> {
if (resultCode == Activity.RESULT_OK && data != null) { if (resultCode == Activity.RESULT_OK && data != null) {
val src = MediaPickerActivity.getMediaUris(data) 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) val extras = data.getBundleExtra(MediaPickerActivity.EXTRA_EXTRAS)
if (extras?.getBoolean(EXTRA_IS_POSSIBLY_SENSITIVE) == true) { if (extras?.getBoolean(EXTRA_IS_POSSIBLY_SENSITIVE) == true) {
possiblySensitive = true possiblySensitive = true

View File

@ -114,7 +114,10 @@ class UserSelectorActivity : BaseActivity(), OnItemClickListener, LoaderManager.
if (!fromCache) { if (!fromCache) {
showProgress() 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>>) { 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 { fun Status.formattedTextWithIndices(): StatusTextWithIndices {
val source = CodePointArray(this.fullText ?: this.text!!) 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) builder.addEntities(this)
val textWithIndices = StatusTextWithIndices() val textWithIndices = StatusTextWithIndices()
val (text, spans) = builder.buildWithIndices() val (text, spans) = builder.buildWithIndices()

View File

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

View File

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

View File

@ -86,13 +86,13 @@ class TrendsSuggestionsFragment : AbsContentListViewFragment<TrendsAdapter>(), L
override fun onItemClick(view: AdapterView<*>, child: View, position: Int, id: Long) { override fun onItemClick(view: AdapterView<*>, child: View, position: Int, id: Long) {
if (multiSelectManager.isActive) return if (multiSelectManager.isActive) return
val trend: String? = if (view is ListView) { val trend: String = (if (view is ListView) {
adapter.getItem(position - view.headerViewsCount) adapter.getItem(position - view.headerViewsCount)
} else { } else {
adapter.getItem(position) adapter.getItem(position)
} })
if (trend == null) return ?: return
activity?.let { openTweetSearch(it, accountKey, trend) } 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>> { override fun onCreateLoader(id: Int, args: Bundle?): Loader<SingleResponse<ParcelableUser>> {
progressContainer.visibility = View.VISIBLE progressContainer.visibility = View.VISIBLE
editProfileContent.visibility = View.GONE 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>>, override fun onLoadFinished(loader: Loader<SingleResponse<ParcelableUser>>,
@ -242,7 +245,8 @@ class UserProfileEditorFragment : BaseFragment(), OnSizeChangedListener,
val task = currentTask val task = currentTask
if (task != null && !task.isFinished) return if (task != null && !task.isFinished) return
currentTask = UpdateProfileBackgroundImageTaskInternal(this, accountKey, currentTask = UpdateProfileBackgroundImageTaskInternal(this, accountKey,
data.data!!, false, true) data.data!!, tile = false, deleteImage = true
)
} }
REQUEST_UPLOAD_PROFILE_IMAGE -> { REQUEST_UPLOAD_PROFILE_IMAGE -> {
val task = currentTask val task = currentTask

View File

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

View File

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

View File

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