This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class NonLazyDemoAdapter internal constructor( | |
fm: FragmentManager | |
) : FragmentStatePagerAdapter(fm) { | |
internal data class FragmentBundle( | |
@SerializedName("id") // caller side now can be refactored to use property, not JvmField | |
var id: Int, | |
@SerializedName("name") | |
var name: String | |
) : Serializable |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class NonLazyDemoAdapter internal constructor( | |
fm: FragmentManager | |
) : FragmentStatePagerAdapter(fm) { | |
internal class FragmentBundle( | |
@JvmField | |
@SerializedName("id") | |
var id: Int, | |
@JvmField |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
override fun getItem(position: Int): Fragment { | |
return cachedFragments[position] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
override fun getItem(position: Int): Fragment { | |
return cachedFragments[position]!! | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class NonLazyDemoAdapter internal constructor(fm: FragmentManager) : FragmentStatePagerAdapter(fm) { | |
internal class FragmentBundle( | |
@JvmField | |
@SerializedName("id") // if this field was used directly before we need JvmField annotation | |
var id: Int, | |
@JvmField | |
@SerializedName("name") // if this field was used directly before we need JvmField annotation | |
var name: String |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class NonLazyDemoAdapter internal constructor(fm: FragmentManager) : FragmentStatePagerAdapter(fm) { | |
internal class FragmentBundle( | |
@field:SerializedName("id") var id: Int, | |
@field:SerializedName("name") var name: String | |
) : Serializable | |
companion object { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class NonLazyDemoAdapter internal constructor(fm: FragmentManager) : FragmentStatePagerAdapter(fm) { | |
private val pages = arrayOf(SomePage.FIRST, SomePage.SECOND) | |
override fun getItem(position: Int): Fragment { | |
return cachedFragments[position]!! | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class NonLazyDemoAdapter extends FragmentStatePagerAdapter { | |
@NonNull // don't forget to mark array content non-nullable | |
private SomePage[] pages = new SomePage[]{FIRST, SECOND}; | |
@NonNull | |
private PageFragment[] cachedFragments = new PageFragment[pages.length]; | |
NonLazyDemoAdapter(@NonNull FragmentManager fm) { | |
... | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class NonLazyDemoAdapter extends FragmentStatePagerAdapter { | |
@NonNull | |
private SomePage[] pages = new SomePage[]{FIRST, SECOND}; | |
@NonNull | |
private PageFragment[] cachedFragments = new PageFragment[pages.length]; | |
NonLazyDemoAdapter(@NonNull FragmentManager fm) { | |
... | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class NonLazyDemoAdapter extends FragmentStatePagerAdapter { | |
private SomePage[] pages = new SomePage[]{FIRST, SECOND}; | |
private PageFragment[] cachedFragments = new PageFragment[pages.length]; | |
NonLazyDemoAdapter(FragmentManager fm) { | |
... | |
} |
NewerOlder