razeware / emitron-Android

Android version of emitron
Apache License 2.0
55 stars 30 forks source link

Added logic & state handling for the visibility of Download buttons. #273

Closed filbabic closed 4 years ago

filbabic commented 4 years ago

Added logic to show/hide the Download button on CollectionsFragment & the CollectionEpisodeItemViewHolder, depending on if the user has or doesn't have download permissions.

This fixes #264.

I simply added the isDownloadAvailable variable to the data binding setup of these two classes/layouts, and as such can change if the user should see the DL button or not.

The important code in the XML is the following:

// within the Data Binding setup
<variable
  name="isDownloadAvailable"
  type="Boolean" />

// within the DownloadButton tags
android:visibility="@{isDownloadAvailable ? View.VISIBLE : View.GONE}"

There are also some formatting changes here, as some files were indented with tabs instead of spaces and vice versa. I chose to opt into spaces, as that's the default, and also as that is what the majority of files use.