Skip to content

Commit

Permalink
Version 1.0.3
Browse files Browse the repository at this point in the history
  • Loading branch information
armcha committed Aug 31, 2018
1 parent 4a9174f commit 2148c8b
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Expand Up @@ -6,7 +6,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.0-alpha07'
classpath 'com.android.tools.build:gradle:3.3.0-alpha08'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "guru.stefma.bintrayrelease:bintrayrelease:1.0.0"
}
Expand Down
2 changes: 1 addition & 1 deletion debugBanner/build.gradle
Expand Up @@ -27,7 +27,7 @@ dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${kotlin_version}"
}

version = "1.0.3"
version = "1.0.4"
group = "com.github.armcha"
publish {
userOrg = 'armcha'
Expand Down
Expand Up @@ -4,6 +4,8 @@ import android.content.Context
import android.graphics.*
import android.support.v4.content.ContextCompat
import android.support.v4.view.ViewCompat
import android.support.v7.widget.AppCompatTextView
import android.text.TextUtils
import android.util.AttributeSet
import android.view.Gravity
import android.widget.FrameLayout
Expand All @@ -24,12 +26,16 @@ internal class DebugBannerView(context: Context, attrs: AttributeSet? = null)
includeFontPadding = false
rotation = -45f
typeface = Typeface.defaultFromStyle(Typeface.BOLD)
textSize = 13f
textSize = 12f
setSingleLine()
ellipsize = TextUtils.TruncateAt.END
}
val layoutParams = FrameLayout.LayoutParams(FrameLayout.LayoutParams.WRAP_CONTENT, FrameLayout.LayoutParams.WRAP_CONTENT, Gravity.CENTER)
layoutParams.setMargins(dip(5),0,dip(5),0)
addView(textView, layoutParams)
setBackgroundColor(Color.TRANSPARENT)
ViewCompat.setElevation(this, 30f)
isClickable = false
}

fun updateText(text: String, textColor: Int) {
Expand Down
6 changes: 2 additions & 4 deletions debugBanner/src/main/java/io/armcha/debugBanner/Extensions.kt
Expand Up @@ -12,17 +12,15 @@ internal fun View.dip(value: Int): Int = (value * resources.displayMetrics.densi
internal val isAtLeastLollipop: Boolean
get() = Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP

internal fun Context.dip(value: Int): Float = value * resources.displayMetrics.density

fun Context.getScreenWidth(): Float {
internal fun Context.getScreenWidth(): Float {
val wm = getSystemService(Context.WINDOW_SERVICE) as WindowManager
val display = wm.defaultDisplay
val size = Point()
display.getSize(size)
return size.x.toFloat()
}

fun Context.getStatusBarHeight(): Float {
internal fun Context.getStatusBarHeight(): Float {
var result = 0
val resourceId = resources.getIdentifier("status_bar_height", "dimen", "android")
if (resourceId > 0) {
Expand Down

0 comments on commit 2148c8b

Please sign in to comment.