Skip to content

Instantly share code, notes, and snippets.

View hanmolee's full-sized avatar

HanmoLee hanmolee

View GitHub Profile
@hanmolee
hanmolee / setProgress.kt
Created October 8, 2018 07:46
setProgress
private fun setProgressBar(progressStatus: Int) {
waterTable?.let {
goalWater.text = "${it.todayWater}ml"
todayWater.text = "${it.goalWater}ml"
val percent : Int = (100 * (it.todayWater!!.toDouble() / it.goalWater!!.toDouble())).toInt()
percentLoop(0.0, percent.toDouble())
if (percent < 100) { remainWater.text = "${it.goalWater!! - it.todayWater!!}ml" }
else { remainWater.text = "0ml" }
@hanmolee
hanmolee / ProgressBar.xml
Created October 8, 2018 07:42
ProgressBar
<ProgressBar
android:id="@+id/waterProgressbar"
android:layout_width="280dp"
android:layout_height="280dp"
android:layoutDirection="rtl"
android:progress="40"
android:indeterminate="false"
android:indeterminateDrawable="@drawable/indeterminate_progress"
android:progressDrawable="@drawable/circular_progress_bar"
android:background="@drawable/circle_shape"
@hanmolee
hanmolee / indeterminate_progress.xml
Created October 8, 2018 07:19
indeterminate progress
<?xml version="1.0" encoding="utf-8"?><!--<layer-list>-->
<rotate xmlns:android="http://schemas.android.com/apk/res/android"
android:fromDegrees="0"
android:toDegrees="360">
<layer-list>
<item>
<rotate xmlns:android="http://schemas.android.com/apk/res/android"
android:fromDegrees="-90"
android:toDegrees="-90">
<shape
@hanmolee
hanmolee / setAnimationDrawable.kt
Created October 7, 2018 14:27
animationDrawable
private fun setProgressBar() {
view?.run {
waterTable = RealmHelper.instance.getTodayWaterGoal()
waterTable?.let {
waterGoal.text = "${it.goalWater}ml"
todayWater.text = "${it.todayWater}ml"
val percent : Int = (100 * (it.todayWater!!.toDouble() / it.goalWater!!.toDouble())).toInt()
percentLoop(0.0, percent.toDouble())
waterProgressbar.setProgress(it.todayWater!!, it.goalWater!!)
if (percent < 100) {
@hanmolee
hanmolee / gradient_animation_list.xml
Created October 7, 2018 14:24
gradient_animation_list
<?xml version="1.0" encoding="utf-8"?>
<animation-list xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:drawable="@drawable/gradient_01"
android:duration="3000" />
<item
android:drawable="@drawable/gradient_02"
android:duration="3000" />
@hanmolee
hanmolee / gradient_01~04.xml
Last active October 7, 2018 14:22
gradient_01 부터 04까지 각각 생성
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient
android:startColor="@color/mainColor"
android:endColor="@color/logoFontColor"
android:angle="180"/>
</shape>
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
@hanmolee
hanmolee / initWaterTypeCheckTransition.kt
Created October 5, 2018 09:20
initWaterTypeCheckTransition
private fun initWaterTypeCheck() {
val selectWaterType = waterType?.run {
this
} ?: kotlin.run {
RealmHelper.instance.queryFirst(Goals::class.java)?.waterType
}
when(selectWaterType) {
Const.type200 -> {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
@hanmolee
hanmolee / MainFragmentSetTransition.kt
Created October 5, 2018 09:12
MainFragmentSetTransition
private fun setMyTargetButton() {
view?.run {
val myTargetIntent = MyTargetWaterActivity.newIntent(mContext)
val logoImagePair = Pair.create(myTargetImage as View, "logoImage")
val typeImagePair = Pair.create(waterTypeIcon as View, "typeImage")
val targetTextPair = Pair.create(waterGoal as View, "waterText")
val options = ActivityOptionsCompat.makeSceneTransitionAnimation(activity!!, logoImagePair, targetTextPair, typeImagePair)
myTargetButton.clicks()
.throttleFirst(500, TimeUnit.MILLISECONDS, AndroidSchedulers.mainThread())
@hanmolee
hanmolee / activist_mytarget.xml
Last active October 5, 2018 09:27
activist_mytarget
<EditText
android:id="@+id/myTargetText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@null"
android:hint="@string/inputMyTargetTextHint"
android:fontFamily="@font/nanumbareunpen"
android:inputType="number"
android:paddingBottom="8dp"
android:paddingTop="8dp"
@hanmolee
hanmolee / fragment_main.xml
Created October 5, 2018 09:06
fragment_main
<TextView
android:id="@+id/waterGoal"
android:transitionName="waterText"
android:fontFamily="@font/nanumbareunpen"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingBottom="3dp"
android:textColor="@color/whiteColor"
android:textSize="18sp" />