Merge pull request #69 from szkolny-eu/hotfix/message-attachments

[Messages] Fix downloading and displaying attachment on API 30+.
This commit is contained in:
Kuba Szczodrzyński 2021-09-10 23:44:26 +02:00 committed by GitHub
commit e902352a4b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 6 deletions

View File

@ -37,9 +37,7 @@ class AttachmentsView @JvmOverloads constructor(
}
private val storageDir by lazy {
val storageDir = Environment.getExternalStoragePublicDirectory("Szkolny.eu")
storageDir.mkdirs()
storageDir
Utils.getStorageDir()
}
fun init(arguments: Bundle, owner: Any) {
@ -82,6 +80,7 @@ class AttachmentsView @JvmOverloads constructor(
list.adapter = adapter
list.apply {
setHasFixedSize(false)
isNestedScrollingEnabled = false
layoutManager = LinearLayoutManager(context)
addItemDecoration(SimpleDividerItemDecoration(context))
}

View File

@ -776,7 +776,8 @@ public class Utils {
public static File getStorageDir() {
if (storageDir != null)
return storageDir;
storageDir = Environment.getExternalStoragePublicDirectory("Szkolny.eu");
storageDir = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS);
storageDir = new File(storageDir, "Szkolny.eu");
storageDir.mkdirs();
return storageDir;
}

View File

@ -57,7 +57,7 @@
android:visibility="visible"
tools:visibility="gone"/>
<ScrollView
<androidx.core.widget.NestedScrollView
android:id="@+id/content"
android:layout_width="match_parent"
android:layout_height="0dp"
@ -306,6 +306,6 @@
</LinearLayout>
</LinearLayout>
</LinearLayout>
</ScrollView>
</androidx.core.widget.NestedScrollView>
</LinearLayout>
</layout>