From ffe397247c0f5b692b9384177ce6c44c5a5930dd Mon Sep 17 00:00:00 2001 From: Steven Schoen Date: Fri, 7 Dec 2018 19:43:21 -0800 Subject: [PATCH] Visual cleanup in file details --- .../putionew/files/FileDetailsFragment.kt | 44 -------------- .../main/res/drawable/filedetails_file.xml | 15 ----- app/src/main/res/layout/filedetails.xml | 60 ++++++++----------- app/src/main/res/values/colors_putio.xml | 4 -- 4 files changed, 25 insertions(+), 98 deletions(-) delete mode 100644 app/src/main/res/drawable/filedetails_file.xml 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 b66e3a8a..8c78c5a5 100644 --- a/app/src/main/java/com/stevenschoen/putionew/files/FileDetailsFragment.kt +++ b/app/src/main/java/com/stevenschoen/putionew/files/FileDetailsFragment.kt @@ -1,8 +1,6 @@ package com.stevenschoen.putionew.files import android.Manifest -import android.animation.Animator -import android.animation.ObjectAnimator import android.app.Activity import android.app.DownloadManager import android.content.ActivityNotFoundException @@ -16,7 +14,6 @@ import android.graphics.drawable.Animatable import android.graphics.drawable.Drawable import android.net.Uri import android.os.AsyncTask -import android.os.Build import android.os.Bundle import android.view.Gravity import android.view.LayoutInflater @@ -27,7 +24,6 @@ import android.widget.ImageView import android.widget.PopupMenu import android.widget.TextView import android.widget.Toast -import androidx.core.content.ContextCompat import androidx.core.content.res.use import androidx.core.view.updatePaddingRelative import androidx.core.widget.ImageViewCompat @@ -79,32 +75,12 @@ class FileDetailsFragment : RxFragment() { val titleView: TextView = findViewById(R.id.filedetails_title) titleView.text = file.name - var titleBackgroundColorAnimator: Animator? = null - var lastTitleBackgroundColor: Int? = null - fun setTitleBackgroundColor(color: Int, animate: Boolean) { - if (color == lastTitleBackgroundColor) return - if (animate && Build.VERSION.SDK_INT >= 21) { - val startingColor = lastTitleBackgroundColor ?: color - titleBackgroundColorAnimator = ObjectAnimator.ofArgb( - titleView, "backgroundColor", startingColor, color - ).apply { - start() - } - } else { - titleBackgroundColorAnimator?.cancel() - titleBackgroundColorAnimator = null - titleView.setBackgroundColor(color) - } - lastTitleBackgroundColor = color - } val screenshotView: ImageView = findViewById(R.id.filedetails_screenshot) val screenshotBlurryView: ImageView = findViewById(R.id.filedetails_screenshot_blurry) val screenshotTopScrimView: View = findViewById(R.id.filedetails_screenshot_scrim_top) val screenshotTitleScrimView: View = findViewById(R.id.filedetails_screenshot_scrim_title) - val fileGraphicView: View = findViewById(R.id.filedetails_graphic_file) - val backView: ImageButton = findViewById(R.id.filedetails_back) backView.setOnClickListener { onBackPressed?.invoke() @@ -166,9 +142,7 @@ class FileDetailsFragment : RxFragment() { .subscribe { Picasso.get().cancelRequest(screenshotTarget) } - fileGraphicView.visibility = View.GONE } else { - titleView.setBackgroundColor(ContextCompat.getColor(context, R.color.putio_filedetails_notdownloaded)) screenshotView.visibility = View.GONE screenshotBlurryView.visibility = View.GONE screenshotTopScrimView.visibility = View.GONE @@ -427,24 +401,6 @@ class FileDetailsFragment : RxFragment() { }, { error -> PutioUtils.getRxJavaThrowable(error).printStackTrace() }) - - if (!useVideoTitleBackground) { - downloadStatus.subscribe({ - val animate = (lastDownloadStatus != null) - val backgroundColorRes = when (it!!) { - FileDownload.Status.Downloaded -> R.color.putio_filedetails_downloaded - FileDownload.Status.InProgress -> R.color.putio_filedetails_inprogress - FileDownload.Status.NotDownloaded -> R.color.putio_filedetails_notdownloaded - } - setTitleBackgroundColor( - ContextCompat.getColor( - context, backgroundColorRes - ), animate - ) - }, { error -> - PutioUtils.getRxJavaThrowable(error).printStackTrace() - }) - } } } diff --git a/app/src/main/res/drawable/filedetails_file.xml b/app/src/main/res/drawable/filedetails_file.xml deleted file mode 100644 index ffb29d13..00000000 --- a/app/src/main/res/drawable/filedetails_file.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - diff --git a/app/src/main/res/layout/filedetails.xml b/app/src/main/res/layout/filedetails.xml index 46fd9dee..7c669573 100644 --- a/app/src/main/res/layout/filedetails.xml +++ b/app/src/main/res/layout/filedetails.xml @@ -18,8 +18,6 @@ android:id="@+id/filedetails_screenshot_blurry" android:layout_width="0dp" android:layout_height="0dp" - android:background="#383838" - android:elevation="2dp" android:scaleType="centerCrop" app:layout_constraintDimensionRatio="16:9" app:layout_constraintEnd_toEndOf="@+id/filedetails_title" @@ -31,7 +29,6 @@ android:id="@+id/filedetails_screenshot" android:layout_width="0dp" android:layout_height="0dp" - android:elevation="2dp" android:scaleType="centerCrop" app:layout_constraintBottom_toBottomOf="@+id/filedetails_screenshot_blurry" app:layout_constraintEnd_toEndOf="@+id/filedetails_screenshot_blurry" @@ -43,7 +40,6 @@ android:id="@+id/filedetails_screenshot_scrim_top" android:layout_width="0dp" android:layout_height="0dp" - android:elevation="2dp" app:layout_constraintBottom_toBottomOf="@+id/filedetails_screenshot" app:layout_constraintEnd_toEndOf="@+id/filedetails_screenshot" app:layout_constraintHeight_max="96dp" @@ -56,7 +52,6 @@ android:id="@+id/filedetails_screenshot_scrim_title" android:layout_width="0dp" android:layout_height="0dp" - android:elevation="2dp" app:layout_constraintBottom_toBottomOf="@+id/filedetails_screenshot" app:layout_constraintEnd_toEndOf="@+id/filedetails_screenshot" app:layout_constraintHeight_max="120dp" @@ -69,7 +64,6 @@ android:id="@+id/filedetails_title" android:layout_width="0dp" android:layout_height="0dp" - android:elevation="2dp" android:ellipsize="end" android:gravity="bottom" android:maxLines="2" @@ -85,32 +79,16 @@ app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" app:layout_constraintVertical_bias="1" - tools:background="@color/putio_filedetails_notdownloaded" tools:paddingTop="@dimen/filedetails_title_top_padding_video" tools:text="File name.rar" /> - - + + diff --git a/app/src/main/res/values/colors_putio.xml b/app/src/main/res/values/colors_putio.xml index 8522c0b2..c534918e 100644 --- a/app/src/main/res/values/colors_putio.xml +++ b/app/src/main/res/values/colors_putio.xml @@ -13,10 +13,6 @@ #202020 - #E5FFE5 - #fbfbdf - #F8F8F8 - #F8F8F8 #1e000000