diff --git a/.classpath b/.classpath
deleted file mode 100644
index 205aca32..00000000
--- a/.classpath
+++ /dev/null
@@ -1,23 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/.cproject b/.cproject
deleted file mode 100644
index 1c122a09..00000000
--- a/.cproject
+++ /dev/null
@@ -1,50 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/.gitignore b/.gitignore
index 9f7eee94..a71312e6 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,21 +1,27 @@
+#built application files
+*.apk
+*.ap_
+
+# files for the dex VM
+*.dex
+
+# Java class files
+*.class
+
+# generated files
bin/
gen/
-.externalToolBuilders/org.eclipse.cdt.managedbuilder.core.genmakebuilder.launch
-.idea/ant.xml
-.idea/compiler.xml
-.idea/copyright/profiles_settings.xml
-.idea/encodings.xml
-.idea/misc.xml
-.idea/modules.xml
-.idea/scopes/scope_settings.xml
-.idea/uiDesigner.xml
-.idea/vcs.xml
-.idea/workspace.xml
-.settings/org.eclipse.jdt.core.prefs
-.settings/org.eclipse.ltk.core.refactoring.prefs
-.idea/.name
-.idea/gradle.xml
+
+# Local configuration file (sdk path, etc)
local.properties
-res/drawable-hdpi/Thumbs.db
-res/values/com_crashlytics_export_strings.xml
-res/values/api_keys.xml
+
+# Windows thumbnail db
+Thumbs.db
+
+# OSX files
+.DS_Store
+
+# Android Studio
+.idea
+.gradle
+build/
\ No newline at end of file
diff --git a/.gradle/1.12/taskArtifacts/cache.properties b/.gradle/1.12/taskArtifacts/cache.properties
deleted file mode 100644
index 548a694f..00000000
--- a/.gradle/1.12/taskArtifacts/cache.properties
+++ /dev/null
@@ -1 +0,0 @@
-#Mon Aug 11 17:26:46 CEST 2014
diff --git a/.gradle/1.12/taskArtifacts/cache.properties.lock b/.gradle/1.12/taskArtifacts/cache.properties.lock
deleted file mode 100644
index 2c952068..00000000
Binary files a/.gradle/1.12/taskArtifacts/cache.properties.lock and /dev/null differ
diff --git a/.gradle/1.12/taskArtifacts/fileHashes.bin b/.gradle/1.12/taskArtifacts/fileHashes.bin
deleted file mode 100644
index 99c78562..00000000
Binary files a/.gradle/1.12/taskArtifacts/fileHashes.bin and /dev/null differ
diff --git a/.gradle/1.12/taskArtifacts/fileSnapshots.bin b/.gradle/1.12/taskArtifacts/fileSnapshots.bin
deleted file mode 100644
index a1aba32b..00000000
Binary files a/.gradle/1.12/taskArtifacts/fileSnapshots.bin and /dev/null differ
diff --git a/.gradle/1.12/taskArtifacts/outputFileStates.bin b/.gradle/1.12/taskArtifacts/outputFileStates.bin
deleted file mode 100644
index 1ed01fb8..00000000
Binary files a/.gradle/1.12/taskArtifacts/outputFileStates.bin and /dev/null differ
diff --git a/.gradle/1.12/taskArtifacts/taskArtifacts.bin b/.gradle/1.12/taskArtifacts/taskArtifacts.bin
deleted file mode 100644
index bb708021..00000000
Binary files a/.gradle/1.12/taskArtifacts/taskArtifacts.bin and /dev/null differ
diff --git a/.idea/libraries/Palette.xml b/.idea/libraries/Palette.xml
deleted file mode 100644
index 60989368..00000000
--- a/.idea/libraries/Palette.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/YouTubeAndroidPlayerApi.xml b/.idea/libraries/YouTubeAndroidPlayerApi.xml
index 2841a6dc..d85d929e 100644
--- a/.idea/libraries/YouTubeAndroidPlayerApi.xml
+++ b/.idea/libraries/YouTubeAndroidPlayerApi.xml
@@ -1,7 +1,7 @@
-
+
diff --git a/.idea/libraries/android_support_v4.xml b/.idea/libraries/android_support_v4.xml
deleted file mode 100644
index 90805f27..00000000
--- a/.idea/libraries/android_support_v4.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/cling_core_1_0_5.xml b/.idea/libraries/cling_core_1_0_5.xml
index 3fcb1e27..f3614701 100644
--- a/.idea/libraries/cling_core_1_0_5.xml
+++ b/.idea/libraries/cling_core_1_0_5.xml
@@ -1,7 +1,7 @@
-
+
diff --git a/.idea/libraries/cling_support_1_0_5.xml b/.idea/libraries/cling_support_1_0_5.xml
index 8a7d5ae8..4a2a647e 100644
--- a/.idea/libraries/cling_support_1_0_5.xml
+++ b/.idea/libraries/cling_support_1_0_5.xml
@@ -1,7 +1,7 @@
-
+
diff --git a/.idea/libraries/guava_16_0_1.xml b/.idea/libraries/guava_16_0_1.xml
index f5685645..2eb7964a 100644
--- a/.idea/libraries/guava_16_0_1.xml
+++ b/.idea/libraries/guava_16_0_1.xml
@@ -1,9 +1,11 @@
-
+
-
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/jcifs.xml b/.idea/libraries/jcifs.xml
index 089d6798..225a5b86 100644
--- a/.idea/libraries/jcifs.xml
+++ b/.idea/libraries/jcifs.xml
@@ -1,7 +1,7 @@
-
+
diff --git a/.idea/libraries/otto_1_3_4.xml b/.idea/libraries/otto_1_3_4.xml
index 90295219..96405ef7 100644
--- a/.idea/libraries/otto_1_3_4.xml
+++ b/.idea/libraries/otto_1_3_4.xml
@@ -1,9 +1,11 @@
-
+
-
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/picasso_2_3_3.xml b/.idea/libraries/picasso_2_3_3.xml
deleted file mode 100644
index f4e235c1..00000000
--- a/.idea/libraries/picasso_2_3_3.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/repackaged_okhttp_2_0_0.xml b/.idea/libraries/repackaged_okhttp_2_0_0.xml
deleted file mode 100644
index 7b6acd49..00000000
--- a/.idea/libraries/repackaged_okhttp_2_0_0.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/repackaged_okhttp_urlconnection_2_0_0.xml b/.idea/libraries/repackaged_okhttp_urlconnection_2_0_0.xml
deleted file mode 100644
index 7897f783..00000000
--- a/.idea/libraries/repackaged_okhttp_urlconnection_2_0_0.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/repackaged_okio_1_0_0.xml b/.idea/libraries/repackaged_okio_1_0_0.xml
deleted file mode 100644
index 970b1fc3..00000000
--- a/.idea/libraries/repackaged_okio_1_0_0.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/teleal_common_1_0_13.xml b/.idea/libraries/teleal_common_1_0_13.xml
index be6eda9d..a7dee2cf 100644
--- a/.idea/libraries/teleal_common_1_0_13.xml
+++ b/.idea/libraries/teleal_common_1_0_13.xml
@@ -1,7 +1,7 @@
-
+
diff --git a/.project b/.project
deleted file mode 100644
index 7cba7a8a..00000000
--- a/.project
+++ /dev/null
@@ -1,43 +0,0 @@
-
-
- Mizuu v2
-
-
-
-
-
- com.android.ide.eclipse.adt.ResourceManagerBuilder
-
-
-
-
- com.android.ide.eclipse.adt.PreCompilerBuilder
-
-
-
-
- org.eclipse.jdt.core.javabuilder
-
-
-
-
- com.android.ide.eclipse.adt.ApkBuilder
-
-
-
-
- org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder
- full,incremental,
-
-
-
-
-
- com.android.ide.eclipse.adt.AndroidNature
- org.eclipse.jdt.core.javanature
- org.eclipse.cdt.core.cnature
- org.eclipse.cdt.core.ccnature
- org.eclipse.cdt.managedbuilder.core.managedBuildNature
- org.eclipse.cdt.managedbuilder.core.ScannerConfigNature
-
-
diff --git a/.settings/org.eclipse.core.resources.prefs b/.settings/org.eclipse.core.resources.prefs
deleted file mode 100644
index 0fd3f30c..00000000
--- a/.settings/org.eclipse.core.resources.prefs
+++ /dev/null
@@ -1,2 +0,0 @@
-eclipse.preferences.version=1
-encoding//src/com/miz/functions/MizLib.java=UTF-8
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
deleted file mode 100644
index 9430b82e..00000000
--- a/CONTRIBUTING.md
+++ /dev/null
@@ -1,45 +0,0 @@
-Contributing to Mizuu's development
-============
-
-#### Contributing code?
-
-1. [Fork Mizuu][1].
-2. `git checkout -b descriptive-branch-name dev` and make your commits.
-3. When you think your code is ready, start a pull request against the dev branch. Please reference [existing issues][2] when possible.
-
-#### No code?
-* You can [suggest features][2].
-* You can [discuss a bug][2] or [report a bug][2]!
-* You can [translate strings][3].
-
-Branch structure
-----------------
-
-The repository is made up of two main branches: master (stable) and dev (unstable / work in progress).
-
-* **master** has the latest stable code, its tags are released as versions of Mizuu on GitHub, www.mizuu.tv and Google Play.
-* **dev** includes the latest unstable code from contributers (you!).
-
-Since Mizuu was just recently open-sourced, there's still some work to do with branching and the overall structure of the development, but this is on the to-do list. For now, use the tagged commits as release versions.
-
-Setup
------
-
-Mizuu is developed using ADT. I will most likely convert the project to the upcoming Android Studio environment in the future.
-
-In order to use the project with the various web services, you'll need to add an `api_keys.xml` file to `/res/values/` with the following content:
-
-```xml
-
-
- add_your_own
- add_your_own
- add_your_own
- add_your_own
- add_your_own
-
-```
-
- [1]: https://github.com/MizzleDK/Mizuu/fork
- [2]: https://github.com/MizzleDK/Mizuu/issues
- [3]: http://translate.mizuu.tv/
diff --git a/LICENSE.txt b/LICENSE.txt
deleted file mode 100644
index d6456956..00000000
--- a/LICENSE.txt
+++ /dev/null
@@ -1,202 +0,0 @@
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
diff --git a/Mizuu.iml b/Mizuu.iml
new file mode 100644
index 00000000..0bb6048a
--- /dev/null
+++ b/Mizuu.iml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/README.md b/README.md
deleted file mode 100644
index f18209a4..00000000
--- a/README.md
+++ /dev/null
@@ -1,59 +0,0 @@
-Mizuu - media indexer for Android
-=====
-
-This GitHub repository houses the source code of the Mizuu application for Android.
-
-![image alt][1]
-
-Description
-----------------------
-
-Mizuu is a user friendly media center application for Android tablets and smartphones. The application helps manage all your movie and TV show video files - and automatically fetches useful information about the video content, including title, plot, cover art and actors.
-
-Features
-- Indexing of movie and TV show files on your device or on Samba (CIFS / SMB) and UPnP / DLNA compatible devices
-- View actor details for movies, including biography, filmography and photos
-- Many options to customize and personalize the application
-- Enjoy popular video content from YouTube, Reddit as well as the latest TED Talks
-- Browse details and watch trailers for upcoming and popular movies with online search
-- Different widgets for displaying your collections on the home screen
-- Synchronizes indexed content with your Trakt.tv account
-- Google TV support (experimental)
-
-
-Issues and suggestions
-----------------------
-
-Please use this link for issue tracking and suggestions: https://github.com/MizzleDK/MizuuApp/issues
-
-Dependencies
-------------
-
-Mizuu uses a number of third-party libraries, which are all included in the lib folder of this repo.
-
-Additionally, you'll need the Crashlytics plugin for your IDE and make sure it's set up with Mizuu. It needs to generate a special file in your assets folder and you also need to supply an API key for Crashlytics.
-
-Contributing
-------------
-
-If you want to contribute to Mizuu's development, there's plenty of ways to do it. You can read about it in [CONTRIBUTING.md][2].
-
-License
--------
-
- Copyright 2014 Michell Bak
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- [1]: http://i.imgur.com/mvwzN67.jpg
- [2]: https://github.com/MizzleDK/Mizuu/blob/master/CONTRIBUTING.md
diff --git a/TRANSLATING.md b/TRANSLATING.md
deleted file mode 100644
index a0f4a4d3..00000000
--- a/TRANSLATING.md
+++ /dev/null
@@ -1,54 +0,0 @@
-Translating Mizuu
-============
-
-#### Steps
-
-1. [Fork Mizuu][1].
-2. Read the guidelines on how to translate strings below.
-3. `git checkout -b branch-name-language dev` and commit your translations.
-4. When you think your translations are done, start a pull request against the dev branch.
-
-#### How to translate
-
-1. Locate the original strings in [/res/values/strings.xml][2]
-2. Check if the strings have already been translated into the language you want to translate to. You can do that by checking [/res/][3] folder and look for values-##, where ## represents the [ISO 639-1 code][4] of the language, i.e. `values-da` for Danish.
-3. If the language folder exists, you can check previous translations and add missing ones. If the folder doesn't exist, you can create it and add translations.
-4. See the section below for specific translation examples
-
-Examples of string translation
-============
-
-#### Regular strings
-
-`Movies`
-
-*... gets translated into this (for Danish):*
-
-`Film`
-
-Some strings have explanations / context descriptions. Please refer to these, if you have any questions or doubts, or alternatively contact me or mention it in the pull request.
-
-#### Plural strings
-
-```xml
-
- movie
- movies
-
-```
-
-*... gets translated into this (for Danish):*
-
-```xml
-
- film
- film
-
-```
-
-Some languages include words for many different quantities. You may add or remove these quantities to match the specific language. Valid quantities are: "zero", "one", "two", "few", "many", "other".
-
- [1]: https://github.com/MizzleDK/Mizuu/fork
- [2]: https://github.com/MizzleDK/Mizuu/blob/master/res/values/strings.xml
- [3]: https://github.com/MizzleDK/Mizuu/blob/master/res/
- [4]: http://www.loc.gov/standards/iso639-2/php/code_list.php
diff --git a/app/app.iml b/app/app.iml
new file mode 100644
index 00000000..af2bffdf
--- /dev/null
+++ b/app/app.iml
@@ -0,0 +1,108 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/build.gradle b/app/build.gradle
new file mode 100644
index 00000000..987df988
--- /dev/null
+++ b/app/build.gradle
@@ -0,0 +1,70 @@
+apply plugin: 'com.android.application'
+
+android {
+ compileSdkVersion 21
+ buildToolsVersion "21.0.2"
+
+ defaultConfig {
+ applicationId "com.miz.mizuu"
+ minSdkVersion 15
+ targetSdkVersion 21
+
+ testApplicationId "com.miz.test"
+ testInstrumentationRunner "android.test.InstrumentationTestRunner"
+
+ renderscriptTargetApi 19
+ renderscriptSupportModeEnabled true
+ }
+
+ buildTypes {
+ release {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
+ }
+ }
+ compileOptions {
+ sourceCompatibility JavaVersion.VERSION_1_7
+ targetCompatibility JavaVersion.VERSION_1_7
+ }
+}
+
+repositories {
+ mavenCentral()
+ mavenLocal()
+ maven {
+ url 'http://4thline.org/m2'
+ }
+}
+
+dependencies {
+ compile 'com.android.support:support-v4:21.0.0'
+ compile 'com.google.guava:guava:16.0.1'
+ compile 'com.android.support:support-v4:21.0.+'
+ compile 'com.android.support:appcompat-v7:21.0.+'
+ compile 'com.android.support:palette-v7:21.0.+'
+ compile 'com.android.support:mediarouter-v7:21.0.+'
+ compile 'com.android.support:recyclerview-v7:+'
+ compile 'com.android.support:cardview-v7:21.+'
+ compile 'com.squareup.picasso:picasso:2.3.4'
+ compile 'com.squareup.okhttp:okhttp:2.1.0'
+ compile 'com.squareup.okhttp:okhttp-urlconnection:2.1.0'
+ compile 'com.squareup.okio:okio:1.0.1'
+ compile 'com.squareup:otto:1.3.4'
+ compile 'com.jpardogo.materialtabstrip:library:1.0.4+'
+ compile files('libs/cling-core-1.0.5.jar')
+ compile files('libs/cling-support-1.0.5.jar')
+ compile files('libs/jcifs.jar')
+ compile files('libs/teleal-common-1.0.13.jar')
+ compile files('libs/YouTubeAndroidPlayerApi.jar')
+
+/**
+ * // Cling
+ compile group: 'org.fourthline.cling', name: 'cling-core', version:'2.0.1'
+ compile group: 'org.fourthline.cling', name: 'cling-support', version:'2.0.1'
+ compile group: 'org.eclipse.jetty', name: 'jetty-server', version:'8.1.12.v20130726'
+ compile group: 'org.eclipse.jetty', name: 'jetty-servlet', version:'8.1.12.v20130726'
+ compile group: 'org.eclipse.jetty', name: 'jetty-client', version:'8.1.12.v20130726'
+ compile group: 'org.slf4j', name: 'slf4j-jdk14', version:'1.7.5'
+ */
+
+}
diff --git a/libs/YouTubeAndroidPlayerApi.jar b/app/libs/YouTubeAndroidPlayerApi.jar
similarity index 100%
rename from libs/YouTubeAndroidPlayerApi.jar
rename to app/libs/YouTubeAndroidPlayerApi.jar
diff --git a/libs/cling-core-1.0.5.jar b/app/libs/cling-core-1.0.5.jar
similarity index 100%
rename from libs/cling-core-1.0.5.jar
rename to app/libs/cling-core-1.0.5.jar
diff --git a/libs/cling-support-1.0.5.jar b/app/libs/cling-support-1.0.5.jar
similarity index 100%
rename from libs/cling-support-1.0.5.jar
rename to app/libs/cling-support-1.0.5.jar
diff --git a/libs/jcifs.jar b/app/libs/jcifs.jar
similarity index 100%
rename from libs/jcifs.jar
rename to app/libs/jcifs.jar
diff --git a/app/libs/okhttp-2.0.0.jar b/app/libs/okhttp-2.0.0.jar
new file mode 100644
index 00000000..0d00384d
Binary files /dev/null and b/app/libs/okhttp-2.0.0.jar differ
diff --git a/app/libs/okhttp-urlconnection-2.0.0.jar b/app/libs/okhttp-urlconnection-2.0.0.jar
new file mode 100644
index 00000000..62cda9be
Binary files /dev/null and b/app/libs/okhttp-urlconnection-2.0.0.jar differ
diff --git a/app/libs/okio-1.0.1.jar b/app/libs/okio-1.0.1.jar
new file mode 100644
index 00000000..11b709a4
Binary files /dev/null and b/app/libs/okio-1.0.1.jar differ
diff --git a/libs/otto-1.3.4.jar b/app/libs/otto-1.3.4.jar
similarity index 100%
rename from libs/otto-1.3.4.jar
rename to app/libs/otto-1.3.4.jar
diff --git a/libs/picasso-2.3.4.jar b/app/libs/picasso-2.3.4.jar
similarity index 100%
rename from libs/picasso-2.3.4.jar
rename to app/libs/picasso-2.3.4.jar
diff --git a/libs/teleal-common-1.0.13.jar b/app/libs/teleal-common-1.0.13.jar
similarity index 100%
rename from libs/teleal-common-1.0.13.jar
rename to app/libs/teleal-common-1.0.13.jar
diff --git a/lint.xml b/app/lint.xml
similarity index 97%
rename from lint.xml
rename to app/lint.xml
index bcbf777d..79e3d098 100644
--- a/lint.xml
+++ b/app/lint.xml
@@ -1,4 +1,4 @@
-
+
diff --git a/app/src/androidTest/java/com/miz/test/DatabaseMovieTests.java b/app/src/androidTest/java/com/miz/test/DatabaseMovieTests.java
new file mode 100644
index 00000000..a7c85c13
--- /dev/null
+++ b/app/src/androidTest/java/com/miz/test/DatabaseMovieTests.java
@@ -0,0 +1,999 @@
+package com.miz.test;/*
+ * Copyright (C) 2014 Michell Bak
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import android.content.Context;
+import android.test.InstrumentationTestCase;
+
+import com.miz.db.DbAdapterCollections;
+import com.miz.db.DbAdapterMovieMappings;
+import com.miz.db.DbAdapterMovies;
+import com.miz.mizuu.MizuuApplication;
+import com.miz.utils.MovieDatabaseUtils;
+
+/**
+ * Tests various movie database queries.
+ * Do not use this on a non-debug build, as
+ * it will remove all data.
+ */
+public class DatabaseMovieTests extends InstrumentationTestCase {
+
+ private Context mContext;
+
+ /**
+ * Tests if it's possible to create a movie.
+ */
+ public void testMovieCreation() {
+ DbAdapterMovies db = getAndResetDatabase();
+
+ // We expect zero movies to begin with
+ assertEquals(0, db.count());
+
+ // Create test movie
+ createTestMovie(db);
+
+ // We've just created a movie, so there should be one now
+ assertEquals(1, db.count());
+ }
+
+ /**
+ * Tests if it's possible to delete a movie.
+ */
+ public void testMovieDeletion() {
+ DbAdapterMovies db = getAndResetDatabase();
+
+ // We expect zero movies to begin with
+ assertEquals(0, db.count());
+
+ // Create test movie
+ createTestMovie(db);
+
+ // We've just created a movie, so there should be one now
+ assertEquals(1, db.count());
+
+ // Delete the test movie
+ MovieDatabaseUtils.deleteMovie(mContext, "1234");
+
+ // We've just deleted the movie, so there should be zero now
+ assertEquals(0, db.count());
+ }
+
+ /**
+ * Tests if it's possible to delete all movies in the database.
+ */
+ public void testDeleteAllMovies() {
+ DbAdapterMovies db = getAndResetDatabase();
+
+ // We expect zero movies to begin with
+ assertEquals(0, db.count());
+
+ // Create two test movies
+ createTwoTestMovies(db);
+
+ // We've just created two movie, so there should be two now
+ assertEquals(2, db.count());
+
+ // Delete all movies
+ MovieDatabaseUtils.deleteAllMovies(mContext);
+
+ // We've just deleted all movies, so there should be zero now
+ assertEquals(0, db.count());
+
+ // Test collection count
+ DbAdapterCollections dbCollections = MizuuApplication.getCollectionsAdapter();
+ assertEquals(0, dbCollections.count());
+
+ // Test filepath mapping count
+ DbAdapterMovieMappings dbMovieMappings = MizuuApplication.getMovieMappingAdapter();
+ assertEquals(0, dbMovieMappings.count());
+
+ // There should be no files left to list in the movie thumbs folder
+ assertEquals(0, MizuuApplication.getMovieThumbFolder(mContext).listFiles().length);
+
+ // There should be no files left to list in the movie backdrops folder
+ assertEquals(0, MizuuApplication.getMovieBackdropFolder(mContext).listFiles().length);
+ }
+
+ /**
+ * Tests if it's possible to create a movie twice. Hint: It shouldn't be.
+ */
+ public void testMovieDuplication() {
+ DbAdapterMovies db = getAndResetDatabase();
+
+ // We expect zero movies to begin with
+ assertEquals(0, db.count());
+
+ // Create test movie
+ createTestMovie(db);
+
+ // We've just created a movie, so there should be one now
+ assertEquals(1, db.count());
+
+ // Create the test movie again
+ createTestMovie(db);
+
+ // There should still just be one movie in the database, since it
+ // already existed when we tried to create the movie the second time.
+ assertEquals(1, db.count());
+ }
+
+ /**
+ * Tests if it's possible to create a movie with an invalid movie ID.
+ */
+ public void testInvalidMovieCreation() {
+ DbAdapterMovies db = getAndResetDatabase();
+
+ // We expect zero movies to begin with
+ assertEquals(0, db.count());
+
+ // Create a movie with an unidentified ID
+ db.createMovie(DbAdapterMovies.UNIDENTIFIED_ID, "title", "plot", "tt1234567", "7.9", "tagline", "1970-01-01", "PG-13", "90", "http://youtube.com", "genres", "1", "actors", "collection", "collectionId", "1", "1", "123456789");
+
+ // There should still be zero movies, since we tried to add
+ // a movie with an unidentified ID
+ assertEquals(0, db.count());
+ }
+
+ /**
+ * Tests if it's possible to create a movie collection.
+ */
+ public void testMovieCollectionCreation() {
+ DbAdapterMovies db = getAndResetDatabase();
+
+ // We expect zero movies to begin with
+ assertEquals(0, db.count());
+
+ // Create test movie
+ createTestMovie(db);
+
+ // We've just created a movie, so there should be one now
+ assertEquals(1, db.count());
+
+ // We've just created a movie with a collection ID, so there should be one now
+ assertEquals(true, MizuuApplication.getCollectionsAdapter().collectionExists("collectionId"));
+ }
+
+ /**
+ * Tests if it's possible to ignore a movie.
+ */
+ public void testIgnoreMovie() {
+ DbAdapterMovies db = getAndResetDatabase();
+
+ // We expect zero movies to begin with
+ assertEquals(0, db.count());
+
+ // Create test movie
+ createTestMovie(db);
+
+ // We've just created a movie, so there should be one now
+ assertEquals(1, db.count());
+
+ DbAdapterMovieMappings dbMappings = MizuuApplication.getMovieMappingAdapter();
+ dbMappings.createFilepathMapping("/test/lulz.mkv", "1234");
+
+ // We've just created a filepath mapping for the movie, so there should be one now
+ assertEquals(1, dbMappings.getMovieFilepaths("1234").size());
+
+ // Ignore the movie based on its movie ID
+ MovieDatabaseUtils.ignoreMovie("1234");
+
+ // We've just ignored the movie, hence removing it from the movie database
+ assertEquals(0, db.count());
+
+ // We've just ignored all filepath mappings for the movie, so there should be zero now
+ assertEquals(0, dbMappings.getMovieFilepaths("1234").size());
+ }
+
+ /**
+ * Tests if it's possible to update the contents of an existing movie
+ * while keeping favourite, watchlist and watched status data intact.
+ */
+ public void testUpdateMovie() {
+ DbAdapterMovies db = getAndResetDatabase();
+
+ // We expect zero movies to begin with
+ assertEquals(0, db.count());
+
+ // Create test movie
+ createTestMovie(db);
+
+ // We've just created a movie, so there should be one now
+ assertEquals(1, db.count());
+
+ db.createOrUpdateMovie("1234", "new title", "new plot", "tt12345678", "9.7", "new tagline", "1970-01-02", "PG-17", "900", "youtube.com", "genres...", "0", "new actors", "collectionName", "collID", "0", "0", "123456");
+
+ // Make sure that there's still just one movie
+ assertEquals(1, db.count());
+
+ // Make sure that the title has been updated
+ assertEquals("new title", db.getSingleItem("1234", DbAdapterMovies.KEY_TITLE));
+
+ // ... plot
+ assertEquals("new plot", db.getSingleItem("1234", DbAdapterMovies.KEY_PLOT));
+
+ // ... IMDB ID
+ assertEquals("tt12345678", db.getSingleItem("1234", DbAdapterMovies.KEY_IMDB_ID));
+
+ // ... Rating
+ assertEquals("9.7", db.getSingleItem("1234", DbAdapterMovies.KEY_RATING));
+
+ // ... Tagline
+ assertEquals("new tagline", db.getSingleItem("1234", DbAdapterMovies.KEY_TAGLINE));
+
+ // ... Release date
+ assertEquals("1970-01-02", db.getSingleItem("1234", DbAdapterMovies.KEY_RELEASEDATE));
+
+ // ... Certification
+ assertEquals("PG-17", db.getSingleItem("1234", DbAdapterMovies.KEY_CERTIFICATION));
+
+ // ... Runtime
+ assertEquals("900", db.getSingleItem("1234", DbAdapterMovies.KEY_RUNTIME));
+
+ // ... Trailer
+ assertEquals("youtube.com", db.getSingleItem("1234", DbAdapterMovies.KEY_TRAILER));
+
+ // ... Genres
+ assertEquals("genres...", db.getSingleItem("1234", DbAdapterMovies.KEY_GENRES));
+
+ // ... Favorite - this should NOT be changed
+ assertEquals("1", db.getSingleItem("1234", DbAdapterMovies.KEY_FAVOURITE));
+
+ // ... Actors
+ assertEquals("new actors", db.getSingleItem("1234", DbAdapterMovies.KEY_ACTORS));
+
+ // ... Collection ID
+ assertEquals("collID", db.getSingleItem("1234", DbAdapterMovies.KEY_COLLECTION_ID));
+
+ // ... To watch - this should NOT be changed
+ assertEquals("0", db.getSingleItem("1234", DbAdapterMovies.KEY_TO_WATCH));
+
+ // ... Has watched - this should NOT be changed
+ assertEquals("1", db.getSingleItem("1234", DbAdapterMovies.KEY_HAS_WATCHED));
+
+ // ... Date added
+ assertEquals("123456", db.getSingleItem("1234", DbAdapterMovies.KEY_DATE_ADDED));
+
+ DbAdapterCollections dbCollections = MizuuApplication.getCollectionsAdapter();
+ assertEquals("collectionName", dbCollections.getCollection("collID"));
+ }
+
+ /**
+ * Tests if it's possible to edit the contents of an existing movie
+ * while keeping favourite, watchlist and watched status data intact.
+ */
+ public void testEditMovie() {
+ DbAdapterMovies db = getAndResetDatabase();
+
+ // We expect zero movies to begin with
+ assertEquals(0, db.count());
+
+ // Create test movie
+ createTestMovie(db);
+
+ // We've just created a movie, so there should be one now
+ assertEquals(1, db.count());
+
+ db.editMovie("1234", "new title", "new tagline", "new plot", "genres...", "900", "9.7", "1970-01-02", "PG-17");
+
+ // Make sure that there's still just one movie
+ assertEquals(1, db.count());
+
+ // Make sure that the title has been updated
+ assertEquals("new title", db.getSingleItem("1234", DbAdapterMovies.KEY_TITLE));
+
+ // ... plot
+ assertEquals("new plot", db.getSingleItem("1234", DbAdapterMovies.KEY_PLOT));
+
+ // ... Rating
+ assertEquals("9.7", db.getSingleItem("1234", DbAdapterMovies.KEY_RATING));
+
+ // ... Tagline
+ assertEquals("new tagline", db.getSingleItem("1234", DbAdapterMovies.KEY_TAGLINE));
+
+ // ... Release date
+ assertEquals("1970-01-02", db.getSingleItem("1234", DbAdapterMovies.KEY_RELEASEDATE));
+
+ // ... Certification
+ assertEquals("PG-17", db.getSingleItem("1234", DbAdapterMovies.KEY_CERTIFICATION));
+
+ // ... Runtime
+ assertEquals("900", db.getSingleItem("1234", DbAdapterMovies.KEY_RUNTIME));
+
+ // ... Genres
+ assertEquals("genres...", db.getSingleItem("1234", DbAdapterMovies.KEY_GENRES));
+ }
+
+ /**
+ * Tests if it's possible to create a movie
+ * and map multiple filepaths to it.
+ */
+ public void testMultipleFilepathMappings() {
+ DbAdapterMovies db = getAndResetDatabase();
+
+ // We expect zero movies to begin with
+ assertEquals(0, db.count());
+
+ // Create test movie
+ createTestMovie(db);
+
+ // We've just created a movie, so there should be one now
+ assertEquals(1, db.count());
+
+ DbAdapterMovieMappings dbMappings = MizuuApplication.getMovieMappingAdapter();
+
+ // We haven't added any filepaths yet, so there shouldn't be any
+ assertEquals(0, dbMappings.getMovieFilepaths("1234").size());
+
+ dbMappings.createFilepathMapping("/test/lulz.mkv", "1234");
+
+ // We have just added a filepath, so there should be one now
+ assertEquals(1, dbMappings.getMovieFilepaths("1234").size());
+
+ dbMappings.createFilepathMapping("/test/lulz_2.mkv", "1234");
+
+ // We have just added another filepath, so there should be two now
+ assertEquals(2, dbMappings.getMovieFilepaths("1234").size());
+ }
+
+ /**
+ * Tests if it's possible to create a movie
+ * and map the same filepath to it multiple times.
+ * Hint: It shouldn't be possible.
+ */
+ public void testMultipleIdenticalFilepathMappings() {
+ DbAdapterMovies db = getAndResetDatabase();
+
+ // We expect zero movies to begin with
+ assertEquals(0, db.count());
+
+ // Create test movie
+ createTestMovie(db);
+
+ // We've just created a movie, so there should be one now
+ assertEquals(1, db.count());
+
+ DbAdapterMovieMappings dbMappings = MizuuApplication.getMovieMappingAdapter();
+
+ // We haven't added any filepaths yet, so there shouldn't be any
+ assertEquals(0, dbMappings.getMovieFilepaths("1234").size());
+
+ dbMappings.createFilepathMapping("/test/lulz.mkv", "1234");
+
+ // We have just added a filepath, so there should be one now
+ assertEquals(1, dbMappings.getMovieFilepaths("1234").size());
+
+ dbMappings.createFilepathMapping("/test/lulz.mkv", "1234");
+
+ // We have just added the exact same filepath, which should be
+ // ignored, so there should still just be one filepath
+ assertEquals(1, dbMappings.getMovieFilepaths("1234").size());
+ }
+
+ /**
+ * Tests if it's possible to query a collection ID
+ * based on a movie ID.
+ */
+ public void testGetCollectionId() {
+ DbAdapterMovies db = getAndResetDatabase();
+
+ // We expect zero movies to begin with
+ assertEquals(0, db.count());
+
+ // Create test movie
+ createTestMovie(db);
+
+ // We've just created a movie, so there should be one now
+ assertEquals(1, db.count());
+
+ // Check that it's the correct collection ID
+ assertEquals("collectionId", db.getCollectionId("1234"));
+ }
+
+ public void testMovieExists() {
+ DbAdapterMovies db = getAndResetDatabase();
+
+ // We don't expect the movie to exist
+ assertEquals(false, db.movieExists("1234"));
+
+ // Create test movie
+ createTestMovie(db);
+
+ // We've just created a movie, so it should exist
+ assertEquals(true, db.movieExists("1234"));
+ }
+
+ public void testCountWatchlist() {
+ DbAdapterMovies db = getAndResetDatabase();
+
+ // We expect zero movies to begin with
+ assertEquals(0, db.countWatchlist());
+
+ // Create test movie
+ createTestMovie(db);
+
+ // We've just created a movie that's not on
+ // the watchlist, so we still expect zero movies
+ assertEquals(0, db.countWatchlist());
+
+ // Create two test movies, where one
+ // is on the watchlist
+ createTwoTestMovies(db);
+
+ // There should now be one movie on the watchlist
+ assertEquals(1, db.countWatchlist());
+
+ // ... and two movies in total
+ assertEquals(2, db.count());
+
+ // Put the first movie on the watchlist
+ db.updateMovieSingleItem("1234", DbAdapterMovies.KEY_TO_WATCH, "1");
+
+ // There should now be two movies on the watchlist
+ assertEquals(2, db.countWatchlist());
+ }
+
+ public void testGetCertifications() {
+ DbAdapterMovies db = getAndResetDatabase();
+
+ // We expect zero movies to begin with
+ assertEquals(0, db.count());
+
+ // Create test movie
+ createTwoTestMovies(db);
+
+ // We've just created two movies, so there should be two now
+ assertEquals(2, db.count());
+
+ // Each movie had a unique certification,
+ // so there should be a total of 2 certifications.
+ assertEquals(2, db.getCertifications().size());
+
+ // The first... PG-13
+ assertEquals("PG-13", db.getCertifications().get(0));
+
+ // The second... PG-17
+ assertEquals("PG-17", db.getCertifications().get(1));
+ }
+
+ /**
+ * Tests if it's possible to delete
+ * all movie collections.
+ */
+ public void testDeleteAllCollections() {
+ DbAdapterCollections dbCollections = MizuuApplication.getCollectionsAdapter();
+ DbAdapterMovies db = getAndResetDatabase();
+
+ // We expect zero movies to begin with
+ assertEquals(0, db.count());
+
+ // ... and zero collections
+ assertEquals(0, dbCollections.count());
+
+ // Create test movies
+ createTwoTestMovies(db);
+
+ // We've just created two movies, so there should be two now
+ assertEquals(2, db.count());
+
+ // ... and two collections
+ assertEquals(2, dbCollections.count());
+
+ // Delete all collections
+ dbCollections.deleteAllCollections();
+
+ // Back to zero
+ assertEquals(0, dbCollections.count());
+ }
+
+ /**
+ * Tests if it's possible to create a movie
+ * collection twice. Hint: It shouldn't be.
+ */
+ public void testCollectionDuplication() {
+ DbAdapterMovies db = getAndResetDatabase();
+ DbAdapterCollections dbCollections = MizuuApplication.getCollectionsAdapter();
+
+ // We expect zero movies to begin with
+ assertEquals(0, db.count());
+
+ // ... and zero collections
+ assertEquals(0, dbCollections.count());
+
+ // Create test movie
+ createTestMovie(db);
+
+ // We've just created a movie, so there should be one now
+ assertEquals(1, db.count());
+
+ // ... and one collection
+ assertEquals(1, dbCollections.count());
+
+ // Create test movie again
+ createTestMovie(db);
+
+ // Still one of each
+ assertEquals(1, db.count());
+ assertEquals(1, dbCollections.count());
+
+ // Try to manually create a collection
+ // using an existing collection ID
+ dbCollections.createCollection("1234", "collectionId", "something, something");
+
+ // Nope, still just one
+ assertEquals(1, dbCollections.count());
+ }
+
+ public void testDeleteCollection() {
+ DbAdapterCollections dbCollections = MizuuApplication.getCollectionsAdapter();
+ DbAdapterMovies db = getAndResetDatabase();
+
+ // We expect zero movies to begin with
+ assertEquals(0, db.count());
+
+ // ... and zero collections
+ assertEquals(0, dbCollections.count());
+
+ // Create test movies
+ createTwoTestMovies(db);
+
+ // We've just created two movies, so there should be two now
+ assertEquals(2, db.count());
+
+ // ... and two collections
+ assertEquals(2, dbCollections.count());
+
+ // Delete one of the collections
+ dbCollections.deleteCollection("collectionId");
+
+ // Back to one
+ assertEquals(1, dbCollections.count());
+
+ // Delete the remaining collection
+ dbCollections.deleteCollection("collectionId2");
+
+ // Back to zero
+ assertEquals(0, dbCollections.count());
+ }
+
+ /**
+ * Tests if a collection exists.
+ */
+ public void testCollectionExists() {
+ DbAdapterMovies db = getAndResetDatabase();
+ DbAdapterCollections dbCollections = MizuuApplication.getCollectionsAdapter();
+
+ // We expect zero movies to begin with
+ assertEquals(0, db.count());
+
+ // ... and zero collections
+ assertEquals(0, dbCollections.count());
+
+ // Create test movie
+ createTestMovie(db);
+
+ // We've just created a movie, so there should be one now
+ assertEquals(1, db.count());
+
+ // ... and one collection
+ assertEquals(1, dbCollections.count());
+
+ // Check if it exists
+ assertEquals(true, dbCollections.collectionExists("collectionId"));
+
+ // Make sure we're not getting a false positive
+ assertEquals(false, dbCollections.collectionExists("lulz"));
+ }
+
+ /**
+ * Tests if it's possible to get the number of
+ * movies mapped to a given collection.
+ */
+ public void testMovieCountForCollection() {
+ DbAdapterMovies db = getAndResetDatabase();
+ DbAdapterCollections dbCollections = MizuuApplication.getCollectionsAdapter();
+
+ // We expect zero movies to begin with
+ assertEquals(0, db.count());
+ assertEquals(0, dbCollections.getMovieCount("collectionId"));
+
+ // Create test movie
+ createTestMovie(db);
+
+ // There should be one now
+ assertEquals(1, db.count());
+ assertEquals(1, dbCollections.getMovieCount("collectionId"));
+ }
+
+ /**
+ * Tests if it's possible to delete all unidentified movies in the database.
+ */
+ public void testDeleteAllUnidentified() {
+ getAndResetDatabase();
+
+ // Test filepath mapping count
+ DbAdapterMovieMappings dbMovieMappings = MizuuApplication.getMovieMappingAdapter();
+ assertEquals(0, dbMovieMappings.count());
+
+ // Create an unidentified mapping
+ dbMovieMappings.createFilepathMapping("/yo/lulz.mkv", DbAdapterMovies.UNIDENTIFIED_ID);
+
+ // Make sure it's created
+ assertEquals(1, dbMovieMappings.count());
+
+ // Create another unidentified mapping
+ dbMovieMappings.createFilepathMapping("/yo/lulzz.mkv", DbAdapterMovies.UNIDENTIFIED_ID);
+
+ // Make sure it's created
+ assertEquals(2, dbMovieMappings.count());
+
+ // Create a third unidentified mapping
+ dbMovieMappings.createFilepathMapping("/yo/lulzzz.mkv", DbAdapterMovies.UNIDENTIFIED_ID);
+
+ // Make sure it's created
+ assertEquals(3, dbMovieMappings.count());
+
+ // Finally, let's create a mapping for an actual movie ID
+ dbMovieMappings.createFilepathMapping("/yo/lulzzzz.mkv", "1234");
+
+ // Make sure it's created
+ assertEquals(4, dbMovieMappings.count());
+
+ // Delete all unidentified filepaths
+ dbMovieMappings.deleteAllUnidentifiedFilepaths();
+
+ // Since we have added three unidentified mappings and one
+ // correct mapping we should be back at one now.
+ assertEquals(1, dbMovieMappings.count());
+ }
+
+ /**
+ * Test if it's possible to update a filepath movie mapping.
+ */
+ public void testUpdateTmdbId() {
+ DbAdapterMovies db = getAndResetDatabase();
+
+ // We expect zero movies to begin with
+ assertEquals(0, db.count());
+
+ // Create test movie
+ createTwoTestMovies(db);
+
+ // We've just created two movies, so there should be two now
+ assertEquals(2, db.count());
+
+ // Get the DB adapter for movie mappings
+ DbAdapterMovieMappings dbMovieMappings = MizuuApplication.getMovieMappingAdapter();
+
+ // Make sure that there aren't any filepaths linked to begin with
+ assertEquals(0, dbMovieMappings.getMovieFilepaths("1234").size());
+
+ // Create a filepath
+ dbMovieMappings.createFilepathMapping("/test/yo.mkv", "1234");
+
+ // We should have one now
+ assertEquals(1, dbMovieMappings.getMovieFilepaths("1234").size());
+
+ // We're going to update the filepath mapping to another movie.
+ // Let's make sure that other movie doesn't have any mappings to begin with.
+ assertEquals(0, dbMovieMappings.getMovieFilepaths("12345").size());
+
+ // Let's update
+ dbMovieMappings.updateTmdbId("/test/yo.mkv", "1234", "12345");
+
+ // We should have one now
+ assertEquals(1, dbMovieMappings.getMovieFilepaths("12345").size());
+
+ // ... and zero for the old one
+ // We should have one now
+ assertEquals(0, dbMovieMappings.getMovieFilepaths("1234").size());
+ }
+
+ /**
+ * Tests if it's possible to check if a
+ * movie has a filepath mapping.
+ */
+ public void testMovieMappingExists() {
+ DbAdapterMovies db = getAndResetDatabase();
+
+ // We expect zero movies to begin with
+ assertEquals(0, db.count());
+
+ // Create test movie
+ createTwoTestMovies(db);
+
+ // We've just created two movies, so there should be two now
+ assertEquals(2, db.count());
+
+ // Get the DB adapter for movie mappings
+ DbAdapterMovieMappings dbMovieMappings = MizuuApplication.getMovieMappingAdapter();
+
+ // We haven't added a filepath mapping yet, so we don't expect it to exist
+ assertEquals(false, dbMovieMappings.exists("1234"));
+
+ // Add the filepath mapping
+ dbMovieMappings.createFilepathMapping("/test/lulz.mkv", "1234");
+
+ // It should exist now
+ assertEquals(true, dbMovieMappings.exists("1234"));
+ }
+
+ /**
+ * Test if it's possible to determine if a a filepath
+ * has been mapped to a movie by its movie ID.
+ */
+ public void testFilepathExists() {
+ DbAdapterMovies db = getAndResetDatabase();
+
+ // We expect zero movies to begin with
+ assertEquals(0, db.count());
+
+ // Create test movie
+ createTwoTestMovies(db);
+
+ // We've just created two movies, so there should be two now
+ assertEquals(2, db.count());
+
+ // Get the DB adapter for movie mappings
+ DbAdapterMovieMappings dbMovieMappings = MizuuApplication.getMovieMappingAdapter();
+
+ // We haven't added a filepath mapping yet, so we don't expect it to exist
+ assertEquals(false, dbMovieMappings.filepathExists("1234", "/test/lulz.mkv"));
+
+ // Add the filepath mapping
+ dbMovieMappings.createFilepathMapping("/test/lulz.mkv", "1234");
+
+ // It should exist now
+ assertEquals(true, dbMovieMappings.filepathExists("1234", "/test/lulz.mkv"));
+ }
+
+ /**
+ * Test if it's possible to delete all filepaths
+ * mapped to a movie, including
+ */
+ public void testDeleteAllFilepathsMappedToMovie() {
+ DbAdapterMovies db = getAndResetDatabase();
+
+ // We expect zero movies to begin with
+ assertEquals(0, db.count());
+
+ // Create two test movies
+ createTwoTestMovies(db);
+
+ // We've just created two movies, so there should be two now
+ assertEquals(2, db.count());
+
+ // Get the DB adapter for movie mappings
+ DbAdapterMovieMappings dbMovieMappings = MizuuApplication.getMovieMappingAdapter();
+
+ // We haven't added any filepath mappings for the movies yet
+ assertEquals(0, dbMovieMappings.count());
+
+ // Add a filepath mapping
+ dbMovieMappings.createFilepathMapping("/test/lulz.mkv", "1234");
+
+ // Add another filepath mapping
+ dbMovieMappings.createFilepathMapping("/test/lulzz.mkv", "1234");
+
+ // Add a filepath mapping
+ dbMovieMappings.createFilepathMapping("/test/lulz_1.mkv", "12345");
+
+ // Add another filepath mapping
+ dbMovieMappings.createFilepathMapping("/test/lulzz_1.mkv", "12345");
+
+ // We have added a total of four filepath mappings
+ assertEquals(4, dbMovieMappings.count());
+
+ // Delete all filepaths for a movie
+ dbMovieMappings.deleteMovie("1234");
+
+ // Back at 2
+ assertEquals(2, dbMovieMappings.count());
+
+ // Delete all filepaths for the second movie
+ dbMovieMappings.deleteMovie("12345");
+
+ // Back at zero
+ assertEquals(0, dbMovieMappings.count());
+
+ // Let's make sure it works with unidentified ID as well
+ dbMovieMappings.createFilepathMapping("/test/wat.mkv", DbAdapterMovies.UNIDENTIFIED_ID);
+
+ // At one
+ assertEquals(1, dbMovieMappings.count());
+
+ // Delete all unidentified filepaths
+ dbMovieMappings.deleteAllUnidentifiedFilepaths();
+
+ // Back at zero
+ assertEquals(0, dbMovieMappings.count());
+ }
+
+ /**
+ * Tests if it's possible to delete all filepaths, including those
+ * marked with an unidentified ID.
+ */
+ public void testDeleteAllMovieFilepaths() {
+ DbAdapterMovies db = getAndResetDatabase();
+
+ // We expect zero movies to begin with
+ assertEquals(0, db.count());
+
+ // Create two test movies
+ createTwoTestMovies(db);
+
+ // We've just created two movies, so there should be two now
+ assertEquals(2, db.count());
+
+ // Get the DB adapter for movie mappings
+ DbAdapterMovieMappings dbMovieMappings = MizuuApplication.getMovieMappingAdapter();
+
+ // We haven't added any filepath mappings for the movies yet
+ assertEquals(0, dbMovieMappings.count());
+
+ // Add a filepath mapping
+ dbMovieMappings.createFilepathMapping("/test/lulz.mkv", "1234");
+
+ // Add another filepath mapping
+ dbMovieMappings.createFilepathMapping("/test/lulzz.mkv", "1234");
+
+ // Add a filepath mapping
+ dbMovieMappings.createFilepathMapping("/test/lulz_1.mkv", "12345");
+
+ // Add another filepath mapping
+ dbMovieMappings.createFilepathMapping("/test/lulzz_1.mkv", "12345");
+
+ // We have added a total of four filepath mappings
+ assertEquals(4, dbMovieMappings.count());
+
+ // Delete them all
+ dbMovieMappings.deleteAllMovies();
+
+ // Zero, plz!
+ assertEquals(0, dbMovieMappings.count());
+
+ // Let's make sure it works with unidentified ID as well
+ dbMovieMappings.createFilepathMapping("/test/wat.mkv", DbAdapterMovies.UNIDENTIFIED_ID);
+
+ // There should be one now
+ assertEquals(1, dbMovieMappings.count());
+
+ // Delete them all (well, hopefully just one)
+ dbMovieMappings.deleteAllMovies();
+
+ // Again... Zero, plz!
+ assertEquals(0, dbMovieMappings.count());
+ }
+
+ /**
+ * Test if it's possible to get all filepaths
+ * mapped to a movie ID.
+ */
+ public void testMovieFilepathsByMovieId() {
+ DbAdapterMovies db = getAndResetDatabase();
+
+ // We expect zero movies to begin with
+ assertEquals(0, db.count());
+
+ // Create test movie
+ createTestMovie(db);
+
+ // We've just created a movie, so there should be one now
+ assertEquals(1, db.count());
+
+ // Get the DB adapter for movie mappings
+ DbAdapterMovieMappings dbMovieMappings = MizuuApplication.getMovieMappingAdapter();
+
+ // We haven't added any filepath mappings for the movie yet
+ assertEquals(0, dbMovieMappings.getMovieFilepaths("1234").size());
+
+ // Add a filepath mapping
+ dbMovieMappings.createFilepathMapping("/test/lulz.mkv", "1234");
+
+ // Add another filepath mapping
+ dbMovieMappings.createFilepathMapping("/test/lulzz.mkv", "1234");
+
+ // We've added two filepath mappings
+ assertEquals(2, dbMovieMappings.getMovieFilepaths("1234").size());
+
+ // Check the first one...
+ assertEquals("/test/lulz.mkv", dbMovieMappings.getMovieFilepaths("1234").get(0));
+
+ // And the second one...
+ assertEquals("/test/lulzz.mkv", dbMovieMappings.getMovieFilepaths("1234").get(1));
+ }
+
+ /**
+ * Test if it's possible to get a movie ID based on a filepath.
+ */
+ public void testMovieIdByFilepath() {
+ DbAdapterMovies db = getAndResetDatabase();
+
+ // We expect zero movies to begin with
+ assertEquals(0, db.count());
+
+ // Create test movie
+ createTestMovie(db);
+
+ // We've just created a movie, so there should be one now
+ assertEquals(1, db.count());
+
+ // Get the DB adapter for movie mappings
+ DbAdapterMovieMappings dbMovieMappings = MizuuApplication.getMovieMappingAdapter();
+
+ // There shouldn't be any
+ assertEquals("", dbMovieMappings.getIdForFilepath("/test/lulz.mkv"));
+
+ // Add the filepath mapping
+ dbMovieMappings.createFilepathMapping("/test/lulz.mkv", "1234");
+
+ // It should exist now
+ assertEquals("1234", dbMovieMappings.getIdForFilepath("/test/lulz.mkv"));
+ }
+
+ /**
+ * Get a database instance and reset it before the test begins.
+ * @return
+ */
+ private DbAdapterMovies getAndResetDatabase() {
+ // Ensures that we've got an application context, which
+ // is required in order to use the MizuuApplication methods.
+ getInstrumentation().waitForIdleSync();
+
+ mContext = getInstrumentation().getTargetContext().getApplicationContext();
+
+ DbAdapterMovies db = MizuuApplication.getMovieAdapter();
+ resetDatabase(db);
+ return db;
+ }
+
+ /**
+ * Resets the movie database by deleting all movies,
+ * collections and filepath mappings.
+ * @param db
+ */
+ private void resetDatabase(DbAdapterMovies db) {
+ MovieDatabaseUtils.deleteAllMovies(mContext);
+
+ // Test movie count
+ assertEquals(0, db.count());
+
+ // Test collection count
+ DbAdapterCollections dbCollections = MizuuApplication.getCollectionsAdapter();
+ assertEquals(0, dbCollections.count());
+
+ // Test filepath mapping count
+ DbAdapterMovieMappings dbMovieMappings = MizuuApplication.getMovieMappingAdapter();
+ assertEquals(0, dbMovieMappings.count());
+ }
+
+ /**
+ * Creates a test movie in the database.
+ * @param db
+ */
+ private void createTestMovie(DbAdapterMovies db) {
+ // Create test movie
+ db.createMovie("1234", "title", "plot", "tt1234567", "7.9", "tagline", "1970-01-01", "PG-13", "90", "http://youtube.com", "genres", "1", "actors", "collection", "collectionId", "0", "1", "123456789");
+ }
+
+ /**
+ * Creates two test movies in the database.
+ * @param db
+ */
+ private void createTwoTestMovies(DbAdapterMovies db) {
+ // Create test movie
+ db.createMovie("1234", "title", "plot", "tt1234567", "7.9", "tagline", "1970-01-01", "PG-13", "90", "http://youtube.com", "genres", "1", "actors", "collection", "collectionId", "0", "1", "123456789");
+ db.createMovie("12345", "title", "plot", "tt1234567", "7.9", "tagline", "1970-01-01", "PG-17", "90", "http://youtube.com", "genres", "1", "actors", "collection2", "collectionId2", "1", "1", "123456789");
+ }
+}
\ No newline at end of file
diff --git a/app/src/androidTest/java/com/miz/test/DatabaseTvShowTests.java b/app/src/androidTest/java/com/miz/test/DatabaseTvShowTests.java
new file mode 100644
index 00000000..76132057
--- /dev/null
+++ b/app/src/androidTest/java/com/miz/test/DatabaseTvShowTests.java
@@ -0,0 +1,91 @@
+package com.miz.test;/*
+ * Copyright (C) 2014 Michell Bak
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import android.content.Context;
+import android.test.InstrumentationTestCase;
+
+/**
+ * Tests various TV show database queries.
+ * Do not use this on a non-debug build, as
+ * it will remove all data.
+ */
+public class DatabaseTvShowTests extends InstrumentationTestCase {
+
+ private Context mContext;
+
+
+
+ /*
+ TV shows:
+
+- create show
+- show exists
+ - TVDb ID
+ - TMDb ID
+ - Title
+- get show ID by show title
+- get show by show ID
+- get all shows
+- delete show by ID
+- delete all shows
+- get certifications
+- edit show
+
+
+TV show episodes:
+
+- create episode
+- update episode
+- get episode
+- get all episodes by show ID
+- get all episodes
+- delete episode
+- delete all episodes by show ID
+- remove season
+- delete all episodes
+- get episode count by show ID
+- get episode count for season
+- get season count
+- get seasons
+- get episodes in season
+- get latest episode airdate by show ID
+- has unwatched episodes
+- set season watched status
+- set episode watched status
+
+
+TV show episode mapping:
+
+- create filepath mapping
+- filepath exists
+- get first filepath
+- get filepaths for episode
+- get all unidentified filepaths
+- get all filepaths
+- get all info for filepath
+- get all filepaths by show ID
+- get all ignored filepaths
+- delete filepath by filepath
+- ignore filepath
+- delete all filepaths by show ID
+- delete all filepaths
+- delete all unidentified filepaths
+- has multiple filepaths
+- remove season
+- ignore season
+ */
+
+}
\ No newline at end of file
diff --git a/src/com/miz/tests/MovieFilenameTests.java b/app/src/androidTest/java/com/miz/test/MovieFilenameTests.java
similarity index 94%
rename from src/com/miz/tests/MovieFilenameTests.java
rename to app/src/androidTest/java/com/miz/test/MovieFilenameTests.java
index 52b8f8c5..a0bcd627 100644
--- a/src/com/miz/tests/MovieFilenameTests.java
+++ b/app/src/androidTest/java/com/miz/test/MovieFilenameTests.java
@@ -1,4 +1,4 @@
-/*
+package com.miz.test;/*
* Copyright (C) 2014 Michell Bak
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -14,12 +14,10 @@
* limitations under the License.
*/
-package com.miz.tests;
+import android.test.AndroidTestCase;
import com.miz.identification.MovieStructure;
-import android.test.AndroidTestCase;
-
public class MovieFilenameTests extends AndroidTestCase {
public void testCase1() {
@@ -192,4 +190,15 @@ public void testCase16() {
assertEquals(true, ms.hasReleaseYear());
assertEquals(2009, ms.getReleaseYear());
}
+
+ public void testCase17() {
+ MovieStructure ms = new MovieStructure("/G.I. Joe Retaliation (2013).mkv");
+ assertEquals("", ms.getParentFolderName());
+ assertEquals("G.I. Joe Retaliation (2013).mkv", ms.getFilename());
+ assertEquals(false, ms.hasImdbId());
+ assertEquals("", ms.getDecryptedParentFolderName());
+ assertEquals("GI Joe Retaliation", ms.getDecryptedFilename());
+ assertEquals(true, ms.hasReleaseYear());
+ assertEquals(2013, ms.getReleaseYear());
+ }
}
\ No newline at end of file
diff --git a/src/com/miz/tests/TvShowFileNameTests.java b/app/src/androidTest/java/com/miz/test/TvShowFilenameTests.java
similarity index 99%
rename from src/com/miz/tests/TvShowFileNameTests.java
rename to app/src/androidTest/java/com/miz/test/TvShowFilenameTests.java
index aacb5ef0..d9cd337a 100644
--- a/src/com/miz/tests/TvShowFileNameTests.java
+++ b/app/src/androidTest/java/com/miz/test/TvShowFilenameTests.java
@@ -1,4 +1,4 @@
-/*
+package com.miz.test;/*
* Copyright (C) 2014 Michell Bak
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -14,12 +14,10 @@
* limitations under the License.
*/
-package com.miz.tests;
+import android.test.AndroidTestCase;
import com.miz.identification.ShowStructure;
-import android.test.AndroidTestCase;
-
public class TvShowFilenameTests extends AndroidTestCase {
public void testCase1() {
diff --git a/app/src/androidTest/res/crunch/drawable-hdpi/apptheme_btn_check_off_disabled_focused_holo_dark.png b/app/src/androidTest/res/crunch/drawable-hdpi/apptheme_btn_check_off_disabled_focused_holo_dark.png
new file mode 100644
index 00000000..cc187cf6
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-hdpi/apptheme_btn_check_off_disabled_focused_holo_dark.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-hdpi/apptheme_btn_check_off_disabled_holo_dark.png b/app/src/androidTest/res/crunch/drawable-hdpi/apptheme_btn_check_off_disabled_holo_dark.png
new file mode 100644
index 00000000..f097749e
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-hdpi/apptheme_btn_check_off_disabled_holo_dark.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-hdpi/apptheme_btn_check_off_focused_holo_dark.png b/app/src/androidTest/res/crunch/drawable-hdpi/apptheme_btn_check_off_focused_holo_dark.png
new file mode 100644
index 00000000..45fe011a
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-hdpi/apptheme_btn_check_off_focused_holo_dark.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-hdpi/apptheme_btn_check_off_holo_dark.png b/app/src/androidTest/res/crunch/drawable-hdpi/apptheme_btn_check_off_holo_dark.png
new file mode 100644
index 00000000..fbde8370
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-hdpi/apptheme_btn_check_off_holo_dark.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-hdpi/apptheme_btn_check_off_pressed_holo_dark.png b/app/src/androidTest/res/crunch/drawable-hdpi/apptheme_btn_check_off_pressed_holo_dark.png
new file mode 100644
index 00000000..2f6d7b56
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-hdpi/apptheme_btn_check_off_pressed_holo_dark.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-hdpi/apptheme_btn_check_on_disabled_focused_holo_dark.png b/app/src/androidTest/res/crunch/drawable-hdpi/apptheme_btn_check_on_disabled_focused_holo_dark.png
new file mode 100644
index 00000000..33af7b77
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-hdpi/apptheme_btn_check_on_disabled_focused_holo_dark.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-hdpi/apptheme_btn_check_on_disabled_holo_dark.png b/app/src/androidTest/res/crunch/drawable-hdpi/apptheme_btn_check_on_disabled_holo_dark.png
new file mode 100644
index 00000000..aa1e5a08
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-hdpi/apptheme_btn_check_on_disabled_holo_dark.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-hdpi/apptheme_btn_check_on_focused_holo_dark.png b/app/src/androidTest/res/crunch/drawable-hdpi/apptheme_btn_check_on_focused_holo_dark.png
new file mode 100644
index 00000000..44fa7883
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-hdpi/apptheme_btn_check_on_focused_holo_dark.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-hdpi/apptheme_btn_check_on_holo_dark.png b/app/src/androidTest/res/crunch/drawable-hdpi/apptheme_btn_check_on_holo_dark.png
new file mode 100644
index 00000000..bfdcdf64
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-hdpi/apptheme_btn_check_on_holo_dark.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-hdpi/apptheme_btn_check_on_pressed_holo_dark.png b/app/src/androidTest/res/crunch/drawable-hdpi/apptheme_btn_check_on_pressed_holo_dark.png
new file mode 100644
index 00000000..4d403fae
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-hdpi/apptheme_btn_check_on_pressed_holo_dark.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-hdpi/apptheme_btn_radio_off_disabled_focused_holo_dark.png b/app/src/androidTest/res/crunch/drawable-hdpi/apptheme_btn_radio_off_disabled_focused_holo_dark.png
new file mode 100644
index 00000000..8608718c
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-hdpi/apptheme_btn_radio_off_disabled_focused_holo_dark.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-hdpi/apptheme_btn_radio_off_disabled_holo_dark.png b/app/src/androidTest/res/crunch/drawable-hdpi/apptheme_btn_radio_off_disabled_holo_dark.png
new file mode 100644
index 00000000..c2f37c29
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-hdpi/apptheme_btn_radio_off_disabled_holo_dark.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-hdpi/apptheme_btn_radio_off_focused_holo_dark.png b/app/src/androidTest/res/crunch/drawable-hdpi/apptheme_btn_radio_off_focused_holo_dark.png
new file mode 100644
index 00000000..87535ea2
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-hdpi/apptheme_btn_radio_off_focused_holo_dark.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-hdpi/apptheme_btn_radio_off_holo_dark.png b/app/src/androidTest/res/crunch/drawable-hdpi/apptheme_btn_radio_off_holo_dark.png
new file mode 100644
index 00000000..dfbe365b
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-hdpi/apptheme_btn_radio_off_holo_dark.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-hdpi/apptheme_btn_radio_off_pressed_holo_dark.png b/app/src/androidTest/res/crunch/drawable-hdpi/apptheme_btn_radio_off_pressed_holo_dark.png
new file mode 100644
index 00000000..5c97445f
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-hdpi/apptheme_btn_radio_off_pressed_holo_dark.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-hdpi/apptheme_btn_radio_on_disabled_focused_holo_dark.png b/app/src/androidTest/res/crunch/drawable-hdpi/apptheme_btn_radio_on_disabled_focused_holo_dark.png
new file mode 100644
index 00000000..c229c011
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-hdpi/apptheme_btn_radio_on_disabled_focused_holo_dark.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-hdpi/apptheme_btn_radio_on_disabled_holo_dark.png b/app/src/androidTest/res/crunch/drawable-hdpi/apptheme_btn_radio_on_disabled_holo_dark.png
new file mode 100644
index 00000000..2fb254cc
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-hdpi/apptheme_btn_radio_on_disabled_holo_dark.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-hdpi/apptheme_btn_radio_on_focused_holo_dark.png b/app/src/androidTest/res/crunch/drawable-hdpi/apptheme_btn_radio_on_focused_holo_dark.png
new file mode 100644
index 00000000..70aa37a3
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-hdpi/apptheme_btn_radio_on_focused_holo_dark.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-hdpi/apptheme_btn_radio_on_holo_dark.png b/app/src/androidTest/res/crunch/drawable-hdpi/apptheme_btn_radio_on_holo_dark.png
new file mode 100644
index 00000000..6a6e6667
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-hdpi/apptheme_btn_radio_on_holo_dark.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-hdpi/apptheme_btn_radio_on_pressed_holo_dark.png b/app/src/androidTest/res/crunch/drawable-hdpi/apptheme_btn_radio_on_pressed_holo_dark.png
new file mode 100644
index 00000000..b2597e9e
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-hdpi/apptheme_btn_radio_on_pressed_holo_dark.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-hdpi/menuicon.png b/app/src/androidTest/res/crunch/drawable-hdpi/menuicon.png
new file mode 100644
index 00000000..e9389647
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-hdpi/menuicon.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-hdpi/shadow.png b/app/src/androidTest/res/crunch/drawable-hdpi/shadow.png
new file mode 100644
index 00000000..1de091f3
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-hdpi/shadow.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-mdpi/apptheme_btn_check_off_disabled_focused_holo_dark.png b/app/src/androidTest/res/crunch/drawable-mdpi/apptheme_btn_check_off_disabled_focused_holo_dark.png
new file mode 100644
index 00000000..1c9b4bd9
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-mdpi/apptheme_btn_check_off_disabled_focused_holo_dark.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-mdpi/apptheme_btn_check_off_disabled_holo_dark.png b/app/src/androidTest/res/crunch/drawable-mdpi/apptheme_btn_check_off_disabled_holo_dark.png
new file mode 100644
index 00000000..43d6882d
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-mdpi/apptheme_btn_check_off_disabled_holo_dark.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-mdpi/apptheme_btn_check_off_focused_holo_dark.png b/app/src/androidTest/res/crunch/drawable-mdpi/apptheme_btn_check_off_focused_holo_dark.png
new file mode 100644
index 00000000..ca200b9d
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-mdpi/apptheme_btn_check_off_focused_holo_dark.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-mdpi/apptheme_btn_check_off_holo_dark.png b/app/src/androidTest/res/crunch/drawable-mdpi/apptheme_btn_check_off_holo_dark.png
new file mode 100644
index 00000000..23235ed8
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-mdpi/apptheme_btn_check_off_holo_dark.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-mdpi/apptheme_btn_check_off_pressed_holo_dark.png b/app/src/androidTest/res/crunch/drawable-mdpi/apptheme_btn_check_off_pressed_holo_dark.png
new file mode 100644
index 00000000..2dda6334
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-mdpi/apptheme_btn_check_off_pressed_holo_dark.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-mdpi/apptheme_btn_check_on_disabled_focused_holo_dark.png b/app/src/androidTest/res/crunch/drawable-mdpi/apptheme_btn_check_on_disabled_focused_holo_dark.png
new file mode 100644
index 00000000..9e67d7f2
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-mdpi/apptheme_btn_check_on_disabled_focused_holo_dark.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-mdpi/apptheme_btn_check_on_disabled_holo_dark.png b/app/src/androidTest/res/crunch/drawable-mdpi/apptheme_btn_check_on_disabled_holo_dark.png
new file mode 100644
index 00000000..c61c75cd
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-mdpi/apptheme_btn_check_on_disabled_holo_dark.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-mdpi/apptheme_btn_check_on_focused_holo_dark.png b/app/src/androidTest/res/crunch/drawable-mdpi/apptheme_btn_check_on_focused_holo_dark.png
new file mode 100644
index 00000000..90c13f46
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-mdpi/apptheme_btn_check_on_focused_holo_dark.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-mdpi/apptheme_btn_check_on_holo_dark.png b/app/src/androidTest/res/crunch/drawable-mdpi/apptheme_btn_check_on_holo_dark.png
new file mode 100644
index 00000000..bf3e7c7d
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-mdpi/apptheme_btn_check_on_holo_dark.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-mdpi/apptheme_btn_check_on_pressed_holo_dark.png b/app/src/androidTest/res/crunch/drawable-mdpi/apptheme_btn_check_on_pressed_holo_dark.png
new file mode 100644
index 00000000..77901d6a
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-mdpi/apptheme_btn_check_on_pressed_holo_dark.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-mdpi/apptheme_btn_radio_off_disabled_focused_holo_dark.png b/app/src/androidTest/res/crunch/drawable-mdpi/apptheme_btn_radio_off_disabled_focused_holo_dark.png
new file mode 100644
index 00000000..3e2bdfca
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-mdpi/apptheme_btn_radio_off_disabled_focused_holo_dark.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-mdpi/apptheme_btn_radio_off_disabled_holo_dark.png b/app/src/androidTest/res/crunch/drawable-mdpi/apptheme_btn_radio_off_disabled_holo_dark.png
new file mode 100644
index 00000000..c445b12c
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-mdpi/apptheme_btn_radio_off_disabled_holo_dark.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-mdpi/apptheme_btn_radio_off_focused_holo_dark.png b/app/src/androidTest/res/crunch/drawable-mdpi/apptheme_btn_radio_off_focused_holo_dark.png
new file mode 100644
index 00000000..5338502a
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-mdpi/apptheme_btn_radio_off_focused_holo_dark.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-mdpi/apptheme_btn_radio_off_holo_dark.png b/app/src/androidTest/res/crunch/drawable-mdpi/apptheme_btn_radio_off_holo_dark.png
new file mode 100644
index 00000000..e42d6fca
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-mdpi/apptheme_btn_radio_off_holo_dark.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-mdpi/apptheme_btn_radio_off_pressed_holo_dark.png b/app/src/androidTest/res/crunch/drawable-mdpi/apptheme_btn_radio_off_pressed_holo_dark.png
new file mode 100644
index 00000000..c2f90bc8
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-mdpi/apptheme_btn_radio_off_pressed_holo_dark.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-mdpi/apptheme_btn_radio_on_disabled_focused_holo_dark.png b/app/src/androidTest/res/crunch/drawable-mdpi/apptheme_btn_radio_on_disabled_focused_holo_dark.png
new file mode 100644
index 00000000..9f24b6b4
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-mdpi/apptheme_btn_radio_on_disabled_focused_holo_dark.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-mdpi/apptheme_btn_radio_on_disabled_holo_dark.png b/app/src/androidTest/res/crunch/drawable-mdpi/apptheme_btn_radio_on_disabled_holo_dark.png
new file mode 100644
index 00000000..f4cc32bc
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-mdpi/apptheme_btn_radio_on_disabled_holo_dark.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-mdpi/apptheme_btn_radio_on_focused_holo_dark.png b/app/src/androidTest/res/crunch/drawable-mdpi/apptheme_btn_radio_on_focused_holo_dark.png
new file mode 100644
index 00000000..c8bbcf9d
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-mdpi/apptheme_btn_radio_on_focused_holo_dark.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-mdpi/apptheme_btn_radio_on_holo_dark.png b/app/src/androidTest/res/crunch/drawable-mdpi/apptheme_btn_radio_on_holo_dark.png
new file mode 100644
index 00000000..7c3ebbff
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-mdpi/apptheme_btn_radio_on_holo_dark.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-mdpi/apptheme_btn_radio_on_pressed_holo_dark.png b/app/src/androidTest/res/crunch/drawable-mdpi/apptheme_btn_radio_on_pressed_holo_dark.png
new file mode 100644
index 00000000..de919436
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-mdpi/apptheme_btn_radio_on_pressed_holo_dark.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-mdpi/shadow.png b/app/src/androidTest/res/crunch/drawable-mdpi/shadow.png
new file mode 100644
index 00000000..242e6f81
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-mdpi/shadow.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-nodpi/bg_with_border.9.png b/app/src/androidTest/res/crunch/drawable-nodpi/bg_with_border.9.png
new file mode 100644
index 00000000..d6b1e403
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-nodpi/bg_with_border.9.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-nodpi/border.9.png b/app/src/androidTest/res/crunch/drawable-nodpi/border.9.png
new file mode 100644
index 00000000..52023fee
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-nodpi/border.9.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-nodpi/menu_bg.png b/app/src/androidTest/res/crunch/drawable-nodpi/menu_bg.png
new file mode 100644
index 00000000..1aa9c6ab
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-nodpi/menu_bg.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-nodpi/widget_movie_backdrop.png b/app/src/androidTest/res/crunch/drawable-nodpi/widget_movie_backdrop.png
new file mode 100644
index 00000000..3b223d27
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-nodpi/widget_movie_backdrop.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-nodpi/widget_movie_cover.png b/app/src/androidTest/res/crunch/drawable-nodpi/widget_movie_cover.png
new file mode 100644
index 00000000..a007a4e7
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-nodpi/widget_movie_cover.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-nodpi/widget_movie_stack.png b/app/src/androidTest/res/crunch/drawable-nodpi/widget_movie_stack.png
new file mode 100644
index 00000000..7cdbaf56
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-nodpi/widget_movie_stack.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-nodpi/widget_show_backdrop.png b/app/src/androidTest/res/crunch/drawable-nodpi/widget_show_backdrop.png
new file mode 100644
index 00000000..1a4d6166
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-nodpi/widget_show_backdrop.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-nodpi/widget_show_cover.png b/app/src/androidTest/res/crunch/drawable-nodpi/widget_show_cover.png
new file mode 100644
index 00000000..06824f2d
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-nodpi/widget_show_cover.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-nodpi/widget_show_stack.png b/app/src/androidTest/res/crunch/drawable-nodpi/widget_show_stack.png
new file mode 100644
index 00000000..b4ef2927
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-nodpi/widget_show_stack.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xhdpi/accent_bottom_border.9.png b/app/src/androidTest/res/crunch/drawable-xhdpi/accent_bottom_border.9.png
new file mode 100644
index 00000000..ce7b20d8
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xhdpi/accent_bottom_border.9.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xhdpi/accent_bottom_border_grey.9.png b/app/src/androidTest/res/crunch/drawable-xhdpi/accent_bottom_border_grey.9.png
new file mode 100644
index 00000000..61290af1
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xhdpi/accent_bottom_border_grey.9.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xhdpi/add.png b/app/src/androidTest/res/crunch/drawable-xhdpi/add.png
new file mode 100644
index 00000000..ba7f34c1
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xhdpi/add.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xhdpi/apptheme_btn_check_off_disabled_focused_holo_dark.png b/app/src/androidTest/res/crunch/drawable-xhdpi/apptheme_btn_check_off_disabled_focused_holo_dark.png
new file mode 100644
index 00000000..24975f73
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xhdpi/apptheme_btn_check_off_disabled_focused_holo_dark.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xhdpi/apptheme_btn_check_off_disabled_holo_dark.png b/app/src/androidTest/res/crunch/drawable-xhdpi/apptheme_btn_check_off_disabled_holo_dark.png
new file mode 100644
index 00000000..0e539cd5
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xhdpi/apptheme_btn_check_off_disabled_holo_dark.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xhdpi/apptheme_btn_check_off_focused_holo_dark.png b/app/src/androidTest/res/crunch/drawable-xhdpi/apptheme_btn_check_off_focused_holo_dark.png
new file mode 100644
index 00000000..7f7d8f97
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xhdpi/apptheme_btn_check_off_focused_holo_dark.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xhdpi/apptheme_btn_check_off_holo_dark.png b/app/src/androidTest/res/crunch/drawable-xhdpi/apptheme_btn_check_off_holo_dark.png
new file mode 100644
index 00000000..57b32cfd
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xhdpi/apptheme_btn_check_off_holo_dark.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xhdpi/apptheme_btn_check_off_pressed_holo_dark.png b/app/src/androidTest/res/crunch/drawable-xhdpi/apptheme_btn_check_off_pressed_holo_dark.png
new file mode 100644
index 00000000..b8682fd9
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xhdpi/apptheme_btn_check_off_pressed_holo_dark.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xhdpi/apptheme_btn_check_on_disabled_focused_holo_dark.png b/app/src/androidTest/res/crunch/drawable-xhdpi/apptheme_btn_check_on_disabled_focused_holo_dark.png
new file mode 100644
index 00000000..dad8ead0
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xhdpi/apptheme_btn_check_on_disabled_focused_holo_dark.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xhdpi/apptheme_btn_check_on_disabled_holo_dark.png b/app/src/androidTest/res/crunch/drawable-xhdpi/apptheme_btn_check_on_disabled_holo_dark.png
new file mode 100644
index 00000000..c3883b7f
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xhdpi/apptheme_btn_check_on_disabled_holo_dark.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xhdpi/apptheme_btn_check_on_focused_holo_dark.png b/app/src/androidTest/res/crunch/drawable-xhdpi/apptheme_btn_check_on_focused_holo_dark.png
new file mode 100644
index 00000000..9229f138
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xhdpi/apptheme_btn_check_on_focused_holo_dark.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xhdpi/apptheme_btn_check_on_holo_dark.png b/app/src/androidTest/res/crunch/drawable-xhdpi/apptheme_btn_check_on_holo_dark.png
new file mode 100644
index 00000000..f73aa585
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xhdpi/apptheme_btn_check_on_holo_dark.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xhdpi/apptheme_btn_check_on_pressed_holo_dark.png b/app/src/androidTest/res/crunch/drawable-xhdpi/apptheme_btn_check_on_pressed_holo_dark.png
new file mode 100644
index 00000000..411f9f6a
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xhdpi/apptheme_btn_check_on_pressed_holo_dark.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xhdpi/apptheme_btn_radio_off_disabled_focused_holo_dark.png b/app/src/androidTest/res/crunch/drawable-xhdpi/apptheme_btn_radio_off_disabled_focused_holo_dark.png
new file mode 100644
index 00000000..e16f7521
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xhdpi/apptheme_btn_radio_off_disabled_focused_holo_dark.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xhdpi/apptheme_btn_radio_off_disabled_holo_dark.png b/app/src/androidTest/res/crunch/drawable-xhdpi/apptheme_btn_radio_off_disabled_holo_dark.png
new file mode 100644
index 00000000..1ea52c7a
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xhdpi/apptheme_btn_radio_off_disabled_holo_dark.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xhdpi/apptheme_btn_radio_off_focused_holo_dark.png b/app/src/androidTest/res/crunch/drawable-xhdpi/apptheme_btn_radio_off_focused_holo_dark.png
new file mode 100644
index 00000000..1baa983d
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xhdpi/apptheme_btn_radio_off_focused_holo_dark.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xhdpi/apptheme_btn_radio_off_holo_dark.png b/app/src/androidTest/res/crunch/drawable-xhdpi/apptheme_btn_radio_off_holo_dark.png
new file mode 100644
index 00000000..91df103a
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xhdpi/apptheme_btn_radio_off_holo_dark.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xhdpi/apptheme_btn_radio_off_pressed_holo_dark.png b/app/src/androidTest/res/crunch/drawable-xhdpi/apptheme_btn_radio_off_pressed_holo_dark.png
new file mode 100644
index 00000000..877d2505
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xhdpi/apptheme_btn_radio_off_pressed_holo_dark.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xhdpi/apptheme_btn_radio_on_disabled_focused_holo_dark.png b/app/src/androidTest/res/crunch/drawable-xhdpi/apptheme_btn_radio_on_disabled_focused_holo_dark.png
new file mode 100644
index 00000000..d3be4794
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xhdpi/apptheme_btn_radio_on_disabled_focused_holo_dark.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xhdpi/apptheme_btn_radio_on_disabled_holo_dark.png b/app/src/androidTest/res/crunch/drawable-xhdpi/apptheme_btn_radio_on_disabled_holo_dark.png
new file mode 100644
index 00000000..747d7dbe
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xhdpi/apptheme_btn_radio_on_disabled_holo_dark.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xhdpi/apptheme_btn_radio_on_focused_holo_dark.png b/app/src/androidTest/res/crunch/drawable-xhdpi/apptheme_btn_radio_on_focused_holo_dark.png
new file mode 100644
index 00000000..384d0211
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xhdpi/apptheme_btn_radio_on_focused_holo_dark.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xhdpi/apptheme_btn_radio_on_holo_dark.png b/app/src/androidTest/res/crunch/drawable-xhdpi/apptheme_btn_radio_on_holo_dark.png
new file mode 100644
index 00000000..2a377a79
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xhdpi/apptheme_btn_radio_on_holo_dark.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xhdpi/apptheme_btn_radio_on_pressed_holo_dark.png b/app/src/androidTest/res/crunch/drawable-xhdpi/apptheme_btn_radio_on_pressed_holo_dark.png
new file mode 100644
index 00000000..c30be5b0
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xhdpi/apptheme_btn_radio_on_pressed_holo_dark.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xhdpi/backdrops.png b/app/src/androidTest/res/crunch/drawable-xhdpi/backdrops.png
new file mode 100644
index 00000000..6409464e
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xhdpi/backdrops.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xhdpi/buffer_size.png b/app/src/androidTest/res/crunch/drawable-xhdpi/buffer_size.png
new file mode 100644
index 00000000..8032e7a1
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xhdpi/buffer_size.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xhdpi/delete.png b/app/src/androidTest/res/crunch/drawable-xhdpi/delete.png
new file mode 100644
index 00000000..cf952f49
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xhdpi/delete.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xhdpi/director.png b/app/src/androidTest/res/crunch/drawable-xhdpi/director.png
new file mode 100644
index 00000000..bc5f6867
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xhdpi/director.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xhdpi/done.png b/app/src/androidTest/res/crunch/drawable-xhdpi/done.png
new file mode 100644
index 00000000..ed8dad20
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xhdpi/done.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xhdpi/drawer_list_shadow.9.png b/app/src/androidTest/res/crunch/drawable-xhdpi/drawer_list_shadow.9.png
new file mode 100644
index 00000000..0c5e98d3
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xhdpi/drawer_list_shadow.9.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xhdpi/fav.png b/app/src/androidTest/res/crunch/drawable-xhdpi/fav.png
new file mode 100644
index 00000000..d5f02b4b
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xhdpi/fav.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xhdpi/file.png b/app/src/androidTest/res/crunch/drawable-xhdpi/file.png
new file mode 100644
index 00000000..0b1fcaf7
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xhdpi/file.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xhdpi/folder.png b/app/src/androidTest/res/crunch/drawable-xhdpi/folder.png
new file mode 100644
index 00000000..eaf73a1b
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xhdpi/folder.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xhdpi/ic_action_calendar_day.png b/app/src/androidTest/res/crunch/drawable-xhdpi/ic_action_calendar_day.png
new file mode 100644
index 00000000..a3263089
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xhdpi/ic_action_calendar_day.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xhdpi/ic_action_calendar_month.png b/app/src/androidTest/res/crunch/drawable-xhdpi/ic_action_calendar_month.png
new file mode 100644
index 00000000..e7625259
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xhdpi/ic_action_calendar_month.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xhdpi/ic_action_clock.png b/app/src/androidTest/res/crunch/drawable-xhdpi/ic_action_clock.png
new file mode 100644
index 00000000..71d39431
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xhdpi/ic_action_clock.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xhdpi/ic_action_discard.png b/app/src/androidTest/res/crunch/drawable-xhdpi/ic_action_discard.png
new file mode 100644
index 00000000..f6e1b735
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xhdpi/ic_action_discard.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xhdpi/ic_action_download.png b/app/src/androidTest/res/crunch/drawable-xhdpi/ic_action_download.png
new file mode 100644
index 00000000..680869a3
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xhdpi/ic_action_download.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xhdpi/ic_action_edit.png b/app/src/androidTest/res/crunch/drawable-xhdpi/ic_action_edit.png
new file mode 100644
index 00000000..30276d50
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xhdpi/ic_action_edit.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xhdpi/ic_action_expand.png b/app/src/androidTest/res/crunch/drawable-xhdpi/ic_action_expand.png
new file mode 100644
index 00000000..85419815
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xhdpi/ic_action_expand.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xhdpi/ic_action_filter.png b/app/src/androidTest/res/crunch/drawable-xhdpi/ic_action_filter.png
new file mode 100644
index 00000000..dc07a00d
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xhdpi/ic_action_filter.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xhdpi/ic_action_flag.png b/app/src/androidTest/res/crunch/drawable-xhdpi/ic_action_flag.png
new file mode 100644
index 00000000..2ca63ba9
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xhdpi/ic_action_flag.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xhdpi/ic_action_globe.png b/app/src/androidTest/res/crunch/drawable-xhdpi/ic_action_globe.png
new file mode 100644
index 00000000..64e770d9
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xhdpi/ic_action_globe.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xhdpi/ic_action_google_play.png b/app/src/androidTest/res/crunch/drawable-xhdpi/ic_action_google_play.png
new file mode 100644
index 00000000..e7b33b90
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xhdpi/ic_action_google_play.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xhdpi/ic_action_key.png b/app/src/androidTest/res/crunch/drawable-xhdpi/ic_action_key.png
new file mode 100644
index 00000000..f5760865
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xhdpi/ic_action_key.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xhdpi/ic_action_list_2.png b/app/src/androidTest/res/crunch/drawable-xhdpi/ic_action_list_2.png
new file mode 100644
index 00000000..c827ac3c
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xhdpi/ic_action_list_2.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xhdpi/ic_action_list_grid.png b/app/src/androidTest/res/crunch/drawable-xhdpi/ic_action_list_grid.png
new file mode 100644
index 00000000..64de9954
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xhdpi/ic_action_list_grid.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xhdpi/ic_action_lock_closed.png b/app/src/androidTest/res/crunch/drawable-xhdpi/ic_action_lock_closed.png
new file mode 100644
index 00000000..b23f9d30
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xhdpi/ic_action_lock_closed.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xhdpi/ic_action_mail.png b/app/src/androidTest/res/crunch/drawable-xhdpi/ic_action_mail.png
new file mode 100644
index 00000000..f28591e1
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xhdpi/ic_action_mail.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xhdpi/ic_action_movie.png b/app/src/androidTest/res/crunch/drawable-xhdpi/ic_action_movie.png
new file mode 100644
index 00000000..08e370bd
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xhdpi/ic_action_movie.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xhdpi/ic_action_playback_play.png b/app/src/androidTest/res/crunch/drawable-xhdpi/ic_action_playback_play.png
new file mode 100644
index 00000000..438d8d09
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xhdpi/ic_action_playback_play.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xhdpi/ic_action_puzzle.png b/app/src/androidTest/res/crunch/drawable-xhdpi/ic_action_puzzle.png
new file mode 100644
index 00000000..2b4a2411
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xhdpi/ic_action_puzzle.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xhdpi/ic_action_ratings.png b/app/src/androidTest/res/crunch/drawable-xhdpi/ic_action_ratings.png
new file mode 100644
index 00000000..e51c40fb
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xhdpi/ic_action_ratings.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xhdpi/ic_action_send.png b/app/src/androidTest/res/crunch/drawable-xhdpi/ic_action_send.png
new file mode 100644
index 00000000..3f3afec2
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xhdpi/ic_action_send.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xhdpi/ic_action_settings.png b/app/src/androidTest/res/crunch/drawable-xhdpi/ic_action_settings.png
new file mode 100644
index 00000000..d5a9f3ec
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xhdpi/ic_action_settings.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xhdpi/ic_action_show.png b/app/src/androidTest/res/crunch/drawable-xhdpi/ic_action_show.png
new file mode 100644
index 00000000..a24f3047
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xhdpi/ic_action_show.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xhdpi/ic_action_star_0.png b/app/src/androidTest/res/crunch/drawable-xhdpi/ic_action_star_0.png
new file mode 100644
index 00000000..7d677dae
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xhdpi/ic_action_star_0.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xhdpi/ic_action_subtitles.png b/app/src/androidTest/res/crunch/drawable-xhdpi/ic_action_subtitles.png
new file mode 100644
index 00000000..b4cfc4c4
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xhdpi/ic_action_subtitles.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xhdpi/ic_action_tags.png b/app/src/androidTest/res/crunch/drawable-xhdpi/ic_action_tags.png
new file mode 100644
index 00000000..2c96082e
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xhdpi/ic_action_tags.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xhdpi/ic_action_tiles_large.png b/app/src/androidTest/res/crunch/drawable-xhdpi/ic_action_tiles_large.png
new file mode 100644
index 00000000..3f1dde7a
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xhdpi/ic_action_tiles_large.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xhdpi/ic_action_tv.png b/app/src/androidTest/res/crunch/drawable-xhdpi/ic_action_tv.png
new file mode 100644
index 00000000..84c9b382
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xhdpi/ic_action_tv.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xhdpi/ic_action_users.png b/app/src/androidTest/res/crunch/drawable-xhdpi/ic_action_users.png
new file mode 100644
index 00000000..d1d98a48
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xhdpi/ic_action_users.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xhdpi/ic_action_wifi.png b/app/src/androidTest/res/crunch/drawable-xhdpi/ic_action_wifi.png
new file mode 100644
index 00000000..98eb98ee
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xhdpi/ic_action_wifi.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xhdpi/ic_arrow_back.png b/app/src/androidTest/res/crunch/drawable-xhdpi/ic_arrow_back.png
new file mode 100644
index 00000000..8a339d33
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xhdpi/ic_arrow_back.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xhdpi/ic_drawer.png b/app/src/androidTest/res/crunch/drawable-xhdpi/ic_drawer.png
new file mode 100644
index 00000000..f0ce3be3
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xhdpi/ic_drawer.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xhdpi/ignoresmallfiles.png b/app/src/androidTest/res/crunch/drawable-xhdpi/ignoresmallfiles.png
new file mode 100644
index 00000000..32be49db
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xhdpi/ignoresmallfiles.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xhdpi/loading_image.png b/app/src/androidTest/res/crunch/drawable-xhdpi/loading_image.png
new file mode 100644
index 00000000..92e3224c
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xhdpi/loading_image.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xhdpi/localizedinfo.png b/app/src/androidTest/res/crunch/drawable-xhdpi/localizedinfo.png
new file mode 100644
index 00000000..d47447f2
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xhdpi/localizedinfo.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xhdpi/menuicon.png b/app/src/androidTest/res/crunch/drawable-xhdpi/menuicon.png
new file mode 100644
index 00000000..487baec5
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xhdpi/menuicon.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xhdpi/no_content_face.png b/app/src/androidTest/res/crunch/drawable-xhdpi/no_content_face.png
new file mode 100644
index 00000000..166c20c3
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xhdpi/no_content_face.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xhdpi/noactor.png b/app/src/androidTest/res/crunch/drawable-xhdpi/noactor.png
new file mode 100644
index 00000000..433fed02
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xhdpi/noactor.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xhdpi/nobackdrop.png b/app/src/androidTest/res/crunch/drawable-xhdpi/nobackdrop.png
new file mode 100644
index 00000000..0f2c2cb9
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xhdpi/nobackdrop.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xhdpi/other.png b/app/src/androidTest/res/crunch/drawable-xhdpi/other.png
new file mode 100644
index 00000000..2e4ced6c
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xhdpi/other.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xhdpi/photo.png b/app/src/androidTest/res/crunch/drawable-xhdpi/photo.png
new file mode 100644
index 00000000..cfef0b63
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xhdpi/photo.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xhdpi/reddit.png b/app/src/androidTest/res/crunch/drawable-xhdpi/reddit.png
new file mode 100644
index 00000000..f67b4417
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xhdpi/reddit.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xhdpi/refresh.png b/app/src/androidTest/res/crunch/drawable-xhdpi/refresh.png
new file mode 100644
index 00000000..22c5c693
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xhdpi/refresh.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xhdpi/search.png b/app/src/androidTest/res/crunch/drawable-xhdpi/search.png
new file mode 100644
index 00000000..a85390f4
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xhdpi/search.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xhdpi/settings_small.png b/app/src/androidTest/res/crunch/drawable-xhdpi/settings_small.png
new file mode 100644
index 00000000..400cf595
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xhdpi/settings_small.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xhdpi/shadow.png b/app/src/androidTest/res/crunch/drawable-xhdpi/shadow.png
new file mode 100644
index 00000000..56d44479
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xhdpi/shadow.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xhdpi/share.png b/app/src/androidTest/res/crunch/drawable-xhdpi/share.png
new file mode 100644
index 00000000..e3bba05b
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xhdpi/share.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xhdpi/sort.png b/app/src/androidTest/res/crunch/drawable-xhdpi/sort.png
new file mode 100644
index 00000000..6f7c16f8
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xhdpi/sort.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xhdpi/startup.png b/app/src/androidTest/res/crunch/drawable-xhdpi/startup.png
new file mode 100644
index 00000000..cf9cdf21
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xhdpi/startup.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xhdpi/support_small.png b/app/src/androidTest/res/crunch/drawable-xhdpi/support_small.png
new file mode 100644
index 00000000..a0cd7978
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xhdpi/support_small.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xhdpi/tedtalks.png b/app/src/androidTest/res/crunch/drawable-xhdpi/tedtalks.png
new file mode 100644
index 00000000..8b0ad489
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xhdpi/tedtalks.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xhdpi/titles.png b/app/src/androidTest/res/crunch/drawable-xhdpi/titles.png
new file mode 100644
index 00000000..23f0af26
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xhdpi/titles.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xhdpi/unknown_user.png b/app/src/androidTest/res/crunch/drawable-xhdpi/unknown_user.png
new file mode 100644
index 00000000..f829548f
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xhdpi/unknown_user.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xhdpi/user_interface.png b/app/src/androidTest/res/crunch/drawable-xhdpi/user_interface.png
new file mode 100644
index 00000000..be8914a6
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xhdpi/user_interface.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xhdpi/watchlist_add.png b/app/src/androidTest/res/crunch/drawable-xhdpi/watchlist_add.png
new file mode 100644
index 00000000..4da6be5a
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xhdpi/watchlist_add.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xhdpi/watchlist_remove.png b/app/src/androidTest/res/crunch/drawable-xhdpi/watchlist_remove.png
new file mode 100644
index 00000000..f3dd3559
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xhdpi/watchlist_remove.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xhdpi/white_app_icon.png b/app/src/androidTest/res/crunch/drawable-xhdpi/white_app_icon.png
new file mode 100644
index 00000000..7042f7b5
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xhdpi/white_app_icon.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xhdpi/youtube.png b/app/src/androidTest/res/crunch/drawable-xhdpi/youtube.png
new file mode 100644
index 00000000..fee7e83f
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xhdpi/youtube.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xxhdpi/add.png b/app/src/androidTest/res/crunch/drawable-xxhdpi/add.png
new file mode 100644
index 00000000..af06eeef
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xxhdpi/add.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xxhdpi/apptheme_btn_check_off_disabled_focused_holo_dark.png b/app/src/androidTest/res/crunch/drawable-xxhdpi/apptheme_btn_check_off_disabled_focused_holo_dark.png
new file mode 100644
index 00000000..92040bdd
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xxhdpi/apptheme_btn_check_off_disabled_focused_holo_dark.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xxhdpi/apptheme_btn_check_off_disabled_holo_dark.png b/app/src/androidTest/res/crunch/drawable-xxhdpi/apptheme_btn_check_off_disabled_holo_dark.png
new file mode 100644
index 00000000..ea2fbe35
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xxhdpi/apptheme_btn_check_off_disabled_holo_dark.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xxhdpi/apptheme_btn_check_off_focused_holo_dark.png b/app/src/androidTest/res/crunch/drawable-xxhdpi/apptheme_btn_check_off_focused_holo_dark.png
new file mode 100644
index 00000000..27c1df97
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xxhdpi/apptheme_btn_check_off_focused_holo_dark.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xxhdpi/apptheme_btn_check_off_holo_dark.png b/app/src/androidTest/res/crunch/drawable-xxhdpi/apptheme_btn_check_off_holo_dark.png
new file mode 100644
index 00000000..30bdac6e
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xxhdpi/apptheme_btn_check_off_holo_dark.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xxhdpi/apptheme_btn_check_off_pressed_holo_dark.png b/app/src/androidTest/res/crunch/drawable-xxhdpi/apptheme_btn_check_off_pressed_holo_dark.png
new file mode 100644
index 00000000..35c1e44f
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xxhdpi/apptheme_btn_check_off_pressed_holo_dark.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xxhdpi/apptheme_btn_check_on_disabled_focused_holo_dark.png b/app/src/androidTest/res/crunch/drawable-xxhdpi/apptheme_btn_check_on_disabled_focused_holo_dark.png
new file mode 100644
index 00000000..fea6f120
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xxhdpi/apptheme_btn_check_on_disabled_focused_holo_dark.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xxhdpi/apptheme_btn_check_on_disabled_holo_dark.png b/app/src/androidTest/res/crunch/drawable-xxhdpi/apptheme_btn_check_on_disabled_holo_dark.png
new file mode 100644
index 00000000..8d92c7f0
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xxhdpi/apptheme_btn_check_on_disabled_holo_dark.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xxhdpi/apptheme_btn_check_on_focused_holo_dark.png b/app/src/androidTest/res/crunch/drawable-xxhdpi/apptheme_btn_check_on_focused_holo_dark.png
new file mode 100644
index 00000000..a849804e
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xxhdpi/apptheme_btn_check_on_focused_holo_dark.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xxhdpi/apptheme_btn_check_on_holo_dark.png b/app/src/androidTest/res/crunch/drawable-xxhdpi/apptheme_btn_check_on_holo_dark.png
new file mode 100644
index 00000000..0380a11c
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xxhdpi/apptheme_btn_check_on_holo_dark.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xxhdpi/apptheme_btn_check_on_pressed_holo_dark.png b/app/src/androidTest/res/crunch/drawable-xxhdpi/apptheme_btn_check_on_pressed_holo_dark.png
new file mode 100644
index 00000000..ee1202a4
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xxhdpi/apptheme_btn_check_on_pressed_holo_dark.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xxhdpi/apptheme_btn_radio_off_disabled_focused_holo_dark.png b/app/src/androidTest/res/crunch/drawable-xxhdpi/apptheme_btn_radio_off_disabled_focused_holo_dark.png
new file mode 100644
index 00000000..daa81eb9
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xxhdpi/apptheme_btn_radio_off_disabled_focused_holo_dark.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xxhdpi/apptheme_btn_radio_off_disabled_holo_dark.png b/app/src/androidTest/res/crunch/drawable-xxhdpi/apptheme_btn_radio_off_disabled_holo_dark.png
new file mode 100644
index 00000000..1a3f2c3a
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xxhdpi/apptheme_btn_radio_off_disabled_holo_dark.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xxhdpi/apptheme_btn_radio_off_focused_holo_dark.png b/app/src/androidTest/res/crunch/drawable-xxhdpi/apptheme_btn_radio_off_focused_holo_dark.png
new file mode 100644
index 00000000..8d064acd
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xxhdpi/apptheme_btn_radio_off_focused_holo_dark.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xxhdpi/apptheme_btn_radio_off_holo_dark.png b/app/src/androidTest/res/crunch/drawable-xxhdpi/apptheme_btn_radio_off_holo_dark.png
new file mode 100644
index 00000000..67bf683f
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xxhdpi/apptheme_btn_radio_off_holo_dark.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xxhdpi/apptheme_btn_radio_off_pressed_holo_dark.png b/app/src/androidTest/res/crunch/drawable-xxhdpi/apptheme_btn_radio_off_pressed_holo_dark.png
new file mode 100644
index 00000000..0650651c
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xxhdpi/apptheme_btn_radio_off_pressed_holo_dark.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xxhdpi/apptheme_btn_radio_on_disabled_focused_holo_dark.png b/app/src/androidTest/res/crunch/drawable-xxhdpi/apptheme_btn_radio_on_disabled_focused_holo_dark.png
new file mode 100644
index 00000000..b2c220f8
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xxhdpi/apptheme_btn_radio_on_disabled_focused_holo_dark.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xxhdpi/apptheme_btn_radio_on_disabled_holo_dark.png b/app/src/androidTest/res/crunch/drawable-xxhdpi/apptheme_btn_radio_on_disabled_holo_dark.png
new file mode 100644
index 00000000..9c825164
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xxhdpi/apptheme_btn_radio_on_disabled_holo_dark.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xxhdpi/apptheme_btn_radio_on_focused_holo_dark.png b/app/src/androidTest/res/crunch/drawable-xxhdpi/apptheme_btn_radio_on_focused_holo_dark.png
new file mode 100644
index 00000000..d5bba333
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xxhdpi/apptheme_btn_radio_on_focused_holo_dark.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xxhdpi/apptheme_btn_radio_on_holo_dark.png b/app/src/androidTest/res/crunch/drawable-xxhdpi/apptheme_btn_radio_on_holo_dark.png
new file mode 100644
index 00000000..ef2dd21b
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xxhdpi/apptheme_btn_radio_on_holo_dark.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xxhdpi/apptheme_btn_radio_on_pressed_holo_dark.png b/app/src/androidTest/res/crunch/drawable-xxhdpi/apptheme_btn_radio_on_pressed_holo_dark.png
new file mode 100644
index 00000000..7922a9a0
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xxhdpi/apptheme_btn_radio_on_pressed_holo_dark.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xxhdpi/backdrops.png b/app/src/androidTest/res/crunch/drawable-xxhdpi/backdrops.png
new file mode 100644
index 00000000..e442d296
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xxhdpi/backdrops.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xxhdpi/buffer_size.png b/app/src/androidTest/res/crunch/drawable-xxhdpi/buffer_size.png
new file mode 100644
index 00000000..3c32d692
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xxhdpi/buffer_size.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xxhdpi/delete.png b/app/src/androidTest/res/crunch/drawable-xxhdpi/delete.png
new file mode 100644
index 00000000..285e490e
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xxhdpi/delete.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xxhdpi/done.png b/app/src/androidTest/res/crunch/drawable-xxhdpi/done.png
new file mode 100644
index 00000000..8b510688
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xxhdpi/done.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xxhdpi/fav.png b/app/src/androidTest/res/crunch/drawable-xxhdpi/fav.png
new file mode 100644
index 00000000..debc7971
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xxhdpi/fav.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xxhdpi/file.png b/app/src/androidTest/res/crunch/drawable-xxhdpi/file.png
new file mode 100644
index 00000000..7d788393
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xxhdpi/file.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xxhdpi/folder.png b/app/src/androidTest/res/crunch/drawable-xxhdpi/folder.png
new file mode 100644
index 00000000..59e7486a
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xxhdpi/folder.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xxhdpi/ic_action_bargraph.png b/app/src/androidTest/res/crunch/drawable-xxhdpi/ic_action_bargraph.png
new file mode 100644
index 00000000..be8cf845
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xxhdpi/ic_action_bargraph.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xxhdpi/ic_action_calendar_day.png b/app/src/androidTest/res/crunch/drawable-xxhdpi/ic_action_calendar_day.png
new file mode 100644
index 00000000..ad1b4811
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xxhdpi/ic_action_calendar_day.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xxhdpi/ic_action_calendar_month.png b/app/src/androidTest/res/crunch/drawable-xxhdpi/ic_action_calendar_month.png
new file mode 100644
index 00000000..33cabaeb
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xxhdpi/ic_action_calendar_month.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xxhdpi/ic_action_clock.png b/app/src/androidTest/res/crunch/drawable-xxhdpi/ic_action_clock.png
new file mode 100644
index 00000000..a42bfc21
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xxhdpi/ic_action_clock.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xxhdpi/ic_action_discard.png b/app/src/androidTest/res/crunch/drawable-xxhdpi/ic_action_discard.png
new file mode 100644
index 00000000..db550e13
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xxhdpi/ic_action_discard.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xxhdpi/ic_action_download.png b/app/src/androidTest/res/crunch/drawable-xxhdpi/ic_action_download.png
new file mode 100644
index 00000000..27f79122
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xxhdpi/ic_action_download.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xxhdpi/ic_action_edit.png b/app/src/androidTest/res/crunch/drawable-xxhdpi/ic_action_edit.png
new file mode 100644
index 00000000..8b4276d7
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xxhdpi/ic_action_edit.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xxhdpi/ic_action_expand.png b/app/src/androidTest/res/crunch/drawable-xxhdpi/ic_action_expand.png
new file mode 100644
index 00000000..f757f979
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xxhdpi/ic_action_expand.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xxhdpi/ic_action_filter.png b/app/src/androidTest/res/crunch/drawable-xxhdpi/ic_action_filter.png
new file mode 100644
index 00000000..6ea44189
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xxhdpi/ic_action_filter.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xxhdpi/ic_action_flag.png b/app/src/androidTest/res/crunch/drawable-xxhdpi/ic_action_flag.png
new file mode 100644
index 00000000..3a637abc
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xxhdpi/ic_action_flag.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xxhdpi/ic_action_globe.png b/app/src/androidTest/res/crunch/drawable-xxhdpi/ic_action_globe.png
new file mode 100644
index 00000000..629ebfc0
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xxhdpi/ic_action_globe.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xxhdpi/ic_action_google_play.png b/app/src/androidTest/res/crunch/drawable-xxhdpi/ic_action_google_play.png
new file mode 100644
index 00000000..163817dc
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xxhdpi/ic_action_google_play.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xxhdpi/ic_action_key.png b/app/src/androidTest/res/crunch/drawable-xxhdpi/ic_action_key.png
new file mode 100644
index 00000000..b43a015c
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xxhdpi/ic_action_key.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xxhdpi/ic_action_list_2.png b/app/src/androidTest/res/crunch/drawable-xxhdpi/ic_action_list_2.png
new file mode 100644
index 00000000..70cc7663
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xxhdpi/ic_action_list_2.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xxhdpi/ic_action_list_grid.png b/app/src/androidTest/res/crunch/drawable-xxhdpi/ic_action_list_grid.png
new file mode 100644
index 00000000..7b2e3294
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xxhdpi/ic_action_list_grid.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xxhdpi/ic_action_lock_closed.png b/app/src/androidTest/res/crunch/drawable-xxhdpi/ic_action_lock_closed.png
new file mode 100644
index 00000000..030cfb05
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xxhdpi/ic_action_lock_closed.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xxhdpi/ic_action_mail.png b/app/src/androidTest/res/crunch/drawable-xxhdpi/ic_action_mail.png
new file mode 100644
index 00000000..68b7be52
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xxhdpi/ic_action_mail.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xxhdpi/ic_action_movie.png b/app/src/androidTest/res/crunch/drawable-xxhdpi/ic_action_movie.png
new file mode 100644
index 00000000..ee743625
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xxhdpi/ic_action_movie.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xxhdpi/ic_action_playback_play.png b/app/src/androidTest/res/crunch/drawable-xxhdpi/ic_action_playback_play.png
new file mode 100644
index 00000000..7b38e1aa
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xxhdpi/ic_action_playback_play.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xxhdpi/ic_action_puzzle.png b/app/src/androidTest/res/crunch/drawable-xxhdpi/ic_action_puzzle.png
new file mode 100644
index 00000000..82003f4b
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xxhdpi/ic_action_puzzle.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xxhdpi/ic_action_ratings.png b/app/src/androidTest/res/crunch/drawable-xxhdpi/ic_action_ratings.png
new file mode 100644
index 00000000..3987b105
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xxhdpi/ic_action_ratings.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xxhdpi/ic_action_send.png b/app/src/androidTest/res/crunch/drawable-xxhdpi/ic_action_send.png
new file mode 100644
index 00000000..8e0f9164
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xxhdpi/ic_action_send.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xxhdpi/ic_action_settings.png b/app/src/androidTest/res/crunch/drawable-xxhdpi/ic_action_settings.png
new file mode 100644
index 00000000..32e2c28e
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xxhdpi/ic_action_settings.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xxhdpi/ic_action_show.png b/app/src/androidTest/res/crunch/drawable-xxhdpi/ic_action_show.png
new file mode 100644
index 00000000..023b8923
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xxhdpi/ic_action_show.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xxhdpi/ic_action_star_0.png b/app/src/androidTest/res/crunch/drawable-xxhdpi/ic_action_star_0.png
new file mode 100644
index 00000000..f603c1aa
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xxhdpi/ic_action_star_0.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xxhdpi/ic_action_subtitles.png b/app/src/androidTest/res/crunch/drawable-xxhdpi/ic_action_subtitles.png
new file mode 100644
index 00000000..2d17426b
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xxhdpi/ic_action_subtitles.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xxhdpi/ic_action_tags.png b/app/src/androidTest/res/crunch/drawable-xxhdpi/ic_action_tags.png
new file mode 100644
index 00000000..35941e3d
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xxhdpi/ic_action_tags.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xxhdpi/ic_action_tiles_large.png b/app/src/androidTest/res/crunch/drawable-xxhdpi/ic_action_tiles_large.png
new file mode 100644
index 00000000..fadc3a04
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xxhdpi/ic_action_tiles_large.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xxhdpi/ic_action_tv.png b/app/src/androidTest/res/crunch/drawable-xxhdpi/ic_action_tv.png
new file mode 100644
index 00000000..b73be4b4
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xxhdpi/ic_action_tv.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xxhdpi/ic_action_users.png b/app/src/androidTest/res/crunch/drawable-xxhdpi/ic_action_users.png
new file mode 100644
index 00000000..97cc30a5
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xxhdpi/ic_action_users.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xxhdpi/ic_action_wifi.png b/app/src/androidTest/res/crunch/drawable-xxhdpi/ic_action_wifi.png
new file mode 100644
index 00000000..26d38626
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xxhdpi/ic_action_wifi.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xxhdpi/ic_arrow_back.png b/app/src/androidTest/res/crunch/drawable-xxhdpi/ic_arrow_back.png
new file mode 100644
index 00000000..0218bd8c
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xxhdpi/ic_arrow_back.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xxhdpi/ic_search_white_24dp.png b/app/src/androidTest/res/crunch/drawable-xxhdpi/ic_search_white_24dp.png
new file mode 100644
index 00000000..67d33c6f
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xxhdpi/ic_search_white_24dp.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xxhdpi/ignoresmallfiles.png b/app/src/androidTest/res/crunch/drawable-xxhdpi/ignoresmallfiles.png
new file mode 100644
index 00000000..bf0bb6de
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xxhdpi/ignoresmallfiles.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xxhdpi/localizedinfo.png b/app/src/androidTest/res/crunch/drawable-xxhdpi/localizedinfo.png
new file mode 100644
index 00000000..4a0ab25b
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xxhdpi/localizedinfo.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xxhdpi/menuicon.png b/app/src/androidTest/res/crunch/drawable-xxhdpi/menuicon.png
new file mode 100644
index 00000000..25981293
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xxhdpi/menuicon.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xxhdpi/other.png b/app/src/androidTest/res/crunch/drawable-xxhdpi/other.png
new file mode 100644
index 00000000..599e65f2
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xxhdpi/other.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xxhdpi/photo.png b/app/src/androidTest/res/crunch/drawable-xxhdpi/photo.png
new file mode 100644
index 00000000..9f454e04
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xxhdpi/photo.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xxhdpi/reddit.png b/app/src/androidTest/res/crunch/drawable-xxhdpi/reddit.png
new file mode 100644
index 00000000..1f8861a1
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xxhdpi/reddit.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xxhdpi/refresh.png b/app/src/androidTest/res/crunch/drawable-xxhdpi/refresh.png
new file mode 100644
index 00000000..63abd3d2
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xxhdpi/refresh.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xxhdpi/search.png b/app/src/androidTest/res/crunch/drawable-xxhdpi/search.png
new file mode 100644
index 00000000..65566dff
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xxhdpi/search.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xxhdpi/settings_small.png b/app/src/androidTest/res/crunch/drawable-xxhdpi/settings_small.png
new file mode 100644
index 00000000..99b65cc8
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xxhdpi/settings_small.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xxhdpi/shadow.png b/app/src/androidTest/res/crunch/drawable-xxhdpi/shadow.png
new file mode 100644
index 00000000..3bd46063
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xxhdpi/shadow.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xxhdpi/share.png b/app/src/androidTest/res/crunch/drawable-xxhdpi/share.png
new file mode 100644
index 00000000..8c591581
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xxhdpi/share.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xxhdpi/sort.png b/app/src/androidTest/res/crunch/drawable-xxhdpi/sort.png
new file mode 100644
index 00000000..c3d2a530
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xxhdpi/sort.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xxhdpi/startup.png b/app/src/androidTest/res/crunch/drawable-xxhdpi/startup.png
new file mode 100644
index 00000000..e4daa037
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xxhdpi/startup.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xxhdpi/support_small.png b/app/src/androidTest/res/crunch/drawable-xxhdpi/support_small.png
new file mode 100644
index 00000000..9dbe1803
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xxhdpi/support_small.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xxhdpi/tedtalks.png b/app/src/androidTest/res/crunch/drawable-xxhdpi/tedtalks.png
new file mode 100644
index 00000000..50db880b
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xxhdpi/tedtalks.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xxhdpi/titles.png b/app/src/androidTest/res/crunch/drawable-xxhdpi/titles.png
new file mode 100644
index 00000000..46ddbfa0
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xxhdpi/titles.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xxhdpi/unknown_user.png b/app/src/androidTest/res/crunch/drawable-xxhdpi/unknown_user.png
new file mode 100644
index 00000000..948189c8
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xxhdpi/unknown_user.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xxhdpi/user_interface.png b/app/src/androidTest/res/crunch/drawable-xxhdpi/user_interface.png
new file mode 100644
index 00000000..c1b4b280
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xxhdpi/user_interface.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xxhdpi/watchlist_add.png b/app/src/androidTest/res/crunch/drawable-xxhdpi/watchlist_add.png
new file mode 100644
index 00000000..e72f96b5
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xxhdpi/watchlist_add.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xxhdpi/watchlist_remove.png b/app/src/androidTest/res/crunch/drawable-xxhdpi/watchlist_remove.png
new file mode 100644
index 00000000..65e9c0ac
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xxhdpi/watchlist_remove.png differ
diff --git a/app/src/androidTest/res/crunch/drawable-xxhdpi/youtube.png b/app/src/androidTest/res/crunch/drawable-xxhdpi/youtube.png
new file mode 100644
index 00000000..1da743ae
Binary files /dev/null and b/app/src/androidTest/res/crunch/drawable-xxhdpi/youtube.png differ
diff --git a/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
similarity index 96%
rename from AndroidManifest.xml
rename to app/src/main/AndroidManifest.xml
index e828ba29..2dc1f7a1 100644
--- a/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -1,698 +1,723 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/assets/Roboto-Bold.ttf b/app/src/main/assets/Roboto-Bold.ttf
similarity index 100%
rename from assets/Roboto-Bold.ttf
rename to app/src/main/assets/Roboto-Bold.ttf
diff --git a/assets/Roboto-BoldItalic.ttf b/app/src/main/assets/Roboto-BoldItalic.ttf
similarity index 100%
rename from assets/Roboto-BoldItalic.ttf
rename to app/src/main/assets/Roboto-BoldItalic.ttf
diff --git a/assets/Roboto-Light.ttf b/app/src/main/assets/Roboto-Light.ttf
similarity index 100%
rename from assets/Roboto-Light.ttf
rename to app/src/main/assets/Roboto-Light.ttf
diff --git a/assets/Roboto-LightItalic.ttf b/app/src/main/assets/Roboto-LightItalic.ttf
similarity index 100%
rename from assets/Roboto-LightItalic.ttf
rename to app/src/main/assets/Roboto-LightItalic.ttf
diff --git a/assets/Roboto-Medium.ttf b/app/src/main/assets/Roboto-Medium.ttf
similarity index 100%
rename from assets/Roboto-Medium.ttf
rename to app/src/main/assets/Roboto-Medium.ttf
diff --git a/app/src/main/assets/Roboto-MediumItalic.ttf b/app/src/main/assets/Roboto-MediumItalic.ttf
new file mode 100644
index 00000000..b8282055
Binary files /dev/null and b/app/src/main/assets/Roboto-MediumItalic.ttf differ
diff --git a/app/src/main/assets/Roboto-Regular.ttf b/app/src/main/assets/Roboto-Regular.ttf
new file mode 100644
index 00000000..0e58508a
Binary files /dev/null and b/app/src/main/assets/Roboto-Regular.ttf differ
diff --git a/assets/Roboto-Thin.ttf b/app/src/main/assets/Roboto-Thin.ttf
similarity index 100%
rename from assets/Roboto-Thin.ttf
rename to app/src/main/assets/Roboto-Thin.ttf
diff --git a/assets/RobotoCondensed-Light.ttf b/app/src/main/assets/RobotoCondensed-Light.ttf
similarity index 100%
rename from assets/RobotoCondensed-Light.ttf
rename to app/src/main/assets/RobotoCondensed-Light.ttf
diff --git a/assets/RobotoCondensed-LightItalic.ttf b/app/src/main/assets/RobotoCondensed-LightItalic.ttf
similarity index 100%
rename from assets/RobotoCondensed-LightItalic.ttf
rename to app/src/main/assets/RobotoCondensed-LightItalic.ttf
diff --git a/assets/RobotoCondensed-Regular.ttf b/app/src/main/assets/RobotoCondensed-Regular.ttf
similarity index 100%
rename from assets/RobotoCondensed-Regular.ttf
rename to app/src/main/assets/RobotoCondensed-Regular.ttf
diff --git a/app/src/main/java/com/melnykov/fab/FloatingActionButton.java b/app/src/main/java/com/melnykov/fab/FloatingActionButton.java
new file mode 100644
index 00000000..3a451cfd
--- /dev/null
+++ b/app/src/main/java/com/melnykov/fab/FloatingActionButton.java
@@ -0,0 +1,422 @@
+package com.melnykov.fab;
+
+import android.annotation.SuppressLint;
+import android.content.Context;
+import android.content.res.ColorStateList;
+import android.content.res.TypedArray;
+import android.graphics.Outline;
+import android.graphics.drawable.Drawable;
+import android.graphics.drawable.LayerDrawable;
+import android.graphics.drawable.RippleDrawable;
+import android.graphics.drawable.ShapeDrawable;
+import android.graphics.drawable.StateListDrawable;
+import android.graphics.drawable.shapes.OvalShape;
+import android.os.Build;
+import android.support.annotation.ColorRes;
+import android.support.annotation.DimenRes;
+import android.support.annotation.IntDef;
+import android.support.annotation.NonNull;
+import android.support.v7.widget.RecyclerView;
+import android.util.AttributeSet;
+import android.view.View;
+import android.view.ViewGroup;
+import android.view.ViewOutlineProvider;
+import android.view.ViewTreeObserver;
+import android.view.animation.AccelerateDecelerateInterpolator;
+import android.view.animation.Interpolator;
+import android.widget.AbsListView;
+import android.widget.ImageButton;
+import android.widget.RelativeLayout;
+
+import com.miz.functions.MizLib;
+import com.miz.mizuu.R;
+
+/**
+ * Android Google+ like floating action button which reacts on the attached list view scrolling events.
+ *
+ * @author Oleksandr Melnykov
+ */
+public class FloatingActionButton extends ImageButton {
+ private static final int TRANSLATE_DURATION_MILLIS = 200;
+ private FabOnScrollListener mOnScrollListener;
+ private FabRecyclerOnViewScrollListener mRecyclerViewOnScrollListener;
+
+ @IntDef({TYPE_NORMAL, TYPE_MINI})
+ public @interface TYPE {
+ }
+
+ public static final int TYPE_NORMAL = 0;
+ public static final int TYPE_MINI = 1;
+
+ protected AbsListView mListView;
+ protected RecyclerView mRecyclerView;
+
+ private boolean mVisible;
+
+ private int mColorNormal;
+ private int mColorPressed;
+ private int mColorRipple;
+ private boolean mShadow;
+ private int mType;
+
+ private final Interpolator mInterpolator = new AccelerateDecelerateInterpolator();
+
+ public FloatingActionButton(Context context) {
+ this(context, null);
+ }
+
+ public FloatingActionButton(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ init(context, attrs);
+ }
+
+ public FloatingActionButton(Context context, AttributeSet attrs, int defStyle) {
+ super(context, attrs, defStyle);
+ init(context, attrs);
+ }
+
+ @Override
+ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
+ super.onMeasure(widthMeasureSpec, heightMeasureSpec);
+ int size = getDimension(
+ mType == TYPE_NORMAL ? R.dimen.fab_size_normal : R.dimen.fab_size_mini);
+ if (mShadow && !hasLollipopApi()) {
+ int shadowSize = getDimension(R.dimen.fab_shadow_size);
+ size += shadowSize * 2;
+ }
+ setMeasuredDimension(size, size);
+ }
+
+ private void init(Context context, AttributeSet attributeSet) {
+ mVisible = true;
+ mColorNormal = getColor(R.color.fab_default);
+ mColorPressed = getColor(R.color.fab_light);
+ mColorRipple = getColor(android.R.color.white);
+ mType = TYPE_NORMAL;
+ mShadow = true;
+ if (attributeSet != null) {
+ initAttributes(context, attributeSet);
+ }
+ updateBackground();
+ }
+
+ private void initAttributes(Context context, AttributeSet attributeSet) {
+ TypedArray attr = getTypedArray(context, attributeSet, R.styleable.FloatingActionButton);
+ if (attr != null) {
+ try {
+ mColorNormal = attr.getColor(R.styleable.FloatingActionButton_fab_colorNormal,
+ getColor(R.color.fab_default));
+ mColorPressed = attr.getColor(R.styleable.FloatingActionButton_fab_colorPressed,
+ getColor(R.color.fab_light));
+ mColorRipple = attr.getColor(R.styleable.FloatingActionButton_fab_colorRipple,
+ getColor(android.R.color.white));
+ mShadow = attr.getBoolean(R.styleable.FloatingActionButton_fab_shadow, true);
+ mType = attr.getInt(R.styleable.FloatingActionButton_fab_type, TYPE_NORMAL);
+ } finally {
+ attr.recycle();
+ }
+ }
+ }
+
+ private void updateBackground() {
+ StateListDrawable drawable = new StateListDrawable();
+ drawable.addState(new int[]{android.R.attr.state_pressed}, createDrawable(mColorPressed));
+ drawable.addState(new int[]{}, createDrawable(mColorNormal));
+ setBackgroundCompat(drawable);
+ }
+
+ private Drawable createDrawable(int color) {
+ OvalShape ovalShape = new OvalShape();
+ ShapeDrawable shapeDrawable = new ShapeDrawable(ovalShape);
+ shapeDrawable.getPaint().setColor(color);
+
+ if (mShadow && !hasLollipopApi()) {
+ LayerDrawable layerDrawable = new LayerDrawable(
+ new Drawable[]{getResources().getDrawable(R.drawable.shadow),
+ shapeDrawable});
+ int shadowSize = getDimension(
+ mType == TYPE_NORMAL ? R.dimen.fab_shadow_size : R.dimen.fab_mini_shadow_size);
+ layerDrawable.setLayerInset(1, shadowSize, shadowSize, shadowSize, shadowSize);
+ return layerDrawable;
+ } else {
+ return shapeDrawable;
+ }
+ }
+
+ private TypedArray getTypedArray(Context context, AttributeSet attributeSet, int[] attr) {
+ return context.obtainStyledAttributes(attributeSet, attr, 0, 0);
+ }
+
+ private int getColor(@ColorRes int id) {
+ return getResources().getColor(id);
+ }
+
+ private int getDimension(@DimenRes int id) {
+ return getResources().getDimensionPixelSize(id);
+ }
+
+ @SuppressWarnings("deprecation")
+ @SuppressLint("NewApi")
+ private void setBackgroundCompat(Drawable drawable) {
+ if (hasLollipopApi()) {
+ setElevation(mShadow ? getDimension(R.dimen.fab_elevation_lollipop) : 0.0f);
+ RippleDrawable rippleDrawable = new RippleDrawable(new ColorStateList(new int[][]{{}},
+ new int[]{mColorRipple}), drawable, null);
+ setOutlineProvider(new ViewOutlineProvider() {
+ @Override
+ public void getOutline(View view, Outline outline) {
+ int size = getDimension(mType == TYPE_NORMAL ? R.dimen.fab_size_normal : R.dimen.fab_size_mini);
+ outline.setOval(0, 0, size, size);
+ }
+ });
+ setClipToOutline(true);
+ setBackground(rippleDrawable);
+ } else if (hasJellyBeanApi()) {
+ setBackground(drawable);
+ } else {
+ setBackgroundDrawable(drawable);
+ }
+ }
+
+ /**
+ * @deprecated to be removed in next release.
+ * Now {@link com.melnykov.fab.ScrollDirectionDetector} is used to detect scrolling direction.
+ */
+ @Deprecated
+ protected int getListViewScrollY() {
+ View topChild = mListView.getChildAt(0);
+ return topChild == null ? 0 : mListView.getFirstVisiblePosition() * topChild.getHeight() -
+ topChild.getTop();
+ }
+
+ private int getMarginBottom() {
+ int marginBottom = 0;
+ final ViewGroup.LayoutParams layoutParams = getLayoutParams();
+ if (layoutParams instanceof ViewGroup.MarginLayoutParams) {
+ marginBottom = ((ViewGroup.MarginLayoutParams) layoutParams).bottomMargin;
+ }
+ return marginBottom;
+ }
+
+ public void setColorNormal(int color) {
+ if (color != mColorNormal) {
+ mColorNormal = color;
+ updateBackground();
+ }
+ }
+
+ public void setColorNormalResId(@ColorRes int colorResId) {
+ setColorNormal(getColor(colorResId));
+ }
+
+ public int getColorNormal() {
+ return mColorNormal;
+ }
+
+ public void setColorPressed(int color) {
+ if (color != mColorPressed) {
+ mColorPressed = color;
+ updateBackground();
+ }
+ }
+
+ public void setColorPressedResId(@ColorRes int colorResId) {
+ setColorPressed(getColor(colorResId));
+ }
+
+ public int getColorPressed() {
+ return mColorPressed;
+ }
+
+ public void setColorRipple(int color) {
+ if (color != mColorRipple) {
+ mColorRipple = color;
+ updateBackground();
+ }
+ }
+
+ public void setColorRippleResId(@ColorRes int colorResId) {
+ setColorRipple(getColor(colorResId));
+ }
+
+ public int getColorRipple() {
+ return mColorRipple;
+ }
+
+ public void setShadow(boolean shadow) {
+ if (shadow != mShadow) {
+ mShadow = shadow;
+ updateBackground();
+ }
+ }
+
+ public boolean hasShadow() {
+ return mShadow;
+ }
+
+ public void setType(@TYPE int type) {
+ if (type != mType) {
+ mType = type;
+ updateBackground();
+ }
+ }
+
+ @TYPE
+ public int getType() {
+ return mType;
+ }
+
+ protected AbsListView.OnScrollListener getOnScrollListener() {
+ return mOnScrollListener;
+ }
+
+ protected RecyclerView.OnScrollListener getRecyclerViewOnScrollListener() {
+ return mRecyclerViewOnScrollListener;
+ }
+
+ public void show() {
+ show(true);
+ }
+
+ public void hide() {
+ hide(true);
+ }
+
+ public void show(boolean animate) {
+ toggle(true, animate, false);
+ }
+
+ public void hide(boolean animate) {
+ toggle(false, animate, false);
+ }
+
+ private void toggle(final boolean visible, final boolean animate, boolean force) {
+ if (mVisible != visible || force) {
+ mVisible = visible;
+ int height = getHeight();
+ if (height == 0 && !force) {
+ ViewTreeObserver vto = getViewTreeObserver();
+ if (vto.isAlive()) {
+ vto.addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() {
+ @Override
+ public boolean onPreDraw() {
+ ViewTreeObserver currentVto = getViewTreeObserver();
+ if (currentVto.isAlive()) {
+ currentVto.removeOnPreDrawListener(this);
+ }
+ toggle(visible, animate, true);
+ return true;
+ }
+ });
+ return;
+ }
+ }
+ int translationY = visible ? 0 : height + getMarginBottom();
+ if (animate) {
+ animate().setInterpolator(mInterpolator)
+ .setDuration(TRANSLATE_DURATION_MILLIS)
+ .translationY(translationY);
+ } else {
+ setTranslationY(translationY);
+ }
+ }
+ }
+
+ /**
+ * If need to use custom {@link android.widget.AbsListView.OnScrollListener},
+ * pass it to {@link #attachToListView(android.widget.AbsListView, com.melnykov.fab.FloatingActionButton.FabOnScrollListener)}
+ */
+ public void attachToListView(@NonNull AbsListView listView) {
+ attachToListView(listView, new FabOnScrollListener());
+ }
+
+ /**
+ * If need to use custom {@link android.widget.AbsListView.OnScrollListener},
+ * pass it to {@link #attachToListView(android.widget.AbsListView, com.melnykov.fab.FloatingActionButton.FabOnScrollListener)}
+ */
+ public void attachToRecyclerView(@NonNull RecyclerView recyclerView) {
+ attachToRecyclerView(recyclerView, new FabRecyclerOnViewScrollListener());
+ }
+
+ public void attachToListView(@NonNull AbsListView listView, @NonNull FabOnScrollListener onScrollListener) {
+ mListView = listView;
+ mOnScrollListener = onScrollListener;
+ onScrollListener.setFloatingActionButton(this);
+ onScrollListener.setListView(listView);
+ mListView.setOnScrollListener(onScrollListener);
+ }
+
+ public void attachToRecyclerView(@NonNull RecyclerView recyclerView, @NonNull FabRecyclerOnViewScrollListener onScrollListener) {
+ mRecyclerView = recyclerView;
+ mRecyclerViewOnScrollListener = onScrollListener;
+ onScrollListener.setFloatingActionButton(this);
+ onScrollListener.setRecyclerView(recyclerView);
+ mRecyclerView.setOnScrollListener(onScrollListener);
+ }
+
+ private boolean hasLollipopApi() {
+ return Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP;
+ }
+
+ private boolean hasJellyBeanApi() {
+ return Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN;
+ }
+
+ public static class FabOnScrollListener extends ScrollDirectionDetector {
+ private FloatingActionButton mFloatingActionButton;
+
+ public FabOnScrollListener() {
+ setScrollDirectionListener(new ScrollDirectionListener() {
+ @Override
+ public void onScrollDown() {
+ mFloatingActionButton.show();
+ }
+
+ @Override
+ public void onScrollUp() {
+ mFloatingActionButton.hide();
+ }
+ });
+ }
+
+ public void setFloatingActionButton(FloatingActionButton floatingActionButton) {
+ mFloatingActionButton = floatingActionButton;
+ }
+ }
+
+ public static class FabRecyclerOnViewScrollListener extends ScrollDirectionRecyclerViewDetector {
+ private FloatingActionButton mFloatingActionButton;
+
+ public FabRecyclerOnViewScrollListener() {
+ setScrollDirectionListener(new ScrollDirectionListener() {
+ @Override
+ public void onScrollDown() {
+ mFloatingActionButton.show();
+ }
+
+ @Override
+ public void onScrollUp() {
+ mFloatingActionButton.hide();
+ }
+ });
+ }
+
+ public void setFloatingActionButton(FloatingActionButton floatingActionButton) {
+ mFloatingActionButton = floatingActionButton;
+ }
+ }
+
+ @Override
+ public void setLayoutParams(ViewGroup.LayoutParams params) {
+
+ // Make sure that we adjust the shadow margin when dealing with devices
+ // running less than Android 5.0
+ if (!hasLollipopApi()) {
+ RelativeLayout.LayoutParams p = (RelativeLayout.LayoutParams) params;
+ p.setMargins(p.leftMargin, p.topMargin - MizLib.convertDpToPixels(getContext(), 8), p.rightMargin, p.bottomMargin);
+ params = p;
+ }
+
+ super.setLayoutParams(params);
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/melnykov/fab/ScrollDirectionDetector.java b/app/src/main/java/com/melnykov/fab/ScrollDirectionDetector.java
new file mode 100644
index 00000000..28b4584c
--- /dev/null
+++ b/app/src/main/java/com/melnykov/fab/ScrollDirectionDetector.java
@@ -0,0 +1,108 @@
+package com.melnykov.fab;
+
+import android.view.View;
+import android.widget.AbsListView;
+
+import com.miz.mizuu.R;
+
+/**
+ * Detects which direction list view was scrolled.
+ *
+ * Set {@link ScrollDirectionListener} to get callbacks
+ * {@link ScrollDirectionListener#onScrollDown()} or
+ * {@link ScrollDirectionListener#onScrollUp()}
+ *
+ * @author Vilius Kraujutis
+ */
+public abstract class ScrollDirectionDetector implements AbsListView.OnScrollListener {
+ private ScrollDirectionListener mScrollDirectionListener;
+ private int mPreviousScrollY;
+ private int mPreviousFirstVisibleItem;
+ public int mLastChangeY;
+ private AbsListView mListView;
+ private int mMinSignificantScroll;
+
+ @Override
+ public void onScrollStateChanged(AbsListView view, int scrollState) {
+ mMinSignificantScroll = view.getContext().getResources().getDimensionPixelOffset(R.dimen.fab_min_significant_scroll);
+ }
+
+ @Override
+ public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
+ int newScrollY = estimateScrollY();
+ if (mScrollDirectionListener != null && isSameRow(firstVisibleItem) && isSignificantDelta(newScrollY)) {
+ if (isScrollUp(newScrollY)) {
+ mScrollDirectionListener.onScrollUp();
+ } else {
+ mScrollDirectionListener.onScrollDown();
+ }
+ }
+ }
+
+ public ScrollDirectionListener getScrollDirectionListener() {
+ return mScrollDirectionListener;
+ }
+
+ public void setScrollDirectionListener(ScrollDirectionListener mScrollDirectionListener) {
+ this.mScrollDirectionListener = mScrollDirectionListener;
+ }
+
+ /**
+ * @return true if scrolled up or false otherwise
+ * @see #isSignificantDelta(int) which ensures, that events are not fired it there was no scrolling
+ */
+ private boolean isScrollUp(int newScrollY) {
+ boolean scrollUp = newScrollY > mPreviousScrollY;
+ mPreviousScrollY = newScrollY;
+ return scrollUp;
+ }
+
+ /**
+ * Make sure wrong direction method is not called when stopping scrolling
+ * and finger moved a little to opposite direction.
+ *
+ * @see #isScrollUp(int)
+ */
+ private boolean isSignificantDelta(int newScrollY) {
+ boolean isSignificantDelta = Math.abs(mLastChangeY - newScrollY) > mMinSignificantScroll;
+ if (isSignificantDelta)
+ mLastChangeY = newScrollY;
+ return isSignificantDelta;
+ }
+
+ /**
+ * newScrollY position might not be correct if:
+ *
+ *
firstVisibleItem is different than mPreviousFirstVisibleItem
+ *
list has rows of different height
+ *
+ *
+ * It's necessary to track if row did not change, so events
+ * {@link ScrollDirectionListener#onScrollUp()} or {@link ScrollDirectionListener#onScrollDown()} could be fired with confidence
+ *
+ * @see #estimateScrollY()
+ */
+ private boolean isSameRow(int firstVisibleItem) {
+ boolean rowsChanged = firstVisibleItem == mPreviousFirstVisibleItem;
+ mPreviousFirstVisibleItem = firstVisibleItem;
+ return rowsChanged;
+ }
+
+ /**
+ * Will be incorrect if rows has changed and if list has rows of different heights
+ *
+ * So when measuring scroll direction, it's necessary to ignore this value
+ * if first visible row is different than previously calculated.
+ *
+ * @deprecated because it should be used with caution
+ */
+ private int estimateScrollY() {
+ if (mListView == null || mListView.getChildAt(0) == null) return 0;
+ View topChild = mListView.getChildAt(0);
+ return mListView.getFirstVisiblePosition() * topChild.getHeight() - topChild.getTop();
+ }
+
+ public void setListView(AbsListView listView) {
+ mListView = listView;
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/melnykov/fab/ScrollDirectionListener.java b/app/src/main/java/com/melnykov/fab/ScrollDirectionListener.java
new file mode 100644
index 00000000..6491310a
--- /dev/null
+++ b/app/src/main/java/com/melnykov/fab/ScrollDirectionListener.java
@@ -0,0 +1,12 @@
+package com.melnykov.fab;
+
+/**
+ * Callbacks when list was scrolled up or down.
+ *
+ * @author Vilius Kraujutis
+ */
+public interface ScrollDirectionListener {
+ void onScrollDown();
+
+ void onScrollUp();
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/melnykov/fab/ScrollDirectionRecyclerViewDetector.java b/app/src/main/java/com/melnykov/fab/ScrollDirectionRecyclerViewDetector.java
new file mode 100644
index 00000000..f2baf413
--- /dev/null
+++ b/app/src/main/java/com/melnykov/fab/ScrollDirectionRecyclerViewDetector.java
@@ -0,0 +1,122 @@
+package com.melnykov.fab;
+
+import android.support.v7.widget.LinearLayoutManager;
+import android.support.v7.widget.RecyclerView;
+import android.view.View;
+
+import com.miz.mizuu.R;
+
+/**
+ * Detects which direction list view was scrolled.
+ *
+ * Set {@link ScrollDirectionListener} to get callbacks
+ * {@link ScrollDirectionListener#onScrollDown()} or
+ * {@link ScrollDirectionListener#onScrollUp()}
+ *
+ * @author Aidan Follestad
+ */
+public abstract class ScrollDirectionRecyclerViewDetector extends RecyclerView.OnScrollListener {
+ private ScrollDirectionListener mScrollDirectionListener;
+ private int mPreviousScrollY;
+ private int mPreviousFirstVisibleItem;
+ public int mLastChangeY;
+ private RecyclerView mRecyclerView;
+ private int mMinSignificantScroll;
+
+ @Override
+ public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
+ super.onScrollStateChanged(recyclerView, newState);
+ mMinSignificantScroll = recyclerView.getContext().getResources().getDimensionPixelOffset(R.dimen.fab_min_significant_scroll);
+ }
+
+ @Override
+ public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
+ super.onScrolled(recyclerView, dx, dy);
+ int newScrollY = estimateScrollY();
+ if (mScrollDirectionListener != null && isSameRow(getFirstVisibleItem()) && isSignificantDelta(newScrollY)) {
+ if (isScrollUp(newScrollY)) {
+ mScrollDirectionListener.onScrollUp();
+ } else {
+ mScrollDirectionListener.onScrollDown();
+ }
+ }
+ }
+
+ public ScrollDirectionListener getScrollDirectionListener() {
+ return mScrollDirectionListener;
+ }
+
+ public void setScrollDirectionListener(ScrollDirectionListener mScrollDirectionListener) {
+ this.mScrollDirectionListener = mScrollDirectionListener;
+ }
+
+ /**
+ * @return true if scrolled up or false otherwise
+ * @see #isSignificantDelta(int) which ensures, that events are not fired it there was no scrolling
+ */
+ private boolean isScrollUp(int newScrollY) {
+ boolean scrollUp = newScrollY > mPreviousScrollY;
+ mPreviousScrollY = newScrollY;
+ return scrollUp;
+ }
+
+ /**
+ * Make sure wrong direction method is not called when stopping scrolling
+ * and finger moved a little to opposite direction.
+ *
+ * @see #isScrollUp(int)
+ */
+ private boolean isSignificantDelta(int newScrollY) {
+ boolean isSignificantDelta = Math.abs(mLastChangeY - newScrollY) > mMinSignificantScroll;
+ if (isSignificantDelta)
+ mLastChangeY = newScrollY;
+ return isSignificantDelta;
+ }
+
+ /**
+ * newScrollY position might not be correct if:
+ *
+ *
firstVisibleItem is different than mPreviousFirstVisibleItem
+ *
list has rows of different height
+ *
+ *
+ * It's necessary to track if row did not change, so events
+ * {@link com.melnykov.fab.ScrollDirectionListener#onScrollUp()} or {@link com.melnykov.fab.ScrollDirectionListener#onScrollDown()} could be fired with confidence
+ *
+ * @see #estimateScrollY()
+ */
+ private boolean isSameRow(int firstVisibleItem) {
+ boolean rowsChanged = firstVisibleItem == mPreviousFirstVisibleItem;
+ mPreviousFirstVisibleItem = firstVisibleItem;
+ return rowsChanged;
+ }
+
+ /**
+ * Will be incorrect if rows has changed and if list has rows of different heights
+ *
+ * So when measuring scroll direction, it's necessary to ignore this value
+ * if first visible row is different than previously calculated.
+ *
+ * @deprecated because it should be used with caution
+ */
+ private int estimateScrollY() {
+ if (mRecyclerView == null || mRecyclerView.getChildAt(0) == null) return 0;
+ View topChild = mRecyclerView.getChildAt(0);
+ return getFirstVisibleItem() * topChild.getHeight() - topChild.getTop();
+ }
+
+ private int getFirstVisibleItem() {
+ RecyclerView.LayoutManager mLayoutManager = mRecyclerView.getLayoutManager();
+ if (mLayoutManager == null)
+ throw new IllegalStateException("Your RecyclerView does not have a LayoutManager.");
+ if (mLayoutManager instanceof LinearLayoutManager) {
+ return ((LinearLayoutManager) mLayoutManager).findFirstVisibleItemPosition();
+ } else {
+ throw new RuntimeException("Currently only LinearLayoutManager is supported for the RecyclerView.");
+ }
+ }
+
+ public void setRecyclerView(RecyclerView recyclerView) {
+ mRecyclerView = recyclerView;
+ }
+}
\ No newline at end of file
diff --git a/src/com/miz/abstractclasses/AbstractFileSource.java b/app/src/main/java/com/miz/abstractclasses/AbstractFileSource.java
similarity index 92%
rename from src/com/miz/abstractclasses/AbstractFileSource.java
rename to app/src/main/java/com/miz/abstractclasses/AbstractFileSource.java
index a4ae8e7b..81b73265 100644
--- a/src/com/miz/abstractclasses/AbstractFileSource.java
+++ b/app/src/main/java/com/miz/abstractclasses/AbstractFileSource.java
@@ -16,21 +16,21 @@
package com.miz.abstractclasses;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.TreeSet;
-
import android.content.Context;
import com.miz.functions.FileSource;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.TreeSet;
+
public abstract class AbstractFileSource {
protected List mFiles = new ArrayList();
protected T mFolder;
protected FileSource mFileSource = null;
protected Context mContext;
- protected boolean mIgnoreRemovedFiles, mSubFolderSearch, mClearLibrary;
+ protected boolean mSubFolderSearch, mClearLibrary;
protected int mFileSizeLimit;
public void setFolder(T folder) {
@@ -53,10 +53,6 @@ public Context getContext() {
return mContext;
}
- public boolean ignoreRemovedFiles() {
- return mIgnoreRemovedFiles;
- }
-
public boolean searchSubFolders() {
return mSubFolderSearch;
}
diff --git a/src/com/miz/abstractclasses/AbstractFileSourceBrowser.java b/app/src/main/java/com/miz/abstractclasses/AbstractFileSourceBrowser.java
similarity index 100%
rename from src/com/miz/abstractclasses/AbstractFileSourceBrowser.java
rename to app/src/main/java/com/miz/abstractclasses/AbstractFileSourceBrowser.java
index 1df483e3..816a85e6 100644
--- a/src/com/miz/abstractclasses/AbstractFileSourceBrowser.java
+++ b/app/src/main/java/com/miz/abstractclasses/AbstractFileSourceBrowser.java
@@ -16,11 +16,11 @@
package com.miz.abstractclasses;
+import com.miz.functions.BrowserFileObject;
+
import java.util.ArrayList;
import java.util.List;
-import com.miz.functions.BrowserFileObject;
-
public abstract class AbstractFileSourceBrowser {
private T mCurrentFolder, mParentFolder;
diff --git a/src/com/miz/abstractclasses/ApiService.java b/app/src/main/java/com/miz/abstractclasses/ApiService.java
similarity index 100%
rename from src/com/miz/abstractclasses/ApiService.java
rename to app/src/main/java/com/miz/abstractclasses/ApiService.java
index dbb82292..f97a4a06 100644
--- a/src/com/miz/abstractclasses/ApiService.java
+++ b/app/src/main/java/com/miz/abstractclasses/ApiService.java
@@ -16,10 +16,10 @@
package com.miz.abstractclasses;
-import java.util.List;
-
import com.miz.functions.Actor;
+import java.util.List;
+
public abstract class ApiService {
/**
diff --git a/src/com/miz/abstractclasses/BaseMovie.java b/app/src/main/java/com/miz/abstractclasses/BaseMovie.java
similarity index 100%
rename from src/com/miz/abstractclasses/BaseMovie.java
rename to app/src/main/java/com/miz/abstractclasses/BaseMovie.java
index 819b387c..48acbfde 100644
--- a/src/com/miz/abstractclasses/BaseMovie.java
+++ b/app/src/main/java/com/miz/abstractclasses/BaseMovie.java
@@ -19,17 +19,17 @@
import android.content.Context;
import android.text.TextUtils;
-import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Locale;
-
import com.miz.functions.Filepath;
import com.miz.functions.MizLib;
import com.miz.mizuu.MizuuApplication;
import com.miz.utils.FileUtils;
import com.miz.utils.StringUtils;
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Locale;
+
public abstract class BaseMovie implements Comparable {
protected ArrayList mFilepaths = new ArrayList();
diff --git a/src/com/miz/abstractclasses/MediumBaseMovie.java b/app/src/main/java/com/miz/abstractclasses/MediumBaseMovie.java
similarity index 100%
rename from src/com/miz/abstractclasses/MediumBaseMovie.java
rename to app/src/main/java/com/miz/abstractclasses/MediumBaseMovie.java
index a7684a89..a421200c 100644
--- a/src/com/miz/abstractclasses/MediumBaseMovie.java
+++ b/app/src/main/java/com/miz/abstractclasses/MediumBaseMovie.java
@@ -16,8 +16,6 @@
package com.miz.abstractclasses;
-import java.io.File;
-
import android.content.Context;
import android.text.TextUtils;
@@ -27,6 +25,8 @@
import com.miz.mizuu.R;
import com.miz.utils.FileUtils;
+import java.io.File;
+
public abstract class MediumBaseMovie extends BaseMovie {
diff --git a/src/com/miz/abstractclasses/MovieApiService.java b/app/src/main/java/com/miz/abstractclasses/MovieApiService.java
similarity index 100%
rename from src/com/miz/abstractclasses/MovieApiService.java
rename to app/src/main/java/com/miz/abstractclasses/MovieApiService.java
index 6d6c89f0..a4993284 100644
--- a/src/com/miz/abstractclasses/MovieApiService.java
+++ b/app/src/main/java/com/miz/abstractclasses/MovieApiService.java
@@ -16,13 +16,13 @@
package com.miz.abstractclasses;
-import java.util.List;
-
import android.text.TextUtils;
import com.miz.apis.tmdb.Movie;
import com.miz.functions.WebMovie;
+import java.util.List;
+
public abstract class MovieApiService extends ApiService {
/**
diff --git a/src/com/miz/abstractclasses/MovieFileSource.java b/app/src/main/java/com/miz/abstractclasses/MovieFileSource.java
similarity index 94%
rename from src/com/miz/abstractclasses/MovieFileSource.java
rename to app/src/main/java/com/miz/abstractclasses/MovieFileSource.java
index cfa0f098..6a647702 100644
--- a/src/com/miz/abstractclasses/MovieFileSource.java
+++ b/app/src/main/java/com/miz/abstractclasses/MovieFileSource.java
@@ -16,31 +16,30 @@
package com.miz.abstractclasses;
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-
import android.content.Context;
import android.database.Cursor;
-import com.miz.db.DbAdapterMovies;
import com.miz.db.DbAdapterMovieMappings;
+import com.miz.db.DbAdapterMovies;
import com.miz.functions.ColumnIndexCache;
import com.miz.functions.DbMovie;
import com.miz.functions.FileSource;
import com.miz.functions.MizLib;
import com.miz.mizuu.MizuuApplication;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
public abstract class MovieFileSource extends AbstractFileSource {
protected HashMap mNfoFiles = new HashMap();
protected List mDbMovies = new ArrayList();
- public MovieFileSource(Context context, FileSource fileSource, boolean ignoreRemovedFiles, boolean subFolderSearch, boolean clearLibrary, boolean disableEthernetWiFiCheck) {
+ public MovieFileSource(Context context, FileSource fileSource, boolean subFolderSearch, boolean clearLibrary, boolean disableEthernetWiFiCheck) {
mContext = context;
mFileSource = fileSource;
- mIgnoreRemovedFiles = ignoreRemovedFiles;
mSubFolderSearch = subFolderSearch;
mClearLibrary = clearLibrary;
@@ -56,7 +55,7 @@ private void setupDbMovies() {
DbAdapterMovies db = MizuuApplication.getMovieAdapter();
ColumnIndexCache cache = new ColumnIndexCache();
- Cursor tempCursor = db.fetchAllMovies(DbAdapterMovies.KEY_TITLE + " ASC", ignoreRemovedFiles());
+ Cursor tempCursor = db.fetchAllMovies(DbAdapterMovies.KEY_TITLE + " ASC");
try {
while (tempCursor.moveToNext()) {
mDbMovies.add(new DbMovie(getContext(),
diff --git a/src/com/miz/abstractclasses/TvShowApiService.java b/app/src/main/java/com/miz/abstractclasses/TvShowApiService.java
similarity index 100%
rename from src/com/miz/abstractclasses/TvShowApiService.java
rename to app/src/main/java/com/miz/abstractclasses/TvShowApiService.java
index 64bfb137..ee4ba1e3 100644
--- a/src/com/miz/abstractclasses/TvShowApiService.java
+++ b/app/src/main/java/com/miz/abstractclasses/TvShowApiService.java
@@ -16,12 +16,12 @@
package com.miz.abstractclasses;
-import java.util.List;
-
import android.text.TextUtils;
import com.miz.apis.thetvdb.TvShow;
+import java.util.List;
+
public abstract class TvShowApiService extends ApiService {
/**
diff --git a/src/com/miz/abstractclasses/TvShowFileSource.java b/app/src/main/java/com/miz/abstractclasses/TvShowFileSource.java
similarity index 91%
rename from src/com/miz/abstractclasses/TvShowFileSource.java
rename to app/src/main/java/com/miz/abstractclasses/TvShowFileSource.java
index 0079a90c..b83f6265 100644
--- a/src/com/miz/abstractclasses/TvShowFileSource.java
+++ b/app/src/main/java/com/miz/abstractclasses/TvShowFileSource.java
@@ -16,9 +16,6 @@
package com.miz.abstractclasses;
-import java.util.ArrayList;
-import java.util.List;
-
import android.content.Context;
import android.database.Cursor;
@@ -29,14 +26,16 @@
import com.miz.functions.MizLib;
import com.miz.mizuu.MizuuApplication;
+import java.util.ArrayList;
+import java.util.List;
+
public abstract class TvShowFileSource extends AbstractFileSource {
protected List mDbEpisode = new ArrayList();
- public TvShowFileSource(Context context, FileSource fileSource, boolean ignoreRemovedFiles, boolean subFolderSearch, boolean clearLibrary, boolean disableEthernetWiFiCheck) {
+ public TvShowFileSource(Context context, FileSource fileSource, boolean subFolderSearch, boolean clearLibrary, boolean disableEthernetWiFiCheck) {
mContext = context;
mFileSource = fileSource;
- mIgnoreRemovedFiles = ignoreRemovedFiles;
mSubFolderSearch = subFolderSearch;
mClearLibrary = clearLibrary;
@@ -51,7 +50,7 @@ private void setupDbEpisodes() {
DbAdapterTvShowEpisodes db = MizuuApplication.getTvEpisodeDbAdapter();
ColumnIndexCache cache = new ColumnIndexCache();
- Cursor tempCursor = db.getAllEpisodesInDatabase(ignoreRemovedFiles());
+ Cursor tempCursor = db.getAllEpisodesInDatabase(false);
try {
while (tempCursor.moveToNext()) {
mDbEpisode.add(new DbEpisode(getContext(),
diff --git a/src/com/miz/apis/thetvdb/Episode.java b/app/src/main/java/com/miz/apis/thetvdb/Episode.java
similarity index 100%
rename from src/com/miz/apis/thetvdb/Episode.java
rename to app/src/main/java/com/miz/apis/thetvdb/Episode.java
diff --git a/src/com/miz/apis/thetvdb/Season.java b/app/src/main/java/com/miz/apis/thetvdb/Season.java
similarity index 100%
rename from src/com/miz/apis/thetvdb/Season.java
rename to app/src/main/java/com/miz/apis/thetvdb/Season.java
diff --git a/src/com/miz/apis/thetvdb/TheTVDbService.java b/app/src/main/java/com/miz/apis/thetvdb/TheTVDbService.java
similarity index 85%
rename from src/com/miz/apis/thetvdb/TheTVDbService.java
rename to app/src/main/java/com/miz/apis/thetvdb/TheTVDbService.java
index ebca1ded..fe766d6f 100644
--- a/src/com/miz/apis/thetvdb/TheTVDbService.java
+++ b/app/src/main/java/com/miz/apis/thetvdb/TheTVDbService.java
@@ -16,24 +16,6 @@
package com.miz.apis.thetvdb;
-import static com.miz.functions.PreferenceKeys.TVSHOWS_RATINGS_SOURCE;
-
-import java.io.UnsupportedEncodingException;
-import java.net.URL;
-import java.net.URLConnection;
-import java.net.URLEncoder;
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-
-import org.json.JSONObject;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
import android.content.Context;
import android.preference.PreferenceManager;
import android.text.TextUtils;
@@ -46,11 +28,30 @@
import com.miz.functions.MizLib;
import com.miz.mizuu.R;
+import org.json.JSONObject;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+import java.io.UnsupportedEncodingException;
+import java.net.URL;
+import java.net.URLConnection;
+import java.net.URLEncoder;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+
+import static com.miz.functions.PreferenceKeys.DVD_ORDERING;
+import static com.miz.functions.PreferenceKeys.TVSHOWS_RATINGS_SOURCE;
+
public class TheTVDbService extends TvShowApiService {
private static TheTVDbService mService;
-
- private final String mRatingsProvider, mTvdbApiKey;
+
+ private final String mTvdbApiKey;
private final Context mContext;
public static TheTVDbService getInstance(Context context) {
@@ -61,10 +62,25 @@ public static TheTVDbService getInstance(Context context) {
private TheTVDbService(Context context) {
mContext = context;
- mRatingsProvider = PreferenceManager.getDefaultSharedPreferences(mContext).getString(TVSHOWS_RATINGS_SOURCE, mContext.getString(R.string.ratings_option_4));
mTvdbApiKey = MizLib.getTvdbApiKey(mContext);
}
+ /**
+ * Get the ratings provider. This isn't a static value, so it should be reloaded when needed.
+ * @return
+ */
+ private String getRatingsProvider() {
+ return PreferenceManager.getDefaultSharedPreferences(mContext).getString(TVSHOWS_RATINGS_SOURCE, mContext.getString(R.string.ratings_option_4));
+ }
+
+ /**
+ * Get the ratings provider. This isn't a static value, so it should be reloaded when needed.
+ * @return
+ */
+ private boolean useDvdOrder() {
+ return PreferenceManager.getDefaultSharedPreferences(mContext).getBoolean(DVD_ORDERING, false);
+ }
+
@Override
public List search(String query, String language) {
language = getLanguage(language);
@@ -210,7 +226,7 @@ public TvShow get(String id, String language) {
}
// Trakt.tv
- if (mRatingsProvider.equals(mContext.getString(R.string.ratings_option_2))) {
+ if (getRatingsProvider().equals(mContext.getString(R.string.ratings_option_2))) {
try {
Show showSummary = Trakt.getShowSummary(mContext, id);
double rating = Double.valueOf(showSummary.getRating() / 10);
@@ -221,7 +237,7 @@ public TvShow get(String id, String language) {
}
// OMDb API / IMDb
- if (mRatingsProvider.equals(mContext.getString(R.string.ratings_option_3))) {
+ if (getRatingsProvider().equals(mContext.getString(R.string.ratings_option_3))) {
try {
JSONObject jObject = MizLib.getJSONObject(mContext, "http://www.omdbapi.com/?i=" + show.getImdbId());
double rating = Double.valueOf(MizLib.getStringFromJSONObject(jObject, "imdbRating", "0"));
@@ -256,23 +272,48 @@ public TvShow get(String id, String language) {
Episode episode = new Episode();
- try {
- list = firstElement.getElementsByTagName("EpisodeNumber");
- element = (Element) list.item(0);
- tag = element.getChildNodes();
- episode.setEpisode(MizLib.getInteger(((Node) tag.item(0)).getNodeValue()));
- } catch(Exception e) {
- episode.setEpisode(0);
- }
-
- try {
- list = firstElement.getElementsByTagName("SeasonNumber");
- element = (Element) list.item(0);
- tag = element.getChildNodes();
- episode.setSeason(MizLib.getInteger(((Node) tag.item(0)).getNodeValue()));
- } catch(Exception e) {
- episode.setSeason(0);
- }
+ if (useDvdOrder()) {
+ try {
+ list = firstElement.getElementsByTagName("DVD_episodenumber");
+ element = (Element) list.item(0);
+ tag = element.getChildNodes();
+ episode.setEpisode(MizLib.getInteger(Double.valueOf(((Node) tag.item(0)).getNodeValue())));
+ } catch (Exception e) {
+ System.out.println("EXCEPTION: DVD_episodenumber");
+ }
+ }
+
+ if (episode.getEpisode() == -1) {
+ try {
+ list = firstElement.getElementsByTagName("EpisodeNumber");
+ element = (Element) list.item(0);
+ tag = element.getChildNodes();
+ episode.setEpisode(MizLib.getInteger(((Node) tag.item(0)).getNodeValue()));
+ } catch (Exception e) {
+ System.out.println("EXCEPTION: EpisodeNumber");
+ episode.setEpisode(0);
+ }
+ }
+
+ if (useDvdOrder()) {
+ try {
+ list = firstElement.getElementsByTagName("DVD_season");
+ element = (Element) list.item(0);
+ tag = element.getChildNodes();
+ episode.setSeason(MizLib.getInteger(((Node) tag.item(0)).getNodeValue()));
+ } catch (Exception e) {}
+ }
+
+ if (episode.getSeason() == -1) {
+ try {
+ list = firstElement.getElementsByTagName("SeasonNumber");
+ element = (Element) list.item(0);
+ tag = element.getChildNodes();
+ episode.setSeason(MizLib.getInteger(((Node) tag.item(0)).getNodeValue()));
+ } catch (Exception e) {
+ episode.setSeason(0);
+ }
+ }
try {
list = firstElement.getElementsByTagName("EpisodeName");
diff --git a/src/com/miz/apis/thetvdb/TvShow.java b/app/src/main/java/com/miz/apis/thetvdb/TvShow.java
similarity index 100%
rename from src/com/miz/apis/thetvdb/TvShow.java
rename to app/src/main/java/com/miz/apis/thetvdb/TvShow.java
index 2e4451b4..7fcb3f4d 100644
--- a/src/com/miz/apis/thetvdb/TvShow.java
+++ b/app/src/main/java/com/miz/apis/thetvdb/TvShow.java
@@ -16,10 +16,10 @@
package com.miz.apis.thetvdb;
-import java.util.ArrayList;
-
import com.miz.db.DbAdapterTvShows;
+import java.util.ArrayList;
+
public class TvShow {
private String mShowId = DbAdapterTvShows.UNIDENTIFIED_ID,
diff --git a/src/com/miz/apis/tmdb/Movie.java b/app/src/main/java/com/miz/apis/tmdb/Movie.java
similarity index 96%
rename from src/com/miz/apis/tmdb/Movie.java
rename to app/src/main/java/com/miz/apis/tmdb/Movie.java
index ccf6abee..7f3bebb2 100644
--- a/src/com/miz/apis/tmdb/Movie.java
+++ b/app/src/main/java/com/miz/apis/tmdb/Movie.java
@@ -16,14 +16,15 @@
package com.miz.apis.tmdb;
-import java.util.ArrayList;
-import java.util.List;
-
import android.text.TextUtils;
+import com.miz.db.DbAdapterMovies;
import com.miz.functions.Actor;
import com.miz.functions.WebMovie;
+import java.util.ArrayList;
+import java.util.List;
+
public class Movie {
private String id = "", title = "", originalTitle = "", plot = "", cover = "", backdrop = "", rating = "0.0", tagline = "", releasedate = "", imdbId = "",
@@ -31,7 +32,12 @@ public class Movie {
private List mActors = new ArrayList();
private List mSimilarMovies = new ArrayList();
-
+
+ public Movie() {
+ // Unidentified by default
+ setId(DbAdapterMovies.UNIDENTIFIED_ID);
+ }
+
public String getId() {
if (TextUtils.isEmpty(id))
return title;
diff --git a/src/com/miz/apis/tmdb/TMDbMovieService.java b/app/src/main/java/com/miz/apis/tmdb/TMDbMovieService.java
similarity index 96%
rename from src/com/miz/apis/tmdb/TMDbMovieService.java
rename to app/src/main/java/com/miz/apis/tmdb/TMDbMovieService.java
index 4b403f9a..3a1ba9a3 100644
--- a/src/com/miz/apis/tmdb/TMDbMovieService.java
+++ b/app/src/main/java/com/miz/apis/tmdb/TMDbMovieService.java
@@ -1,19 +1,5 @@
package com.miz.apis.tmdb;
-import static com.miz.functions.PreferenceKeys.INCLUDE_ADULT_CONTENT;
-import static com.miz.functions.PreferenceKeys.MOVIE_RATINGS_SOURCE;
-
-import java.io.UnsupportedEncodingException;
-import java.net.URLEncoder;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import org.json.JSONArray;
-import org.json.JSONException;
-import org.json.JSONObject;
-
import android.content.Context;
import android.preference.PreferenceManager;
import android.text.TextUtils;
@@ -27,11 +13,25 @@
import com.miz.functions.WebMovie;
import com.miz.mizuu.R;
+import org.json.JSONArray;
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.io.UnsupportedEncodingException;
+import java.net.URLEncoder;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import static com.miz.functions.PreferenceKeys.INCLUDE_ADULT_CONTENT;
+import static com.miz.functions.PreferenceKeys.MOVIE_RATINGS_SOURCE;
+
public class TMDbMovieService extends MovieApiService {
private static TMDbMovieService mService;
- private final String mRatingsProvider, mTmdbApiKey;
+ private final String mTmdbApiKey;
private final Context mContext;
public static TMDbMovieService getInstance(Context context) {
@@ -42,10 +42,17 @@ public static TMDbMovieService getInstance(Context context) {
private TMDbMovieService(Context context) {
mContext = context;
- mRatingsProvider = PreferenceManager.getDefaultSharedPreferences(mContext).getString(MOVIE_RATINGS_SOURCE, mContext.getString(R.string.ratings_option_1));
mTmdbApiKey = MizLib.getTmdbApiKey(mContext);
}
+ /**
+ * Get the ratings provider. This isn't a static value, so it should be reloaded when needed.
+ * @return
+ */
+ public String getRatingsProvider() {
+ return PreferenceManager.getDefaultSharedPreferences(mContext).getString(MOVIE_RATINGS_SOURCE, mContext.getString(R.string.ratings_option_1));
+ }
+
@Override
public List search(String query, String language) {
language = getLanguage(language);
@@ -236,7 +243,7 @@ public Movie get(String id, String json, String language) {
} catch (Exception e) {}
// Trakt.tv
- if (mRatingsProvider.equals(mContext.getString(R.string.ratings_option_2)) && json == null) {
+ if (getRatingsProvider().equals(mContext.getString(R.string.ratings_option_2)) && json == null) {
try {
com.miz.apis.trakt.Movie movieSummary = Trakt.getMovieSummary(mContext, id);
double rating = Double.valueOf(movieSummary.getRating()) / 10;
@@ -247,7 +254,7 @@ public Movie get(String id, String json, String language) {
}
// OMDb API / IMDb
- if (mRatingsProvider.equals(mContext.getString(R.string.ratings_option_3)) && json == null) {
+ if (getRatingsProvider().equals(mContext.getString(R.string.ratings_option_3)) && json == null) {
try {
jObject = MizLib.getJSONObject(mContext, "http://www.omdbapi.com/?i=" + movie.getImdbId());
double rating = Double.valueOf(MizLib.getStringFromJSONObject(jObject, "imdbRating", "0"));
@@ -563,6 +570,11 @@ public CompleteActor getCompleteActorDetails(final String actorId) {
profilePhoto = baseUrl + "w500" + profilePhoto;
actor.setProfilePhoto(profilePhoto);
+ String profilePhotoThumb = MizLib.getStringFromJSONObject(json, "profile_path", "");
+ if (!TextUtils.isEmpty(profilePhoto))
+ profilePhotoThumb = baseUrl + MizLib.getActorUrlSize(mContext) + profilePhoto;
+ actor.setProfilePhotoThumb(profilePhotoThumb);
+
// Set up movies
List movies = new ArrayList();
try {
diff --git a/src/com/miz/apis/tmdb/TMDbTvShowService.java b/app/src/main/java/com/miz/apis/tmdb/TMDbTvShowService.java
similarity index 96%
rename from src/com/miz/apis/tmdb/TMDbTvShowService.java
rename to app/src/main/java/com/miz/apis/tmdb/TMDbTvShowService.java
index e0ac7f8c..cdddfcf2 100644
--- a/src/com/miz/apis/tmdb/TMDbTvShowService.java
+++ b/app/src/main/java/com/miz/apis/tmdb/TMDbTvShowService.java
@@ -1,18 +1,5 @@
package com.miz.apis.tmdb;
-import static com.miz.functions.PreferenceKeys.TVSHOWS_RATINGS_SOURCE;
-
-import java.io.UnsupportedEncodingException;
-import java.net.URLEncoder;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import org.json.JSONArray;
-import org.json.JSONException;
-import org.json.JSONObject;
-
import android.content.Context;
import android.preference.PreferenceManager;
import android.text.TextUtils;
@@ -26,11 +13,24 @@
import com.miz.functions.MizLib;
import com.miz.mizuu.R;
+import org.json.JSONArray;
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.io.UnsupportedEncodingException;
+import java.net.URLEncoder;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import static com.miz.functions.PreferenceKeys.TVSHOWS_RATINGS_SOURCE;
+
public class TMDbTvShowService extends TvShowApiService {
private static TMDbTvShowService mService;
- private final String mRatingsProvider, mTmdbApiKey;
+ private final String mTmdbApiKey;
private final Context mContext;
public static TMDbTvShowService getInstance(Context context) {
@@ -41,10 +41,17 @@ public static TMDbTvShowService getInstance(Context context) {
private TMDbTvShowService(Context context) {
mContext = context;
- mRatingsProvider = PreferenceManager.getDefaultSharedPreferences(mContext).getString(TVSHOWS_RATINGS_SOURCE, mContext.getString(R.string.ratings_option_4));
mTmdbApiKey = MizLib.getTmdbApiKey(mContext);
}
+ /**
+ * Get the ratings provider. This isn't a static value, so it should be reloaded when needed.
+ * @return
+ */
+ public String getRatingsProvider() {
+ return PreferenceManager.getDefaultSharedPreferences(mContext).getString(TVSHOWS_RATINGS_SOURCE, mContext.getString(R.string.ratings_option_4));
+ }
+
@Override
public List search(String query, String language) {
language = getLanguage(language);
@@ -174,7 +181,7 @@ public TvShow get(String id, String language) {
} catch (JSONException e) {}
// Trakt.tv
- if (mRatingsProvider.equals(mContext.getString(R.string.ratings_option_2))) {
+ if (getRatingsProvider().equals(mContext.getString(R.string.ratings_option_2))) {
try {
com.miz.apis.trakt.Movie movieSummary = Trakt.getMovieSummary(mContext, id);
double rating = Double.valueOf(movieSummary.getRating() / 10);
@@ -185,7 +192,7 @@ public TvShow get(String id, String language) {
}
// OMDb API / IMDb
- if (mRatingsProvider.equals(mContext.getString(R.string.ratings_option_3))) {
+ if (getRatingsProvider().equals(mContext.getString(R.string.ratings_option_3))) {
try {
jObject = MizLib.getJSONObject(mContext, "http://www.omdbapi.com/?i=" + show.getImdbId());
double rating = Double.valueOf(MizLib.getStringFromJSONObject(jObject, "imdbRating", "0"));
diff --git a/src/com/miz/apis/trakt/Movie.java b/app/src/main/java/com/miz/apis/trakt/Movie.java
similarity index 100%
rename from src/com/miz/apis/trakt/Movie.java
rename to app/src/main/java/com/miz/apis/trakt/Movie.java
index 1bbbb235..c60ab410 100644
--- a/src/com/miz/apis/trakt/Movie.java
+++ b/app/src/main/java/com/miz/apis/trakt/Movie.java
@@ -16,13 +16,13 @@
package com.miz.apis.trakt;
-import java.util.ArrayList;
-import java.util.List;
-
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
+import java.util.ArrayList;
+import java.util.List;
+
public class Movie {
private String mTitle, mUrl, mOverview, mTagline, mCertification, mImdbId, mPoster, mFanart;
diff --git a/src/com/miz/apis/trakt/Show.java b/app/src/main/java/com/miz/apis/trakt/Show.java
similarity index 100%
rename from src/com/miz/apis/trakt/Show.java
rename to app/src/main/java/com/miz/apis/trakt/Show.java
index a93ceb41..0f7c4862 100644
--- a/src/com/miz/apis/trakt/Show.java
+++ b/app/src/main/java/com/miz/apis/trakt/Show.java
@@ -16,13 +16,13 @@
package com.miz.apis.trakt;
-import java.util.ArrayList;
-import java.util.List;
-
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
+import java.util.ArrayList;
+import java.util.List;
+
public class Show {
private String mTitle, mUrl, mCountry, mOverview, mStatus, mNetwork, mAirDay, mAirTime, mCertification, mImdbId, mPoster, mFanart;
diff --git a/src/com/miz/apis/trakt/Trakt.java b/app/src/main/java/com/miz/apis/trakt/Trakt.java
similarity index 100%
rename from src/com/miz/apis/trakt/Trakt.java
rename to app/src/main/java/com/miz/apis/trakt/Trakt.java
index eff5fa81..64b8456d 100644
--- a/src/com/miz/apis/trakt/Trakt.java
+++ b/app/src/main/java/com/miz/apis/trakt/Trakt.java
@@ -16,16 +16,6 @@
package com.miz.apis.trakt;
-import static com.miz.functions.PreferenceKeys.SYNC_WITH_TRAKT;
-import static com.miz.functions.PreferenceKeys.TRAKT_PASSWORD;
-import static com.miz.functions.PreferenceKeys.TRAKT_USERNAME;
-
-import java.util.Collection;
-import java.util.List;
-
-import org.json.JSONArray;
-import org.json.JSONObject;
-
import android.content.Context;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;
@@ -40,6 +30,16 @@
import com.squareup.okhttp.Request;
import com.squareup.okhttp.Response;
+import org.json.JSONArray;
+import org.json.JSONObject;
+
+import java.util.Collection;
+import java.util.List;
+
+import static com.miz.functions.PreferenceKeys.SYNC_WITH_TRAKT;
+import static com.miz.functions.PreferenceKeys.TRAKT_PASSWORD;
+import static com.miz.functions.PreferenceKeys.TRAKT_USERNAME;
+
public class Trakt {
private Trakt() {} // No instantiation
diff --git a/src/com/miz/apis/trakt/TraktTvShow.java b/app/src/main/java/com/miz/apis/trakt/TraktTvShow.java
similarity index 100%
rename from src/com/miz/apis/trakt/TraktTvShow.java
rename to app/src/main/java/com/miz/apis/trakt/TraktTvShow.java
diff --git a/src/com/miz/base/MizActivity.java b/app/src/main/java/com/miz/base/MizActivity.java
similarity index 72%
rename from src/com/miz/base/MizActivity.java
rename to app/src/main/java/com/miz/base/MizActivity.java
index 2dd3349f..d075f84f 100644
--- a/src/com/miz/base/MizActivity.java
+++ b/app/src/main/java/com/miz/base/MizActivity.java
@@ -20,29 +20,45 @@
import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
import android.os.Bundle;
import android.preference.PreferenceManager;
-import android.support.v4.app.FragmentActivity;
-
-import static com.miz.functions.PreferenceKeys.FULLSCREEN_TAG;
+import android.support.v7.app.ActionBarActivity;
+import android.support.v7.widget.Toolbar;
+import android.view.ViewGroup;
+import android.widget.FrameLayout;
+import com.miz.functions.MizLib;
import com.miz.mizuu.MizuuApplication;
import com.miz.mizuu.R;
-public class MizActivity extends FragmentActivity implements OnSharedPreferenceChangeListener {
+import static com.miz.functions.PreferenceKeys.FULLSCREEN_TAG;
+public abstract class MizActivity extends ActionBarActivity implements OnSharedPreferenceChangeListener {
+
+ public Toolbar mToolbar;
private boolean mFullscreen = true;
@Override
- public void onCreate(Bundle savedInstanceState) {
+ protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mFullscreen = MizuuApplication.isFullscreen(this);
-
+
if (isFullscreen())
setTheme(R.style.Mizuu_Theme_FullScreen);
-
+
+ if (getLayoutResource() > 0) {
+ setContentView(getLayoutResource());
+
+ mToolbar = (Toolbar) findViewById(R.id.toolbar);
+ if (mToolbar != null) {
+ setSupportActionBar(mToolbar);
+ }
+ }
+
PreferenceManager.getDefaultSharedPreferences(this).registerOnSharedPreferenceChangeListener(this);
}
+ protected abstract int getLayoutResource();
+
protected boolean isFullscreen() {
return mFullscreen;
}
diff --git a/src/com/miz/contentprovider/MovieActorContentProvider.java b/app/src/main/java/com/miz/contentprovider/MovieActorContentProvider.java
similarity index 99%
rename from src/com/miz/contentprovider/MovieActorContentProvider.java
rename to app/src/main/java/com/miz/contentprovider/MovieActorContentProvider.java
index 8c65abe3..1e7b6c53 100644
--- a/src/com/miz/contentprovider/MovieActorContentProvider.java
+++ b/app/src/main/java/com/miz/contentprovider/MovieActorContentProvider.java
@@ -16,12 +16,6 @@
package com.miz.contentprovider;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Locale;
-
import android.app.SearchManager;
import android.content.ContentResolver;
import android.content.ContentValues;
@@ -38,6 +32,12 @@
import com.miz.mizuu.MizuuApplication;
import com.miz.mizuu.R;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Locale;
+
public class MovieActorContentProvider extends SearchRecentSuggestionsProvider {
static final String TAG = MovieActorContentProvider.class.getSimpleName();
@@ -122,7 +122,7 @@ private List getSearchResults(String query) {
query = query.toLowerCase(Locale.ENGLISH);
- Cursor c = db.fetchAllMovies(DbAdapterMovies.KEY_TITLE + " ASC", false);
+ Cursor c = db.fetchAllMovies(DbAdapterMovies.KEY_TITLE + " ASC");
ColumnIndexCache cache = new ColumnIndexCache();
try {
diff --git a/src/com/miz/contentprovider/MovieContentProvider.java b/app/src/main/java/com/miz/contentprovider/MovieContentProvider.java
similarity index 99%
rename from src/com/miz/contentprovider/MovieContentProvider.java
rename to app/src/main/java/com/miz/contentprovider/MovieContentProvider.java
index 7b605f27..169c81bb 100644
--- a/src/com/miz/contentprovider/MovieContentProvider.java
+++ b/app/src/main/java/com/miz/contentprovider/MovieContentProvider.java
@@ -16,12 +16,6 @@
package com.miz.contentprovider;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.Locale;
-import java.util.regex.Pattern;
-
import android.app.SearchManager;
import android.content.ContentValues;
import android.content.SearchRecentSuggestionsProvider;
@@ -38,6 +32,12 @@
import com.miz.functions.MizLib;
import com.miz.mizuu.MizuuApplication;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Locale;
+import java.util.regex.Pattern;
+
public class MovieContentProvider extends SearchRecentSuggestionsProvider {
static final String TAG = MovieContentProvider.class.getSimpleName();
@@ -115,7 +115,7 @@ private List getSearchResults(String query) {
query = query.toLowerCase(Locale.ENGLISH);
- Cursor c = db.fetchAllMovies(DbAdapterMovies.KEY_TITLE + " ASC", false);
+ Cursor c = db.fetchAllMovies(DbAdapterMovies.KEY_TITLE + " ASC");
Pattern p = Pattern.compile(MizLib.CHARACTER_REGEX); // Use a pre-compiled pattern as it's a lot faster (approx. 3x for ~700 movies)
ColumnIndexCache cache = new ColumnIndexCache();
diff --git a/src/com/miz/contentprovider/TvShowActorContentProvider.java b/app/src/main/java/com/miz/contentprovider/TvShowActorContentProvider.java
similarity index 100%
rename from src/com/miz/contentprovider/TvShowActorContentProvider.java
rename to app/src/main/java/com/miz/contentprovider/TvShowActorContentProvider.java
index f33eb122..b7094271 100644
--- a/src/com/miz/contentprovider/TvShowActorContentProvider.java
+++ b/app/src/main/java/com/miz/contentprovider/TvShowActorContentProvider.java
@@ -16,12 +16,6 @@
package com.miz.contentprovider;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Locale;
-
import android.app.SearchManager;
import android.content.ContentResolver;
import android.content.ContentValues;
@@ -38,6 +32,12 @@
import com.miz.mizuu.MizuuApplication;
import com.miz.mizuu.R;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Locale;
+
public class TvShowActorContentProvider extends SearchRecentSuggestionsProvider {
static final String TAG = TvShowActorContentProvider.class.getSimpleName();
diff --git a/src/com/miz/contentprovider/TvShowContentProvider.java b/app/src/main/java/com/miz/contentprovider/TvShowContentProvider.java
similarity index 100%
rename from src/com/miz/contentprovider/TvShowContentProvider.java
rename to app/src/main/java/com/miz/contentprovider/TvShowContentProvider.java
index 7e8d2dcd..c763bf9c 100644
--- a/src/com/miz/contentprovider/TvShowContentProvider.java
+++ b/app/src/main/java/com/miz/contentprovider/TvShowContentProvider.java
@@ -16,12 +16,6 @@
package com.miz.contentprovider;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.Locale;
-import java.util.regex.Pattern;
-
import android.app.SearchManager;
import android.content.ContentValues;
import android.content.SearchRecentSuggestionsProvider;
@@ -38,6 +32,12 @@
import com.miz.mizuu.MizuuApplication;
import com.miz.mizuu.TvShow;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Locale;
+import java.util.regex.Pattern;
+
public class TvShowContentProvider extends SearchRecentSuggestionsProvider {
static final String TAG = TvShowContentProvider.class.getSimpleName();
diff --git a/src/com/miz/db/AbstractDbAdapter.java b/app/src/main/java/com/miz/db/AbstractDbAdapter.java
similarity index 100%
rename from src/com/miz/db/AbstractDbAdapter.java
rename to app/src/main/java/com/miz/db/AbstractDbAdapter.java
diff --git a/src/com/miz/db/DatabaseHelper.java b/app/src/main/java/com/miz/db/DatabaseHelper.java
similarity index 100%
rename from src/com/miz/db/DatabaseHelper.java
rename to app/src/main/java/com/miz/db/DatabaseHelper.java
index 3f5b5a31..cb5be94f 100644
--- a/src/com/miz/db/DatabaseHelper.java
+++ b/app/src/main/java/com/miz/db/DatabaseHelper.java
@@ -1,9 +1,5 @@
package com.miz.db;
-import java.io.File;
-import java.util.ArrayList;
-import java.util.HashSet;
-
import android.annotation.SuppressLint;
import android.content.ContentValues;
import android.content.Context;
@@ -15,6 +11,10 @@
import com.miz.functions.MizLib;
import com.miz.mizuu.MizuuApplication;
+import java.io.File;
+import java.util.ArrayList;
+import java.util.HashSet;
+
@SuppressLint("NewApi")
public class DatabaseHelper extends SQLiteOpenHelper {
diff --git a/src/com/miz/db/DbAdapterCollections.java b/app/src/main/java/com/miz/db/DbAdapterCollections.java
similarity index 63%
rename from src/com/miz/db/DbAdapterCollections.java
rename to app/src/main/java/com/miz/db/DbAdapterCollections.java
index 2a447bb0..17f973e9 100644
--- a/src/com/miz/db/DbAdapterCollections.java
+++ b/app/src/main/java/com/miz/db/DbAdapterCollections.java
@@ -16,14 +16,15 @@
package com.miz.db;
-import java.util.HashMap;
-
-import com.miz.functions.ColumnIndexCache;
-
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
+import com.miz.functions.ColumnIndexCache;
+import com.miz.mizuu.MizuuApplication;
+
+import java.util.HashMap;
+
public class DbAdapterCollections extends AbstractDbAdapter {
public static final String KEY_COLLECTION_ID = "collection_id";
@@ -37,10 +38,31 @@ public DbAdapterCollections(Context context) {
super(context);
}
- public long createCollection(String collectionId, String collection) {
+ /**
+ * Creates a collection mapping. This method also gets the collection ID
+ * of the supplied movie ID, and checks if that collection has more than
+ * one movie mapped to it. If it doesn't, it'll remove the old mapping,
+ * since it also re-maps to a new collection.
+ * @param tmdbId
+ * @param collectionId
+ * @param collection
+ * @return
+ */
+ public long createCollection(String tmdbId, String collectionId, String collection) {
+ DbAdapterMovies db = MizuuApplication.getMovieAdapter();
+
// We don't want to create it again if it already exists
- if (collectionExists(collectionId))
+ // or if the movie doesn't exist
+ if (collectionExists(collectionId) || !db.movieExists(tmdbId))
return -1;
+
+ String currentCollectionId = db.getSingleItem(tmdbId, DbAdapterMovies.KEY_COLLECTION_ID);
+
+ // If there's only a single movie mapped to the collection ID,
+ // we can remove the mapping, since we're about to re-map it.
+ if (getMovieCount(currentCollectionId) == 1) {
+ deleteCollection(currentCollectionId);
+ }
// Add values to a ContentValues object
ContentValues values = new ContentValues();
@@ -86,6 +108,28 @@ public String getCollection(String collectionId) {
return collection;
}
+
+ /**
+ * Returns the number of movies mapped to the given collection ID.
+ * @param collectionId
+ * @return
+ */
+ public int getMovieCount(String collectionId) {
+ int count = 0;
+
+ Cursor cursor = mDatabase.query(DATABASE_TABLE, ALL_COLUMNS, KEY_COLLECTION_ID + " = ?", new String[]{collectionId}, null, null, null);
+
+ if (cursor != null) {
+ try {
+ count = cursor.getCount();
+ } catch (Exception e) {
+ } finally {
+ cursor.close();
+ }
+ }
+
+ return count;
+ }
public HashMap getCollectionsMap() {
Cursor cursor = mDatabase.query(DATABASE_TABLE, ALL_COLUMNS, null, null, null, null, null);
@@ -114,4 +158,15 @@ public boolean deleteCollection(String collectionId) {
public boolean deleteAllCollections() {
return mDatabase.delete(DATABASE_TABLE, null, null) > 0;
}
+
+ /**
+ * Used for unit testing.
+ * @return
+ */
+ public int count() {
+ Cursor c = mDatabase.query(DATABASE_TABLE, new String[]{KEY_COLLECTION_ID}, null, null, null, null, null);
+ int count = c.getCount();
+ c.close();
+ return count;
+ }
}
\ No newline at end of file
diff --git a/src/com/miz/db/DbAdapterMovieMappings.java b/app/src/main/java/com/miz/db/DbAdapterMovieMappings.java
similarity index 82%
rename from src/com/miz/db/DbAdapterMovieMappings.java
rename to app/src/main/java/com/miz/db/DbAdapterMovieMappings.java
index 998e456c..42359e83 100644
--- a/src/com/miz/db/DbAdapterMovieMappings.java
+++ b/app/src/main/java/com/miz/db/DbAdapterMovieMappings.java
@@ -16,12 +16,12 @@
package com.miz.db;
-import java.util.ArrayList;
-
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
+import java.util.ArrayList;
+
public class DbAdapterMovieMappings extends AbstractDbAdapter {
public static final String KEY_FILEPATH = "filepath";
@@ -37,6 +37,8 @@ public DbAdapterMovieMappings(Context context) {
}
public long createFilepathMapping(String filepath, String tmdbId) {
+ // We only want to create a filepath mapping if
+ // the filepath doesn't already exist
if (!filepathExists(tmdbId, filepath)) {
// Add values to a ContentValues object
ContentValues values = new ContentValues();
@@ -45,7 +47,7 @@ public long createFilepathMapping(String filepath, String tmdbId) {
values.put(KEY_IGNORED, 0);
// Insert into database
- return mDatabase.insert(DATABASE_TABLE, null, values);
+ return mDatabase.insert(DATABASE_TABLE, null, values);
}
return -1;
}
@@ -54,6 +56,10 @@ public Cursor getAllFilepaths(boolean includeRemoved) {
return mDatabase.query(DATABASE_TABLE, ALL_COLUMNS, includeRemoved ? null : "NOT(" + KEY_IGNORED + " = '1')", null, null, null, null);
}
+ public Cursor getAllIgnoredFilepaths() {
+ return mDatabase.query(DATABASE_TABLE, ALL_COLUMNS, KEY_IGNORED + " = '1'", null, null, null, null);
+ }
+
public Cursor getAllUnidentifiedFilepaths() {
return mDatabase.query(DATABASE_TABLE, ALL_COLUMNS, "NOT(" + KEY_IGNORED + " = '1') AND " + KEY_TMDB_ID + "='" + DbAdapterMovies.UNIDENTIFIED_ID + "'", null, null, null, null);
}
@@ -80,11 +86,11 @@ public String getFirstFilepathForMovie(String tmdbId) {
return filepath;
}
- public boolean updateTmdbId(String filepath, String newTmdbId) {
+ public boolean updateTmdbId(String filepath, String currentId, String newId) {
ContentValues values = new ContentValues();
- values.put(KEY_TMDB_ID, newTmdbId);
+ values.put(KEY_TMDB_ID, newId);
- return mDatabase.update(DATABASE_TABLE, values, KEY_FILEPATH + " = ?", new String[]{filepath}) > 0;
+ return mDatabase.update(DATABASE_TABLE, values, KEY_FILEPATH + " = ? AND " + KEY_TMDB_ID + " = ?", new String[]{filepath, currentId}) > 0;
}
public boolean exists(String tmdbId) {
@@ -122,6 +128,10 @@ public boolean filepathExists(String tmdbId, String filepath) {
return result;
}
+ public boolean deleteIgnoredFilepath(String filepath) {
+ return mDatabase.delete(DATABASE_TABLE, KEY_FILEPATH + " = ?", new String[]{filepath}) > 0;
+ }
+
public boolean deleteMovie(String tmdbId) {
return mDatabase.delete(DATABASE_TABLE, KEY_TMDB_ID + " = ?", new String[]{tmdbId}) > 0;
}
@@ -153,8 +163,13 @@ public boolean hasMultipleFilepaths(String tmdbId) {
return result;
}
+ /**
+ * Gets all un-ignored filepaths mapped to a given movie ID
+ * @param tmdbId
+ * @return
+ */
public ArrayList getMovieFilepaths(String tmdbId) {
- Cursor cursor = mDatabase.query(DATABASE_TABLE, ALL_COLUMNS, KEY_TMDB_ID + " = ?", new String[]{tmdbId}, null, null, null);
+ Cursor cursor = mDatabase.query(DATABASE_TABLE, ALL_COLUMNS, KEY_TMDB_ID + " = ? AND " + KEY_IGNORED + " = '0'", new String[]{tmdbId}, null, null, null);
ArrayList paths = new ArrayList();
if (cursor != null) {
@@ -189,4 +204,15 @@ public String getIdForFilepath(String filepath) {
return id;
}
+
+ /**
+ * Used for unit testing
+ * @return
+ */
+ public int count() {
+ Cursor c = mDatabase.query(DATABASE_TABLE, new String[]{KEY_FILEPATH}, null, null, null, null, null);
+ int count = c.getCount();
+ c.close();
+ return count;
+ }
}
\ No newline at end of file
diff --git a/app/src/main/java/com/miz/db/DbAdapterMovies.java b/app/src/main/java/com/miz/db/DbAdapterMovies.java
new file mode 100644
index 00000000..609267ca
--- /dev/null
+++ b/app/src/main/java/com/miz/db/DbAdapterMovies.java
@@ -0,0 +1,291 @@
+/*
+ * Copyright (C) 2014 Michell Bak
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.miz.db;
+
+import android.content.ContentValues;
+import android.content.Context;
+import android.database.Cursor;
+import android.database.SQLException;
+import android.database.sqlite.SQLiteException;
+import android.text.TextUtils;
+
+import com.miz.mizuu.MizuuApplication;
+
+import java.util.ArrayList;
+
+public class DbAdapterMovies extends AbstractDbAdapter {
+
+ // Database fields
+ public static final String KEY_TMDB_ID = "tmdbid"; // Unidentified movies and .nfo files without TMDb ID use the filepath
+ public static final String KEY_TITLE = "title";
+ public static final String KEY_PLOT = "plot";
+ public static final String KEY_IMDB_ID = "imdbid";
+ public static final String KEY_RATING = "rating";
+ public static final String KEY_TAGLINE = "tagline";
+ public static final String KEY_RELEASEDATE = "release";
+ public static final String KEY_CERTIFICATION = "certification";
+ public static final String KEY_RUNTIME = "runtime";
+ public static final String KEY_TRAILER = "trailer";
+ public static final String KEY_GENRES = "genres";
+ public static final String KEY_FAVOURITE = "favourite";
+ public static final String KEY_ACTORS = "actors";
+ public static final String KEY_COLLECTION_ID = "collection_id";
+ public static final String KEY_TO_WATCH = "to_watch";
+ public static final String KEY_HAS_WATCHED = "has_watched";
+ public static final String KEY_DATE_ADDED = "date_added";
+
+ public static final String DATABASE_TABLE = "movie";
+
+ public static final String UNIDENTIFIED_ID = "invalid";
+
+ public static final String[] SELECT_ALL = new String[] {KEY_TMDB_ID, KEY_TITLE, KEY_PLOT, KEY_IMDB_ID, KEY_RATING, KEY_TAGLINE, KEY_RELEASEDATE, KEY_CERTIFICATION,
+ KEY_RUNTIME, KEY_TRAILER, KEY_GENRES, KEY_FAVOURITE, KEY_ACTORS, KEY_COLLECTION_ID, KEY_TO_WATCH, KEY_HAS_WATCHED, KEY_DATE_ADDED};
+
+ public DbAdapterMovies(Context context) {
+ super(context);
+ }
+
+ /**
+ * Create a new movie
+ */
+ public void createMovie(String tmdbid, String title, String plot, String imdbid, String rating, String tagline, String release,
+ String certification, String runtime, String trailer, String genres, String favourite, String actors, String collection,
+ String collectionId, String toWatch, String hasWatched, String date) {
+
+ if (tmdbid.equals(UNIDENTIFIED_ID))
+ return; // We're not interesting in adding this to the movie database
+
+ if (movieExists(tmdbid))
+ return; // It already exists, let's not create it again
+
+ ContentValues initialValues = createContentValues(tmdbid, title, plot, imdbid, rating, tagline, release, certification, runtime, trailer, genres, favourite, actors, collectionId, toWatch, hasWatched, date, true);
+ mDatabase.insert(DATABASE_TABLE, null, initialValues);
+
+ MizuuApplication.getCollectionsAdapter().createCollection(tmdbid, collectionId, collection);
+ }
+
+ public void createOrUpdateMovie(String tmdbid, String title, String plot, String imdbid, String rating, String tagline, String release,
+ String certification, String runtime, String trailer, String genres, String favourite, String actors, String collection,
+ String collectionId, String toWatch, String hasWatched, String date) {
+ if (movieExists(tmdbid)) {
+ // It already exists - let's update it while keeping
+ // favourite, watchlist and watched status data intact
+ updateMovie(tmdbid, title, plot, imdbid, rating, tagline, release, certification, runtime, trailer, genres,
+ actors, collection, collectionId, date);
+ } else {
+ // It doesn't exist! Let's create it
+ createMovie(tmdbid, title, plot, imdbid, rating, tagline, release, certification, runtime, trailer, genres,
+ favourite, actors, collection, collectionId, toWatch, hasWatched, date);
+ }
+ }
+
+ /**
+ * Update the movie
+ */
+ private boolean updateMovie(String tmdbid, String title, String plot, String imdbid, String rating, String tagline, String release,
+ String certification, String runtime, String trailer, String genres, String actors, String collection, String collectionId, String date) {
+
+ ContentValues updateValues = createUpdateContentValues(title, plot, imdbid, rating, tagline, release, certification,
+ runtime, trailer, genres, actors, collectionId, date);
+
+ return mDatabase.update(DATABASE_TABLE, updateValues, KEY_TMDB_ID + " = ?", new String[]{tmdbid}) > 0 &&
+ MizuuApplication.getCollectionsAdapter().createCollection(tmdbid, collectionId, collection) > 0;
+ }
+
+ public boolean updateMovieSingleItem(String tmdbId, String column, String value) {
+ ContentValues values = new ContentValues();
+ values.put(column, value);
+
+ return mDatabase.update(DATABASE_TABLE, values, KEY_TMDB_ID + " = ?", new String[]{tmdbId}) > 0;
+ }
+
+ public String getSingleItem(String tmdbId, String column) {
+ String singleItem = "";
+ Cursor c = mDatabase.query(DATABASE_TABLE, new String[]{column}, KEY_TMDB_ID + " = ?", new String[]{tmdbId}, null, null, null);
+ if (c != null) {
+ try {
+ if (c.moveToFirst())
+ singleItem = c.getString(c.getColumnIndex(column));
+ } catch (SQLException e) {} finally {
+ c.close();
+ }
+ }
+ return singleItem;
+ }
+
+ public boolean editMovie(String movieId, String title, String tagline, String description,
+ String genres, String runtime, String rating, String releaseDate, String certification) {
+ ContentValues cv = new ContentValues();
+ cv.put(KEY_TITLE, title);
+ cv.put(KEY_PLOT, description);
+ cv.put(KEY_RATING, rating);
+ cv.put(KEY_TAGLINE, tagline);
+ cv.put(KEY_RELEASEDATE, releaseDate);
+ cv.put(KEY_CERTIFICATION, certification);
+ cv.put(KEY_RUNTIME, runtime);
+ cv.put(KEY_GENRES, genres);
+ return mDatabase.update(DATABASE_TABLE, cv, KEY_TMDB_ID + " = ?", new String[]{movieId}) > 0;
+ }
+
+ /**
+ * Deletes movie
+ */
+ public boolean deleteMovie(String tmdbId) {
+ return mDatabase.delete(DATABASE_TABLE, KEY_TMDB_ID + " = ?", new String[]{tmdbId}) > 0;
+ }
+
+ public boolean deleteAllMovies() {
+ return mDatabase.delete(DATABASE_TABLE, null, null) > 0;
+ }
+
+ public String getCollectionId(String tmdbId) {
+ return getSingleItem(tmdbId, KEY_COLLECTION_ID);
+ }
+
+ /**
+ * Return a Cursor over the list of all movies in the database
+ */
+ public Cursor fetchAllMovies(String sort) {
+ return mDatabase.query(DATABASE_TABLE, SELECT_ALL, null, null, null, null, sort);
+ }
+
+ public Cursor getAllMovies() {
+ return mDatabase.query(DATABASE_TABLE, SELECT_ALL, null, null, null, null, null);
+ }
+
+ public Cursor getCollections() {
+ return mDatabase.query(DATABASE_TABLE, SELECT_ALL, null, null, KEY_COLLECTION_ID, null, null);
+ }
+
+ public Cursor fetchMovie(String movieId) throws SQLException {
+ Cursor cursor = mDatabase.query(DATABASE_TABLE, SELECT_ALL, KEY_TMDB_ID + " = ?", new String[]{movieId}, null, null, null, null);
+ if (cursor != null) {
+ cursor.moveToFirst();
+ }
+ return cursor;
+ }
+
+ public boolean movieExists(String movieId) {
+ Cursor cursor = mDatabase.query(DATABASE_TABLE, SELECT_ALL, KEY_TMDB_ID + " = ?", new String[]{movieId}, null, null, null, null);
+
+ if (cursor != null)
+ try {
+ return cursor.getCount() > 0;
+ } catch (SQLiteException e) {} finally {
+ cursor.close();
+ }
+
+ return false;
+ }
+
+ private ContentValues createContentValues(String tmdbid, String title,
+ String plot, String imdbid, String rating, String tagline, String release,
+ String certification, String runtime, String trailer, String genres, String favourite, String actors,
+ String collectionId, String toWatch, String hasWatched, String date, boolean includeTmdbId) {
+ ContentValues values = new ContentValues();
+ values.put(KEY_TITLE, title);
+ values.put(KEY_PLOT, plot);
+ if (includeTmdbId)
+ values.put(KEY_TMDB_ID, tmdbid);
+ values.put(KEY_IMDB_ID, imdbid);
+ values.put(KEY_RATING, rating);
+ values.put(KEY_TAGLINE, tagline);
+ values.put(KEY_RELEASEDATE, release);
+ values.put(KEY_CERTIFICATION, certification);
+ values.put(KEY_RUNTIME, runtime);
+ values.put(KEY_TRAILER, trailer);
+ values.put(KEY_GENRES, genres);
+ values.put(KEY_FAVOURITE, favourite);
+ values.put(KEY_ACTORS, actors);
+ values.put(KEY_COLLECTION_ID, collectionId);
+ values.put(KEY_TO_WATCH, toWatch);
+ values.put(KEY_HAS_WATCHED, hasWatched);
+ values.put(KEY_DATE_ADDED, date);
+ return values;
+ }
+
+ private ContentValues createUpdateContentValues(String title, String plot, String imdbid,
+ String rating, String tagline, String release, String certification, String runtime,
+ String trailer, String genres, String actors, String collectionId, String date) {
+ ContentValues values = new ContentValues();
+ values.put(KEY_TITLE, title);
+ values.put(KEY_PLOT, plot);
+ values.put(KEY_IMDB_ID, imdbid);
+ values.put(KEY_RATING, rating);
+ values.put(KEY_TAGLINE, tagline);
+ values.put(KEY_RELEASEDATE, release);
+ values.put(KEY_CERTIFICATION, certification);
+ values.put(KEY_RUNTIME, runtime);
+ values.put(KEY_TRAILER, trailer);
+ values.put(KEY_GENRES, genres);
+ values.put(KEY_ACTORS, actors);
+ values.put(KEY_COLLECTION_ID, collectionId);
+ values.put(KEY_DATE_ADDED, date);
+ return values;
+ }
+
+ private ContentValues createEditContentValues(String title, String plot, String rating, String tagline,
+ String release, String certification, String runtime, String genres, String toWatch, String hasWatched, String date) {
+ ContentValues values = new ContentValues();
+ values.put(KEY_TITLE, title);
+ values.put(KEY_PLOT, plot);
+ values.put(KEY_RATING, rating);
+ values.put(KEY_TAGLINE, tagline);
+ values.put(KEY_RELEASEDATE, release);
+ values.put(KEY_CERTIFICATION, certification);
+ values.put(KEY_RUNTIME, runtime);
+ values.put(KEY_GENRES, genres);
+ values.put(KEY_TO_WATCH, toWatch);
+ values.put(KEY_HAS_WATCHED, hasWatched);
+ values.put(KEY_DATE_ADDED, date);
+ return values;
+ }
+
+ public int count() {
+ Cursor c = mDatabase.query(DATABASE_TABLE, new String[]{KEY_TITLE, KEY_TMDB_ID}, "NOT(" + KEY_TMDB_ID + " = '" + UNIDENTIFIED_ID + "')", null, null, null, null);
+ int count = c.getCount();
+ c.close();
+ return count;
+ }
+
+ public int countWatchlist() {
+ Cursor c = mDatabase.query(DATABASE_TABLE, new String[] {KEY_TO_WATCH}, KEY_TO_WATCH + " = '1'", null, null, null, null);
+ int count = c.getCount();
+ c.close();
+ return count;
+ }
+
+ public ArrayList getCertifications() {
+ ArrayList certifications = new ArrayList();
+ Cursor cursor = mDatabase.query(DATABASE_TABLE, new String[]{KEY_CERTIFICATION}, null, null, KEY_CERTIFICATION, null, null);
+
+ if (cursor != null) {
+ try {
+ while (cursor.moveToNext()) {
+ String certification = cursor.getString(cursor.getColumnIndex(KEY_CERTIFICATION));
+ if (!TextUtils.isEmpty(certification))
+ certifications.add(certification);
+ }
+ } catch (Exception e) {
+ } finally {
+ cursor.close();
+ }
+ }
+
+ return certifications;
+ }
+}
\ No newline at end of file
diff --git a/src/com/miz/db/DbAdapterSources.java b/app/src/main/java/com/miz/db/DbAdapterSources.java
similarity index 100%
rename from src/com/miz/db/DbAdapterSources.java
rename to app/src/main/java/com/miz/db/DbAdapterSources.java
diff --git a/src/com/miz/db/DbAdapterTvShowEpisodeMappings.java b/app/src/main/java/com/miz/db/DbAdapterTvShowEpisodeMappings.java
similarity index 100%
rename from src/com/miz/db/DbAdapterTvShowEpisodeMappings.java
rename to app/src/main/java/com/miz/db/DbAdapterTvShowEpisodeMappings.java
index b8b4d199..9195ea4d 100644
--- a/src/com/miz/db/DbAdapterTvShowEpisodeMappings.java
+++ b/app/src/main/java/com/miz/db/DbAdapterTvShowEpisodeMappings.java
@@ -16,14 +16,14 @@
package com.miz.db;
-import java.util.ArrayList;
+import android.content.ContentValues;
+import android.content.Context;
+import android.database.Cursor;
import com.miz.functions.MizLib;
import com.miz.mizuu.MizuuApplication;
-import android.content.ContentValues;
-import android.content.Context;
-import android.database.Cursor;
+import java.util.ArrayList;
public class DbAdapterTvShowEpisodeMappings extends AbstractDbAdapter {
diff --git a/src/com/miz/db/DbAdapterTvShowEpisodes.java b/app/src/main/java/com/miz/db/DbAdapterTvShowEpisodes.java
similarity index 100%
rename from src/com/miz/db/DbAdapterTvShowEpisodes.java
rename to app/src/main/java/com/miz/db/DbAdapterTvShowEpisodes.java
index 4ed0119e..3b9a4dd4 100644
--- a/src/com/miz/db/DbAdapterTvShowEpisodes.java
+++ b/app/src/main/java/com/miz/db/DbAdapterTvShowEpisodes.java
@@ -16,10 +16,9 @@
package com.miz.db;
-import java.io.File;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
+import android.content.ContentValues;
+import android.content.Context;
+import android.database.Cursor;
import com.miz.functions.ColumnIndexCache;
import com.miz.functions.EpisodeCounter;
@@ -28,9 +27,10 @@
import com.miz.mizuu.MizuuApplication;
import com.miz.utils.FileUtils;
-import android.content.ContentValues;
-import android.content.Context;
-import android.database.Cursor;
+import java.io.File;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
public class DbAdapterTvShowEpisodes extends AbstractDbAdapter {
diff --git a/src/com/miz/db/DbAdapterTvShows.java b/app/src/main/java/com/miz/db/DbAdapterTvShows.java
similarity index 100%
rename from src/com/miz/db/DbAdapterTvShows.java
rename to app/src/main/java/com/miz/db/DbAdapterTvShows.java
index 6620c9a6..953e980e 100644
--- a/src/com/miz/db/DbAdapterTvShows.java
+++ b/app/src/main/java/com/miz/db/DbAdapterTvShows.java
@@ -16,13 +16,13 @@
package com.miz.db;
-import java.util.ArrayList;
-
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.text.TextUtils;
+import java.util.ArrayList;
+
public class DbAdapterTvShows extends AbstractDbAdapter {
public static final String KEY_SHOW_ID = "show_id";
diff --git a/src/com/miz/filesources/BrowserFile.java b/app/src/main/java/com/miz/filesources/BrowserFile.java
similarity index 100%
rename from src/com/miz/filesources/BrowserFile.java
rename to app/src/main/java/com/miz/filesources/BrowserFile.java
index 8f2a8a09..bc26f966 100644
--- a/src/com/miz/filesources/BrowserFile.java
+++ b/app/src/main/java/com/miz/filesources/BrowserFile.java
@@ -16,6 +16,12 @@
package com.miz.filesources;
+import android.util.Log;
+
+import com.miz.abstractclasses.AbstractFileSourceBrowser;
+import com.miz.functions.BrowserFileObject;
+import com.miz.functions.MizLib;
+
import java.io.File;
import java.util.ArrayList;
import java.util.Collections;
@@ -23,12 +29,6 @@
import java.util.List;
import java.util.Locale;
-import android.util.Log;
-
-import com.miz.abstractclasses.AbstractFileSourceBrowser;
-import com.miz.functions.BrowserFileObject;
-import com.miz.functions.MizLib;
-
public class BrowserFile extends AbstractFileSourceBrowser {
public BrowserFile(File folder) {
diff --git a/src/com/miz/filesources/BrowserSmb.java b/app/src/main/java/com/miz/filesources/BrowserSmb.java
similarity index 100%
rename from src/com/miz/filesources/BrowserSmb.java
rename to app/src/main/java/com/miz/filesources/BrowserSmb.java
index 0084ccda..a48c7dd3 100644
--- a/src/com/miz/filesources/BrowserSmb.java
+++ b/app/src/main/java/com/miz/filesources/BrowserSmb.java
@@ -16,6 +16,12 @@
package com.miz.filesources;
+import android.util.Log;
+
+import com.miz.abstractclasses.AbstractFileSourceBrowser;
+import com.miz.functions.BrowserFileObject;
+import com.miz.functions.MizLib;
+
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
@@ -24,12 +30,6 @@
import jcifs.smb.SmbFile;
-import android.util.Log;
-
-import com.miz.abstractclasses.AbstractFileSourceBrowser;
-import com.miz.functions.BrowserFileObject;
-import com.miz.functions.MizLib;
-
public class BrowserSmb extends AbstractFileSourceBrowser {
public BrowserSmb(SmbFile folder) {
diff --git a/src/com/miz/filesources/BrowserUpnp.java b/app/src/main/java/com/miz/filesources/BrowserUpnp.java
similarity index 100%
rename from src/com/miz/filesources/BrowserUpnp.java
rename to app/src/main/java/com/miz/filesources/BrowserUpnp.java
index d6857dad..e4d5c345 100644
--- a/src/com/miz/filesources/BrowserUpnp.java
+++ b/app/src/main/java/com/miz/filesources/BrowserUpnp.java
@@ -16,13 +16,13 @@
package com.miz.filesources;
-import java.util.HashMap;
+import com.miz.abstractclasses.AbstractFileSourceBrowser;
import org.teleal.cling.model.meta.Device;
import org.teleal.cling.model.meta.Service;
import org.teleal.cling.support.model.container.Container;
-import com.miz.abstractclasses.AbstractFileSourceBrowser;
+import java.util.HashMap;
public class BrowserUpnp extends AbstractFileSourceBrowser> {
diff --git a/src/com/miz/filesources/FileMovie.java b/app/src/main/java/com/miz/filesources/FileMovie.java
similarity index 85%
rename from src/com/miz/filesources/FileMovie.java
rename to app/src/main/java/com/miz/filesources/FileMovie.java
index f72ca5a6..aa1a31a7 100644
--- a/src/com/miz/filesources/FileMovie.java
+++ b/app/src/main/java/com/miz/filesources/FileMovie.java
@@ -16,35 +16,36 @@
package com.miz.filesources;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Locale;
-import java.util.TreeSet;
-
import android.content.Context;
import android.database.Cursor;
import com.miz.abstractclasses.MovieFileSource;
-import com.miz.db.DbAdapterMovies;
import com.miz.db.DbAdapterMovieMappings;
+import com.miz.db.DbAdapterMovies;
import com.miz.functions.ColumnIndexCache;
import com.miz.functions.DbMovie;
import com.miz.functions.FileSource;
import com.miz.functions.MizLib;
import com.miz.mizuu.MizuuApplication;
+import com.miz.utils.MovieDatabaseUtils;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Locale;
+import java.util.TreeSet;
public class FileMovie extends MovieFileSource {
private HashMap existingMovies = new HashMap();
private File tempFile;
- public FileMovie(Context context, FileSource fileSource, boolean ignoreRemovedFiles, boolean subFolderSearch, boolean clearLibrary, boolean disableEthernetWiFiCheck) {
- super(context, fileSource, ignoreRemovedFiles, subFolderSearch, clearLibrary, disableEthernetWiFiCheck);
+ public FileMovie(Context context, FileSource fileSource, boolean subFolderSearch, boolean clearLibrary, boolean disableEthernetWiFiCheck) {
+ super(context, fileSource, subFolderSearch, clearLibrary, disableEthernetWiFiCheck);
}
@Override
@@ -58,7 +59,7 @@ public void removeUnidentifiedFiles() {
if (!dbMovies.get(i).isNetworkFile() && !dbMovies.get(i).isUpnpFile()) {
temp = new File(dbMovies.get(i).getFilepath());
if (temp.exists() && dbMovies.get(i).isUnidentified())
- db.deleteMovie(dbMovies.get(i).getTmdbId());
+ MovieDatabaseUtils.deleteMovie(mContext, dbMovies.get(i).getTmdbId());
}
}
}
@@ -66,39 +67,25 @@ public void removeUnidentifiedFiles() {
@Override
public void removeUnavailableFiles() {
DbAdapterMovies db = MizuuApplication.getMovieAdapter();
- List dbMovies = getDbMovies(), deletedMovies = new ArrayList();
+ List dbMovies = getDbMovies();
- boolean deleted;
File temp;
int count = dbMovies.size();
for (int i = 0; i < count; i++) {
if (!dbMovies.get(i).isNetworkFile()) {
temp = new File(dbMovies.get(i).getFilepath());
if (!temp.exists()) {
- deleted = db.deleteMovie(dbMovies.get(i).getTmdbId());
- if (deleted)
- deletedMovies.add(dbMovies.get(i));
+ MovieDatabaseUtils.deleteMovie(mContext, dbMovies.get(i).getTmdbId());
}
}
}
-
- count = deletedMovies.size();
- for (int i = 0; i < count; i++) {
- if (!db.movieExists(deletedMovies.get(i).getTmdbId())) {
- MizLib.deleteFile(new File(deletedMovies.get(i).getThumbnail()));
- MizLib.deleteFile(new File(deletedMovies.get(i).getBackdrop()));
- }
- }
-
- // Clean up
- deletedMovies.clear();
}
@Override
public List searchFolder() {
DbAdapterMovieMappings dbHelper = MizuuApplication.getMovieMappingAdapter();
- Cursor cursor = dbHelper.getAllFilepaths(ignoreRemovedFiles()); // Query database to return all filepaths in a cursor
+ Cursor cursor = dbHelper.getAllFilepaths(false); // Query database to return all filepaths in a cursor
ColumnIndexCache cache = new ColumnIndexCache();
try {
diff --git a/src/com/miz/filesources/FileTvShow.java b/app/src/main/java/com/miz/filesources/FileTvShow.java
similarity index 95%
rename from src/com/miz/filesources/FileTvShow.java
rename to app/src/main/java/com/miz/filesources/FileTvShow.java
index a2226f88..6fafaa65 100644
--- a/src/com/miz/filesources/FileTvShow.java
+++ b/app/src/main/java/com/miz/filesources/FileTvShow.java
@@ -16,33 +16,33 @@
package com.miz.filesources;
-import java.io.File;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.TreeSet;
-
import android.content.Context;
import android.database.Cursor;
import com.miz.abstractclasses.TvShowFileSource;
import com.miz.db.DbAdapterTvShowEpisodeMappings;
-import com.miz.db.DbAdapterTvShows;
import com.miz.db.DbAdapterTvShowEpisodes;
+import com.miz.db.DbAdapterTvShows;
import com.miz.functions.ColumnIndexCache;
import com.miz.functions.DbEpisode;
import com.miz.functions.FileSource;
import com.miz.functions.MizLib;
import com.miz.mizuu.MizuuApplication;
+import java.io.File;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.TreeSet;
+
public class FileTvShow extends TvShowFileSource {
private HashMap existingEpisodes = new HashMap();
private File tempFile;
- public FileTvShow(Context context, FileSource fileSource, boolean ignoreRemovedFiles, boolean subFolderSearch, boolean clearLibrary, boolean disableEthernetWiFiCheck) {
- super(context, fileSource, ignoreRemovedFiles, subFolderSearch, clearLibrary, disableEthernetWiFiCheck);
+ public FileTvShow(Context context, FileSource fileSource, boolean subFolderSearch, boolean clearLibrary, boolean disableEthernetWiFiCheck) {
+ super(context, fileSource, subFolderSearch, clearLibrary, disableEthernetWiFiCheck);
}
@Override
@@ -69,7 +69,7 @@ public void removeUnavailableFiles() {
DbAdapterTvShowEpisodes db = MizuuApplication.getTvEpisodeDbAdapter();
ColumnIndexCache cache = new ColumnIndexCache();
- Cursor tempCursor = db.getAllEpisodesInDatabase(ignoreRemovedFiles());
+ Cursor tempCursor = db.getAllEpisodesInDatabase(false);
if (tempCursor == null)
return;
diff --git a/src/com/miz/filesources/SmbMovie.java b/app/src/main/java/com/miz/filesources/SmbMovie.java
similarity index 87%
rename from src/com/miz/filesources/SmbMovie.java
rename to app/src/main/java/com/miz/filesources/SmbMovie.java
index 505596e0..dde970c7 100644
--- a/src/com/miz/filesources/SmbMovie.java
+++ b/app/src/main/java/com/miz/filesources/SmbMovie.java
@@ -16,36 +16,37 @@
package com.miz.filesources;
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Locale;
-import java.util.TreeSet;
-
-import jcifs.smb.SmbException;
-import jcifs.smb.SmbFile;
import android.content.Context;
import android.database.Cursor;
import com.miz.abstractclasses.MovieFileSource;
-import com.miz.db.DbAdapterMovies;
import com.miz.db.DbAdapterMovieMappings;
+import com.miz.db.DbAdapterMovies;
import com.miz.functions.ColumnIndexCache;
import com.miz.functions.DbMovie;
import com.miz.functions.FileSource;
import com.miz.functions.MizLib;
import com.miz.mizuu.MizuuApplication;
+import com.miz.utils.MovieDatabaseUtils;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Locale;
+import java.util.TreeSet;
+
+import jcifs.smb.SmbException;
+import jcifs.smb.SmbFile;
public class SmbMovie extends MovieFileSource {
private HashMap existingMovies = new HashMap();
private SmbFile tempSmbFile;
- public SmbMovie(Context context, FileSource fileSource, boolean ignoreRemovedFiles, boolean subFolderSearch, boolean clearLibrary, boolean disableEthernetWiFiCheck) {
- super(context, fileSource, ignoreRemovedFiles, subFolderSearch, clearLibrary, disableEthernetWiFiCheck);
+ public SmbMovie(Context context, FileSource fileSource, boolean subFolderSearch, boolean clearLibrary, boolean disableEthernetWiFiCheck) {
+ super(context, fileSource, subFolderSearch, clearLibrary, disableEthernetWiFiCheck);
}
@Override
@@ -72,7 +73,7 @@ public void removeUnidentifiedFiles() {
if (source == null) {
if (dbMovies.get(i).isUnidentified())
- db.deleteMovie(dbMovies.get(i).getTmdbId());
+ MovieDatabaseUtils.deleteMovie(mContext, dbMovies.get(i).getTmdbId());
continue;
}
@@ -86,7 +87,7 @@ public void removeUnidentifiedFiles() {
));
if (temp.exists() && dbMovies.get(i).isUnidentified())
- db.deleteMovie(dbMovies.get(i).getTmdbId());
+ MovieDatabaseUtils.deleteMovie(mContext, dbMovies.get(i).getTmdbId());
} catch (Exception e) {} // Do nothing - the file isn't available (either MalformedURLException or SmbException)
}
}
@@ -96,7 +97,7 @@ public void removeUnidentifiedFiles() {
@Override
public void removeUnavailableFiles() {
DbAdapterMovies db = MizuuApplication.getMovieAdapter();
- List dbMovies = getDbMovies(), deletedMovies = new ArrayList();
+ List dbMovies = getDbMovies();
ArrayList filesources = MizLib.getFileSources(MizLib.TYPE_MOVIE, true);
FileSource source;
@@ -116,9 +117,7 @@ public void removeUnavailableFiles() {
}
if (source == null) {
- deleted = db.deleteMovie(dbMovies.get(i).getTmdbId());
- if (deleted)
- deletedMovies.add(dbMovies.get(i));
+ MovieDatabaseUtils.deleteMovie(mContext, dbMovies.get(i).getTmdbId());
continue;
}
@@ -132,25 +131,14 @@ public void removeUnavailableFiles() {
));
if (!temp.exists()) {
- deleted = db.deleteMovie(dbMovies.get(i).getTmdbId());
- if (deleted)
- deletedMovies.add(dbMovies.get(i));
+ MovieDatabaseUtils.deleteMovie(mContext, dbMovies.get(i).getTmdbId());
}
} catch (Exception e) {} // Do nothing - the file isn't available (either MalformedURLException or SmbException)
}
}
}
- count = deletedMovies.size();
- for (int i = 0; i < count; i++) {
- if (!db.movieExists(deletedMovies.get(i).getTmdbId())) {
- MizLib.deleteFile(new File(deletedMovies.get(i).getThumbnail()));
- MizLib.deleteFile(new File(deletedMovies.get(i).getBackdrop()));
- }
- }
-
// Clean up
- deletedMovies.clear();
filesources.clear();
}
@@ -160,7 +148,7 @@ public List searchFolder() {
return new ArrayList(); // Return empty List
DbAdapterMovieMappings dbHelper = MizuuApplication.getMovieMappingAdapter();
- Cursor cursor = dbHelper.getAllFilepaths(ignoreRemovedFiles()); // Query database to return all filepaths in a cursor
+ Cursor cursor = dbHelper.getAllFilepaths(false); // Query database to return all filepaths in a cursor
ColumnIndexCache cache = new ColumnIndexCache();
try {
diff --git a/src/com/miz/filesources/SmbTvShow.java b/app/src/main/java/com/miz/filesources/SmbTvShow.java
similarity index 96%
rename from src/com/miz/filesources/SmbTvShow.java
rename to app/src/main/java/com/miz/filesources/SmbTvShow.java
index 3efd3908..d5692334 100644
--- a/src/com/miz/filesources/SmbTvShow.java
+++ b/app/src/main/java/com/miz/filesources/SmbTvShow.java
@@ -16,35 +16,36 @@
package com.miz.filesources;
-import java.io.File;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.TreeSet;
-
-import jcifs.smb.SmbException;
-import jcifs.smb.SmbFile;
import android.content.Context;
import android.database.Cursor;
import com.miz.abstractclasses.TvShowFileSource;
import com.miz.db.DbAdapterTvShowEpisodeMappings;
-import com.miz.db.DbAdapterTvShows;
import com.miz.db.DbAdapterTvShowEpisodes;
+import com.miz.db.DbAdapterTvShows;
import com.miz.functions.ColumnIndexCache;
import com.miz.functions.DbEpisode;
import com.miz.functions.FileSource;
import com.miz.functions.MizLib;
import com.miz.mizuu.MizuuApplication;
+import java.io.File;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.TreeSet;
+
+import jcifs.smb.SmbException;
+import jcifs.smb.SmbFile;
+
public class SmbTvShow extends TvShowFileSource {
private HashMap existingEpisodes = new HashMap();
private SmbFile tempSmbFile;
- public SmbTvShow(Context context, FileSource fileSource, boolean ignoreRemovedFiles, boolean subFolderSearch, boolean clearLibrary, boolean disableEthernetWiFiCheck) {
- super(context, fileSource, ignoreRemovedFiles, subFolderSearch, clearLibrary, disableEthernetWiFiCheck);
+ public SmbTvShow(Context context, FileSource fileSource, boolean subFolderSearch, boolean clearLibrary, boolean disableEthernetWiFiCheck) {
+ super(context, fileSource, subFolderSearch, clearLibrary, disableEthernetWiFiCheck);
}
@Override
@@ -98,7 +99,7 @@ public void removeUnavailableFiles() {
DbAdapterTvShowEpisodes db = MizuuApplication.getTvEpisodeDbAdapter();
ColumnIndexCache cache = new ColumnIndexCache();
- Cursor tempCursor = db.getAllEpisodesInDatabase(ignoreRemovedFiles());
+ Cursor tempCursor = db.getAllEpisodesInDatabase(false);
if (tempCursor == null)
return;
diff --git a/src/com/miz/filesources/UpnpMovie.java b/app/src/main/java/com/miz/filesources/UpnpMovie.java
similarity index 91%
rename from src/com/miz/filesources/UpnpMovie.java
rename to app/src/main/java/com/miz/filesources/UpnpMovie.java
index 58d64380..56688dcc 100644
--- a/src/com/miz/filesources/UpnpMovie.java
+++ b/app/src/main/java/com/miz/filesources/UpnpMovie.java
@@ -16,15 +16,24 @@
package com.miz.filesources;
-import java.io.File;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Locale;
-import java.util.TreeSet;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
+import android.content.ComponentName;
+import android.content.Context;
+import android.content.Intent;
+import android.content.ServiceConnection;
+import android.database.Cursor;
+import android.os.IBinder;
+import android.text.TextUtils;
+
+import com.miz.abstractclasses.MovieFileSource;
+import com.miz.db.DbAdapterMovieMappings;
+import com.miz.db.DbAdapterMovies;
+import com.miz.functions.ColumnIndexCache;
+import com.miz.functions.DbMovie;
+import com.miz.functions.FileSource;
+import com.miz.functions.MizLib;
+import com.miz.mizuu.MizuuApplication;
+import com.miz.service.WireUpnpService;
+import com.miz.utils.MovieDatabaseUtils;
import org.teleal.cling.android.AndroidUpnpService;
import org.teleal.cling.model.action.ActionInvocation;
@@ -43,23 +52,14 @@
import org.teleal.cling.support.model.container.Container;
import org.teleal.cling.support.model.item.Item;
-import android.content.ComponentName;
-import android.content.Context;
-import android.content.Intent;
-import android.content.ServiceConnection;
-import android.database.Cursor;
-import android.os.IBinder;
-import android.text.TextUtils;
-
-import com.miz.abstractclasses.MovieFileSource;
-import com.miz.db.DbAdapterMovies;
-import com.miz.db.DbAdapterMovieMappings;
-import com.miz.functions.ColumnIndexCache;
-import com.miz.functions.DbMovie;
-import com.miz.functions.FileSource;
-import com.miz.functions.MizLib;
-import com.miz.mizuu.MizuuApplication;
-import com.miz.service.WireUpnpService;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Locale;
+import java.util.TreeSet;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
public class UpnpMovie extends MovieFileSource {
@@ -68,8 +68,8 @@ public class UpnpMovie extends MovieFileSource {
private CountDownLatch mLatch = new CountDownLatch(1);
private AndroidUpnpService mUpnpService;
- public UpnpMovie(Context context, FileSource fileSource, boolean ignoreRemovedFiles, boolean subFolderSearch, boolean clearLibrary, boolean disableEthernetWiFiCheck) {
- super(context, fileSource, ignoreRemovedFiles, subFolderSearch, clearLibrary, disableEthernetWiFiCheck);
+ public UpnpMovie(Context context, FileSource fileSource, boolean subFolderSearch, boolean clearLibrary, boolean disableEthernetWiFiCheck) {
+ super(context, fileSource, subFolderSearch, clearLibrary, disableEthernetWiFiCheck);
}
@Override
@@ -80,41 +80,27 @@ public void removeUnidentifiedFiles() {
int count = dbMovies.size();
for (int i = 0; i < count; i++) {
if (dbMovies.get(i).isUpnpFile() && dbMovies.get(i).isUnidentified() && MizLib.exists(dbMovies.get(i).getFilepath()))
- db.deleteMovie(dbMovies.get(i).getTmdbId());
+ MovieDatabaseUtils.deleteMovie(mContext, dbMovies.get(i).getTmdbId());
}
}
@Override
public void removeUnavailableFiles() {
DbAdapterMovies db = MizuuApplication.getMovieAdapter();
- List dbMovies = getDbMovies(), deletedMovies = new ArrayList();
+ List dbMovies = getDbMovies();
- boolean deleted;
int count = dbMovies.size();
for (int i = 0; i < count; i++) {
if (dbMovies.get(i).isUpnpFile() && !MizLib.exists(dbMovies.get(i).getFilepath())) {
- deleted = db.deleteMovie(dbMovies.get(i).getTmdbId());
- if (deleted)
- deletedMovies.add(dbMovies.get(i));
+ MovieDatabaseUtils.deleteMovie(mContext, dbMovies.get(i).getTmdbId());
}
}
-
- count = deletedMovies.size();
- for (int i = 0; i < count; i++) {
- if (!db.movieExists(deletedMovies.get(i).getTmdbId())) {
- MizLib.deleteFile(new File(deletedMovies.get(i).getThumbnail()));
- MizLib.deleteFile(new File(deletedMovies.get(i).getBackdrop()));
- }
- }
-
- // Clean up
- deletedMovies.clear();
}
@Override
public List searchFolder() {
DbAdapterMovieMappings dbHelper = MizuuApplication.getMovieMappingAdapter();
- Cursor cursor = dbHelper.getAllFilepaths(ignoreRemovedFiles()); // Query database to return all filepaths in a cursor
+ Cursor cursor = dbHelper.getAllFilepaths(false); // Query database to return all filepaths in a cursor
ColumnIndexCache cache = new ColumnIndexCache();
try {
diff --git a/src/com/miz/filesources/UpnpTvShow.java b/app/src/main/java/com/miz/filesources/UpnpTvShow.java
similarity index 97%
rename from src/com/miz/filesources/UpnpTvShow.java
rename to app/src/main/java/com/miz/filesources/UpnpTvShow.java
index 6a5ebf97..8a82e081 100644
--- a/src/com/miz/filesources/UpnpTvShow.java
+++ b/app/src/main/java/com/miz/filesources/UpnpTvShow.java
@@ -16,14 +16,24 @@
package com.miz.filesources;
-import java.io.File;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.TreeSet;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
+import android.content.ComponentName;
+import android.content.Context;
+import android.content.Intent;
+import android.content.ServiceConnection;
+import android.database.Cursor;
+import android.os.IBinder;
+import android.text.TextUtils;
+
+import com.miz.abstractclasses.TvShowFileSource;
+import com.miz.db.DbAdapterTvShowEpisodeMappings;
+import com.miz.db.DbAdapterTvShowEpisodes;
+import com.miz.db.DbAdapterTvShows;
+import com.miz.functions.ColumnIndexCache;
+import com.miz.functions.DbEpisode;
+import com.miz.functions.FileSource;
+import com.miz.functions.MizLib;
+import com.miz.mizuu.MizuuApplication;
+import com.miz.service.WireUpnpService;
import org.teleal.cling.android.AndroidUpnpService;
import org.teleal.cling.model.action.ActionInvocation;
@@ -42,24 +52,14 @@
import org.teleal.cling.support.model.container.Container;
import org.teleal.cling.support.model.item.Item;
-import android.content.ComponentName;
-import android.content.Context;
-import android.content.Intent;
-import android.content.ServiceConnection;
-import android.database.Cursor;
-import android.os.IBinder;
-import android.text.TextUtils;
-
-import com.miz.abstractclasses.TvShowFileSource;
-import com.miz.db.DbAdapterTvShowEpisodeMappings;
-import com.miz.db.DbAdapterTvShows;
-import com.miz.db.DbAdapterTvShowEpisodes;
-import com.miz.functions.ColumnIndexCache;
-import com.miz.functions.DbEpisode;
-import com.miz.functions.FileSource;
-import com.miz.functions.MizLib;
-import com.miz.mizuu.MizuuApplication;
-import com.miz.service.WireUpnpService;
+import java.io.File;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.TreeSet;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
public class UpnpTvShow extends TvShowFileSource {
@@ -68,8 +68,8 @@ public class UpnpTvShow extends TvShowFileSource {
private CountDownLatch mLatch = new CountDownLatch(1);
private AndroidUpnpService mUpnpService;
- public UpnpTvShow(Context context, FileSource fileSource, boolean ignoreRemovedFiles, boolean subFolderSearch, boolean clearLibrary, boolean disableEthernetWiFiCheck) {
- super(context, fileSource, ignoreRemovedFiles, subFolderSearch, clearLibrary, disableEthernetWiFiCheck);
+ public UpnpTvShow(Context context, FileSource fileSource, boolean subFolderSearch, boolean clearLibrary, boolean disableEthernetWiFiCheck) {
+ super(context, fileSource, subFolderSearch, clearLibrary, disableEthernetWiFiCheck);
}
@Override
@@ -93,7 +93,7 @@ public void removeUnavailableFiles() {
DbAdapterTvShowEpisodes db = MizuuApplication.getTvEpisodeDbAdapter();
ColumnIndexCache cache = new ColumnIndexCache();
- Cursor tempCursor = db.getAllEpisodesInDatabase(ignoreRemovedFiles());
+ Cursor tempCursor = db.getAllEpisodesInDatabase(false);
if (tempCursor == null)
return;
diff --git a/src/com/miz/functions/AbstractCursorLoader.java b/app/src/main/java/com/miz/functions/AbstractCursorLoader.java
similarity index 100%
rename from src/com/miz/functions/AbstractCursorLoader.java
rename to app/src/main/java/com/miz/functions/AbstractCursorLoader.java
diff --git a/src/com/miz/functions/ActionBarSpinner.java b/app/src/main/java/com/miz/functions/ActionBarSpinner.java
similarity index 99%
rename from src/com/miz/functions/ActionBarSpinner.java
rename to app/src/main/java/com/miz/functions/ActionBarSpinner.java
index fd38f0f5..13265216 100644
--- a/src/com/miz/functions/ActionBarSpinner.java
+++ b/app/src/main/java/com/miz/functions/ActionBarSpinner.java
@@ -16,8 +16,6 @@
package com.miz.functions;
-import java.util.ArrayList;
-
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
@@ -27,6 +25,8 @@
import com.miz.mizuu.R;
+import java.util.ArrayList;
+
public class ActionBarSpinner extends BaseAdapter {
private LayoutInflater mInflater;
@@ -67,7 +67,7 @@ public View getView(int position, View convertView, ViewGroup parent) {
@Override
public int getViewTypeCount() {
- return 0;
+ return 1;
}
@Override
diff --git a/src/com/miz/functions/ActionBarSpinnerViewHolder.java b/app/src/main/java/com/miz/functions/ActionBarSpinnerViewHolder.java
similarity index 100%
rename from src/com/miz/functions/ActionBarSpinnerViewHolder.java
rename to app/src/main/java/com/miz/functions/ActionBarSpinnerViewHolder.java
diff --git a/src/com/miz/functions/Actor.java b/app/src/main/java/com/miz/functions/Actor.java
similarity index 100%
rename from src/com/miz/functions/Actor.java
rename to app/src/main/java/com/miz/functions/Actor.java
diff --git a/src/com/miz/functions/AsyncTask.java b/app/src/main/java/com/miz/functions/AsyncTask.java
similarity index 98%
rename from src/com/miz/functions/AsyncTask.java
rename to app/src/main/java/com/miz/functions/AsyncTask.java
index ec456ec8..996f30a3 100644
--- a/src/com/miz/functions/AsyncTask.java
+++ b/app/src/main/java/com/miz/functions/AsyncTask.java
@@ -22,7 +22,18 @@
import android.os.Process;
import java.util.ArrayDeque;
-import java.util.concurrent.*;
+import java.util.concurrent.BlockingQueue;
+import java.util.concurrent.Callable;
+import java.util.concurrent.CancellationException;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Executor;
+import java.util.concurrent.Executors;
+import java.util.concurrent.FutureTask;
+import java.util.concurrent.LinkedBlockingQueue;
+import java.util.concurrent.ThreadFactory;
+import java.util.concurrent.ThreadPoolExecutor;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
diff --git a/src/com/miz/functions/BlurTransformation.java b/app/src/main/java/com/miz/functions/BlurTransformation.java
similarity index 100%
rename from src/com/miz/functions/BlurTransformation.java
rename to app/src/main/java/com/miz/functions/BlurTransformation.java
diff --git a/src/com/miz/functions/BrowserFileObject.java b/app/src/main/java/com/miz/functions/BrowserFileObject.java
similarity index 100%
rename from src/com/miz/functions/BrowserFileObject.java
rename to app/src/main/java/com/miz/functions/BrowserFileObject.java
diff --git a/src/com/miz/functions/ColumnIndexCache.java b/app/src/main/java/com/miz/functions/ColumnIndexCache.java
similarity index 100%
rename from src/com/miz/functions/ColumnIndexCache.java
rename to app/src/main/java/com/miz/functions/ColumnIndexCache.java
index befc325e..f3b30766 100644
--- a/src/com/miz/functions/ColumnIndexCache.java
+++ b/app/src/main/java/com/miz/functions/ColumnIndexCache.java
@@ -16,10 +16,10 @@
package com.miz.functions;
-import java.util.HashMap;
-
import android.database.Cursor;
+import java.util.HashMap;
+
public class ColumnIndexCache {
private HashMap mMap = new HashMap();
diff --git a/src/com/miz/functions/CompleteActor.java b/app/src/main/java/com/miz/functions/CompleteActor.java
similarity index 91%
rename from src/com/miz/functions/CompleteActor.java
rename to app/src/main/java/com/miz/functions/CompleteActor.java
index 941ec62b..ef7dd06f 100644
--- a/src/com/miz/functions/CompleteActor.java
+++ b/app/src/main/java/com/miz/functions/CompleteActor.java
@@ -16,17 +16,17 @@
package com.miz.functions;
+import android.text.TextUtils;
+
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Random;
-import android.text.TextUtils;
-
public class CompleteActor {
private final String mId;
- private String mName, mBirthday, mDayOfDeath, mPlaceOfBirth, mProfilePhoto, mBiography;
+ private String mName, mBirthday, mDayOfDeath, mPlaceOfBirth, mProfilePhoto, mProfilePhotoThumb, mBiography;
private int mKnownCreditCount;
private List mMovies = new ArrayList(), mTvShows = new ArrayList();
private List mPhotos = new ArrayList(), mTaggedPhotos = new ArrayList();
@@ -92,6 +92,16 @@ public String getProfilePhoto() {
return null;
return mProfilePhoto;
}
+
+ public void setProfilePhotoThumb(String photo) {
+ mProfilePhotoThumb = photo;
+ }
+
+ public String getProfilePhotoThumb() {
+ if (TextUtils.isEmpty(mProfilePhotoThumb))
+ return getProfilePhoto();
+ return mProfilePhotoThumb;
+ }
public void setKnownCreditCount(int count) {
mKnownCreditCount = count;
diff --git a/src/com/miz/functions/ContentItem.java b/app/src/main/java/com/miz/functions/ContentItem.java
similarity index 100%
rename from src/com/miz/functions/ContentItem.java
rename to app/src/main/java/com/miz/functions/ContentItem.java
diff --git a/src/com/miz/functions/Cover.java b/app/src/main/java/com/miz/functions/Cover.java
similarity index 100%
rename from src/com/miz/functions/Cover.java
rename to app/src/main/java/com/miz/functions/Cover.java
diff --git a/src/com/miz/functions/CoverItem.java b/app/src/main/java/com/miz/functions/CoverItem.java
similarity index 100%
rename from src/com/miz/functions/CoverItem.java
rename to app/src/main/java/com/miz/functions/CoverItem.java
diff --git a/src/com/miz/functions/DbEpisode.java b/app/src/main/java/com/miz/functions/DbEpisode.java
similarity index 100%
rename from src/com/miz/functions/DbEpisode.java
rename to app/src/main/java/com/miz/functions/DbEpisode.java
index fae660fb..74c0a488 100644
--- a/src/com/miz/functions/DbEpisode.java
+++ b/app/src/main/java/com/miz/functions/DbEpisode.java
@@ -16,11 +16,11 @@
package com.miz.functions;
+import android.content.Context;
+
import com.miz.db.DbAdapterTvShows;
import com.miz.utils.FileUtils;
-import android.content.Context;
-
public class DbEpisode {
private final Context mContext;
diff --git a/src/com/miz/functions/DbMovie.java b/app/src/main/java/com/miz/functions/DbMovie.java
similarity index 100%
rename from src/com/miz/functions/DbMovie.java
rename to app/src/main/java/com/miz/functions/DbMovie.java
index 5c893ad9..4c47f458 100644
--- a/src/com/miz/functions/DbMovie.java
+++ b/app/src/main/java/com/miz/functions/DbMovie.java
@@ -16,12 +16,12 @@
package com.miz.functions;
-import java.io.File;
+import android.content.Context;
+import android.text.TextUtils;
import com.miz.utils.FileUtils;
-import android.content.Context;
-import android.text.TextUtils;
+import java.io.File;
public class DbMovie {
diff --git a/src/com/miz/functions/DeviceItem.java b/app/src/main/java/com/miz/functions/DeviceItem.java
similarity index 100%
rename from src/com/miz/functions/DeviceItem.java
rename to app/src/main/java/com/miz/functions/DeviceItem.java
index 9de4fa1d..5a7bec02 100644
--- a/src/com/miz/functions/DeviceItem.java
+++ b/app/src/main/java/com/miz/functions/DeviceItem.java
@@ -17,11 +17,11 @@
package com.miz.functions;
+import android.graphics.drawable.Drawable;
+
import org.teleal.cling.model.meta.Device;
import org.teleal.cling.model.types.UDN;
-import android.graphics.drawable.Drawable;
-
/**
* Wraps a Device for display with icon and label. Equality is
* implemented with UDN comparison.
diff --git a/src/com/miz/functions/EpisodeCounter.java b/app/src/main/java/com/miz/functions/EpisodeCounter.java
similarity index 100%
rename from src/com/miz/functions/EpisodeCounter.java
rename to app/src/main/java/com/miz/functions/EpisodeCounter.java
diff --git a/src/com/miz/functions/FileRequestTransformer.java b/app/src/main/java/com/miz/functions/FileRequestTransformer.java
similarity index 94%
rename from src/com/miz/functions/FileRequestTransformer.java
rename to app/src/main/java/com/miz/functions/FileRequestTransformer.java
index 444f5ef7..33fde9b5 100644
--- a/src/com/miz/functions/FileRequestTransformer.java
+++ b/app/src/main/java/com/miz/functions/FileRequestTransformer.java
@@ -30,6 +30,9 @@
public class FileRequestTransformer implements Picasso.RequestTransformer {
@Override
public Request transformRequest(Request arg0) {
+ if (arg0.resourceId > 0)
+ return arg0;
+
return arg0.buildUpon().setUri(Uri.parse(arg0.uri.toString().replace("file://", "/"))).build();
}
}
\ No newline at end of file
diff --git a/src/com/miz/functions/FileSource.java b/app/src/main/java/com/miz/functions/FileSource.java
similarity index 100%
rename from src/com/miz/functions/FileSource.java
rename to app/src/main/java/com/miz/functions/FileSource.java
index 054846e2..47f14c35 100644
--- a/src/com/miz/functions/FileSource.java
+++ b/app/src/main/java/com/miz/functions/FileSource.java
@@ -16,10 +16,10 @@
package com.miz.functions;
-import java.io.File;
-
import com.miz.db.DbAdapterSources;
+import java.io.File;
+
public class FileSource {
public static final int FILE = 0, SMB = 1, UPNP = 2;
diff --git a/src/com/miz/functions/Filepath.java b/app/src/main/java/com/miz/functions/Filepath.java
similarity index 100%
rename from src/com/miz/functions/Filepath.java
rename to app/src/main/java/com/miz/functions/Filepath.java
diff --git a/src/com/miz/functions/GridEpisode.java b/app/src/main/java/com/miz/functions/GridEpisode.java
similarity index 100%
rename from src/com/miz/functions/GridEpisode.java
rename to app/src/main/java/com/miz/functions/GridEpisode.java
index 36aa8dda..f1177ef1 100644
--- a/src/com/miz/functions/GridEpisode.java
+++ b/app/src/main/java/com/miz/functions/GridEpisode.java
@@ -16,16 +16,16 @@
package com.miz.functions;
-import static com.miz.functions.PreferenceKeys.TVSHOWS_EPISODE_ORDER;
-
-import java.io.File;
-
import android.content.Context;
import android.preference.PreferenceManager;
import android.text.TextUtils;
import com.miz.mizuu.R;
+import java.io.File;
+
+import static com.miz.functions.PreferenceKeys.TVSHOWS_EPISODE_ORDER;
+
public class GridEpisode implements Comparable {
private Context mContext;
diff --git a/src/com/miz/functions/GridSeason.java b/app/src/main/java/com/miz/functions/GridSeason.java
similarity index 81%
rename from src/com/miz/functions/GridSeason.java
rename to app/src/main/java/com/miz/functions/GridSeason.java
index 83f30ae1..b98c9dd9 100644
--- a/src/com/miz/functions/GridSeason.java
+++ b/app/src/main/java/com/miz/functions/GridSeason.java
@@ -16,12 +16,12 @@
package com.miz.functions;
-import java.io.File;
+import android.content.Context;
+import android.preference.PreferenceManager;
import com.miz.mizuu.R;
-import android.content.Context;
-import android.preference.PreferenceManager;
+import java.io.File;
import static com.miz.functions.PreferenceKeys.TVSHOWS_COLLECTION_LAYOUT;
import static com.miz.functions.PreferenceKeys.TVSHOWS_SEASON_ORDER;
@@ -29,20 +29,24 @@
public class GridSeason implements Comparable {
private Context mContext;
- private String mSubtitleText;
+ private String mShowId, mHeaderText, mSubtitleText, mSubtitleTextSimple;
private int mSeason, mEpisodeCount, mWatchedCount;
private boolean mUseGridView;
private File mCover;
- public GridSeason(Context context, int season, int episodeCount, int watchedCount, File cover) {
+ public GridSeason(Context context, String showId, int season, int episodeCount, int watchedCount, File cover) {
mContext = context;
+ mShowId = showId;
mSeason = season;
mEpisodeCount = episodeCount;
mWatchedCount = watchedCount;
mCover = cover;
mUseGridView = PreferenceManager.getDefaultSharedPreferences(mContext).getString(TVSHOWS_COLLECTION_LAYOUT, mContext.getString(R.string.gridView)).equals(mContext.getString(R.string.gridView));
-
+
+ // Header text
+ mHeaderText = (mSeason == 0) ? context.getString(R.string.stringSpecials) : context.getString(R.string.showSeason) + " " + getSeasonZeroIndex();
+
// Subtitle text
StringBuilder sb = new StringBuilder();
sb.append(getEpisodeCount()).append(" ").append(mContext.getResources().getQuantityString(R.plurals.episodes, getEpisodeCount(), getEpisodeCount()));
@@ -56,8 +60,10 @@ else if (MizLib.isTablet(mContext)) // Small tablets (23 left)
else // Phones (23)
sb.append(" (" + getUnwatchedCount() + ")");
}
-
+
mSubtitleText = sb.toString();
+
+ mSubtitleTextSimple = getEpisodeCount() + " " + mContext.getResources().getQuantityString(R.plurals.episodes, getEpisodeCount(), getEpisodeCount());
}
public int getSeason() {
@@ -79,15 +85,27 @@ public int getWatchedCount() {
public int getUnwatchedCount() {
return mEpisodeCount - mWatchedCount;
}
-
+
+ public String getHeaderText() {
+ return mHeaderText;
+ }
+
public String getSubtitleText() {
return mSubtitleText;
}
+ public String getSimpleSubtitleText() {
+ return mSubtitleTextSimple;
+ }
+
public File getCover() {
return mCover;
}
+ public String getShowId() {
+ return mShowId;
+ }
+
/**
* Custom comparator in order to put regular seasons before specials.
* The comparator takes the user's sorting preference into consideration
diff --git a/app/src/main/java/com/miz/functions/IntentKeys.java b/app/src/main/java/com/miz/functions/IntentKeys.java
new file mode 100644
index 00000000..cd2cb2c9
--- /dev/null
+++ b/app/src/main/java/com/miz/functions/IntentKeys.java
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) 2014 Michell Bak
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.miz.functions;
+
+/**
+ * Simple class to hold keys for Intent keys. This should
+ * always be used when dealing with Intents. Scattered keys
+ * across the app? No thank you.
+ * @author Michell
+ *
+ */
+public class IntentKeys {
+
+ private IntentKeys() {} // No instantiation
+
+ public static final String TOOLBAR_COLOR = "toolbarColor";
+
+}
diff --git a/src/com/miz/functions/LibrarySectionAsyncTask.java b/app/src/main/java/com/miz/functions/LibrarySectionAsyncTask.java
similarity index 98%
rename from src/com/miz/functions/LibrarySectionAsyncTask.java
rename to app/src/main/java/com/miz/functions/LibrarySectionAsyncTask.java
index d77a6bae..c500cdeb 100644
--- a/src/com/miz/functions/LibrarySectionAsyncTask.java
+++ b/app/src/main/java/com/miz/functions/LibrarySectionAsyncTask.java
@@ -22,7 +22,18 @@
import android.os.Process;
import java.util.ArrayDeque;
-import java.util.concurrent.*;
+import java.util.concurrent.BlockingQueue;
+import java.util.concurrent.Callable;
+import java.util.concurrent.CancellationException;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Executor;
+import java.util.concurrent.Executors;
+import java.util.concurrent.FutureTask;
+import java.util.concurrent.LinkedBlockingQueue;
+import java.util.concurrent.ThreadFactory;
+import java.util.concurrent.ThreadPoolExecutor;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
diff --git a/src/com/miz/functions/MediumMovie.java b/app/src/main/java/com/miz/functions/MediumMovie.java
similarity index 100%
rename from src/com/miz/functions/MediumMovie.java
rename to app/src/main/java/com/miz/functions/MediumMovie.java
index b9df4985..2dc060e0 100644
--- a/src/com/miz/functions/MediumMovie.java
+++ b/app/src/main/java/com/miz/functions/MediumMovie.java
@@ -16,10 +16,10 @@
package com.miz.functions;
-import com.miz.abstractclasses.MediumBaseMovie;
-
import android.content.Context;
+import com.miz.abstractclasses.MediumBaseMovie;
+
public class MediumMovie extends MediumBaseMovie {
public MediumMovie(Context context, String title, String tmdbId, String rating, String releasedate,
diff --git a/src/com/miz/functions/MenuItem.java b/app/src/main/java/com/miz/functions/MenuItem.java
similarity index 83%
rename from src/com/miz/functions/MenuItem.java
rename to app/src/main/java/com/miz/functions/MenuItem.java
index d3b0483b..40b1544c 100644
--- a/src/com/miz/functions/MenuItem.java
+++ b/app/src/main/java/com/miz/functions/MenuItem.java
@@ -18,11 +18,15 @@
public class MenuItem {
- public static final int HEADER = 0, SEPARATOR = 1000, SECTION = 2000, THIRD_PARTY_APP = 3000, SMALL_SECTION = 4000;
+ public static final int HEADER = 0, SEPARATOR = 1000, SEPARATOR_EXTRA_PADDING = 1100, SUB_HEADER = 1500, SECTION = 2000, THIRD_PARTY_APP = 3000, SETTINGS_AREA = 4000;
private int mType, mCount, mFragment, mIcon;
private String mTitle, mPackageName;
-
+
+ public MenuItem(int type) {
+ mType = type;
+ }
+
public MenuItem(String title, int type, int icon) {
mTitle = title;
mType = type;
@@ -36,12 +40,13 @@ public MenuItem(String title, int count, int type, String packageName) {
mPackageName = packageName;
}
- public MenuItem(String title, int count, int type, String packageName, int fragment) {
+ public MenuItem(String title, int count, int type, String packageName, int fragment, int icon) {
mTitle = title;
mCount = count;
mType = type;
mPackageName = packageName;
mFragment = fragment;
+ mIcon = icon;
}
public String getTitle() {
diff --git a/src/com/miz/functions/MizLib.java b/app/src/main/java/com/miz/functions/MizLib.java
similarity index 97%
rename from src/com/miz/functions/MizLib.java
rename to app/src/main/java/com/miz/functions/MizLib.java
index 208e7588..660f494d 100644
--- a/src/com/miz/functions/MizLib.java
+++ b/app/src/main/java/com/miz/functions/MizLib.java
@@ -16,53 +16,11 @@
package com.miz.functions;
-import static com.miz.functions.PreferenceKeys.DISABLE_ETHERNET_WIFI_CHECK;
-import static com.miz.functions.PreferenceKeys.IGNORE_FILE_SIZE;
-import static com.miz.functions.PreferenceKeys.INCLUDE_ADULT_CONTENT;
-import static com.miz.functions.PreferenceKeys.SCHEDULED_UPDATES_MOVIE;
-import static com.miz.functions.PreferenceKeys.SCHEDULED_UPDATES_TVSHOWS;
-import static com.miz.functions.PreferenceKeys.TMDB_BASE_URL;
-import static com.miz.functions.PreferenceKeys.TMDB_BASE_URL_TIME;
-import static com.miz.functions.PreferenceKeys.TRAKT_USERNAME;
-
-import android.support.v8.renderscript.*;
-
-import java.io.BufferedInputStream;
-import java.io.BufferedOutputStream;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.io.UnsupportedEncodingException;
-import java.net.HttpURLConnection;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.net.URLEncoder;
-import java.security.MessageDigest;
-import java.security.NoSuchAlgorithmException;
-import java.text.DateFormat;
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.Comparator;
-import java.util.List;
-import java.util.Locale;
-import java.util.Random;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import jcifs.smb.NtlmPasswordAuthentication;
-import jcifs.smb.SmbException;
-import jcifs.smb.SmbFile;
-
-import org.json.JSONException;
-import org.json.JSONObject;
-
import android.annotation.SuppressLint;
import android.app.ActivityManager;
+import android.app.ActivityManager.RunningServiceInfo;
import android.app.AlertDialog;
import android.app.Dialog;
-import android.app.ActivityManager.RunningServiceInfo;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
@@ -88,6 +46,10 @@
import android.os.Looper;
import android.os.StatFs;
import android.preference.PreferenceManager;
+import android.support.v8.renderscript.Allocation;
+import android.support.v8.renderscript.Element;
+import android.support.v8.renderscript.RenderScript;
+import android.support.v8.renderscript.ScriptIntrinsicBlur;
import android.text.TextUtils;
import android.util.TypedValue;
import android.view.Display;
@@ -110,12 +72,54 @@
import com.miz.service.MakeAvailableOffline;
import com.miz.service.MovieLibraryUpdate;
import com.miz.service.TvShowsLibraryUpdate;
+import com.miz.utils.FileUtils;
+import com.miz.utils.ViewUtils;
import com.squareup.okhttp.MediaType;
import com.squareup.okhttp.OkHttpClient;
import com.squareup.okhttp.Request;
import com.squareup.okhttp.RequestBody;
import com.squareup.okhttp.Response;
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.UnsupportedEncodingException;
+import java.net.HttpURLConnection;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLEncoder;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+import java.text.DateFormat;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Comparator;
+import java.util.List;
+import java.util.Locale;
+import java.util.Random;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import jcifs.smb.NtlmPasswordAuthentication;
+import jcifs.smb.SmbException;
+import jcifs.smb.SmbFile;
+
+import static com.miz.functions.PreferenceKeys.DISABLE_ETHERNET_WIFI_CHECK;
+import static com.miz.functions.PreferenceKeys.IGNORE_FILE_SIZE;
+import static com.miz.functions.PreferenceKeys.INCLUDE_ADULT_CONTENT;
+import static com.miz.functions.PreferenceKeys.SCHEDULED_UPDATES_MOVIE;
+import static com.miz.functions.PreferenceKeys.SCHEDULED_UPDATES_TVSHOWS;
+import static com.miz.functions.PreferenceKeys.TMDB_BASE_URL;
+import static com.miz.functions.PreferenceKeys.TMDB_BASE_URL_TIME;
+import static com.miz.functions.PreferenceKeys.TRAKT_USERNAME;
+
@SuppressLint("NewApi")
public class MizLib {
@@ -526,7 +530,7 @@ public static void addNavigationBarMargin(Context c, View v) {
params.setMargins(0, 0, 0, getNavigationBarHeight(c));
v.setLayoutParams(params);
}
-
+
public static boolean hasICSMR1() {
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1;
}
@@ -547,6 +551,14 @@ public static boolean hasKitKat() {
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT;
}
+ public static boolean isKitKat() {
+ return Build.VERSION.SDK_INT == Build.VERSION_CODES.KITKAT;
+ }
+
+ public static boolean hasLollipop() {
+ return Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP;
+ }
+
public static int getThumbnailNotificationSize(Context c) {
Resources r = c.getResources();
return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 64, r.getDisplayMetrics());
@@ -557,42 +569,30 @@ public static int getLargeNotificationWidth(Context c) {
return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 360, r.getDisplayMetrics());
}
- public static int getMenuWidth(Context c) {
- Resources r = c.getResources();
- if (MizLib.isTablet(c)) {
- return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 320, r.getDisplayMetrics());
- } else
- return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 300, r.getDisplayMetrics());
- }
-
public static int convertDpToPixels(Context c, int dp) {
Resources r = c.getResources();
return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dp, r.getDisplayMetrics());
}
public static int getActionBarHeight(Context c) {
- int mActionBarHeight = 0;
+ int actionBarHeight = 0;
TypedValue tv = new TypedValue();
- if (c.getTheme().resolveAttribute(android.R.attr.actionBarSize, tv, true))
- mActionBarHeight = TypedValue.complexToDimensionPixelSize(tv.data, c.getResources().getDisplayMetrics());
+ if (c.getTheme().resolveAttribute(R.attr.actionBarSize, tv, true))
+ actionBarHeight = TypedValue.complexToDimensionPixelSize(tv.data, c.getResources().getDisplayMetrics());
else
- mActionBarHeight = 0; // No ActionBar style (pre-Honeycomb or ActionBar not in theme)
+ actionBarHeight = 0; // No ActionBar style (pre-Honeycomb or ActionBar not in theme)
- return mActionBarHeight;
+ return actionBarHeight;
}
public static int getActionBarAndStatusBarHeight(Context c) {
- int mActionBarHeight = 0, mStatusBarHeight = 0;
- TypedValue tv = new TypedValue();
- if (c.getTheme().resolveAttribute(android.R.attr.actionBarSize, tv, true))
- mActionBarHeight = TypedValue.complexToDimensionPixelSize(tv.data, c.getResources().getDisplayMetrics());
- else
- mActionBarHeight = 0; // No ActionBar style (pre-Honeycomb or ActionBar not in theme)
-
- if (hasKitKat())
- mStatusBarHeight = convertDpToPixels(c, 25);
+ int actionBarHeight = getActionBarHeight(c);
+ int statusBarHeight = ViewUtils.getStatusBarHeight(c);
- return mActionBarHeight + mStatusBarHeight;
+ // We're only interested in returning the combined
+ // height, if we're running on KitKat or above
+ return hasKitKat() ?
+ actionBarHeight + statusBarHeight : actionBarHeight;
}
public static final String md5(final String s) {
@@ -825,7 +825,7 @@ public static Bitmap fastblur(Context context, Bitmap sentBitmap, int radius) {
script.setInput(input);
script.forEach(output);
output.copyTo(sentBitmap);
-
+
return sentBitmap;
}
@@ -859,7 +859,7 @@ public static boolean downloadFile(String url, String savePath) {
} catch(Exception e) {
// The download failed, so let's delete whatever was downloaded
deleteFile(new File(savePath));
-
+
return false;
} finally {
if (fileos != null) {
@@ -884,11 +884,12 @@ public static JSONObject getJSONObject(Context context, String url) {
Request request = new Request.Builder()
.url(url)
+ .get()
.build();
try {
Response response = client.newCall(request).execute();
-
+
if (response.code() >= 429) {
// HTTP error 429 and above means that we've exceeded the query limit
// for TMDb. Sleep for 5 seconds and try again.
@@ -920,6 +921,14 @@ public static int getInteger(String number) {
}
}
+ public static int getInteger(double number) {
+ try {
+ return (int) number;
+ } catch (Exception e) {
+ return 0;
+ }
+ }
+
public static String removeIndexZero(String s) {
if (!TextUtils.isEmpty(s))
try {
@@ -1190,7 +1199,7 @@ public static boolean deleteFile(File f) {
public static String createSmbLoginString(String domain, String user, String password, String server, boolean isFolder) {
// Create the string to fit the following syntax: smb://[[[domain;]username[:password]@]server[:port]/
StringBuilder sb = new StringBuilder("smb://");
-
+
try {
user = URLEncoder.encode(user, "utf-8");
} catch (UnsupportedEncodingException e) {}
@@ -1859,14 +1868,16 @@ public static String getRandomBackdropPath(Context c) {
ArrayList files = new ArrayList();
File[] f = MizuuApplication.getMovieBackdropFolder(c).listFiles();
- for (File file : f) {
- files.add(file);
- }
+ if (f != null)
+ for (File file : f) {
+ files.add(file);
+ }
f = MizuuApplication.getTvShowBackdropFolder(c).listFiles();
- for (File file : f) {
- files.add(file);
- }
+ if (f != null)
+ for (File file : f) {
+ files.add(file);
+ }
if (files.size() > 0) {
Random rndm = new Random();
@@ -2141,4 +2152,12 @@ public static String getFilenameWithoutExtension(String filename) {
return filename;
}
}
+
+ public static void copyDatabase(Context context) {
+ try {
+ FileUtils.copyFile(context.getDatabasePath("mizuu_data"), new File(Environment.getExternalStorageDirectory(), "mizuu_data.db"));
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
}
\ No newline at end of file
diff --git a/src/com/miz/functions/Movie.java b/app/src/main/java/com/miz/functions/Movie.java
similarity index 100%
rename from src/com/miz/functions/Movie.java
rename to app/src/main/java/com/miz/functions/Movie.java
index a902a10a..e16e852e 100644
--- a/src/com/miz/functions/Movie.java
+++ b/app/src/main/java/com/miz/functions/Movie.java
@@ -16,15 +16,15 @@
package com.miz.functions;
-import java.io.File;
-import java.util.Locale;
-
import android.content.Context;
import android.text.TextUtils;
import com.miz.abstractclasses.MediumBaseMovie;
import com.miz.mizuu.R;
+import java.io.File;
+import java.util.Locale;
+
public class Movie extends MediumBaseMovie {
private String PLOT, TAGLINE, IMDB_ID, TRAILER;
diff --git a/src/com/miz/functions/MovieLibraryUpdateCallback.java b/app/src/main/java/com/miz/functions/MovieLibraryUpdateCallback.java
similarity index 100%
rename from src/com/miz/functions/MovieLibraryUpdateCallback.java
rename to app/src/main/java/com/miz/functions/MovieLibraryUpdateCallback.java
diff --git a/app/src/main/java/com/miz/functions/MovieLoader.java b/app/src/main/java/com/miz/functions/MovieLoader.java
new file mode 100644
index 00000000..ea7b8431
--- /dev/null
+++ b/app/src/main/java/com/miz/functions/MovieLoader.java
@@ -0,0 +1,174 @@
+/*
+ * Copyright (C) 2014 Michell Bak
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.miz.functions;
+
+import android.content.Context;
+import android.database.Cursor;
+
+import com.miz.db.DbAdapterMovies;
+import com.miz.mizuu.MizuuApplication;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
+public class MovieLoader {
+
+ public enum MovieLibraryType {
+ ALL_MOVIES,
+ FAVORITES,
+ NEW_RELEASES,
+ WATCHLIST,
+ WATCHED,
+ UNWATCHED,
+ COLLECTIONS
+ }
+
+ public interface OnLoadCompletedCallback {
+ void onLoadCompleted(List movieList);
+ }
+
+ private final Context mContext;
+ private final MovieLibraryType mLibraryType;
+ private final OnLoadCompletedCallback mCallback;
+ private final DbAdapterMovies mDatabase;
+
+ private MovieLoaderAsyncTask mAsyncTask;
+ private boolean mIgnorePrefixes = false,
+ mAvailableFilesOnly = false,
+ mOfflineFilesOnly = false;
+
+ public MovieLoader(Context context, MovieLibraryType libraryType, OnLoadCompletedCallback callback) {
+ mContext = context;
+ mLibraryType = libraryType;
+ mCallback = callback;
+ mDatabase = MizuuApplication.getMovieAdapter();
+ }
+
+ /**
+ * Determine whether the MovieLoader should ignore title prefixes.
+ * @param ignore
+ */
+ public void setIgnorePrefixes(boolean ignore) {
+ mIgnorePrefixes = ignore;
+ }
+
+ /**
+ * Determine whether to only show available files.
+ * @param showAvailableFilesOnly
+ */
+ public void setShowAvailableFiles(boolean showAvailableFilesOnly) {
+ mAvailableFilesOnly = showAvailableFilesOnly;
+ }
+
+ public void setShowOfflineFiles(boolean showOfflineFilesOnly) {
+ mOfflineFilesOnly = showOfflineFilesOnly;
+ }
+
+ public void load() {
+ if (mAsyncTask != null) {
+ mAsyncTask.cancel(true);
+ }
+
+ mAsyncTask = new MovieLoaderAsyncTask();
+ mAsyncTask.execute();
+ }
+
+ /**
+ * Creates movie objects from a Cursor and adds them to a list.
+ * @param cursor
+ * @return
+ */
+ private ArrayList listFromCursor(Cursor cursor) {
+ ArrayList list = new ArrayList();
+
+ if (cursor != null) {
+ HashMap collectionsMap = MizuuApplication.getCollectionsAdapter().getCollectionsMap();
+ ColumnIndexCache cache = new ColumnIndexCache();
+
+ try {
+ while (cursor.moveToNext()) {
+ list.add(new MediumMovie(mContext,
+ cursor.getString(cache.getColumnIndex(cursor, DbAdapterMovies.KEY_TITLE)),
+ cursor.getString(cache.getColumnIndex(cursor, DbAdapterMovies.KEY_TMDB_ID)),
+ cursor.getString(cache.getColumnIndex(cursor, DbAdapterMovies.KEY_RATING)),
+ cursor.getString(cache.getColumnIndex(cursor, DbAdapterMovies.KEY_RELEASEDATE)),
+ cursor.getString(cache.getColumnIndex(cursor, DbAdapterMovies.KEY_GENRES)),
+ cursor.getString(cache.getColumnIndex(cursor, DbAdapterMovies.KEY_FAVOURITE)),
+ cursor.getString(cache.getColumnIndex(cursor, DbAdapterMovies.KEY_ACTORS)),
+ collectionsMap.get(cursor.getString(cache.getColumnIndex(cursor, DbAdapterMovies.KEY_COLLECTION_ID))),
+ cursor.getString(cache.getColumnIndex(cursor, DbAdapterMovies.KEY_COLLECTION_ID)),
+ cursor.getString(cache.getColumnIndex(cursor, DbAdapterMovies.KEY_TO_WATCH)),
+ cursor.getString(cache.getColumnIndex(cursor, DbAdapterMovies.KEY_HAS_WATCHED)),
+ cursor.getString(cache.getColumnIndex(cursor, DbAdapterMovies.KEY_DATE_ADDED)),
+ cursor.getString(cache.getColumnIndex(cursor, DbAdapterMovies.KEY_CERTIFICATION)),
+ cursor.getString(cache.getColumnIndex(cursor, DbAdapterMovies.KEY_RUNTIME)),
+ mIgnorePrefixes
+ ));
+ }
+ } catch (Exception e) {} finally {
+ cursor.close();
+ cache.clear();
+ }
+ }
+
+ return list;
+ }
+
+ private class MovieLoaderAsyncTask extends LibrarySectionAsyncTask {
+
+ private final ArrayList mMovieList;
+
+ public MovieLoaderAsyncTask() {
+ mMovieList = new ArrayList();
+ }
+
+ @Override
+ protected Void doInBackground(Void... params) {
+ switch (mLibraryType) {
+ case ALL_MOVIES:
+ mMovieList.addAll(listFromCursor(mDatabase.getAllMovies()));
+ break;
+ case COLLECTIONS:
+ mMovieList.addAll(listFromCursor(mDatabase.getCollections()));
+ break;
+ case FAVORITES:
+ break;
+ case NEW_RELEASES:
+ break;
+ case UNWATCHED:
+ break;
+ case WATCHED:
+ break;
+ case WATCHLIST:
+ break;
+ default:
+ break;
+ }
+ return null;
+ }
+
+ @Override
+ protected void onPostExecute(Void result) {
+
+ if (!isCancelled())
+ mCallback.onLoadCompleted(mMovieList);
+ else
+ mMovieList.clear();
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/com/miz/functions/MovieSortHelper.java b/app/src/main/java/com/miz/functions/MovieSortHelper.java
similarity index 99%
rename from src/com/miz/functions/MovieSortHelper.java
rename to app/src/main/java/com/miz/functions/MovieSortHelper.java
index 09761136..10844438 100644
--- a/src/com/miz/functions/MovieSortHelper.java
+++ b/app/src/main/java/com/miz/functions/MovieSortHelper.java
@@ -16,13 +16,14 @@
package com.miz.functions;
+import android.text.TextUtils;
+
import static com.miz.functions.SortingKeys.DATE;
import static com.miz.functions.SortingKeys.DURATION;
import static com.miz.functions.SortingKeys.RATING;
import static com.miz.functions.SortingKeys.RELEASE;
import static com.miz.functions.SortingKeys.TITLE;
import static com.miz.functions.SortingKeys.WEIGHTED_RATING;
-import android.text.TextUtils;
public class MovieSortHelper implements Comparable {
diff --git a/src/com/miz/functions/NetworkFile.java b/app/src/main/java/com/miz/functions/NetworkFile.java
similarity index 100%
rename from src/com/miz/functions/NetworkFile.java
rename to app/src/main/java/com/miz/functions/NetworkFile.java
diff --git a/src/com/miz/functions/NfoMovie.java b/app/src/main/java/com/miz/functions/NfoMovie.java
similarity index 100%
rename from src/com/miz/functions/NfoMovie.java
rename to app/src/main/java/com/miz/functions/NfoMovie.java
index fb5887ad..e0b7473e 100644
--- a/src/com/miz/functions/NfoMovie.java
+++ b/app/src/main/java/com/miz/functions/NfoMovie.java
@@ -16,25 +16,25 @@
package com.miz.functions;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Locale;
+import android.content.Context;
+import android.text.TextUtils;
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
+import com.miz.apis.tmdb.Movie;
+import com.miz.db.DbAdapterMovies;
+import com.miz.mizuu.MizuuApplication;
+import com.squareup.picasso.Picasso;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
-import android.content.Context;
-import android.text.TextUtils;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Locale;
-import com.miz.apis.tmdb.Movie;
-import com.miz.db.DbAdapterMovies;
-import com.miz.mizuu.MizuuApplication;
-import com.squareup.picasso.Picasso;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
public class NfoMovie {
diff --git a/src/com/miz/functions/OkHttpDownloader.java b/app/src/main/java/com/miz/functions/OkHttpDownloader.java
similarity index 99%
rename from src/com/miz/functions/OkHttpDownloader.java
rename to app/src/main/java/com/miz/functions/OkHttpDownloader.java
index 1a7dfa1f..0cbe8ed1 100644
--- a/src/com/miz/functions/OkHttpDownloader.java
+++ b/app/src/main/java/com/miz/functions/OkHttpDownloader.java
@@ -15,17 +15,6 @@
*/
package com.miz.functions;
-import static com.miz.functions.PreferenceKeys.IGNORED_NFO_FILES;
-
-import java.io.BufferedInputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.net.HttpURLConnection;
-import java.net.URL;
-import java.util.ArrayList;
-
-import jcifs.smb.SmbFile;
import android.content.Context;
import android.net.Uri;
import android.preference.PreferenceManager;
@@ -38,6 +27,18 @@
import com.squareup.okhttp.OkUrlFactory;
import com.squareup.picasso.Downloader;
+import java.io.BufferedInputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.net.HttpURLConnection;
+import java.net.URL;
+import java.util.ArrayList;
+
+import jcifs.smb.SmbFile;
+
+import static com.miz.functions.PreferenceKeys.IGNORED_NFO_FILES;
+
/** A {@link Downloader} which uses OkHttp to download images. */
public class OkHttpDownloader implements Downloader {
diff --git a/app/src/main/java/com/miz/functions/PaletteLoader.java b/app/src/main/java/com/miz/functions/PaletteLoader.java
new file mode 100644
index 00000000..e25cdfb2
--- /dev/null
+++ b/app/src/main/java/com/miz/functions/PaletteLoader.java
@@ -0,0 +1,132 @@
+package com.miz.functions;
+
+import android.animation.ArgbEvaluator;
+import android.animation.ObjectAnimator;
+import android.graphics.Color;
+import android.net.Uri;
+import android.support.v7.graphics.Palette;
+import android.view.View;
+
+import com.melnykov.fab.FloatingActionButton;
+import com.miz.mizuu.MizuuApplication;
+import com.squareup.picasso.Picasso;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+public class PaletteLoader extends AsyncTask {
+
+ private final Picasso mPicasso;
+ private final String mKey;
+ private final Uri mImage;
+ private final List mViews;
+ private final OnPaletteLoadedCallback mOnPaletteLoadedCallback;
+
+ private FloatingActionButton mFab;
+ private int mSwatchColor;
+
+ public PaletteLoader(Picasso picasso, Uri image, OnPaletteLoadedCallback callback) {
+ mPicasso = picasso;
+ mImage = image;
+ mKey = image.toString();
+ mViews = new ArrayList();
+ mOnPaletteLoadedCallback = callback;
+ }
+
+ private String getPaletteKey() {
+ return mKey;
+ }
+
+ private Uri getImage() {
+ return mImage;
+ }
+
+ public void addView(View view) {
+ mViews.add(view);
+ }
+
+ private List getViews() {
+ return mViews;
+ }
+
+ public void setFab(FloatingActionButton fab) {
+ mFab = fab;
+ }
+
+ private FloatingActionButton getFab() {
+ return mFab;
+ }
+
+ public void clearViews() {
+ mViews.clear();
+ mFab = null;
+ }
+
+ @Override
+ protected Palette doInBackground(Void... params) {
+ Palette palette = MizuuApplication.getPalette(getPaletteKey());
+
+ if (palette == null) {
+ try {
+ palette = Palette.generate(mPicasso.load(getImage()).get());
+ } catch (IOException e) {}
+ }
+
+ return palette;
+ }
+
+ @Override
+ protected void onPostExecute(Palette result) {
+ if (result != null) {
+ // Add it to the Palette cache
+ MizuuApplication.addToPaletteCache(getPaletteKey(), result);
+
+ Palette.Swatch sw = result.getDarkVibrantSwatch();
+
+ if (sw == null)
+ sw = result.getDarkMutedSwatch();
+
+ if (sw == null)
+ sw = result.getVibrantSwatch();
+
+ if (sw != null) {
+ // Set the found color
+ mSwatchColor = sw.getRgb();
+
+ // Color the views
+ colorViews();
+
+ mOnPaletteLoadedCallback.onPaletteLoaded(getSwatchColor());
+ }
+ }
+ }
+
+ public void colorViews() {
+ // Animate the color change for all set views
+ for (View v : getViews())
+ animate(v);
+
+ // Set the FAB color, if a FAB has been set
+ if (getFab() != null) {
+ mFab.setColorNormal(getSwatchColor());
+ mFab.setColorPressed(getSwatchColor());
+ mFab.setColorRipple(Color.parseColor("#80ffffff"));
+ }
+ }
+
+ private void animate(View v) {
+ ObjectAnimator backgroundColorAnimator = ObjectAnimator.ofObject(v, "backgroundColor", new ArgbEvaluator(), 0xFF666666, getSwatchColor());
+ backgroundColorAnimator.setDuration(500);
+ backgroundColorAnimator.start();
+ }
+
+ public int getSwatchColor() {
+ return mSwatchColor;
+ }
+
+ public interface OnPaletteLoadedCallback {
+ void onPaletteLoaded(int swatchColor);
+ }
+
+}
\ No newline at end of file
diff --git a/src/com/miz/functions/PaletteTransformation.java b/app/src/main/java/com/miz/functions/PaletteTransformation.java
similarity index 83%
rename from src/com/miz/functions/PaletteTransformation.java
rename to app/src/main/java/com/miz/functions/PaletteTransformation.java
index c9c7dbb0..cd65d33e 100644
--- a/src/com/miz/functions/PaletteTransformation.java
+++ b/app/src/main/java/com/miz/functions/PaletteTransformation.java
@@ -5,7 +5,7 @@
import android.graphics.Bitmap;
import android.support.v7.graphics.Palette;
import android.support.v7.graphics.Palette.PaletteAsyncListener;
-import android.support.v7.graphics.PaletteItem;
+import android.support.v7.graphics.Palette.Swatch;
import android.view.View;
import com.miz.mizuu.MizuuApplication;
@@ -52,19 +52,19 @@ private void setBackgroundColor(Palette p, boolean animate) {
if (mViews == null || mHasSetBackground)
return;
- PaletteItem pi = p.getDarkVibrantColor();
+ Swatch sw = p.getDarkVibrantSwatch();
- if (pi == null)
- pi = p.getDarkMutedColor();
+ if (sw == null)
+ sw = p.getDarkMutedSwatch();
- if (pi == null)
- pi = p.getVibrantColor();
+ if (sw == null)
+ sw = p.getVibrantSwatch();
- if (pi != null) {
+ if (sw != null) {
if (animate) {
for (View v : mViews) {
if (v != null) {
- ObjectAnimator backgroundColorAnimator = ObjectAnimator.ofObject(v, "backgroundColor", new ArgbEvaluator(), 0xFF666666, pi.getRgb());
+ ObjectAnimator backgroundColorAnimator = ObjectAnimator.ofObject(v, "backgroundColor", new ArgbEvaluator(), 0xFF666666, sw.getRgb());
backgroundColorAnimator.setDuration(500);
backgroundColorAnimator.start();
}
@@ -72,7 +72,7 @@ private void setBackgroundColor(Palette p, boolean animate) {
} else {
for (View v : mViews)
if (v != null)
- v.setBackgroundColor(pi.getRgb());
+ v.setBackgroundColor(sw.getRgb());
}
}
diff --git a/src/com/miz/functions/PreferenceKeys.java b/app/src/main/java/com/miz/functions/PreferenceKeys.java
similarity index 96%
rename from src/com/miz/functions/PreferenceKeys.java
rename to app/src/main/java/com/miz/functions/PreferenceKeys.java
index 06a79337..bc3dd97c 100644
--- a/src/com/miz/functions/PreferenceKeys.java
+++ b/app/src/main/java/com/miz/functions/PreferenceKeys.java
@@ -76,5 +76,7 @@ private PreferenceKeys() {} // No instantiation
public static final String LANGUAGE_PREFERENCE = "prefsLanguagePreference";
public static final String TV_SHOW_DATA_SOURCE = "prefsShowsDataSource";
public static final String BLUR_BACKDROPS = "prefsBlurBackdrops";
-
+ public static final String DVD_ORDERING = "prefsDvdOrdering";
+ public static final String CHROMECAST_BETA_SUPPORT = "prefsChromecastBeta";
+
}
diff --git a/src/com/miz/functions/SQLiteCursorLoader.java b/app/src/main/java/com/miz/functions/SQLiteCursorLoader.java
similarity index 100%
rename from src/com/miz/functions/SQLiteCursorLoader.java
rename to app/src/main/java/com/miz/functions/SQLiteCursorLoader.java
diff --git a/src/com/miz/functions/ScheduledUpdatesAlarmManager.java b/app/src/main/java/com/miz/functions/ScheduledUpdatesAlarmManager.java
similarity index 100%
rename from src/com/miz/functions/ScheduledUpdatesAlarmManager.java
rename to app/src/main/java/com/miz/functions/ScheduledUpdatesAlarmManager.java
diff --git a/src/com/miz/functions/SmallMovie.java b/app/src/main/java/com/miz/functions/SmallMovie.java
similarity index 100%
rename from src/com/miz/functions/SmallMovie.java
rename to app/src/main/java/com/miz/functions/SmallMovie.java
index 98e1b901..2a177da4 100644
--- a/src/com/miz/functions/SmallMovie.java
+++ b/app/src/main/java/com/miz/functions/SmallMovie.java
@@ -16,10 +16,10 @@
package com.miz.functions;
-import com.miz.abstractclasses.BaseMovie;
-
import android.content.Context;
+import com.miz.abstractclasses.BaseMovie;
+
public class SmallMovie extends BaseMovie {
public SmallMovie(Context context, String title, String tmdbId, boolean ignorePrefixes) {
diff --git a/src/com/miz/functions/SortingKeys.java b/app/src/main/java/com/miz/functions/SortingKeys.java
similarity index 100%
rename from src/com/miz/functions/SortingKeys.java
rename to app/src/main/java/com/miz/functions/SortingKeys.java
diff --git a/src/com/miz/functions/SpinnerItem.java b/app/src/main/java/com/miz/functions/SpinnerItem.java
similarity index 100%
rename from src/com/miz/functions/SpinnerItem.java
rename to app/src/main/java/com/miz/functions/SpinnerItem.java
diff --git a/src/com/miz/functions/StartScheduledUpdatesService.java b/app/src/main/java/com/miz/functions/StartScheduledUpdatesService.java
similarity index 100%
rename from src/com/miz/functions/StartScheduledUpdatesService.java
rename to app/src/main/java/com/miz/functions/StartScheduledUpdatesService.java
diff --git a/src/com/miz/functions/TmdbTrailerSearch.java b/app/src/main/java/com/miz/functions/TmdbTrailerSearch.java
similarity index 100%
rename from src/com/miz/functions/TmdbTrailerSearch.java
rename to app/src/main/java/com/miz/functions/TmdbTrailerSearch.java
index d0d912b5..06c24d73 100644
--- a/src/com/miz/functions/TmdbTrailerSearch.java
+++ b/app/src/main/java/com/miz/functions/TmdbTrailerSearch.java
@@ -16,19 +16,19 @@
package com.miz.functions;
-import org.json.JSONArray;
-import org.json.JSONObject;
+import android.app.Activity;
+import android.content.Intent;
+import android.net.Uri;
+import android.os.AsyncTask;
+import android.widget.Toast;
import com.google.android.youtube.player.YouTubeApiServiceUtil;
import com.google.android.youtube.player.YouTubeInitializationResult;
import com.google.android.youtube.player.YouTubeStandalonePlayer;
import com.miz.mizuu.R;
-import android.app.Activity;
-import android.content.Intent;
-import android.net.Uri;
-import android.os.AsyncTask;
-import android.widget.Toast;
+import org.json.JSONArray;
+import org.json.JSONObject;
/**
* Looks for trailers on TMDb for a given movie and starts playback of the first found trailer.
diff --git a/src/com/miz/functions/TvShowEpisode.java b/app/src/main/java/com/miz/functions/TvShowEpisode.java
similarity index 100%
rename from src/com/miz/functions/TvShowEpisode.java
rename to app/src/main/java/com/miz/functions/TvShowEpisode.java
diff --git a/src/com/miz/functions/TvShowLibraryUpdateCallback.java b/app/src/main/java/com/miz/functions/TvShowLibraryUpdateCallback.java
similarity index 100%
rename from src/com/miz/functions/TvShowLibraryUpdateCallback.java
rename to app/src/main/java/com/miz/functions/TvShowLibraryUpdateCallback.java
diff --git a/src/com/miz/functions/TvShowSortHelper.java b/app/src/main/java/com/miz/functions/TvShowSortHelper.java
similarity index 100%
rename from src/com/miz/functions/TvShowSortHelper.java
rename to app/src/main/java/com/miz/functions/TvShowSortHelper.java
index daf36df2..29c764a0 100644
--- a/src/com/miz/functions/TvShowSortHelper.java
+++ b/app/src/main/java/com/miz/functions/TvShowSortHelper.java
@@ -16,15 +16,15 @@
package com.miz.functions;
-import static com.miz.functions.SortingKeys.NEWEST_EPISODE;
+import com.miz.mizuu.TvShow;
+
import static com.miz.functions.SortingKeys.DURATION;
+import static com.miz.functions.SortingKeys.NEWEST_EPISODE;
import static com.miz.functions.SortingKeys.RATING;
import static com.miz.functions.SortingKeys.RELEASE;
import static com.miz.functions.SortingKeys.TITLE;
import static com.miz.functions.SortingKeys.WEIGHTED_RATING;
-import com.miz.mizuu.TvShow;
-
public class TvShowSortHelper implements Comparable {
private TvShow mTvShow;
diff --git a/src/com/miz/functions/WebMovie.java b/app/src/main/java/com/miz/functions/WebMovie.java
similarity index 100%
rename from src/com/miz/functions/WebMovie.java
rename to app/src/main/java/com/miz/functions/WebMovie.java
diff --git a/src/com/miz/functions/YoutubeTrailerSearch.java b/app/src/main/java/com/miz/functions/YoutubeTrailerSearch.java
similarity index 100%
rename from src/com/miz/functions/YoutubeTrailerSearch.java
rename to app/src/main/java/com/miz/functions/YoutubeTrailerSearch.java
index 5342c923..e270c6b6 100644
--- a/src/com/miz/functions/YoutubeTrailerSearch.java
+++ b/app/src/main/java/com/miz/functions/YoutubeTrailerSearch.java
@@ -16,9 +16,6 @@
package com.miz.functions;
-import org.json.JSONArray;
-import org.json.JSONObject;
-
import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
@@ -30,6 +27,9 @@
import com.google.android.youtube.player.YouTubeStandalonePlayer;
import com.miz.mizuu.R;
+import org.json.JSONArray;
+import org.json.JSONObject;
+
/**
* Searches YouTube for a given query and starts playback of the given
* @author Michell
diff --git a/src/com/miz/identification/Episode.java b/app/src/main/java/com/miz/identification/Episode.java
similarity index 100%
rename from src/com/miz/identification/Episode.java
rename to app/src/main/java/com/miz/identification/Episode.java
diff --git a/src/com/miz/identification/MovieIdentification.java b/app/src/main/java/com/miz/identification/MovieIdentification.java
similarity index 82%
rename from src/com/miz/identification/MovieIdentification.java
rename to app/src/main/java/com/miz/identification/MovieIdentification.java
index 6aa3ee84..9e384b0e 100644
--- a/src/com/miz/identification/MovieIdentification.java
+++ b/app/src/main/java/com/miz/identification/MovieIdentification.java
@@ -16,16 +16,6 @@
package com.miz.identification;
-import static com.miz.functions.PreferenceKeys.IGNORED_FILENAME_TAGS;
-import static com.miz.functions.PreferenceKeys.IGNORED_NFO_FILES;
-import static com.miz.functions.PreferenceKeys.LANGUAGE_PREFERENCE;
-
-import java.io.File;
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-
import android.content.Context;
import android.preference.PreferenceManager;
import android.text.TextUtils;
@@ -41,9 +31,20 @@
import com.miz.mizuu.MizuuApplication;
import com.miz.utils.FileUtils;
import com.miz.utils.LocalBroadcastUtils;
+import com.miz.utils.MovieDatabaseUtils;
import com.miz.utils.WidgetUtils;
import com.squareup.picasso.Picasso;
+import java.io.File;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
+import static com.miz.functions.PreferenceKeys.IGNORED_FILENAME_TAGS;
+import static com.miz.functions.PreferenceKeys.IGNORED_NFO_FILES;
+import static com.miz.functions.PreferenceKeys.LANGUAGE_PREFERENCE;
+
public class MovieIdentification {
private final Picasso mPicasso;
@@ -54,7 +55,7 @@ public class MovieIdentification {
private final HashMap mNfoFiles;
private SparseBooleanArray mImdbMap = new SparseBooleanArray();
- private String mMovieId = null, mLocale = null;
+ private String mMovieId = null, mCurrentMovieId = null, mLocale = null;
private boolean mCancel = false, mIgnoreNfoFiles = true;
private int mCount = 0;
@@ -85,12 +86,16 @@ private void getLanguagePreference() {
* Use this to disable movie searching
* and attempt identification based on the
* provided movie ID.
- * @param showId
+ * @param movieId
*/
public void setMovieId(String movieId) {
mMovieId = movieId;
}
+ public void setCurrentMovieId(String oldMovieId) {
+ mCurrentMovieId = oldMovieId;
+ }
+
private boolean overrideMovieId() {
return null != getMovieId();
}
@@ -99,6 +104,10 @@ private String getMovieId() {
return mMovieId;
}
+ private String getCurrentMovieId() {
+ return mCurrentMovieId;
+ }
+
/**
* Accepts two-letter ISO 639-1 language codes, i.e. "en".
* @param language
@@ -187,12 +196,14 @@ public void start() {
movie = service.get(getMovieId(), mLocale);
}
- if (movie == null && results.size() > 0) {
- movie = service.get(results.get(0).getId(), mLocale);
- } else {
- movie = new Movie();
- movie.setId(DbAdapterMovies.UNIDENTIFIED_ID);
- }
+ if (!overrideMovieId() && results.size() > 0) {
+ // Automatic library update
+ movie = service.get(results.get(0).getId(), mLocale);
+ }
+
+ // Last check - is movie still null?
+ if (movie == null)
+ movie = new Movie();
createMovie(ms, movie);
}
@@ -239,74 +250,34 @@ private void addToDatabase(MovieStructure ms, Movie movie) {
// Check if this is manual identification by the user
if (overrideMovieId()) {
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- /**
- *
- *
- *
- *
- *
- *
- *
- * TODO FIX THIS SHIT TODO
- *
- *
- *
- *
- *
- *
- */
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+ // How many filepaths are mapped to the current movie ID?
+ int currentCount = dbHelperMovieMapping.getMovieFilepaths(getCurrentMovieId()).size();
+
+ if (currentCount > 1) {
+ // This movie has more than one filepath mapping, so we don't want
+ // to remove the movie entry nor any images, etc.
+
+ // Update the ID currently used to map the filepath to the movie
+ dbHelperMovieMapping.updateTmdbId(ms.getFilepath(), getCurrentMovieId(), getMovieId());
+ } else {
+ // This movie only has one filepath mapping, i.e. the one we're
+ // currently re-assigning. It's safe to delete all movie data and
+ // create the filepath mapping for the new movie ID.
+
+ // Delete the old movie and everything related to it
+ MovieDatabaseUtils.deleteMovie(mContext, getCurrentMovieId());
+
+ // Create the new filepath mapping
+ dbHelperMovieMapping.createFilepathMapping(ms.getFilepath(), getMovieId());
+ }
} else {
// This is Mizuu's automatic library update...
-
- // Check if movie already exists
- if (dbHelper.movieExists(movie.getId())) {
-
- // Get the old filepath ID before updating the mapping
- String oldId = dbHelperMovieMapping.getIdForFilepath(ms.getFilepath());
-
- // Update the mapping TMDb ID to the new one
- dbHelperMovieMapping.updateTmdbId(ms.getFilepath(), movie.getId());
-
- // Let's check if the old TMDb ID is mapped to
- // any other file paths - if not, remove the movie
- // entry in the movie database
- if (!dbHelperMovieMapping.exists(oldId))
- dbHelper.deleteMovie(oldId);
-
- } else {
- // The movie mapping doesn't exist - so let's create it
- dbHelperMovieMapping.createFilepathMapping(ms.getFilepath(), movie.getId());
- }
+
+ // Just create the filepath mapping - if the filepath / movie
+ // combination already exists, it won't do anything
+ dbHelperMovieMapping.createFilepathMapping(ms.getFilepath(), movie.getId());
}
// Finally, create or update the movie
diff --git a/src/com/miz/identification/MovieStructure.java b/app/src/main/java/com/miz/identification/MovieStructure.java
similarity index 93%
rename from src/com/miz/identification/MovieStructure.java
rename to app/src/main/java/com/miz/identification/MovieStructure.java
index 85c2500f..c86740d5 100644
--- a/src/com/miz/identification/MovieStructure.java
+++ b/app/src/main/java/com/miz/identification/MovieStructure.java
@@ -16,11 +16,11 @@
package com.miz.identification;
+import com.miz.functions.MizLib;
+
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-import com.miz.functions.MizLib;
-
public class MovieStructure {
private final String mFilepath;
@@ -32,9 +32,10 @@ public MovieStructure(String filepath) {
checkImdbId();
}
- public void split() {
+ public void split() {
Pattern splitPattern = Pattern.compile("/"); // Pre-compiled pattern to speed things up
- String[] split = splitPattern.split(mFilepath.contains("") ? mFilepath.split("")[0] : mFilepath);
+ // UPnP files don't have an extension, so we add one in those cases in order to make everything work with titles like "G.I. Joe"
+ String[] split = splitPattern.split(mFilepath.contains("") ? (mFilepath.split("")[0] + ".mkv") : mFilepath);
if (split.length >= 2) {
mFilename = split[split.length - 1];
mParentFolder = split[split.length - 2].trim();
diff --git a/src/com/miz/identification/ShowStructure.java b/app/src/main/java/com/miz/identification/ShowStructure.java
similarity index 100%
rename from src/com/miz/identification/ShowStructure.java
rename to app/src/main/java/com/miz/identification/ShowStructure.java
index a824b611..33e70a97 100644
--- a/src/com/miz/identification/ShowStructure.java
+++ b/app/src/main/java/com/miz/identification/ShowStructure.java
@@ -16,14 +16,14 @@
package com.miz.identification;
-import java.util.ArrayList;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
import android.text.TextUtils;
import com.miz.functions.MizLib;
+import java.util.ArrayList;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
public class ShowStructure {
private final String mFilepath;
diff --git a/src/com/miz/identification/TvShowIdentification.java b/app/src/main/java/com/miz/identification/TvShowIdentification.java
similarity index 100%
rename from src/com/miz/identification/TvShowIdentification.java
rename to app/src/main/java/com/miz/identification/TvShowIdentification.java
index 96e5d4a2..a56ac99e 100644
--- a/src/com/miz/identification/TvShowIdentification.java
+++ b/app/src/main/java/com/miz/identification/TvShowIdentification.java
@@ -16,21 +16,19 @@
package com.miz.identification;
-import static com.miz.functions.PreferenceKeys.IGNORED_FILENAME_TAGS;
-import static com.miz.functions.PreferenceKeys.LANGUAGE_PREFERENCE;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
+import android.content.Context;
+import android.database.Cursor;
+import android.preference.PreferenceManager;
+import android.text.TextUtils;
+import android.util.SparseBooleanArray;
import com.google.common.collect.LinkedListMultimap;
import com.google.common.collect.Multimap;
import com.miz.abstractclasses.TvShowApiService;
-import com.miz.apis.thetvdb.TvShow;
import com.miz.apis.thetvdb.Episode;
-import com.miz.db.DbAdapterTvShows;
+import com.miz.apis.thetvdb.TvShow;
import com.miz.db.DbAdapterTvShowEpisodes;
+import com.miz.db.DbAdapterTvShows;
import com.miz.functions.MizLib;
import com.miz.functions.TvShowLibraryUpdateCallback;
import com.miz.mizuu.MizuuApplication;
@@ -39,11 +37,13 @@
import com.miz.utils.WidgetUtils;
import com.squareup.picasso.Picasso;
-import android.content.Context;
-import android.database.Cursor;
-import android.preference.PreferenceManager;
-import android.text.TextUtils;
-import android.util.SparseBooleanArray;
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import static com.miz.functions.PreferenceKeys.IGNORED_FILENAME_TAGS;
+import static com.miz.functions.PreferenceKeys.LANGUAGE_PREFERENCE;
public class TvShowIdentification {
diff --git a/src/com/miz/mizuu/ActorBrowser.java b/app/src/main/java/com/miz/mizuu/ActorBrowser.java
similarity index 71%
rename from src/com/miz/mizuu/ActorBrowser.java
rename to app/src/main/java/com/miz/mizuu/ActorBrowser.java
index b81218e6..37e26b5d 100644
--- a/src/com/miz/mizuu/ActorBrowser.java
+++ b/app/src/main/java/com/miz/mizuu/ActorBrowser.java
@@ -16,17 +16,23 @@
package com.miz.mizuu;
+import android.graphics.drawable.ColorDrawable;
import android.os.Bundle;
+import android.preference.Preference;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction;
import android.view.MenuItem;
import com.miz.base.MizActivity;
+import com.miz.functions.IntentKeys;
+import com.miz.functions.MizLib;
import com.miz.mizuu.fragments.ActorBrowserFragment;
+import com.miz.utils.ViewUtils;
public class ActorBrowser extends MizActivity {
private static String TAG = "ActorBrowserFragment";
+ private int mToolbarColor;
@Override
public void onCreate(Bundle savedInstanceState) {
@@ -34,13 +40,14 @@ public void onCreate(Bundle savedInstanceState) {
String movieId = getIntent().getExtras().getString("movieId");
String title = getIntent().getExtras().getString("title");
-
- getActionBar().setSubtitle(title);
+ mToolbarColor = getIntent().getExtras().getInt(IntentKeys.TOOLBAR_COLOR);
+
+ getSupportActionBar().setSubtitle(title);
Fragment frag = getSupportFragmentManager().findFragmentByTag(TAG);
if (frag == null && savedInstanceState == null) {
final FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
- ft.replace(android.R.id.content, ActorBrowserFragment.newInstance(movieId), TAG);
+ ft.replace(R.id.content, ActorBrowserFragment.newInstance(movieId), TAG);
ft.commit();
}
}
@@ -59,6 +66,13 @@ public boolean onOptionsItemSelected(MenuItem item) {
@Override
public void onStart() {
super.onStart();
- getActionBar().setDisplayHomeAsUpEnabled(true);
+ getSupportActionBar().setDisplayHomeAsUpEnabled(true);
+
+ ViewUtils.setToolbarAndStatusBarColor(getSupportActionBar(), getWindow(), mToolbarColor);
+ }
+
+ @Override
+ protected int getLayoutResource() {
+ return R.layout.empty_layout_with_toolbar;
}
}
diff --git a/src/com/miz/mizuu/ActorBrowserTv.java b/app/src/main/java/com/miz/mizuu/ActorBrowserTv.java
similarity index 66%
rename from src/com/miz/mizuu/ActorBrowserTv.java
rename to app/src/main/java/com/miz/mizuu/ActorBrowserTv.java
index 17d51569..98d4bdaf 100644
--- a/src/com/miz/mizuu/ActorBrowserTv.java
+++ b/app/src/main/java/com/miz/mizuu/ActorBrowserTv.java
@@ -6,11 +6,14 @@
import android.view.MenuItem;
import com.miz.base.MizActivity;
+import com.miz.functions.IntentKeys;
import com.miz.mizuu.fragments.ActorBrowserTvFragment;
+import com.miz.utils.ViewUtils;
public class ActorBrowserTv extends MizActivity {
private static String TAG = "ActorBrowserTvFragment";
+ private int mToolbarColor;
@Override
public void onCreate(Bundle savedInstanceState) {
@@ -18,13 +21,14 @@ public void onCreate(Bundle savedInstanceState) {
String showId = getIntent().getExtras().getString("showId");
String title = getIntent().getExtras().getString("title");
+ mToolbarColor = getIntent().getExtras().getInt(IntentKeys.TOOLBAR_COLOR);
- getActionBar().setSubtitle(title);
+ getSupportActionBar().setSubtitle(title);
Fragment frag = getSupportFragmentManager().findFragmentByTag(TAG);
if (frag == null && savedInstanceState == null) {
final FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
- ft.replace(android.R.id.content, ActorBrowserTvFragment.newInstance(showId), TAG);
+ ft.replace(R.id.content, ActorBrowserTvFragment.newInstance(showId), TAG);
ft.commit();
}
}
@@ -43,6 +47,13 @@ public boolean onOptionsItemSelected(MenuItem item) {
@Override
public void onStart() {
super.onStart();
- getActionBar().setDisplayHomeAsUpEnabled(true);
+ getSupportActionBar().setDisplayHomeAsUpEnabled(true);
+
+ ViewUtils.setToolbarAndStatusBarColor(getSupportActionBar(), getWindow(), mToolbarColor);
+ }
+
+ @Override
+ protected int getLayoutResource() {
+ return R.layout.empty_layout_with_toolbar;
}
}
diff --git a/src/com/miz/mizuu/ActorDetails.java b/app/src/main/java/com/miz/mizuu/ActorDetails.java
similarity index 79%
rename from src/com/miz/mizuu/ActorDetails.java
rename to app/src/main/java/com/miz/mizuu/ActorDetails.java
index 9abca0e1..d1a26721 100644
--- a/src/com/miz/mizuu/ActorDetails.java
+++ b/app/src/main/java/com/miz/mizuu/ActorDetails.java
@@ -20,11 +20,10 @@
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction;
import android.view.MenuItem;
-import android.view.Window;
import com.miz.base.MizActivity;
-import com.miz.functions.MizLib;
import com.miz.mizuu.fragments.ActorDetailsFragment;
+import com.miz.utils.ViewUtils;
public class ActorDetails extends MizActivity {
@@ -34,17 +33,12 @@ public class ActorDetails extends MizActivity {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- if (isFullscreen())
- setTheme(R.style.Mizuu_Theme_Transparent_NoBackGround_FullScreen);
- else
- setTheme(R.style.Mizuu_Theme_NoBackGround_Transparent);
+ // Set theme
+ setTheme(R.style.Mizuu_Theme_NoBackground);
- if (MizLib.isPortrait(this))
- getWindow().setBackgroundDrawableResource(R.drawable.bg);
+ ViewUtils.setupWindowFlagsForStatusbarOverlay(getWindow(), isFullscreen(), true);
- getWindow().requestFeature(Window.FEATURE_ACTION_BAR_OVERLAY);
-
- setTitle(null);
+ setTitle(null);
String actorId = getIntent().getExtras().getString("actorID");
@@ -70,6 +64,11 @@ public boolean onOptionsItemSelected(MenuItem item) {
@Override
public void onStart() {
super.onStart();
- getActionBar().setDisplayHomeAsUpEnabled(true);
+ getSupportActionBar().setDisplayHomeAsUpEnabled(true);
+ }
+
+ @Override
+ protected int getLayoutResource() {
+ return 0;
}
}
\ No newline at end of file
diff --git a/src/com/miz/mizuu/ActorMovies.java b/app/src/main/java/com/miz/mizuu/ActorMovies.java
similarity index 75%
rename from src/com/miz/mizuu/ActorMovies.java
rename to app/src/main/java/com/miz/mizuu/ActorMovies.java
index 60523eae..4614f8d1 100644
--- a/src/com/miz/mizuu/ActorMovies.java
+++ b/app/src/main/java/com/miz/mizuu/ActorMovies.java
@@ -22,11 +22,14 @@
import android.view.MenuItem;
import com.miz.base.MizActivity;
+import com.miz.functions.IntentKeys;
import com.miz.mizuu.fragments.ActorMoviesFragment;
+import com.miz.utils.ViewUtils;
public class ActorMovies extends MizActivity {
private static String TAG = "ActorMoviesFragment";
+ private int mToolbarColor;
@Override
public void onCreate(Bundle savedInstanceState) {
@@ -34,13 +37,14 @@ public void onCreate(Bundle savedInstanceState) {
String actorId = getIntent().getExtras().getString("actorId");
String actorName = getIntent().getExtras().getString("actorName");
-
- getActionBar().setSubtitle(actorName);
+ mToolbarColor = getIntent().getExtras().getInt(IntentKeys.TOOLBAR_COLOR);
+
+ getSupportActionBar().setSubtitle(actorName);
Fragment frag = getSupportFragmentManager().findFragmentByTag(TAG);
if (frag == null && savedInstanceState == null) {
final FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
- ft.replace(android.R.id.content, ActorMoviesFragment.newInstance(actorId), TAG);
+ ft.replace(R.id.content, ActorMoviesFragment.newInstance(actorId), TAG);
ft.commit();
}
}
@@ -59,6 +63,13 @@ public boolean onOptionsItemSelected(MenuItem item) {
@Override
public void onStart() {
super.onStart();
- getActionBar().setDisplayHomeAsUpEnabled(true);
+ getSupportActionBar().setDisplayHomeAsUpEnabled(true);
+
+ ViewUtils.setToolbarAndStatusBarColor(getSupportActionBar(), getWindow(), mToolbarColor);
+ }
+
+ @Override
+ protected int getLayoutResource() {
+ return R.layout.empty_layout_with_toolbar;
}
}
\ No newline at end of file
diff --git a/src/com/miz/mizuu/ActorPhotos.java b/app/src/main/java/com/miz/mizuu/ActorPhotos.java
similarity index 75%
rename from src/com/miz/mizuu/ActorPhotos.java
rename to app/src/main/java/com/miz/mizuu/ActorPhotos.java
index 783568dd..e9886f2b 100644
--- a/src/com/miz/mizuu/ActorPhotos.java
+++ b/app/src/main/java/com/miz/mizuu/ActorPhotos.java
@@ -22,11 +22,14 @@
import android.view.MenuItem;
import com.miz.base.MizActivity;
+import com.miz.functions.IntentKeys;
import com.miz.mizuu.fragments.ActorPhotosFragment;
+import com.miz.utils.ViewUtils;
public class ActorPhotos extends MizActivity {
private static String TAG = "ActorPhotosFragment";
+ private int mToolbarColor;
@Override
public void onCreate(Bundle savedInstanceState) {
@@ -34,13 +37,14 @@ public void onCreate(Bundle savedInstanceState) {
String actorId = getIntent().getExtras().getString("actorId");
String actorName = getIntent().getExtras().getString("actorName");
+ mToolbarColor = getIntent().getExtras().getInt(IntentKeys.TOOLBAR_COLOR);
- getActionBar().setSubtitle(actorName);
+ getSupportActionBar().setSubtitle(actorName);
Fragment frag = getSupportFragmentManager().findFragmentByTag(TAG);
if (frag == null && savedInstanceState == null) {
final FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
- ft.replace(android.R.id.content, ActorPhotosFragment.newInstance(actorId), TAG);
+ ft.replace(R.id.content, ActorPhotosFragment.newInstance(actorId), TAG);
ft.commit();
}
}
@@ -59,6 +63,13 @@ public boolean onOptionsItemSelected(MenuItem item) {
@Override
public void onStart() {
super.onStart();
- getActionBar().setDisplayHomeAsUpEnabled(true);
+ getSupportActionBar().setDisplayHomeAsUpEnabled(true);
+
+ ViewUtils.setToolbarAndStatusBarColor(getSupportActionBar(), getWindow(), mToolbarColor);
+ }
+
+ @Override
+ protected int getLayoutResource() {
+ return R.layout.empty_layout_with_toolbar;
}
}
\ No newline at end of file
diff --git a/src/com/miz/mizuu/ActorTaggedPhotos.java b/app/src/main/java/com/miz/mizuu/ActorTaggedPhotos.java
similarity index 75%
rename from src/com/miz/mizuu/ActorTaggedPhotos.java
rename to app/src/main/java/com/miz/mizuu/ActorTaggedPhotos.java
index 3bad6e35..feb525ba 100644
--- a/src/com/miz/mizuu/ActorTaggedPhotos.java
+++ b/app/src/main/java/com/miz/mizuu/ActorTaggedPhotos.java
@@ -22,11 +22,14 @@
import android.view.MenuItem;
import com.miz.base.MizActivity;
+import com.miz.functions.IntentKeys;
import com.miz.mizuu.fragments.ActorTaggedPhotosFragment;
+import com.miz.utils.ViewUtils;
public class ActorTaggedPhotos extends MizActivity {
private static String TAG = "ActorTaggedPhotosFragment";
+ private int mToolbarColor;
@Override
public void onCreate(Bundle savedInstanceState) {
@@ -34,13 +37,14 @@ public void onCreate(Bundle savedInstanceState) {
String actorId = getIntent().getExtras().getString("actorId");
String actorName = getIntent().getExtras().getString("actorName");
+ mToolbarColor = getIntent().getExtras().getInt(IntentKeys.TOOLBAR_COLOR);
- getActionBar().setSubtitle(actorName);
+ getSupportActionBar().setSubtitle(actorName);
Fragment frag = getSupportFragmentManager().findFragmentByTag(TAG);
if (frag == null && savedInstanceState == null) {
final FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
- ft.replace(android.R.id.content, ActorTaggedPhotosFragment.newInstance(actorId), TAG);
+ ft.replace(R.id.content, ActorTaggedPhotosFragment.newInstance(actorId), TAG);
ft.commit();
}
}
@@ -59,6 +63,13 @@ public boolean onOptionsItemSelected(MenuItem item) {
@Override
public void onStart() {
super.onStart();
- getActionBar().setDisplayHomeAsUpEnabled(true);
+ getSupportActionBar().setDisplayHomeAsUpEnabled(true);
+
+ ViewUtils.setToolbarAndStatusBarColor(getSupportActionBar(), getWindow(), mToolbarColor);
+ }
+
+ @Override
+ protected int getLayoutResource() {
+ return R.layout.empty_layout_with_toolbar;
}
}
\ No newline at end of file
diff --git a/src/com/miz/mizuu/ActorTvShows.java b/app/src/main/java/com/miz/mizuu/ActorTvShows.java
similarity index 75%
rename from src/com/miz/mizuu/ActorTvShows.java
rename to app/src/main/java/com/miz/mizuu/ActorTvShows.java
index 7543c32c..46421aca 100644
--- a/src/com/miz/mizuu/ActorTvShows.java
+++ b/app/src/main/java/com/miz/mizuu/ActorTvShows.java
@@ -22,11 +22,14 @@
import android.view.MenuItem;
import com.miz.base.MizActivity;
+import com.miz.functions.IntentKeys;
import com.miz.mizuu.fragments.ActorTvShowsFragment;
+import com.miz.utils.ViewUtils;
public class ActorTvShows extends MizActivity {
private static String TAG = "ActorTvShowsFragment";
+ private int mToolbarColor;
@Override
public void onCreate(Bundle savedInstanceState) {
@@ -34,13 +37,14 @@ public void onCreate(Bundle savedInstanceState) {
String actorId = getIntent().getExtras().getString("actorId");
String actorName = getIntent().getExtras().getString("actorName");
+ mToolbarColor = getIntent().getExtras().getInt(IntentKeys.TOOLBAR_COLOR);
- getActionBar().setSubtitle(actorName);
+ getSupportActionBar().setSubtitle(actorName);
Fragment frag = getSupportFragmentManager().findFragmentByTag(TAG);
if (frag == null && savedInstanceState == null) {
final FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
- ft.replace(android.R.id.content, ActorTvShowsFragment.newInstance(actorId), TAG);
+ ft.replace(R.id.content, ActorTvShowsFragment.newInstance(actorId), TAG);
ft.commit();
}
}
@@ -59,6 +63,13 @@ public boolean onOptionsItemSelected(MenuItem item) {
@Override
public void onStart() {
super.onStart();
- getActionBar().setDisplayHomeAsUpEnabled(true);
+ getSupportActionBar().setDisplayHomeAsUpEnabled(true);
+
+ ViewUtils.setToolbarAndStatusBarColor(getSupportActionBar(), getWindow(), mToolbarColor);
+ }
+
+ @Override
+ protected int getLayoutResource() {
+ return R.layout.empty_layout_with_toolbar;
}
}
\ No newline at end of file
diff --git a/src/com/miz/mizuu/AddFileSource.java b/app/src/main/java/com/miz/mizuu/AddFileSource.java
similarity index 92%
rename from src/com/miz/mizuu/AddFileSource.java
rename to app/src/main/java/com/miz/mizuu/AddFileSource.java
index 6b8c24e5..310b9e1d 100644
--- a/src/com/miz/mizuu/AddFileSource.java
+++ b/app/src/main/java/com/miz/mizuu/AddFileSource.java
@@ -16,11 +16,6 @@
package com.miz.mizuu;
-import static com.miz.functions.MizLib.TYPE;
-import static com.miz.functions.MizLib.MOVIE;
-import static com.miz.functions.MizLib.TV_SHOW;
-import static com.miz.functions.MizLib.FILESOURCE;
-
import android.content.Intent;
import android.graphics.Typeface;
import android.os.Bundle;
@@ -33,6 +28,12 @@
import com.miz.base.MizActivity;
import com.miz.functions.FileSource;
+import com.miz.utils.TypefaceUtils;
+
+import static com.miz.functions.MizLib.FILESOURCE;
+import static com.miz.functions.MizLib.MOVIE;
+import static com.miz.functions.MizLib.TV_SHOW;
+import static com.miz.functions.MizLib.TYPE;
public class AddFileSource extends MizActivity {
@@ -45,11 +46,9 @@ public class AddFileSource extends MizActivity {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- setContentView(R.layout.add_file_source);
-
setTitle(R.string.addFileSourceTitle);
- mTypeface = MizuuApplication.getOrCreateTypeface(this, "RobotoCondensed-Regular.ttf");
+ mTypeface = TypefaceUtils.getRobotoCondensedRegular(this);
mContentType = (TextView) findViewById(R.id.contentType);
mContentType.setTypeface(mTypeface);
@@ -79,11 +78,16 @@ public void onClick(View v) {
}
});
}
+
+ @Override
+ protected int getLayoutResource() {
+ return R.layout.add_file_source;
+ }
@Override
public void onStart() {
super.onStart();
- getActionBar().setDisplayHomeAsUpEnabled(true);
+ getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}
@Override
diff --git a/src/com/miz/mizuu/AddNetworkFilesourceDialog.java b/app/src/main/java/com/miz/mizuu/AddNetworkFilesourceDialog.java
similarity index 100%
rename from src/com/miz/mizuu/AddNetworkFilesourceDialog.java
rename to app/src/main/java/com/miz/mizuu/AddNetworkFilesourceDialog.java
index 1142cde5..3f0bb26c 100644
--- a/src/com/miz/mizuu/AddNetworkFilesourceDialog.java
+++ b/app/src/main/java/com/miz/mizuu/AddNetworkFilesourceDialog.java
@@ -16,11 +16,6 @@
package com.miz.mizuu;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.TreeSet;
-
import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.AlertDialog;
@@ -47,14 +42,19 @@
import com.miz.functions.FileSource;
import com.miz.functions.MizLib;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.TreeSet;
+
import static com.miz.functions.MizLib.DOMAIN;
-import static com.miz.functions.MizLib.USER;
+import static com.miz.functions.MizLib.FILESOURCE;
+import static com.miz.functions.MizLib.MOVIE;
import static com.miz.functions.MizLib.PASSWORD;
import static com.miz.functions.MizLib.SERVER;
-import static com.miz.functions.MizLib.TYPE;
import static com.miz.functions.MizLib.TV_SHOW;
-import static com.miz.functions.MizLib.MOVIE;
-import static com.miz.functions.MizLib.FILESOURCE;
+import static com.miz.functions.MizLib.TYPE;
+import static com.miz.functions.MizLib.USER;
import static com.miz.functions.PreferenceKeys.FULLSCREEN_TAG;
public class AddNetworkFilesourceDialog extends Activity {
diff --git a/src/com/miz/mizuu/AddUpnpFilesourceDialog.java b/app/src/main/java/com/miz/mizuu/AddUpnpFilesourceDialog.java
similarity index 100%
rename from src/com/miz/mizuu/AddUpnpFilesourceDialog.java
rename to app/src/main/java/com/miz/mizuu/AddUpnpFilesourceDialog.java
index d7db1cba..70cf21cc 100644
--- a/src/com/miz/mizuu/AddUpnpFilesourceDialog.java
+++ b/app/src/main/java/com/miz/mizuu/AddUpnpFilesourceDialog.java
@@ -16,20 +16,6 @@
package com.miz.mizuu;
-import static com.miz.functions.MizLib.FILESOURCE;
-import static com.miz.functions.MizLib.MOVIE;
-import static com.miz.functions.MizLib.SERIAL_NUMBER;
-import static com.miz.functions.MizLib.SERVER;
-import static com.miz.functions.MizLib.TV_SHOW;
-import static com.miz.functions.MizLib.TYPE;
-
-import org.teleal.cling.android.AndroidUpnpService;
-import org.teleal.cling.model.meta.Device;
-import org.teleal.cling.model.meta.LocalDevice;
-import org.teleal.cling.model.meta.RemoteDevice;
-import org.teleal.cling.registry.DefaultRegistryListener;
-import org.teleal.cling.registry.Registry;
-
import android.app.Activity;
import android.content.ComponentName;
import android.content.Context;
@@ -46,6 +32,20 @@
import com.miz.functions.FileSource;
import com.miz.service.WireUpnpService;
+import org.teleal.cling.android.AndroidUpnpService;
+import org.teleal.cling.model.meta.Device;
+import org.teleal.cling.model.meta.LocalDevice;
+import org.teleal.cling.model.meta.RemoteDevice;
+import org.teleal.cling.registry.DefaultRegistryListener;
+import org.teleal.cling.registry.Registry;
+
+import static com.miz.functions.MizLib.FILESOURCE;
+import static com.miz.functions.MizLib.MOVIE;
+import static com.miz.functions.MizLib.SERIAL_NUMBER;
+import static com.miz.functions.MizLib.SERVER;
+import static com.miz.functions.MizLib.TV_SHOW;
+import static com.miz.functions.MizLib.TYPE;
+
public class AddUpnpFilesourceDialog extends Activity {
private ListView mListView;
diff --git a/src/com/miz/mizuu/CancelLibraryUpdate.java b/app/src/main/java/com/miz/mizuu/CancelLibraryUpdate.java
similarity index 98%
rename from src/com/miz/mizuu/CancelLibraryUpdate.java
rename to app/src/main/java/com/miz/mizuu/CancelLibraryUpdate.java
index b7284ff5..ea958f55 100644
--- a/src/com/miz/mizuu/CancelLibraryUpdate.java
+++ b/app/src/main/java/com/miz/mizuu/CancelLibraryUpdate.java
@@ -32,8 +32,6 @@ public class CancelLibraryUpdate extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
-
- setContentView(R.layout.empty_layout);
final boolean isMovie = getIntent().getExtras().getBoolean("isMovie");
diff --git a/src/com/miz/mizuu/CancelOfflineDownload.java b/app/src/main/java/com/miz/mizuu/CancelOfflineDownload.java
similarity index 97%
rename from src/com/miz/mizuu/CancelOfflineDownload.java
rename to app/src/main/java/com/miz/mizuu/CancelOfflineDownload.java
index 0aa519bf..91b9e4f3 100644
--- a/src/com/miz/mizuu/CancelOfflineDownload.java
+++ b/app/src/main/java/com/miz/mizuu/CancelOfflineDownload.java
@@ -21,7 +21,6 @@
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
-
import android.support.v4.content.LocalBroadcastManager;
import android.widget.Toast;
@@ -31,8 +30,6 @@ public class CancelOfflineDownload extends Activity {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- setContentView(R.layout.empty_layout);
-
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setMessage(getString(R.string.areYouSure))
.setTitle(getString(R.string.stopFileDownload))
diff --git a/src/com/miz/mizuu/EditMovie.java b/app/src/main/java/com/miz/mizuu/EditMovie.java
similarity index 55%
rename from src/com/miz/mizuu/EditMovie.java
rename to app/src/main/java/com/miz/mizuu/EditMovie.java
index d679c845..5b2713d9 100644
--- a/src/com/miz/mizuu/EditMovie.java
+++ b/app/src/main/java/com/miz/mizuu/EditMovie.java
@@ -4,19 +4,37 @@
import android.support.v4.app.FragmentManager;
import com.miz.base.MizActivity;
+import com.miz.functions.IntentKeys;
import com.miz.mizuu.fragments.EditMovieFragment;
+import com.miz.utils.ViewUtils;
public class EditMovie extends MizActivity {
+ private int mToolbarColor;
+
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
final String movieId = getIntent().getStringExtra("movieId");
+ mToolbarColor = getIntent().getExtras().getInt(IntentKeys.TOOLBAR_COLOR);
+
final FragmentManager fm = getSupportFragmentManager();
if (fm.findFragmentById(android.R.id.content) == null) {
fm.beginTransaction().add(android.R.id.content, EditMovieFragment.newInstance(movieId)).commit();
}
}
+
+ @Override
+ public void onStart() {
+ super.onStart();
+ getSupportActionBar().setDisplayHomeAsUpEnabled(true);
+
+ ViewUtils.setToolbarAndStatusBarColor(getSupportActionBar(), getWindow(), mToolbarColor);
+ }
+ @Override
+ protected int getLayoutResource() {
+ return 0;
+ }
}
diff --git a/src/com/miz/mizuu/EditTvShow.java b/app/src/main/java/com/miz/mizuu/EditTvShow.java
similarity index 55%
rename from src/com/miz/mizuu/EditTvShow.java
rename to app/src/main/java/com/miz/mizuu/EditTvShow.java
index 752977a8..4d37879b 100644
--- a/src/com/miz/mizuu/EditTvShow.java
+++ b/app/src/main/java/com/miz/mizuu/EditTvShow.java
@@ -4,19 +4,37 @@
import android.support.v4.app.FragmentManager;
import com.miz.base.MizActivity;
+import com.miz.functions.IntentKeys;
import com.miz.mizuu.fragments.EditTvShowFragment;
+import com.miz.utils.ViewUtils;
public class EditTvShow extends MizActivity {
+ private int mToolbarColor;
+
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
final String showId = getIntent().getStringExtra("showId");
+ mToolbarColor = getIntent().getExtras().getInt(IntentKeys.TOOLBAR_COLOR);
+
final FragmentManager fm = getSupportFragmentManager();
if (fm.findFragmentById(android.R.id.content) == null) {
fm.beginTransaction().add(android.R.id.content, EditTvShowFragment.newInstance(showId)).commit();
}
}
+
+ @Override
+ public void onStart() {
+ super.onStart();
+ getSupportActionBar().setDisplayHomeAsUpEnabled(true);
+
+ ViewUtils.setToolbarAndStatusBarColor(getSupportActionBar(), getWindow(), mToolbarColor);
+ }
+ @Override
+ protected int getLayoutResource() {
+ return 0;
+ }
}
diff --git a/src/com/miz/mizuu/EditTvShowEpisode.java b/app/src/main/java/com/miz/mizuu/EditTvShowEpisode.java
similarity index 92%
rename from src/com/miz/mizuu/EditTvShowEpisode.java
rename to app/src/main/java/com/miz/mizuu/EditTvShowEpisode.java
index b8667895..17f7653a 100644
--- a/src/com/miz/mizuu/EditTvShowEpisode.java
+++ b/app/src/main/java/com/miz/mizuu/EditTvShowEpisode.java
@@ -21,4 +21,8 @@ public void onCreate(Bundle savedInstanceState) {
}
}
+ @Override
+ protected int getLayoutResource() {
+ return 0;
+ }
}
diff --git a/src/com/miz/mizuu/FileSourceBrowser.java b/app/src/main/java/com/miz/mizuu/FileSourceBrowser.java
similarity index 84%
rename from src/com/miz/mizuu/FileSourceBrowser.java
rename to app/src/main/java/com/miz/mizuu/FileSourceBrowser.java
index 8eb32a60..a53bbf60 100644
--- a/src/com/miz/mizuu/FileSourceBrowser.java
+++ b/app/src/main/java/com/miz/mizuu/FileSourceBrowser.java
@@ -16,16 +16,6 @@
package com.miz.mizuu;
-import static com.miz.functions.MizLib.DOMAIN;
-import static com.miz.functions.MizLib.FILESOURCE;
-import static com.miz.functions.MizLib.MOVIE;
-import static com.miz.functions.MizLib.PASSWORD;
-import static com.miz.functions.MizLib.SERIAL_NUMBER;
-import static com.miz.functions.MizLib.SERVER;
-import static com.miz.functions.MizLib.TYPE;
-import static com.miz.functions.MizLib.USER;
-import static com.miz.functions.PreferenceKeys.HAS_SHOWN_FILEBROWSER_MESSAGE;
-
import android.content.Intent;
import android.content.SharedPreferences.Editor;
import android.os.Bundle;
@@ -40,6 +30,16 @@
import com.miz.functions.FileSource;
import com.miz.mizuu.fragments.FileSourceBrowserFragment;
+import static com.miz.functions.MizLib.DOMAIN;
+import static com.miz.functions.MizLib.FILESOURCE;
+import static com.miz.functions.MizLib.MOVIE;
+import static com.miz.functions.MizLib.PASSWORD;
+import static com.miz.functions.MizLib.SERIAL_NUMBER;
+import static com.miz.functions.MizLib.SERVER;
+import static com.miz.functions.MizLib.TYPE;
+import static com.miz.functions.MizLib.USER;
+import static com.miz.functions.PreferenceKeys.HAS_SHOWN_FILEBROWSER_MESSAGE;
+
public class FileSourceBrowser extends MizActivity {
private static String TAG = "";
@@ -62,13 +62,13 @@ public void onCreate(Bundle savedInstanceState) {
ft.setCustomAnimations(R.anim.fade_in, R.anim.fade_out);
switch (mFilesource) {
case FileSource.FILE:
- ft.replace(android.R.id.content, FileSourceBrowserFragment.newInstanceFile(isMovie), TAG);
+ ft.replace(R.id.content, FileSourceBrowserFragment.newInstanceFile(isMovie), TAG);
break;
case FileSource.SMB:
- ft.replace(android.R.id.content, FileSourceBrowserFragment.newInstanceSmbFile(extras.getString(SERVER), extras.getString(USER), extras.getString(PASSWORD), extras.getString(DOMAIN), isMovie), TAG);
+ ft.replace(R.id.content, FileSourceBrowserFragment.newInstanceSmbFile(extras.getString(SERVER), extras.getString(USER), extras.getString(PASSWORD), extras.getString(DOMAIN), isMovie), TAG);
break;
case FileSource.UPNP:
- ft.replace(android.R.id.content, FileSourceBrowserFragment.newInstanceUpnp(extras.getString(SERVER), extras.getString(SERIAL_NUMBER), isMovie), TAG);
+ ft.replace(R.id.content, FileSourceBrowserFragment.newInstanceUpnp(extras.getString(SERVER), extras.getString(SERIAL_NUMBER), isMovie), TAG);
break;
}
ft.commit();
@@ -99,11 +99,16 @@ public boolean onOptionsItemSelected(MenuItem item) {
@Override
public void onStart() {
super.onStart();
- getActionBar().setDisplayHomeAsUpEnabled(true);
+ getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}
@Override
public void onBackPressed() {
LocalBroadcastManager.getInstance(this).sendBroadcast(new Intent("onBackPressed"));
}
+
+ @Override
+ protected int getLayoutResource() {
+ return R.layout.empty_layout_with_toolbar;
+ }
}
\ No newline at end of file
diff --git a/src/com/miz/mizuu/FileSources.java b/app/src/main/java/com/miz/mizuu/FileSources.java
similarity index 96%
rename from src/com/miz/mizuu/FileSources.java
rename to app/src/main/java/com/miz/mizuu/FileSources.java
index 0828ae30..e828c059 100644
--- a/src/com/miz/mizuu/FileSources.java
+++ b/app/src/main/java/com/miz/mizuu/FileSources.java
@@ -16,17 +16,12 @@
package com.miz.mizuu;
-import java.util.ArrayList;
-
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.database.Cursor;
import android.os.Bundle;
-import com.miz.base.MizActivity;
-import com.miz.db.DbAdapterSources;
-
import android.support.v4.content.LocalBroadcastManager;
import android.view.LayoutInflater;
import android.view.Menu;
@@ -40,7 +35,12 @@
import android.widget.ListView;
import android.widget.TextView;
+import com.miz.base.MizActivity;
+import com.miz.db.DbAdapterSources;
import com.miz.functions.FileSource;
+import com.miz.utils.TypefaceUtils;
+
+import java.util.ArrayList;
public class FileSources extends MizActivity {
@@ -54,8 +54,6 @@ public class FileSources extends MizActivity {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- setContentView(R.layout.filesources_layout);
-
mEmptyView = (LinearLayout) findViewById(R.id.noFileSources);
mListView = (ListView) findViewById(R.id.listView1);
@@ -68,6 +66,11 @@ public void onCreate(Bundle savedInstanceState) {
LocalBroadcastManager.getInstance(this).registerReceiver(mMessageReceiver, new IntentFilter("mizuu-filesource-change"));
}
+ @Override
+ protected int getLayoutResource() {
+ return R.layout.filesources_layout;
+ }
+
private BroadcastReceiver mMessageReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
@@ -78,7 +81,7 @@ public void onReceive(Context context, Intent intent) {
@Override
public void onStart() {
super.onStart();
- getActionBar().setDisplayHomeAsUpEnabled(true);
+ getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}
@Override
@@ -211,7 +214,7 @@ public View getView(final int position, View convertView, ViewGroup parent) {
convertView = mInflater.inflate(R.layout.file_source_list_header, parent, false);
TextView title = (TextView) convertView.findViewById(R.id.title);
title.setText(mItems.get(position).getTitle());
- title.setTypeface(MizuuApplication.getOrCreateTypeface(getApplicationContext(), "Roboto-Light.ttf"));
+ title.setTypeface(TypefaceUtils.getRobotoLight(getApplicationContext()));
} else {
convertView = mInflater.inflate(R.layout.filesource_list, parent, false);
((TextView) convertView.findViewById(R.id.txtListTitle)).setText(mItems.get(position).getTitle());
diff --git a/src/com/miz/mizuu/IdentifyMovie.java b/app/src/main/java/com/miz/mizuu/IdentifyMovie.java
similarity index 76%
rename from src/com/miz/mizuu/IdentifyMovie.java
rename to app/src/main/java/com/miz/mizuu/IdentifyMovie.java
index f1cad7ed..ff40407e 100644
--- a/src/com/miz/mizuu/IdentifyMovie.java
+++ b/app/src/main/java/com/miz/mizuu/IdentifyMovie.java
@@ -22,22 +22,27 @@
import android.view.MenuItem;
import com.miz.base.MizActivity;
+import com.miz.functions.IntentKeys;
import com.miz.mizuu.fragments.IdentifyMovieFragment;
+import com.miz.utils.ViewUtils;
public class IdentifyMovie extends MizActivity {
private static String TAG = "IdentifyMovieFragment";
+ private int mToolbarColor;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
String filepath = getIntent().getExtras().getString("fileName");
+ String currentMovieId = getIntent().getExtras().getString("currentMovieId");
+ mToolbarColor = getIntent().getExtras().getInt(IntentKeys.TOOLBAR_COLOR);
Fragment frag = getSupportFragmentManager().findFragmentByTag(TAG);
if (frag == null) {
final FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
- ft.add(android.R.id.content, IdentifyMovieFragment.newInstance(filepath), TAG);
+ ft.add(android.R.id.content, IdentifyMovieFragment.newInstance(filepath, currentMovieId), TAG);
ft.commit();
}
}
@@ -56,6 +61,13 @@ public boolean onOptionsItemSelected(MenuItem item) {
@Override
public void onStart() {
super.onStart();
- getActionBar().setDisplayHomeAsUpEnabled(true);
+ getSupportActionBar().setDisplayHomeAsUpEnabled(true);
+
+ ViewUtils.setToolbarAndStatusBarColor(getSupportActionBar(), getWindow(), mToolbarColor);
+ }
+
+ @Override
+ protected int getLayoutResource() {
+ return 0;
}
}
\ No newline at end of file
diff --git a/src/com/miz/mizuu/IdentifyTvShow.java b/app/src/main/java/com/miz/mizuu/IdentifyTvShow.java
similarity index 81%
rename from src/com/miz/mizuu/IdentifyTvShow.java
rename to app/src/main/java/com/miz/mizuu/IdentifyTvShow.java
index 010bc5d4..574751b5 100644
--- a/src/com/miz/mizuu/IdentifyTvShow.java
+++ b/app/src/main/java/com/miz/mizuu/IdentifyTvShow.java
@@ -22,11 +22,14 @@
import android.view.MenuItem;
import com.miz.base.MizActivity;
+import com.miz.functions.IntentKeys;
import com.miz.mizuu.fragments.IdentifyTvShowFragment;
+import com.miz.utils.ViewUtils;
public class IdentifyTvShow extends MizActivity {
private static String TAG = "IdentifyTvShowFragment";
+ private int mToolbarColor;
@Override
public void onCreate(Bundle savedInstanceState) {
@@ -34,6 +37,7 @@ public void onCreate(Bundle savedInstanceState) {
String showId = getIntent().getExtras().getString("showId");
String showTitle = getIntent().getExtras().getString("showTitle");
+ mToolbarColor = getIntent().getExtras().getInt(IntentKeys.TOOLBAR_COLOR);
Fragment frag = getSupportFragmentManager().findFragmentByTag(TAG);
if (frag == null) {
@@ -57,6 +61,13 @@ public boolean onOptionsItemSelected(MenuItem item) {
@Override
public void onStart() {
super.onStart();
- getActionBar().setDisplayHomeAsUpEnabled(true);
+ getSupportActionBar().setDisplayHomeAsUpEnabled(true);
+
+ ViewUtils.setToolbarAndStatusBarColor(getSupportActionBar(), getWindow(), mToolbarColor);
+ }
+
+ @Override
+ protected int getLayoutResource() {
+ return 0;
}
}
\ No newline at end of file
diff --git a/src/com/miz/mizuu/IdentifyTvShowEpisode.java b/app/src/main/java/com/miz/mizuu/IdentifyTvShowEpisode.java
similarity index 93%
rename from src/com/miz/mizuu/IdentifyTvShowEpisode.java
rename to app/src/main/java/com/miz/mizuu/IdentifyTvShowEpisode.java
index ef9f7a0a..e24d787e 100644
--- a/src/com/miz/mizuu/IdentifyTvShowEpisode.java
+++ b/app/src/main/java/com/miz/mizuu/IdentifyTvShowEpisode.java
@@ -16,8 +16,6 @@
package com.miz.mizuu;
-import java.util.ArrayList;
-
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction;
@@ -26,6 +24,8 @@
import com.miz.base.MizActivity;
import com.miz.mizuu.fragments.IdentifyTvShowEpisodeFragment;
+import java.util.ArrayList;
+
public class IdentifyTvShowEpisode extends MizActivity {
private static String TAG = "IdentifyTvShowEpisodeFragment";
@@ -60,6 +60,11 @@ public boolean onOptionsItemSelected(MenuItem item) {
@Override
public void onStart() {
super.onStart();
- getActionBar().setDisplayHomeAsUpEnabled(true);
+ getSupportActionBar().setDisplayHomeAsUpEnabled(true);
+ }
+
+ @Override
+ protected int getLayoutResource() {
+ return 0;
}
}
\ No newline at end of file
diff --git a/src/com/miz/mizuu/ImageViewer.java b/app/src/main/java/com/miz/mizuu/ImageViewer.java
similarity index 84%
rename from src/com/miz/mizuu/ImageViewer.java
rename to app/src/main/java/com/miz/mizuu/ImageViewer.java
index 409fe0b6..9d85a132 100644
--- a/src/com/miz/mizuu/ImageViewer.java
+++ b/app/src/main/java/com/miz/mizuu/ImageViewer.java
@@ -22,19 +22,18 @@
import android.os.Bundle;
import android.os.Handler;
import android.support.v4.app.Fragment;
-import com.miz.base.MizActivity;
-import com.miz.functions.MizLib;
-
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.view.ViewPager;
import android.support.v4.view.ViewPager.SimpleOnPageChangeListener;
+import android.support.v7.widget.Toolbar;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnSystemUiVisibilityChangeListener;
-import android.view.Window;
+import com.miz.base.MizActivity;
+import com.miz.functions.MizLib;
import com.miz.mizuu.fragments.ActorPhotoFragment;
import com.squareup.otto.Bus;
import com.squareup.otto.Subscribe;
@@ -46,6 +45,7 @@ public class ImageViewer extends MizActivity {
private String[] mPhotos;
private Bus mBus;
private Handler mHandler = new Handler();
+ private Toolbar mToolbar;
private Runnable mHideSystemUiRunnable = new Runnable() {
@Override
public void run() {
@@ -55,7 +55,6 @@ public void run() {
@Override
public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
if (MizLib.hasKitKat()) {
if (isFullscreen())
@@ -69,18 +68,21 @@ public void onCreate(Bundle savedInstanceState) {
setTheme(R.style.Mizuu_Theme_Transparent);
}
- getWindow().requestFeature(Window.FEATURE_ACTION_BAR_OVERLAY);
+ super.onCreate(savedInstanceState);
- setContentView(R.layout.viewpager);
+ mToolbar = (Toolbar) findViewById(R.id.toolbar);
+ setSupportActionBar(mToolbar);
+ getSupportActionBar().setBackgroundDrawable(getResources().getDrawable(R.drawable.transparent_actionbar));
+
mBus = MizuuApplication.getBus();
- getActionBar().setBackgroundDrawable(null);
+ //getSupportActionBar().setBackgroundDrawable(null);
mPortraitPhotos = getIntent().getBooleanExtra("portraitPhotos", true);
mPhotos = getIntent().getStringArrayExtra("photos");
- setTitle((getIntent().getIntExtra("selectedIndex", 0) + 1) + " " + getString(R.string.of) + " " + mPhotos.length);
+ getSupportActionBar().setTitle((getIntent().getIntExtra("selectedIndex", 0) + 1) + " " + getString(R.string.of) + " " + mPhotos.length);
mViewPager = (ViewPager) findViewById(R.id.awesomepager);
mViewPager.setPageMargin(MizLib.convertDpToPixels(getApplicationContext(), 16));
@@ -88,7 +90,7 @@ public void onCreate(Bundle savedInstanceState) {
mViewPager.setOnPageChangeListener(new SimpleOnPageChangeListener() {
@Override
public void onPageSelected(int arg0) {
- setTitle((arg0 + 1) + " " + getString(R.string.of) + " " + mPhotos.length);
+ getSupportActionBar().setTitle((arg0 + 1) + " " + getString(R.string.of) + " " + mPhotos.length);
}
});
@@ -105,18 +107,21 @@ public void onSystemUiVisibilityChange(int visibility) {
}
});
}
+
+ @Override
+ protected int getLayoutResource() {
+ return R.layout.viewpager_with_toolbar_overlay;
+ }
@SuppressLint("InlinedApi")
@Subscribe
public void tappedImage(Object event) {
- boolean visible = getActionBar().isShowing();
+ boolean visible = getSupportActionBar().isShowing();
if (visible) {
- getActionBar().hide();
hideSystemUi();
} else {
showSystemUi();
- getActionBar().show();
}
}
@@ -130,10 +135,14 @@ private void hideSystemUi() {
| View.SYSTEM_UI_FLAG_IMMERSIVE);
mHandler.removeCallbacks(mHideSystemUiRunnable);
+
+ getSupportActionBar().hide();
}
private void showSystemUi() {
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_VISIBLE);
+
+ getSupportActionBar().show();
}
@Override
@@ -195,6 +204,6 @@ private void openInBrowser() {
@Override
public void onStart() {
super.onStart();
- getActionBar().setDisplayHomeAsUpEnabled(true);
+ getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}
}
\ No newline at end of file
diff --git a/app/src/main/java/com/miz/mizuu/Main.java b/app/src/main/java/com/miz/mizuu/Main.java
new file mode 100644
index 00000000..58cf37fa
--- /dev/null
+++ b/app/src/main/java/com/miz/mizuu/Main.java
@@ -0,0 +1,582 @@
+/*
+ * Copyright (C) 2014 Michell Bak
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.miz.mizuu;
+
+import android.annotation.SuppressLint;
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.content.IntentFilter;
+import android.content.SharedPreferences;
+import android.content.pm.ApplicationInfo;
+import android.content.pm.PackageManager;
+import android.content.res.Configuration;
+import android.graphics.Color;
+import android.graphics.Typeface;
+import android.os.Bundle;
+import android.preference.PreferenceActivity;
+import android.preference.PreferenceManager;
+import android.support.v4.app.Fragment;
+import android.support.v4.app.FragmentTransaction;
+import android.support.v4.content.LocalBroadcastManager;
+import android.support.v4.view.GravityCompat;
+import android.support.v4.widget.DrawerLayout;
+import android.support.v7.app.ActionBarDrawerToggle;
+import android.text.TextUtils;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.AdapterView;
+import android.widget.AdapterView.OnItemClickListener;
+import android.widget.BaseAdapter;
+import android.widget.ImageView;
+import android.widget.LinearLayout;
+import android.widget.ListView;
+import android.widget.TextView;
+import android.widget.Toast;
+
+import com.miz.base.MizActivity;
+import com.miz.db.DbAdapterMovies;
+import com.miz.db.DbAdapterTvShows;
+import com.miz.functions.MenuItem;
+import com.miz.functions.MizLib;
+import com.miz.mizuu.fragments.AccountsFragment;
+import com.miz.mizuu.fragments.ContactDeveloperFragment;
+import com.miz.mizuu.fragments.MovieDiscoveryViewPagerFragment;
+import com.miz.mizuu.fragments.MovieLibraryFragment;
+import com.miz.mizuu.fragments.TvShowLibraryFragment;
+import com.miz.mizuu.fragments.WebVideosViewPagerFragment;
+import com.miz.utils.LocalBroadcastUtils;
+import com.miz.utils.TypefaceUtils;
+import com.miz.utils.ViewUtils;
+import com.squareup.picasso.Callback;
+import com.squareup.picasso.Picasso;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+
+import static com.miz.functions.PreferenceKeys.CONFIRM_BACK_PRESS;
+import static com.miz.functions.PreferenceKeys.STARTUP_SELECTION;
+import static com.miz.functions.PreferenceKeys.TRAKT_FULL_NAME;
+import static com.miz.functions.PreferenceKeys.TRAKT_USERNAME;
+
+@SuppressLint("NewApi")
+public class Main extends MizActivity {
+
+ public static final int MOVIES = 1, SHOWS = 2, WATCHLIST = 3, WEB_MOVIES = 4, WEB_VIDEOS = 5;
+ private int mNumMovies, mNumShows, mNumWatchlist, selectedIndex, mStartup;
+ private Typeface mTfMedium, mTfCondensed, mTfRegular;
+ private DrawerLayout mDrawerLayout;
+ protected ListView mDrawerList;
+ private ActionBarDrawerToggle mDrawerToggle;
+ private DbAdapterMovies mDbHelper;
+ private DbAdapterTvShows mDbHelperTv;
+ private boolean mConfirmExit, mTriedOnce = false;
+ private ArrayList