-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
00b6039
commit e1b6079
Showing
45 changed files
with
253 additions
and
586 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
49 changes: 0 additions & 49 deletions
49
desk360/src/main/java/com/teknasyon/desk360/helper/Desk360ButtonStyle.kt
This file was deleted.
Oops, something went wrong.
122 changes: 122 additions & 0 deletions
122
desk360/src/main/java/com/teknasyon/desk360/helper/Desk360CustomStyle.kt
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
package com.teknasyon.desk360.helper | ||
|
||
import android.content.Context | ||
import android.graphics.Typeface | ||
import android.util.DisplayMetrics | ||
import android.widget.TextView | ||
import androidx.constraintlayout.widget.ConstraintLayout | ||
import androidx.recyclerview.widget.RecyclerView | ||
|
||
object Desk360CustomStyle { | ||
|
||
fun setStyle(styleId: Int?, layout: ConstraintLayout, context: Context) { | ||
val params = layout.layoutParams as ConstraintLayout.LayoutParams | ||
when (styleId) { | ||
1, 2, 3 -> { | ||
params.setMargins( | ||
convertDpToPixel(32f, context).toInt(), | ||
0, | ||
convertDpToPixel(32f, context).toInt(), | ||
0 | ||
) | ||
} | ||
4 -> { | ||
params.setMargins(0, 0, 0, 0) | ||
} | ||
else -> { | ||
params.setMargins( | ||
convertDpToPixel(32f, context).toInt(), | ||
0, | ||
convertDpToPixel(32f, context).toInt(), | ||
0 | ||
) | ||
} | ||
} | ||
|
||
layout.layoutParams = params | ||
} | ||
|
||
|
||
fun setStyleTicket(styleIdTicket: Int?, layout: ConstraintLayout, context: Context) { | ||
val params = layout.layoutParams as RecyclerView.LayoutParams | ||
when (styleIdTicket) { | ||
1, 2, 3 -> { | ||
params.setMargins( | ||
convertDpToPixel(16f, context).toInt(), | ||
24, | ||
convertDpToPixel(16f, context).toInt(), | ||
0 | ||
) | ||
} | ||
4 -> { | ||
params.setMargins(0, 24, 0, 0) | ||
} | ||
else -> { | ||
params.setMargins( | ||
convertDpToPixel(16f, context).toInt(), | ||
24, | ||
convertDpToPixel(16f, context).toInt(), | ||
0 | ||
) | ||
} | ||
} | ||
|
||
layout.layoutParams = params | ||
} | ||
|
||
fun setFontWeight( | ||
textView: TextView, | ||
context: Context?, | ||
weight: Int? | ||
) { | ||
|
||
when (weight) { | ||
100 -> { | ||
val face = Typeface.createFromAsset(context?.assets, "Montserrat-Thin.ttf") | ||
textView.typeface = face | ||
} | ||
200 -> { | ||
val face = Typeface.createFromAsset(context?.assets, "Montserrat-ExtraLight.ttf") | ||
textView.typeface = face | ||
} | ||
300 -> { | ||
val face = Typeface.createFromAsset(context?.assets, "Montserrat-Light.ttf") | ||
textView.typeface = face | ||
} | ||
400 -> { | ||
val face = Typeface.createFromAsset(context?.assets, "Montserrat-Regular.ttf") | ||
textView.typeface = face | ||
} | ||
500 -> { | ||
val face = Typeface.createFromAsset(context?.assets, "Montserrat-Medium.ttf") | ||
textView.typeface = face | ||
} | ||
600 -> { | ||
val face = Typeface.createFromAsset(context?.assets, "Montserrat-SemiBold.ttf") | ||
textView.typeface = face | ||
} | ||
700 -> { | ||
val face = Typeface.createFromAsset(context?.assets, "Montserrat-Bold.ttf") | ||
textView.typeface = face | ||
} | ||
800 -> { | ||
val face = Typeface.createFromAsset(context?.assets, "Montserrat-ExtraBold.ttf") | ||
textView.typeface = face | ||
} | ||
900 -> { | ||
val face = Typeface.createFromAsset(context?.assets, "Montserrat-Black.ttf") | ||
textView.typeface = face | ||
} | ||
else -> { | ||
val face = Typeface.createFromAsset(context?.assets, "Montserrat-Regular.ttf") | ||
textView.typeface = face | ||
} | ||
} | ||
} | ||
|
||
|
||
private fun convertDpToPixel(dpOfMargin: Float, context: Context): Float { | ||
return dpOfMargin * (context.resources.displayMetrics.densityDpi.toFloat() / DisplayMetrics.DENSITY_DEFAULT) | ||
} | ||
} | ||
|
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
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
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
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
Oops, something went wrong.