Skip to content

Commit

Permalink
Merge pull request #23 from ericktijerou/bugfix/restore-translations
Browse files Browse the repository at this point in the history
Restore original translations
  • Loading branch information
ericktijerou authored Aug 9, 2020
2 parents 04b5a64 + b185d0c commit 8bc9472
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ You can [download](https://bintray.com/ericktijerou/maven/koleton/_latestVersion
```gradle
// In your module's `build.gradle.kts`
dependencies {
implementation("com.ericktijerou.koleton:koleton:0.8.0")
implementation("com.ericktijerou.koleton:koleton:0.8.1")
}
```

Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ compileSdk=29
groupId=com.ericktijerou.koleton
vcsUrl=https://github.com/ericktijerou/koleton
issueTrackerUrl=https://github.com/ericktijerou/koleton/issues
publishVersion=0.8.0
publishVersion=0.8.1
1 change: 1 addition & 0 deletions koleton-base/src/main/kotlin/koleton/MainSkeletonLoader.kt
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ internal class MainSkeletonLoader(
val originalParent = skeletonView.getParentViewGroup()
skeletonView.removeView(view)
originalParent.removeView(skeletonView)
view.cloneTranslations(skeletonView)
originalParent.addView(view, originalParams)
}

Expand Down
13 changes: 11 additions & 2 deletions koleton-base/src/main/kotlin/koleton/util/Views.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ import android.widget.FrameLayout
import androidx.core.view.ViewCompat
import androidx.recyclerview.widget.RecyclerView
import koleton.base.R
import koleton.custom.*
import koleton.custom.Attributes
import koleton.custom.RecyclerKoletonView
import koleton.custom.RecyclerViewAttributes
import koleton.custom.SimpleKoletonView
import koleton.memory.ViewTargetSkeletonManager

internal fun View.visible() {
Expand Down Expand Up @@ -101,7 +104,13 @@ internal val View.koletonManager: ViewTargetSkeletonManager
return manager
}

internal fun KoletonView.cloneTranslations(view: View) = run {
internal fun View.cloneTranslations(view: View) {
translationX = view.translationX
translationY = view.translationY
view.clearTranslations()
}

internal fun View.clearTranslations() {
translationX = 0f
translationY = 0f
}

0 comments on commit 8bc9472

Please sign in to comment.