fixed topappbar having weird border on older androids
This commit is contained in:
parent
42fbf78ea2
commit
a59ee75851
6 changed files with 38 additions and 15 deletions
|
|
@ -44,15 +44,27 @@ class DownloadLogActivity : AppCompatActivity() {
|
||||||
topAppBar.title = file.name
|
topAppBar.title = file.name
|
||||||
content.text = file.readText()
|
content.text = file.readText()
|
||||||
|
|
||||||
observer = object : FileObserver(file.absolutePath, MODIFY) {
|
if(Build.VERSION.SDK_INT < 29){
|
||||||
override fun onEvent(event: Int, p: String?) {
|
observer = object : FileObserver(file.absolutePath, MODIFY) {
|
||||||
runOnUiThread{
|
override fun onEvent(event: Int, p: String?) {
|
||||||
content.text = File(path).readText()
|
runOnUiThread{
|
||||||
content.scrollTo(0, content.height)
|
content.text = File(path).readText()
|
||||||
|
content.scrollTo(0, content.height)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
observer.startWatching();
|
||||||
|
}else{
|
||||||
|
observer = object : FileObserver(file, MODIFY) {
|
||||||
|
override fun onEvent(event: Int, p: String?) {
|
||||||
|
runOnUiThread{
|
||||||
|
content.text = File(path).readText()
|
||||||
|
content.scrollTo(0, content.height)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
observer.startWatching();
|
||||||
}
|
}
|
||||||
observer.startWatching();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onDestroy() {
|
override fun onDestroy() {
|
||||||
|
|
|
||||||
|
|
@ -54,14 +54,25 @@ class DownloadLogListActivity : AppCompatActivity(), DownloadLogsAdapter.OnItemC
|
||||||
val logFolder = File(filesDir.absolutePath + "/logs")
|
val logFolder = File(filesDir.absolutePath + "/logs")
|
||||||
updateList(logFolder)
|
updateList(logFolder)
|
||||||
|
|
||||||
val observer: FileObserver = object : FileObserver(logFolder.absolutePath) {
|
if(Build.VERSION.SDK_INT < 29){
|
||||||
override fun onEvent(event: Int, path: String?) {
|
val observer: FileObserver = object : FileObserver(logFolder.absolutePath) {
|
||||||
when(event) {
|
override fun onEvent(event: Int, path: String?) {
|
||||||
CREATE, DELETE -> updateList(logFolder)
|
when(event) {
|
||||||
|
CREATE, DELETE -> updateList(logFolder)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
observer.startWatching()
|
||||||
|
}else{
|
||||||
|
val observer: FileObserver = object : FileObserver(logFolder) {
|
||||||
|
override fun onEvent(event: Int, path: String?) {
|
||||||
|
when(event) {
|
||||||
|
CREATE, DELETE -> updateList(logFolder)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
observer.startWatching()
|
||||||
}
|
}
|
||||||
observer.startWatching();
|
|
||||||
initMenu(logFolder)
|
initMenu(logFolder)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -57,7 +57,7 @@
|
||||||
<com.google.android.material.appbar.AppBarLayout
|
<com.google.android.material.appbar.AppBarLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
app:liftOnScroll="false"
|
app:liftOnScroll="true"
|
||||||
android:background="@android:color/transparent"
|
android:background="@android:color/transparent"
|
||||||
android:fitsSystemWindows="true">
|
android:fitsSystemWindows="true">
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@
|
||||||
<com.google.android.material.appbar.AppBarLayout
|
<com.google.android.material.appbar.AppBarLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
app:liftOnScroll="false"
|
app:liftOnScroll="true"
|
||||||
android:background="@android:color/transparent"
|
android:background="@android:color/transparent"
|
||||||
android:fitsSystemWindows="true">
|
android:fitsSystemWindows="true">
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@
|
||||||
<com.google.android.material.appbar.AppBarLayout
|
<com.google.android.material.appbar.AppBarLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
app:liftOnScroll="false"
|
app:liftOnScroll="true"
|
||||||
android:background="@android:color/transparent"
|
android:background="@android:color/transparent"
|
||||||
android:fitsSystemWindows="true">
|
android:fitsSystemWindows="true">
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
<com.google.android.material.appbar.AppBarLayout
|
<com.google.android.material.appbar.AppBarLayout
|
||||||
android:id="@+id/history_appbarlayout"
|
android:id="@+id/history_appbarlayout"
|
||||||
app:liftOnScroll="false"
|
app:liftOnScroll="true"
|
||||||
android:background="@android:color/transparent"
|
android:background="@android:color/transparent"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content">
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue