Skip to content

Commit

Permalink
[fix] changed font styles
Browse files Browse the repository at this point in the history
  • Loading branch information
mskteknasyon committed Nov 27, 2019
1 parent 00b6039 commit e1b6079
Show file tree
Hide file tree
Showing 45 changed files with 253 additions and 586 deletions.
Binary file removed desk360/src/main/assets/Gotham-Book.ttf
Binary file not shown.
Binary file added desk360/src/main/assets/Montserrat-Black.ttf
Binary file not shown.
Binary file added desk360/src/main/assets/Montserrat-Bold.ttf
Binary file not shown.
Binary file added desk360/src/main/assets/Montserrat-ExtraBold.ttf
Binary file not shown.
Binary file not shown.
Binary file added desk360/src/main/assets/Montserrat-Light.ttf
Binary file not shown.
Binary file added desk360/src/main/assets/Montserrat-Medium.ttf
Binary file not shown.
Binary file added desk360/src/main/assets/Montserrat-Regular.ttf
Binary file not shown.
Binary file added desk360/src/main/assets/Montserrat-SemiBold.ttf
Binary file not shown.
Binary file added desk360/src/main/assets/Montserrat-Thin.ttf
Binary file not shown.

This file was deleted.

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)
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -14,39 +14,6 @@ class Desk360CommonButtonText : TextView {
this.setTextColor(Color.parseColor(currentType?.data?.first_screen?.button_text_color))
this.text = currentType?.data?.first_screen?.button_text
this.textSize = currentType?.data?.first_screen?.button_text_font_size!!.toFloat()
when (currentType?.data?.first_screen?.button_text_font_weight) {
100 -> {
this.setTypeface(null, Typeface.NORMAL)
}
200 -> {
this.setTypeface(null, Typeface.BOLD)
}
300 -> {
this.setTypeface(null, Typeface.NORMAL)
}
400 -> {
this.setTypeface(null, Typeface.NORMAL)
}
500 -> {
this.setTypeface(null, Typeface.BOLD)
}
600 -> {
this.setTypeface(null, Typeface.NORMAL)
}
700 -> {
this.setTypeface(null, Typeface.NORMAL)
}
800 -> {
this.setTypeface(null, Typeface.BOLD)
}
900 -> {
this.setTypeface(null, Typeface.NORMAL)
}
else -> {
this.setTypeface(null, Typeface.NORMAL)
}
}

}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,38 +22,6 @@ class Desk360CommonFooterText : TextView {
} else {
this.visibility = View.VISIBLE
}
when (Desk360Constants.currentType?.data?.general_settings?.bottom_note_font_weight) {
100 -> {
this.setTypeface(null, Typeface.NORMAL)
}
200 -> {
this.setTypeface(null, Typeface.BOLD)
}
300 -> {
this.setTypeface(null, Typeface.NORMAL)
}
400 -> {
this.setTypeface(null, Typeface.NORMAL)
}
500 -> {
this.setTypeface(null, Typeface.BOLD)
}
600 -> {
this.setTypeface(null, Typeface.NORMAL)
}
700 -> {
this.setTypeface(null, Typeface.NORMAL)
}
800 -> {
this.setTypeface(null, Typeface.BOLD)
}
900 -> {
this.setTypeface(null, Typeface.NORMAL)
}
else -> {
this.setTypeface(null, Typeface.NORMAL)
}
}
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,39 +15,6 @@ class Desk360FirstDescription : TextView {
this.setTextColor(Color.parseColor(Desk360Constants.currentType?.data?.first_screen?.sub_title_color))
this.text= Desk360Constants.currentType?.data?.first_screen?.sub_title
this.textSize = Desk360Constants.currentType?.data?.first_screen?.sub_title_font_size!!.toFloat()
when(Desk360Constants.currentType?.data?.first_screen?.sub_title_font_weight){
100 -> {
this.setTypeface(null, Typeface.NORMAL)
}
200 -> {
this.setTypeface(null, Typeface.BOLD)
}
300 -> {
this.setTypeface(null, Typeface.NORMAL)
}
400 -> {
this.setTypeface(null, Typeface.NORMAL)
}
500 -> {
this.setTypeface(null, Typeface.BOLD)
}
600 -> {
this.setTypeface(null, Typeface.NORMAL)
}
700 -> {
this.setTypeface(null, Typeface.NORMAL)
}
800 -> {
this.setTypeface(null, Typeface.BOLD)
}
900 -> {
this.setTypeface(null, Typeface.NORMAL)
}
else -> {
this.setTypeface(null, Typeface.NORMAL)
}
}

}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,36 +31,47 @@ class Desk360IncomingText : TextView {
this.setTextColor(Color.parseColor(Desk360Constants.currentType?.data?.ticket_detail_screen?.chat_receiver_text_color))
this.textSize =
Desk360Constants.currentType?.data?.ticket_detail_screen?.chat_receiver_font_size!!.toFloat()

when (Desk360Constants.currentType?.data?.ticket_detail_screen?.chat_receiver_font_weight) {
100 -> {
this.setTypeface(null, Typeface.NORMAL)
val face = Typeface.createFromAsset(context?.assets, "Montserrat-Thin.ttf")
this.typeface = face
}
200 -> {
this.setTypeface(null, Typeface.BOLD)
val face = Typeface.createFromAsset(context?.assets, "Montserrat-ExtraLight.ttf")
this.typeface = face
}
300 -> {
this.setTypeface(null, Typeface.NORMAL)
val face = Typeface.createFromAsset(context?.assets, "Montserrat-Light.ttf")
this.typeface = face
}
400 -> {
this.setTypeface(null, Typeface.NORMAL)
val face = Typeface.createFromAsset(context?.assets, "Montserrat-Regular.ttf")
this.typeface = face
}
500 -> {
this.setTypeface(null, Typeface.BOLD)
val face = Typeface.createFromAsset(context?.assets, "Montserrat-Medium.ttf")
this.typeface = face
}
600 -> {
this.setTypeface(null, Typeface.NORMAL)
val face = Typeface.createFromAsset(context?.assets, "Montserrat-SemiBold.ttf")
this.typeface = face
}
700 -> {
this.setTypeface(null, Typeface.NORMAL)
val face = Typeface.createFromAsset(context?.assets, "Montserrat-Bold.ttf")
this.typeface = face
}
800 -> {
this.setTypeface(null, Typeface.BOLD)
val face = Typeface.createFromAsset(context?.assets, "Montserrat-ExtraBold.ttf")
this.typeface = face
}
900 -> {
this.setTypeface(null, Typeface.NORMAL)
val face = Typeface.createFromAsset(context?.assets, "Montserrat-Black.ttf")
this.typeface = face
}
else -> {
this.setTypeface(null, Typeface.NORMAL)
val face = Typeface.createFromAsset(context?.assets, "Montserrat-Regular.ttf")
this.typeface = face
}
}
}
Expand Down
Loading

0 comments on commit e1b6079

Please sign in to comment.