-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
library update, sdk version 28, kotlin 1.2.71, DimenUtils extended
- Loading branch information
kroegerama
committed
Oct 6, 2018
1 parent
a7e960b
commit 7b347a1
Showing
7 changed files
with
63 additions
and
57 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
#Wed Apr 25 18:31:26 CEST 2018 | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip | ||
#Sat Oct 06 22:29:51 CEST 2018 | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,35 @@ | ||
package com.kroegerama.kaiteki | ||
|
||
import android.content.Context | ||
import android.content.res.Resources | ||
import android.support.annotation.DimenRes | ||
import android.support.annotation.Px | ||
import android.util.TypedValue | ||
import com.kroegerama.kaiteki.baseui.BaseFragment | ||
|
||
@Px | ||
fun Float.dpToPx() = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, this, Resources.getSystem().displayMetrics).toInt() | ||
|
||
@Px | ||
fun Float.spToPx() = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, this, Resources.getSystem().displayMetrics).toInt() | ||
|
||
fun Float.spToDp() = this.spToPx() / Resources.getSystem().displayMetrics.scaledDensity; | ||
fun Float.spToDp() = this.spToPx() / Resources.getSystem().displayMetrics.scaledDensity | ||
|
||
/** @see Resources.getDimension */ | ||
fun Context.getDimension(@DimenRes res: Int) = resources.getDimension(res) | ||
|
||
/** @see Resources.getDimensionPixelSize */ | ||
fun Context.getDimensionPixelSize(@DimenRes res: Int) = resources.getDimensionPixelSize(res) | ||
|
||
/** @see Resources.getDimensionPixelOffset */ | ||
fun Context.getDimensionPixelOffset(@DimenRes res: Int) = resources.getDimensionPixelOffset(res) | ||
|
||
/** @see Resources.getDimension */ | ||
fun BaseFragment.getDimension(@DimenRes res: Int) = requireContext().getDimension(res) | ||
|
||
/** @see Resources.getDimensionPixelSize */ | ||
fun BaseFragment.getDimensionPixelSize(@DimenRes res: Int) = requireContext().getDimensionPixelSize(res) | ||
|
||
/** @see Resources.getDimensionPixelOffset */ | ||
fun BaseFragment.getDimensionPixelOffset(@DimenRes res: Int) = requireContext().getDimensionPixelOffset(res) | ||
|