add ktlint plugin to project and apply default code style (#2209)
* add ktlint plugin to project and apply default code style * some manual adjustments, fix wildcard imports * update CONTRIBUTING.md * fix formatting
This commit is contained in:
parent
955267199e
commit
16ffcca748
227 changed files with 3933 additions and 3371 deletions
|
@ -15,18 +15,17 @@
|
|||
|
||||
package com.keylesspalace.tusky.pager
|
||||
|
||||
import androidx.fragment.app.*
|
||||
|
||||
import com.keylesspalace.tusky.fragment.AccountMediaFragment
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.fragment.app.FragmentActivity
|
||||
import com.keylesspalace.tusky.components.timeline.TimelineFragment
|
||||
import com.keylesspalace.tusky.components.timeline.TimelineViewModel
|
||||
import com.keylesspalace.tusky.fragment.AccountMediaFragment
|
||||
import com.keylesspalace.tusky.interfaces.RefreshableFragment
|
||||
|
||||
import com.keylesspalace.tusky.util.CustomFragmentStateAdapter
|
||||
|
||||
class AccountPagerAdapter(
|
||||
activity: FragmentActivity,
|
||||
private val accountId: String
|
||||
activity: FragmentActivity,
|
||||
private val accountId: String
|
||||
) : CustomFragmentStateAdapter(activity) {
|
||||
|
||||
override fun getItemCount() = TAB_COUNT
|
||||
|
|
|
@ -8,9 +8,9 @@ import com.keylesspalace.tusky.fragment.ViewMediaFragment
|
|||
import java.lang.ref.WeakReference
|
||||
|
||||
class ImagePagerAdapter(
|
||||
activity: FragmentActivity,
|
||||
private val attachments: List<Attachment>,
|
||||
private val initialPosition: Int
|
||||
activity: FragmentActivity,
|
||||
private val attachments: List<Attachment>,
|
||||
private val initialPosition: Int
|
||||
) : ViewMediaAdapter(activity) {
|
||||
|
||||
private var didTransition = false
|
||||
|
@ -25,8 +25,8 @@ class ImagePagerAdapter(
|
|||
// forth photo and then back to the first. The first fragment will try to start the
|
||||
// transition and wait until it's over and it will never take place.
|
||||
val fragment = ViewMediaFragment.newInstance(
|
||||
attachment = attachments[position],
|
||||
shouldStartPostponedTransition = !didTransition && position == initialPosition
|
||||
attachment = attachments[position],
|
||||
shouldStartPostponedTransition = !didTransition && position == initialPosition
|
||||
)
|
||||
fragments[position] = WeakReference(fragment)
|
||||
return fragment
|
||||
|
@ -35,7 +35,7 @@ class ImagePagerAdapter(
|
|||
}
|
||||
}
|
||||
|
||||
override fun onTransitionEnd(position: Int) {
|
||||
override fun onTransitionEnd(position: Int) {
|
||||
this.didTransition = true
|
||||
fragments[position]?.get()?.onTransitionEnd()
|
||||
}
|
||||
|
|
|
@ -28,5 +28,4 @@ class MainPagerAdapter(val tabs: List<TabData>, activity: FragmentActivity) : Cu
|
|||
}
|
||||
|
||||
override fun getItemCount() = tabs.size
|
||||
|
||||
}
|
||||
|
|
|
@ -6,8 +6,8 @@ import com.keylesspalace.tusky.ViewMediaAdapter
|
|||
import com.keylesspalace.tusky.fragment.ViewMediaFragment
|
||||
|
||||
class SingleImagePagerAdapter(
|
||||
activity: FragmentActivity,
|
||||
private val imageUrl: String
|
||||
activity: FragmentActivity,
|
||||
private val imageUrl: String
|
||||
) : ViewMediaAdapter(activity) {
|
||||
|
||||
override fun createFragment(position: Int): Fragment {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue