diff --git a/app/src/main/java/com/stevenschoen/putionew/PutioActivity.kt b/app/src/main/java/com/stevenschoen/putionew/PutioActivity.kt index 4123cb74..74d99bfa 100644 --- a/app/src/main/java/com/stevenschoen/putionew/PutioActivity.kt +++ b/app/src/main/java/com/stevenschoen/putionew/PutioActivity.kt @@ -9,6 +9,7 @@ import android.os.Build import android.os.Bundle import android.preference.PreferenceManager import android.support.v4.app.Fragment +import android.support.v4.content.ContextCompat import android.support.v4.view.animation.FastOutSlowInInterpolator import android.support.v7.widget.Toolbar import android.view.Menu @@ -298,7 +299,7 @@ class PutioActivity : BaseCastActivity() { setSupportActionBar(toolbar) bottomNavView = findViewById(R.id.main_bottom_nav) - bottomNavView.defaultBackgroundColor = Color.parseColor("#F8F8F8") + bottomNavView.defaultBackgroundColor = ContextCompat.getColor(this, R.color.putio_light_canvas) bottomNavView.accentColor = Color.BLACK bottomNavView.inactiveColor = Color.parseColor("#80000000") bottomNavView.addItem(AHBottomNavigationItem(getString(R.string.account), R.drawable.ic_nav_account)) diff --git a/app/src/main/java/com/stevenschoen/putionew/files/FileDetailsFragment.kt b/app/src/main/java/com/stevenschoen/putionew/files/FileDetailsFragment.kt index c7ab3edc..ea0799b7 100644 --- a/app/src/main/java/com/stevenschoen/putionew/files/FileDetailsFragment.kt +++ b/app/src/main/java/com/stevenschoen/putionew/files/FileDetailsFragment.kt @@ -42,34 +42,17 @@ import io.reactivex.schedulers.Schedulers class FileDetailsFragment : RxFragment() { - companion object { - const val EXTRA_FILE = "file" - - const val REQUEST_DOWNLOAD = 1 - const val REQUEST_DOWNLOAD_MP4 = 2 - - fun newInstance(context: Context, file: PutioFile): FileDetailsFragment { - if (file.isFolder) { - throw IllegalStateException("FileDetailsFragment created for the wrong kind of file: " + - "${file.name} (ID ${file.id}), type ${file.contentType}") - } - val args = Bundle() - args.putParcelable(EXTRA_FILE, file) - return Fragment.instantiate(context, FileDetailsFragment::class.java.name, args) as FileDetailsFragment - } - } - - val fileDownloads by lazy { putioApp.fileDownloadDatabase.fileDownloadsDao() } - val fileDownloadHelper by lazy { FileDownloadHelper(context!!) } + private val fileDownloads by lazy { putioApp.fileDownloadDatabase.fileDownloadsDao() } + private val fileDownloadHelper by lazy { FileDownloadHelper(context!!) } var onBackPressed: (() -> Any)? = null var castCallbacks: PutioApplication.CastCallbacks? = null - val file by lazy { arguments!!.getParcelable(EXTRA_FILE)!! } - val showMp4Options by lazy { file.isVideo && !file.isMp4 } + private val file by lazy { arguments!!.getParcelable(EXTRA_FILE)!! } + private val showMp4Options by lazy { file.isVideo && !file.isMp4 } - lateinit var loader: FileDetailsLoader - var mp4Loader: Mp4StatusLoader? = null + private lateinit var loader: FileDetailsLoader + private var mp4Loader: Mp4StatusLoader? = null override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) @@ -282,20 +265,24 @@ class FileDetailsFragment : RxFragment() { data class DownloadAndMp4Status( val download: FileDownload, val mp4Status: PutioMp4Status) - val mp4Status = if (showMp4Options) { - mp4Loader!!.mp4Status() - .startWith(PutioMp4Status().apply { - // Assume it's completed, most common case - status = PutioMp4Status.Status.Completed - }) - .bindToLifecycle(this@FileDetailsFragment) - } else if (useVideoTitleBackground) { - Observable.just(PutioMp4Status().apply { status = PutioMp4Status.Status.AlreadyMp4 }) - } else { - playActionView.visibility = View.GONE - playProgressBarView.visibility = View.GONE - playMoreView.visibility = View.GONE - Observable.just(PutioMp4Status().apply { status = PutioMp4Status.Status.NotVideo }) + val mp4Status = when { + showMp4Options -> { + mp4Loader!!.mp4Status() + .startWith(PutioMp4Status().apply { + // Assume it's completed, most common case + status = PutioMp4Status.Status.Completed + }) + .bindToLifecycle(this@FileDetailsFragment) + } + useVideoTitleBackground -> { + Observable.just(PutioMp4Status().apply { status = PutioMp4Status.Status.AlreadyMp4 }) + } + else -> { + playActionView.visibility = View.GONE + playProgressBarView.visibility = View.GONE + playMoreView.visibility = View.GONE + Observable.just(PutioMp4Status().apply { status = PutioMp4Status.Status.NotVideo }) + } } val downloadAndMp4Status: Observable = Observable.combineLatest( fileDownloadWithDefault, mp4Status, BiFunction { newDownload, newMp4Status -> @@ -516,4 +503,22 @@ class FileDetailsFragment : RxFragment() { } } } + + companion object { + const val EXTRA_FILE = "file" + + const val REQUEST_DOWNLOAD = 1 + const val REQUEST_DOWNLOAD_MP4 = 2 + + fun newInstance(context: Context, file: PutioFile): FileDetailsFragment { + if (file.isFolder) { + throw IllegalStateException("FileDetailsFragment created for the wrong kind of file: " + + "${file.name} (ID ${file.id}), type ${file.contentType}") + } + val args = Bundle() + args.putParcelable(EXTRA_FILE, file) + return Fragment.instantiate(context, FileDetailsFragment::class.java.name, args) as FileDetailsFragment + } + } + } diff --git a/app/src/main/res/layout/main.xml b/app/src/main/res/layout/main.xml index bfbf66b3..2541f77a 100644 --- a/app/src/main/res/layout/main.xml +++ b/app/src/main/res/layout/main.xml @@ -41,7 +41,7 @@ android:layout_alignParentBottom="true" android:background="#F8F8F8" android:elevation="@dimen/appBarElevation" - > + /> - - - \ No newline at end of file diff --git a/app/src/main/res/values-large/integers.xml b/app/src/main/res/values-large/integers.xml deleted file mode 100644 index 560002c3..00000000 --- a/app/src/main/res/values-large/integers.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/app/src/main/res/values-v27/styles.xml b/app/src/main/res/values-v27/styles.xml new file mode 100644 index 00000000..27849539 --- /dev/null +++ b/app/src/main/res/values-v27/styles.xml @@ -0,0 +1,12 @@ + + + + + + +