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
interface FabulousListener { | |
fun onClick() | |
} | |
class FabulousFragment : Fragment() { | |
companion object { | |
fun newInstance() = FabulousFragment() | |
} |
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 FabulousActivity : Activity() { | |
companion object { | |
fun newIntent(context: Context): Intent = Intent(context, FabulousActivity::class.java) | |
} | |
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) | |
// Commit FabulousFragment instance into FragmentManager |
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 FabulousActivity : Activity(), FabulousListener { | |
companion object { | |
fun newIntent(context: Context): Intent = Intent(context, FabulousActivity::class.java) | |
} | |
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) | |
// Commit FabulousFragment instance into FragmentManager |
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
interface FabulousListener { | |
fun onClick() | |
} | |
class FabulousFragment : Fragment() { | |
companion object { | |
fun newInstance() = FabulousFragment() | |
} |
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 SegmentedProgressBar @JvmOverloads constructor( | |
context: Context, | |
attrs: AttributeSet? = null, | |
defStyleAttr: Int = 0 | |
) : View(context, attrs, defStyleAttr) { | |
override fun onDraw(canvas: Canvas) { | |
// Draw something onto the canvas | |
} | |
} |
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 SegmentedProgressBar @JvmOverloads constructor( | |
context: Context, | |
attrs: AttributeSet? = null, | |
defStyleAttr: Int = 0 | |
) : View(context, attrs, defStyleAttr) { | |
@get:ColorInt | |
var segmentColor: Int = Color.WHITE | |
var segmentAlpha: Float = 1f |
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 SegmentedProgressBar @JvmOverloads constructor( | |
context: Context, | |
attrs: AttributeSet? = null, | |
defStyleAttr: Int = 0 | |
) : View(context, attrs, defStyleAttr) { | |
@get:ColorInt | |
var segmentColor: Int = Color.WHITE | |
var segmentAlpha: Float = 1f | |
var segmentCount: Int = 1 |
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 SegmentCoordinatesComputer { | |
fun segmentCoordinates(position: Int, segmentCount: Int, width: Float, spacing: Float): SegmentCoordinates { | |
val segmentWidth = (width - spacing * (segmentCount - 1)) / segmentCount | |
val isLast = position == segmentCount - 1 | |
val topLeft = (segmentWidth + spacing) * position | |
val bottomLeft = (segmentWidth + spacing) * position | |
val topRight = segmentWidth * (position + 1) + spacing * position | |
val bottomRight = segmentWidth * (position + 1) + spacing * 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 SegmentCoordinatesComputer { | |
fun segmentCoordinates(position: Int, segmentCount: Int, width: Float, spacing: Float): SegmentCoordinates { | |
[...] | |
} | |
fun progressCoordinates(progress: Int, segmentCount: Int, width: Float, spacing: Float): SegmentCoordinates { | |
val segmentWidth = (width - spacing * (segmentCount - 1)) / segmentCount | |
val isLast = progress == segmentCount |
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 SegmentedProgressBar @JvmOverloads constructor( | |
context: Context, | |
attrs: AttributeSet? = null, | |
defStyleAttr: Int = 0 | |
) : View(context, attrs, defStyleAttr) { | |
[...] | |
@get:ColorInt | |
var progressColor: Int = Color.GREEN |
OlderNewer