Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Reverted switch animation
  • Fixed RTL layout issues
  • Updated translations
  • Loading branch information
Hamza417 committed Aug 26, 2021
1 parent 6394a1a commit 53e3632
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 25 deletions.
4 changes: 4 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions app/src/main/assets/html/translators.html
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ <h1>Excluded Translations</h1>
<div class="entry">
<div class="title">
<h3>German</h3>
<p>67%</p>
<p>63%</p>
</div>
<div class="body">
<p>Diese Sprache wird übersetzt von</p>
Expand All @@ -153,7 +153,7 @@ <h3>German</h3>
<div class="entry">
<div class="title">
<h3>Spanish</h3>
<p>54%</p>
<p>52%</p>
</div>
<div class="body">
<p>Este idioma es traducido por</p>
Expand All @@ -169,7 +169,7 @@ <h3>Spanish</h3>
<div class="entry">
<div class="title">
<h3>Korean</h3>
<p>48%</p>
<p>45%</p>
</div>
<div class="body">
<p>이 언어는 다음에 의해 번역됩니다</p>
Expand All @@ -184,7 +184,7 @@ <h3>Korean</h3>
<div class="entry">
<div class="title">
<h3>Polish</h3>
<p>38%</p>
<p>37%</p>
</div>
<div class="body">
<p>Ten język jest tłumaczony przez</p>
Expand All @@ -199,7 +199,7 @@ <h3>Polish</h3>
<div class="entry">
<div class="title">
<h3>Portuguese, Brazilian</h3>
<p>21%</p>
<p>20%</p>
</div>
<div class="body">
<p>Este idioma é traduzido por</p>
Expand All @@ -215,7 +215,7 @@ <h3>Portuguese, Brazilian</h3>
<div class="entry">
<div class="title">
<h3>Serbian (Cyrillic)</h3>
<p>56%</p>
<p>52%</p>
</div>
<div class="body">
<p>превео је овај језик</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import android.view.LayoutInflater
import android.view.MotionEvent
import android.view.View
import android.view.animation.DecelerateInterpolator
import android.view.animation.OvershootInterpolator
import android.widget.ImageView
import androidx.core.content.ContextCompat
import androidx.dynamicanimation.animation.DynamicAnimation
Expand All @@ -25,10 +26,8 @@ class SwitchView @JvmOverloads constructor(context: Context, attrs: AttributeSet

private var thumb: ImageView
private var switchCallbacks: SwitchCallbacks? = null
private var switchAnimation : SpringAnimation? = null

private val dampingRatio = 0.32F
private val stiffness = 300F
private val tension = 3.5F

var isChecked: Boolean = false
set(value) {
Expand All @@ -45,8 +44,6 @@ class SwitchView @JvmOverloads constructor(context: Context, attrs: AttributeSet

thumb = view.findViewById(R.id.switch_thumb)

switchAnimation = SpringAnimation(thumb, DynamicAnimation.TRANSLATION_X)

clipChildren = false
clipToPadding = false
clipToOutline = false
Expand Down Expand Up @@ -86,11 +83,11 @@ class SwitchView @JvmOverloads constructor(context: Context, attrs: AttributeSet
}

private fun animateUnchecked() {
switchAnimation!!.spring = SpringForce(0F)
.setDampingRatio(dampingRatio)
.setStiffness(stiffness)

switchAnimation!!.start()
thumb.animate()
.translationX(0F)
.setInterpolator(OvershootInterpolator(tension))
.setDuration(500)
.start()

animateColorChange(ContextCompat.getColor(context, R.color.switch_off))
switchCallbacks?.onCheckedChanged(false)
Expand All @@ -103,11 +100,11 @@ class SwitchView @JvmOverloads constructor(context: Context, attrs: AttributeSet
val p = context.resources.getDimensionPixelOffset(R.dimen.switch_padding)
val thumbWidth = context.resources.getDimensionPixelOffset(R.dimen.switch_thumb_dimensions)

switchAnimation!!.spring = SpringForce((w - p * 2 - thumbWidth).toFloat())
.setDampingRatio(dampingRatio)
.setStiffness(stiffness)

switchAnimation!!.start()
thumb.animate()
.translationX((w - p * 2 - thumbWidth).toFloat())
.setInterpolator(OvershootInterpolator(tension))
.setDuration(500)
.start()

animateColorChange(context.resolveAttrColor(R.attr.colorAppAccent))
switchCallbacks?.onCheckedChanged(true)
Expand All @@ -130,7 +127,7 @@ class SwitchView @JvmOverloads constructor(context: Context, attrs: AttributeSet

override fun onViewRemoved(child: View?) {
super.onViewRemoved(child)
switchAnimation?.cancel()
thumb.clearAnimation()
}

/**
Expand Down
5 changes: 3 additions & 2 deletions app/src/main/res/drawable/ic_arrow_left.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:autoMirrored="true"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M14.71,6.71c-0.39,-0.39 -1.02,-0.39 -1.41,0L8.71,11.3c-0.39,0.39 -0.39,1.02 0,1.41l4.59,4.59c0.39,0.39 1.02,0.39 1.41,0 0.39,-0.39 0.39,-1.02 0,-1.41L10.83,12l3.88,-3.88c0.39,-0.39 0.38,-1.03 0,-1.41z"
android:fillColor="#000000" />
android:fillColor="#000000"
android:pathData="M14.71,6.71c-0.39,-0.39 -1.02,-0.39 -1.41,0L8.71,11.3c-0.39,0.39 -0.39,1.02 0,1.41l4.59,4.59c0.39,0.39 1.02,0.39 1.41,0 0.39,-0.39 0.39,-1.02 0,-1.41L10.83,12l3.88,-3.88c0.39,-0.39 0.38,-1.03 0,-1.41z" />
</vector>
3 changes: 2 additions & 1 deletion app/src/main/res/drawable/ic_arrow_right.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
android:viewportHeight="24"
android:autoMirrored="true">
<path
android:pathData="M9.29,6.71c-0.39,0.39 -0.39,1.02 0,1.41L13.17,12l-3.88,3.88c-0.39,0.39 -0.39,1.02 0,1.41 0.39,0.39 1.02,0.39 1.41,0l4.59,-4.59c0.39,-0.39 0.39,-1.02 0,-1.41L10.7,6.7c-0.38,-0.38 -1.02,-0.38 -1.41,0.01z"
android:fillColor="#000000" />
Expand Down

0 comments on commit 53e3632

Please sign in to comment.