From 4c4373e7899c6378d82b534926d97b9a55c7cd64 Mon Sep 17 00:00:00 2001 From: Steven Schoen Date: Sun, 1 Oct 2017 16:07:45 -0700 Subject: [PATCH] Fix opening downloaded non-MP4 videos, fix analytics logging --- app/build.gradle | 2 +- app/src/main/AndroidManifest.xml | 4 -- .../com/stevenschoen/putionew/Analytics.kt | 35 +++++++-------- .../putionew/files/DownloadFinishedService.kt | 14 +++--- .../putionew/files/FileDetailsFragment.kt | 15 +++++-- .../putionew/files/FileFinishedActivity.kt | 43 ------------------- 6 files changed, 38 insertions(+), 75 deletions(-) delete mode 100644 app/src/main/java/com/stevenschoen/putionew/files/FileFinishedActivity.kt diff --git a/app/build.gradle b/app/build.gradle index 37c348eb..0656d7aa 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -26,7 +26,7 @@ android { applicationId 'com.stevenschoen.putionew' minSdkVersion 19 targetSdkVersion 26 - versionCode 125 + versionCode 126 versionName '4.2' multiDexEnabled true } diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 9d72c87a..018fb0bf 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -67,10 +67,6 @@ - + play(false, fileDownload.status == FileDownload.Status.Downloaded + && fileDownload.downloadedMp4 != true) + }, { error -> + PutioUtils.getRxJavaThrowable(error).printStackTrace() + }) true } @@ -266,6 +274,7 @@ class FileDetailsFragment : RxFragment() { null, FileDownload.Status.NotDownloaded, null, null)) val downloadStatus = fileDownload .map { it.status } + var lastDownloadStatus: FileDownload.Status? = null var lastMp4PercentDone = 0 data class DownloadAndMp4Status( diff --git a/app/src/main/java/com/stevenschoen/putionew/files/FileFinishedActivity.kt b/app/src/main/java/com/stevenschoen/putionew/files/FileFinishedActivity.kt deleted file mode 100644 index 71c63d69..00000000 --- a/app/src/main/java/com/stevenschoen/putionew/files/FileFinishedActivity.kt +++ /dev/null @@ -1,43 +0,0 @@ -package com.stevenschoen.putionew.files - -import android.content.Intent -import android.net.Uri -import android.os.Bundle -import android.support.v7.app.AppCompatActivity -import android.view.View -import android.widget.TextView -import com.stevenschoen.putionew.R - -class FileFinishedActivity : AppCompatActivity() { - - companion object { - const val EXTRA_NAME = "name" - const val EXTRA_URI = "uri" - const val EXTRA_MEDIA_TYPE = "type" - } - - override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) - setContentView(R.layout.dialog_filefinished) - - val name = intent.extras.getString(EXTRA_NAME) - - val messageView = findViewById(R.id.text_downloadfinished_body) - messageView.text = String.format(getString(R.string.downloadfinishedbody), name) - - val openView = findViewById(R.id.button_filefinished_action) - openView.setOnClickListener { - val uri = intent.extras.getParcelable(EXTRA_URI) - val type = intent.extras.getString(EXTRA_MEDIA_TYPE) - val intent = Intent(Intent.ACTION_VIEW).apply { - setDataAndType(uri, type) - } - startActivity(Intent.createChooser(intent, null)) - - finish() - } - - val okView = findViewById(R.id.button_filefinished_ok) - okView.setOnClickListener { finish() } - } -} \ No newline at end of file