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 CurvedContainer @JvmOverloads constructor( | |
context: Context, | |
attrs: AttributeSet? = null, | |
defStyleAttr: Int = 0 | |
): LinearLayout(context, attrs, defStyleAttr) { | |
/* paint object for coloring the canvas */ | |
private val mPaint = Paint() | |
/* path that will be drawn to achieve the shape */ | |
private val path = Path() |
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 onSizeChanged(w: Int, h: Int, oldw: Int, oldh: Int) { | |
super.onSizeChanged(w, h, oldw, oldh) | |
/* curve from P1 to P2 */ | |
leftArc.set( | |
0f, | |
0f, | |
xAxisOffset, | |
yAxisOffset | |
) | |
path.addArc(leftArc, 180f, 90f) |
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 onDraw(canvas: Canvas?) { | |
super.onDraw(canvas) | |
canvas?.drawPath(path, mPaint) | |
} |
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
<style name="TransparentBackgroundDialog" parent="Theme.Design.Light.BottomSheetDialog"> | |
<item name="android:colorBackground">@android:color/transparent</item> | |
</style> |
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 onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) | |
setStyle(STYLE_NORMAL, R.style.TransparentBackgroundDialog) | |
} |
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
/** | |
* Created by Saurabh(aqua) in 2017. | |
*/ | |
public class ParallaxActivity extends BaseActivity { | |
/* view binding */ | |
@BindView(R.id.scrollView)ScrollView scrollView; | |
@BindView(R.id.parallax_image)ImageView parallaxImage; | |
@BindView(R.id.tv_perhour)TextView textView; |
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
dependencyResolutionManagement { | |
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) | |
repositories { | |
google() | |
mavenCentral() | |
} | |
versionCatalogs { | |
libs { | |
version('compose','1.4.0') | |
version('composeui','1.1.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
AnimatedContent( | |
targetState = timerContent, | |
transitionSpec = { | |
if(targetState == TimerContent.SELECTION) { | |
slideInVertically { height -> height } + fadeIn() with | |
slideOutVertically { height -> -height } + fadeOut() | |
} else { | |
slideInVertically { height -> -height } + fadeIn() with | |
slideOutVertically { height -> height } + fadeOut() | |
} |
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
data class TimeData( | |
val hours: TimeUnit = TimeUnit(), | |
val mins: TimeUnit = TimeUnit(), | |
val secs: TimeUnit = TimeUnit(), | |
) { | |
fun isDataFull() = hours.leftDigit > 0 | |
fun isDataEmpty() = | |
hours.leftDigit == 0 && hours.rightDigit == 0 | |
&& mins.leftDigit == 0 && mins.rightDigit == 0 |
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
@Composable | |
fun TimeDisplay( | |
time: TimeData = TimeData(), | |
) { | |
val timeUnitColor = if (time.isDataEmpty()) GRAY_TEXT else BLUE_LIGHT | |
Row( | |
horizontalArrangement = Arrangement.spacedBy(16.dp) | |
) { |