Skip to content

Commit 13e8566

Browse files
committed
disable fading
1 parent 8e79ba0 commit 13e8566

3 files changed

Lines changed: 12 additions & 24 deletions

File tree

app/src/main/java/de/felixnuesse/disky/MainActivity.kt

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,7 @@ class MainActivity : AppCompatActivity(), ChangeFolderCallback, ScanCompleteCall
246246
showFolder(rootElement!!)
247247
} else {
248248
rootElement?.mergePartialTree(internalRootElement)
249+
rootElement?.getCalculatedSize(true)
249250
currentElement?.let { changeFolder(it) }
250251
}
251252
updateStaticElements(rootElement!!, result.total, result.free)
@@ -419,13 +420,15 @@ class MainActivity : AppCompatActivity(), ChangeFolderCallback, ScanCompleteCall
419420
if(base == 0L) {
420421
base = 1L
421422
}
422-
val currentlyUsed = currentRoot.getCalculatedSize().div(base.toDouble())
423+
val used = currentRoot.getCalculatedSize(true)
424+
val currentlyUsedPerc = used.div(base.toDouble())
425+
Timber.tag("updateStaticElements").e("rfs used: ${readableFileSize(used)}")
423426
fadeTextview(
424-
readableFileSize(currentRoot.getCalculatedSize()),
427+
readableFileSize(used),
425428
binding.usedText
426429
)
427430
ObjectAnimator
428-
.ofInt(binding.dataUsage, "progress", (currentlyUsed * 100).toInt())
431+
.ofInt(binding.dataUsage, "progress", (currentlyUsedPerc * 100).toInt())
429432
.setDuration(300)
430433
.start()
431434
Timber.e("updateStaticElements: CurrentRoot not null!")
@@ -435,6 +438,7 @@ class MainActivity : AppCompatActivity(), ChangeFolderCallback, ScanCompleteCall
435438
}
436439

437440
fadeTextview(readableFileSize(rootUnused), binding.freeText)
441+
Timber.tag("updateStaticElements").e("rfs rootUnused: ${readableFileSize(rootUnused)}")
438442
}
439443

440444
fun showFolder(currentRoot: StoragePrototype) {

app/src/main/java/de/felixnuesse/disky/model/StoragePrototype.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ sealed class StoragePrototype(var name: String, var storageType: StorageType = S
7373

7474
/**
7575
* This merges a partial storage tree into this one.
76-
* Its a breath-first approach.
76+
* It's a breath-first approach.
7777
*
7878
* For generic items, children are replaced for the found root-partial-tree.
7979
* For other items, special handling is applied. (Apps are replaced in-place)
Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,18 @@
11
package de.felixnuesse.disky.ui.utils
22

33
import android.view.View
4-
import android.view.animation.AlphaAnimation
5-
import android.view.animation.Animation
64
import android.widget.TextView
75

86
class TextFading {
97

108
companion object {
119
fun fadeTextview(text: String, view: TextView) {
12-
if(view.text == text) {
13-
return
14-
}
15-
view.visibility = View.VISIBLE
16-
17-
val fadeIn = AlphaAnimation(0.0f, 1.0f)
18-
val fadeOut = AlphaAnimation(1.0f, 0.0f)
19-
fadeIn.duration = 300
20-
fadeOut.duration = 300
2110

22-
fadeOut.setAnimationListener(object : Animation.AnimationListener {
23-
override fun onAnimationStart(animation: Animation?) {}
24-
override fun onAnimationRepeat(animation: Animation?) {}
25-
override fun onAnimationEnd(animation: Animation) {
26-
view.text = text
27-
view.startAnimation(fadeIn)
28-
}
11+
view.visibility = View.VISIBLE
12+
view.text = text
2913

30-
})
31-
view.startAnimation(fadeOut)
14+
// it is likely, that the animators are broken and interfering with each other.
15+
// use singletons to manage them, when readding this function
3216
}
3317
}
3418
}

0 commit comments

Comments
 (0)