├── .gitignore
├── CODE_OF_CONDUCT.md
├── CONTRIBUTING.md
├── LICENSE.txt
├── README.md
├── app
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── com
│ │ └── irontec
│ │ └── axier
│ │ └── mvvmexample
│ │ └── ExampleInstrumentedTest.java
│ ├── main
│ ├── AndroidManifest.xml
│ ├── java
│ │ └── com
│ │ │ └── irontec
│ │ │ └── axier
│ │ │ └── mvvmexample
│ │ │ ├── mock
│ │ │ └── ArticleMockHelper.kt
│ │ │ ├── model
│ │ │ └── Article.kt
│ │ │ ├── view
│ │ │ ├── ArticleAdapter.kt
│ │ │ └── MainActivity.kt
│ │ │ └── viewmodel
│ │ │ └── ArticleViewModel.kt
│ └── res
│ │ ├── layout
│ │ ├── activity_main.xml
│ │ └── row_article.xml
│ │ ├── mipmap-hdpi
│ │ └── ic_launcher.png
│ │ ├── mipmap-mdpi
│ │ └── ic_launcher.png
│ │ ├── mipmap-xhdpi
│ │ └── ic_launcher.png
│ │ ├── mipmap-xxhdpi
│ │ └── ic_launcher.png
│ │ ├── mipmap-xxxhdpi
│ │ └── ic_launcher.png
│ │ └── values
│ │ ├── colors.xml
│ │ ├── strings.xml
│ │ └── styles.xml
│ └── test
│ └── java
│ └── com
│ └── irontec
│ └── axier
│ └── mvvmexample
│ └── ExampleUnitTest.java
├── build.gradle
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── logo.png
└── settings.gradle
/.gitignore:
--------------------------------------------------------------------------------
1 |
2 | # Created by https://www.gitignore.io/api/macos,android,intellij+all,androidstudio
3 |
4 | ### Android ###
5 | # Built application files
6 | *.apk
7 | *.ap_
8 |
9 | # Files for the ART/Dalvik VM
10 | *.dex
11 |
12 | # Java class files
13 | *.class
14 |
15 | # Generated files
16 | bin/
17 | gen/
18 | out/
19 |
20 | # Gradle files
21 | .gradle/
22 | build/
23 |
24 | # Local configuration file (sdk path, etc)
25 | local.properties
26 |
27 | # Proguard folder generated by Eclipse
28 | proguard/
29 |
30 | # Log Files
31 | *.log
32 |
33 | # Android Studio Navigation editor temp files
34 | .navigation/
35 |
36 | # Android Studio captures folder
37 | captures/
38 |
39 | # Intellij
40 | *.iml
41 | .idea/workspace.xml
42 | .idea/tasks.xml
43 | .idea/gradle.xml
44 | .idea/dictionaries
45 | .idea/libraries
46 |
47 | # Keystore files
48 | *.jks
49 |
50 | # External native build folder generated in Android Studio 2.2 and later
51 | .externalNativeBuild
52 |
53 | # Google Services (e.g. APIs or Firebase)
54 | google-services.json
55 |
56 | # Freeline
57 | freeline.py
58 | freeline/
59 | freeline_project_description.json
60 |
61 | ### Android Patch ###
62 | gen-external-apklibs
63 |
64 | ### AndroidStudio ###
65 | # Covers files to be ignored for android development using Android Studio.
66 |
67 | # Built application files
68 |
69 | # Files for the ART/Dalvik VM
70 |
71 | # Java class files
72 |
73 | # Generated files
74 |
75 | # Gradle files
76 | .gradle
77 |
78 | # Signing files
79 | .signing/
80 |
81 | # Local configuration file (sdk path, etc)
82 |
83 | # Proguard folder generated by Eclipse
84 |
85 | # Log Files
86 |
87 | # Android Studio
88 | /*/build/
89 | /*/local.properties
90 | /*/out
91 | /*/*/build
92 | /*/*/production
93 | *.ipr
94 | *~
95 | *.swp
96 |
97 | # Android Patch
98 |
99 | # External native build folder generated in Android Studio 2.2 and later
100 |
101 | # NDK
102 | obj/
103 |
104 | # IntelliJ IDEA
105 | *.iws
106 | /out/
107 |
108 | # User-specific configurations
109 | .idea/libraries/
110 | .idea/.name
111 | .idea/compiler.xml
112 | .idea/copyright/profiles_settings.xml
113 | .idea/encodings.xml
114 | .idea/misc.xml
115 | .idea/modules.xml
116 | .idea/scopes/scope_settings.xml
117 | .idea/vcs.xml
118 | .idea/jsLibraryMappings.xml
119 | .idea/datasources.xml
120 | .idea/dataSources.ids
121 | .idea/sqlDataSources.xml
122 | .idea/dynamic.xml
123 | .idea/uiDesigner.xml
124 |
125 | # Keystore files
126 |
127 | # OS-specific files
128 | .DS_Store
129 | .DS_Store?
130 | ._*
131 | .Spotlight-V100
132 | .Trashes
133 | ehthumbs.db
134 | Thumbs.db
135 |
136 | # Legacy Eclipse project files
137 | .classpath
138 | .project
139 |
140 | # Mobile Tools for Java (J2ME)
141 | .mtj.tmp/
142 |
143 | # Package Files #
144 | *.jar
145 | *.war
146 | *.ear
147 |
148 | # virtual machine crash logs (Reference: http://www.java.com/en/download/help/error_hotspot.xml)
149 | hs_err_pid*
150 |
151 | ## Plugin-specific files:
152 |
153 | # mpeltonen/sbt-idea plugin
154 | .idea_modules/
155 |
156 | # JIRA plugin
157 | atlassian-ide-plugin.xml
158 |
159 | # Mongo Explorer plugin
160 | .idea/mongoSettings.xml
161 |
162 | # Crashlytics plugin (for Android Studio and IntelliJ)
163 | com_crashlytics_export_strings.xml
164 | crashlytics.properties
165 | crashlytics-build.properties
166 | fabric.properties
167 |
168 | ### AndroidStudio Patch ###
169 | # Google Services plugin
170 |
171 | !/gradle/wrapper/gradle-wrapper.jar
172 |
173 | ### Intellij+all ###
174 | # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
175 | # Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
176 |
177 | # User-specific stuff:
178 | .idea/**/workspace.xml
179 | .idea/**/tasks.xml
180 |
181 | # Sensitive or high-churn files:
182 | .idea/**/dataSources/
183 | .idea/**/dataSources.ids
184 | .idea/**/dataSources.xml
185 | .idea/**/dataSources.local.xml
186 | .idea/**/sqlDataSources.xml
187 | .idea/**/dynamic.xml
188 | .idea/**/uiDesigner.xml
189 |
190 | # Gradle:
191 | .idea/**/gradle.xml
192 | .idea/**/libraries
193 |
194 | # CMake
195 | cmake-build-debug/
196 |
197 | # Mongo Explorer plugin:
198 | .idea/**/mongoSettings.xml
199 |
200 | ## File-based project format:
201 |
202 | ## Plugin-specific files:
203 |
204 | # IntelliJ
205 |
206 | # mpeltonen/sbt-idea plugin
207 |
208 | # JIRA plugin
209 |
210 | # Cursive Clojure plugin
211 | .idea/replstate.xml
212 |
213 | # Crashlytics plugin (for Android Studio and IntelliJ)
214 |
215 | ### Intellij+all Patch ###
216 | # Ignores the whole idea folder
217 | # See https://github.com/joeblau/gitignore.io/issues/186 and https://github.com/joeblau/gitignore.io/issues/360
218 |
219 | .idea/
220 |
221 | ### macOS ###
222 | *.DS_Store
223 | .AppleDouble
224 | .LSOverride
225 |
226 | # Icon must end with two \r
227 | Icon
228 |
229 | # Thumbnails
230 |
231 | # Files that might appear in the root of a volume
232 | .DocumentRevisions-V100
233 | .fseventsd
234 | .TemporaryItems
235 | .VolumeIcon.icns
236 | .com.apple.timemachine.donotpresent
237 |
238 | # Directories potentially created on remote AFP share
239 | .AppleDB
240 | .AppleDesktop
241 | Network Trash Folder
242 | Temporary Items
243 | .apdisk
244 |
245 | # End of https://www.gitignore.io/api/macos,android,intellij+all,androidstudio
246 |
--------------------------------------------------------------------------------
/CODE_OF_CONDUCT.md:
--------------------------------------------------------------------------------
1 | # Contributor Covenant Code of Conduct
2 |
3 | ## Our Pledge
4 |
5 | In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
6 |
7 | ## Our Standards
8 |
9 | Examples of behavior that contributes to creating a positive environment include:
10 |
11 | * Using welcoming and inclusive language
12 | * Being respectful of differing viewpoints and experiences
13 | * Gracefully accepting constructive criticism
14 | * Focusing on what is best for the community
15 | * Showing empathy towards other community members
16 |
17 | Examples of unacceptable behavior by participants include:
18 |
19 | * The use of sexualized language or imagery and unwelcome sexual attention or advances
20 | * Trolling, insulting/derogatory comments, and personal or political attacks
21 | * Public or private harassment
22 | * Publishing others' private information, such as a physical or electronic address, without explicit permission
23 | * Other conduct which could reasonably be considered inappropriate in a professional setting
24 |
25 | ## Our Responsibilities
26 |
27 | Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
28 |
29 | Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
30 |
31 | ## Scope
32 |
33 | This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
34 |
35 | ## Enforcement
36 |
37 | Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at info@irontec.com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
38 |
39 | Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
40 |
41 | ## Attribution
42 |
43 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
44 |
45 | [homepage]: http://contributor-covenant.org
46 | [version]: http://contributor-covenant.org/version/1/4/
47 |
--------------------------------------------------------------------------------
/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | ## Contributing
2 |
3 | First off, thank you for considering contributing to android-mvvm-example.
4 |
5 | ### 1. Where do I go from here?
6 |
7 | If you've noticed a bug or have a question,
8 | [search the issue tracker](https://github.com/irontec/android-mvvm-example/issues?q=something)
9 | to see if someone else has already created a ticket.
10 | If not, go ahead and [make one](https://github.com/irontec/android-mvvm-example/issues/new)!
11 |
12 | ### 2. Fork & create a branch
13 |
14 | If this is something you think you can fix, then
15 | [fork](https://help.github.com/articles/fork-a-repo)
16 | and create a branch with a descriptive name.
17 |
18 | A good branch name would be (where issue #7 is the ticket you're working on):
19 |
20 | ```sh
21 | git checkout -b 7-new-fix-for-fancy-functionality
22 | ```
23 |
24 | #### 3. Did you find a bug?
25 |
26 | * **Ensure the bug was not already reported** by searching on GitHub under [Issues](https://github.com/irontec/android-mvvm-example/issues).
27 |
28 | * If you're unable to find an open issue addressing the problem, [open a new one](https://github.com/irontec/android-mvvm-example/issues/new).
29 | Be sure to include a **title and clear description**, as much relevant information as possible,
30 | and a **code sample** or an **executable test case** demonstrating the expected behavior that is not occurring.
31 |
32 | * If possible, use the relevant bug report templates to create the issue.
33 | Simply copy the content of the appropriate template into a .rb file, make the necessary changes to demonstrate the issue,
34 | and **paste the content into the issue description**:
35 |
36 | ### 4. Implement your fix or feature
37 |
38 | At this point, you're ready to make your changes! Feel free to ask for help;
39 | everyone is a beginner at first :smile_cat:
40 |
41 | ### 5. Make a Pull Request
42 |
43 | At this point, you should switch back to your master branch and make sure it's
44 | up to date with Active Admin's master branch:
45 |
46 | ```sh
47 | git remote add upstream git@github.com:irontec/android-mvvm-example.git
48 | git checkout master
49 | git pull upstream master
50 | ```
51 |
52 | Then update your feature branch from your local copy of master, and push it!
53 |
54 | ```sh
55 | git checkout 7-new-fix-for-fancy-functionality
56 | git rebase master
57 | git push --set-upstream origin 7-new-fix-for-fancy-functionality
58 | ```
59 |
60 | Finally, go to GitHub and
61 | [make a Pull Request](https://help.github.com/articles/creating-a-pull-request)
62 | :D
63 |
64 | ### 6. Keeping your Pull Request updated
65 |
66 | If a maintainer asks you to "rebase" your PR, they're saying that a lot of code
67 | has changed, and that you need to update your branch so it's easier to merge.
68 |
69 | To learn more about rebasing in Git, there are a lot of
70 | [good](http://git-scm.com/book/en/Git-Branching-Rebasing)
71 | [resources](https://help.github.com/articles/interactive-rebase),
72 | but here's the suggested workflow:
73 |
74 | ```sh
75 | git checkout 7-new-fix-for-fancy-functionality
76 | git pull --rebase upstream master
77 | git push --force-with-lease 7-new-fix-for-fancy-functionality
78 | ```
79 |
--------------------------------------------------------------------------------
/LICENSE.txt:
--------------------------------------------------------------------------------
1 | European Union Public Licence
2 | V. 1.1
3 |
4 | EUPL (c) the European Community 2007
5 |
6 |
7 | This European Union Public Licence (the "EUPL") applies to the Work or Software
8 | (as defined below) which is provided under the terms of this Licence. Any use
9 | of the Work, other than as authorised under this Licence is prohibited (to the
10 | extent such use is covered by a right of the copyright holder of the Work).
11 |
12 | The Original Work is provided under the terms of this Licence when the Licensor
13 | (as defined below) has placed the following notice immediately following the
14 | copyright notice for the Original Work:
15 |
16 | Licensed under the EUPL V.1.1
17 |
18 | or has expressed by any other mean his willingness to license under the EUPL.
19 |
20 |
21 | 1. Definitions
22 |
23 | In this Licence, the following terms have the following meaning:
24 |
25 | * The Licence: this Licence.
26 |
27 | * The Original Work or the Software: the software distributed and/or
28 | communicated by the Licensor under this Licence, available as Source Code
29 | and also as Executable Code as the case may be.
30 |
31 | * Derivative Works: the works or software that could be created by the
32 | Licensee, based upon the Original Work or modifications thereof. This
33 | Licence does not define the extent of modification or dependence on the
34 | Original Work required in order to classify a work as a Derivative Work;
35 | this extent is determined by copyright law applicable in the country
36 | mentioned in Article 15.
37 |
38 | * The Work: the Original Work and/or its Derivative Works.
39 |
40 | * The Source Code: the human-readable form of the Work which is the most
41 | convenient for people to study and modify.
42 |
43 | * The Executable Code: any code which has generally been compiled and which is
44 | meant to be interpreted by a computer as a program.
45 |
46 | * The Licensor: the natural or legal person that distributes and/or
47 | communicates the Work under the Licence.
48 |
49 | * Contributor(s): any natural or legal person who modifies the Work under the
50 | Licence, or otherwise contributes to the creation of a Derivative Work.
51 |
52 | * The Licensee or "You": any natural or legal person who makes any usage of
53 | the Software under the terms of the Licence.
54 |
55 | * Distribution and/or Communication: any act of selling, giving, lending,
56 | renting, distributing, communicating, transmitting, or otherwise making
57 | available, on-line or off-line, copies of the Work or providing access to
58 | its essential functionalities at the disposal of any other natural or legal
59 | person.
60 |
61 |
62 | 2. Scope of the rights granted by the Licence
63 |
64 | The Licensor hereby grants You a world-wide, royalty-free, non-exclusive,
65 | sublicensable licence to do the following, for the duration of copyright vested
66 | in the Original Work:
67 |
68 | * use the Work in any circumstance and for all usage,
69 | * reproduce the Work,
70 | * modify the Original Work, and make Derivative Works based upon the Work,
71 | * communicate to the public, including the right to make available or display
72 | the Work or copies thereof to the public and perform publicly, as the case
73 | may be, the Work,
74 | * distribute the Work or copies thereof,
75 | * lend and rent the Work or copies thereof,
76 | * sub-license rights in the Work or copies thereof.
77 |
78 | Those rights can be exercised on any media, supports and formats, whether now
79 | known or later invented, as far as the applicable law permits so.
80 |
81 | In the countries where moral rights apply, the Licensor waives his right to
82 | exercise his moral right to the extent allowed by law in order to make
83 | effective the licence of the economic rights here above listed.
84 |
85 | The Licensor grants to the Licensee royalty-free, non exclusive usage rights to
86 | any patents held by the Licensor, to the extent necessary to make use of the
87 | rights granted on the Work under this Licence.
88 |
89 |
90 | 3. Communication of the Source Code
91 |
92 | The Licensor may provide the Work either in its Source Code form, or as
93 | Executable Code. If the Work is provided as Executable Code, the Licensor
94 | provides in addition a machine-readable copy of the Source Code of the Work
95 | along with each copy of the Work that the Licensor distributes or indicates, in
96 | a notice following the copyright notice attached to the Work, a repository
97 | where the Source Code is easily and freely accessible for as long as the
98 | Licensor continues to distribute and/or communicate the Work.
99 |
100 |
101 | 4. Limitations on copyright
102 |
103 | Nothing in this Licence is intended to deprive the Licensee of the benefits
104 | from any exception or limitation to the exclusive rights of the rights owners
105 | in the Original Work or Software, of the exhaustion of those rights or of other
106 | applicable limitations thereto.
107 |
108 |
109 | 5. Obligations of the Licensee
110 |
111 | The grant of the rights mentioned above is subject to some restrictions and
112 | obligations imposed on the Licensee. Those obligations are the following:
113 |
114 | - Attribution right: the Licensee shall keep intact all copyright, patent or
115 | trademarks notices and all notices that refer to the Licence and to the
116 | disclaimer of warranties. The Licensee must include a copy of such notices
117 | and a copy of the Licence with every copy of the Work he/she distributes
118 | and/or communicates. The Licensee must cause any Derivative Work to carry
119 | prominent notices stating that the Work has been modified and the date of
120 | modification.
121 |
122 | - Copyleft clause: If the Licensee distributes and/or communicates copies of
123 | the Original Works or Derivative Works based upon the Original Work, this
124 | Distribution and/or Communication will be done under the terms of this
125 | Licence or of a later version of this Licence unless the Original Work is
126 | expressly distributed only under this version of the Licence. The Licensee
127 | (becoming Licensor) cannot offer or impose any additional terms or
128 | conditions on the Work or Derivative Work that alter or restrict the terms
129 | of the Licence.
130 |
131 | - Compatibility clause: If the Licensee Distributes and/or Communicates
132 | Derivative Works or copies thereof based upon both the Original Work and
133 | another work licensed under a Compatible Licence, this Distribution and/or
134 | Communication can be done under the terms of this Compatible Licence. For
135 | the sake of this clause, "Compatible Licence" refers to the licences listed
136 | in the appendix attached to this Licence. Should the Licensee's obligations
137 | under the Compatible Licence conflict with his/her obligations under this
138 | Licence, the obligations of the Compatible Licence shall prevail.
139 |
140 | - Provision of Source Code: When distributing and/or communicating copies of
141 | the Work, the Licensee will provide a machine-readable copy of the Source
142 | Code or indicate a repository where this Source will be easily and freely
143 | available for as long as the Licensee continues to distribute and/or
144 | communicate the Work. Legal Protection: This Licence does not grant
145 | permission to use the trade names, trademarks, service marks, or names of
146 | the Licensor, except as required for reasonable and customary use in
147 | describing the origin of the Work and reproducing the content of the
148 | copyright notice.
149 |
150 |
151 | 6. Chain of Authorship
152 |
153 | The original Licensor warrants that the copyright in the Original Work granted
154 | hereunder is owned by him/her or licensed to him/her and that he/she has the
155 | power and authority to grant the Licence.
156 |
157 | Each Contributor warrants that the copyright in the modifications he/she brings
158 | to the Work are owned by him/her or licensed to him/her and that he/she has the
159 | power and authority to grant the Licence.
160 |
161 | Each time You accept the Licence, the original Licensor and subsequent
162 | Contributors grant You a licence to their contributions to the Work, under the
163 | terms of this Licence.
164 |
165 |
166 | 7. Disclaimer of Warranty
167 |
168 | The Work is a work in progress, which is continuously improved by numerous
169 | contributors. It is not a finished work and may therefore contain defects or
170 | "bugs" inherent to this type of software development.
171 |
172 | For the above reason, the Work is provided under the Licence on an "as is"
173 | basis and without warranties of any kind concerning the Work, including without
174 | limitation merchantability, fitness for a particular purpose, absence of
175 | defects or errors, accuracy, non-infringement of intellectual property rights
176 | other than copyright as stated in Article 6 of this Licence.
177 |
178 | This disclaimer of warranty is an essential part of the Licence and a condition
179 | for the grant of any rights to the Work.
180 |
181 |
182 | 8. Disclaimer of Liability
183 |
184 | Except in the cases of wilful misconduct or damages directly caused to natural
185 | persons, the Licensor will in no event be liable for any direct or indirect,
186 | material or moral, damages of any kind, arising out of the Licence or of the
187 | use of the Work, including without limitation, damages for loss of goodwill,
188 | work stoppage, computer failure or malfunction, loss of data or any commercial
189 | damage, even if the Licensor has been advised of the possibility of such
190 | damage. However, the Licensor will be liable under statutory product liability
191 | laws as far such laws apply to the Work.
192 |
193 |
194 | 9. Additional agreements
195 |
196 | While distributing the Original Work or Derivative Works, You may choose to
197 | conclude an additional agreement to offer, and charge a fee for, acceptance of
198 | support, warranty, indemnity, or other liability obligations and/or services
199 | consistent with this Licence. However, in accepting such obligations, You may
200 | act only on your own behalf and on your sole responsibility, not on behalf of
201 | the original Licensor or any other Contributor, and only if You agree to
202 | indemnify, defend, and hold each Contributor harmless for any liability
203 | incurred by, or claims asserted against such Contributor by the fact You have
204 | accepted any such warranty or additional liability.
205 |
206 |
207 | 10. Acceptance of the Licence
208 |
209 | The provisions of this Licence can be accepted by clicking on an icon "I agree"
210 | placed under the bottom of a window displaying the text of this Licence or by
211 | affirming consent in any other similar way, in accordance with the rules of
212 | applicable law. Clicking on that icon indicates your clear and irrevocable
213 | acceptance of this Licence and all of its terms and conditions.
214 |
215 | Similarly, you irrevocably accept this Licence and all of its terms and
216 | conditions by exercising any rights granted to You by Article 2 of this
217 | Licence, such as the use of the Work, the creation by You of a Derivative Work
218 | or the Distribution and/or Communication by You of the Work or copies thereof.
219 |
220 |
221 | 11. Information to the public
222 |
223 | In case of any Distribution and/or Communication of the Work by means of
224 | electronic communication by You (for example, by offering to download the Work
225 | from a remote location) the distribution channel or media (for example, a
226 | website) must at least provide to the public the information requested by the
227 | applicable law regarding the Licensor, the Licence and the way it may be
228 | accessible, concluded, stored and reproduced by the Licensee.
229 |
230 |
231 | 12. Termination of the Licence
232 |
233 | The Licence and the rights granted hereunder will terminate automatically upon
234 | any breach by the Licensee of the terms of the Licence.
235 |
236 | Such a termination will not terminate the licences of any person who has
237 | received the Work from the Licensee under the Licence, provided such persons
238 | remain in full compliance with the Licence.
239 |
240 |
241 | 13. Miscellaneous
242 |
243 | Without prejudice of Article 9 above, the Licence represents the complete
244 | agreement between the Parties as to the Work licensed hereunder.
245 |
246 | If any provision of the Licence is invalid or unenforceable under applicable
247 | law, this will not affect the validity or enforceability of the Licence as a
248 | whole. Such provision will be construed and/or reformed so as necessary to make
249 | it valid and enforceable.
250 |
251 | The European Commission may publish other linguistic versions and/or new
252 | versions of this Licence, so far this is required and reasonable, without
253 | reducing the scope of the rights granted by the Licence. New versions of the
254 | Licence will be published with a unique version number.
255 |
256 | All linguistic versions of this Licence, approved by the European Commission,
257 | have identical value. Parties can take advantage of the linguistic version of
258 | their choice.
259 |
260 |
261 | 14. Jurisdiction
262 |
263 | Any litigation resulting from the interpretation of this License, arising
264 | between the European Commission, as a Licensor, and any Licensee, will be
265 | subject to the jurisdiction of the Court of Justice of the European
266 | Communities, as laid down in article 238 of the Treaty establishing the
267 | European Community.
268 |
269 | Any litigation arising between Parties, other than the European Commission, and
270 | resulting from the interpretation of this License, will be subject to the
271 | exclusive jurisdiction of the competent court where the Licensor resides or
272 | conducts its primary business.
273 |
274 |
275 | 15. Applicable Law
276 |
277 | This Licence shall be governed by the law of the European Union country where
278 | the Licensor resides or has his registered office.
279 |
280 | This licence shall be governed by the Belgian law if:
281 |
282 | * a litigation arises between the European Commission, as a Licensor, and any
283 | Licensee;
284 | * the Licensor, other than the European Commission, has no residence or
285 | registered office inside a European Union country.
286 |
287 |
288 | Appendix
289 |
290 | "Compatible Licences" according to article 5 EUPL are:
291 |
292 | * GNU General Public License (GNU GPL) v. 2
293 | * Open Software License (OSL) v. 2.1, v. 3.0
294 | * Common Public License v. 1.0
295 | * Eclipse Public License v. 1.0
296 | * Cecill v. 2.0
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # android-mvvm-example
2 |
3 |
4 |
5 | Basic app for showcasing the use of the [MVVM](https://en.wikipedia.org/wiki/Model–view–viewmodel) (Model - View - ViewModel) Pattern on Android using the [Data Binding](https://github.com/ReactiveX/RxAndroid) library.
6 | This app is only for educational purposes.
7 |
8 | ### License
9 |
10 | [EUPL v1.1](https://github.com/irontec/android-mvvm-example/blob/master/LICENSE.txt)
11 |
12 | ```
13 | Copyright 2015 Irontec SL
14 |
15 | Licensed under the EUPL, Version 1.1 or - as soon they will be approved by the European
16 | Commission - subsequent versions of the EUPL (the "Licence"); You may not use this work
17 | except in compliance with the Licence.
18 |
19 | You may obtain a copy of the Licence at:
20 | http://ec.europa.eu/idabc/eupl.html
21 |
22 | Unless required by applicable law or agreed to in writing, software distributed under
23 | the Licence is distributed on an "AS IS" basis, WITHOUT WARRANTIES OR CONDITIONS OF
24 | ANY KIND, either express or implied. See the Licence for the specific language
25 | governing permissions and limitations under the Licence.
26 | ```
27 |
--------------------------------------------------------------------------------
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 | apply plugin: 'kotlin-android'
3 | apply plugin: 'kotlin-android-extensions'
4 | apply plugin: 'kotlin-kapt'
5 |
6 | android {
7 |
8 | dataBinding {
9 | enabled = true
10 | }
11 |
12 | compileSdkVersion 27
13 | buildToolsVersion "27.0.2"
14 | defaultConfig {
15 | applicationId "com.irontec.axier.mvvmexample"
16 | minSdkVersion 16
17 | targetSdkVersion 27
18 | versionCode 1
19 | versionName "1.0"
20 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
21 | }
22 | buildTypes {
23 | release {
24 | minifyEnabled false
25 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
26 | }
27 | }
28 | }
29 |
30 | dependencies {
31 | compile fileTree(dir: 'libs', include: ['*.jar'])
32 | androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
33 | exclude group: 'com.android.support', module: 'support-annotations'
34 | })
35 | compile 'com.android.support:appcompat-v7:27.0.2'
36 | compile 'com.android.support:animated-vector-drawable:27.0.2'
37 | compile 'com.android.support:support-v4:27.0.2'
38 | compile 'com.android.support.constraint:constraint-layout:1.0.2'
39 | compile 'com.android.support:recyclerview-v7:27.0.2'
40 | testCompile 'junit:junit:4.12'
41 | compile "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
42 | kapt 'com.android.databinding:compiler:3.0.1'
43 | }
44 | repositories {
45 | mavenCentral()
46 | }
47 |
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in C:\Users\oneil\AppData\Local\Android\Sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
19 | # Uncomment this to preserve the line number information for
20 | # debugging stack traces.
21 | #-keepattributes SourceFile,LineNumberTable
22 |
23 | # If you keep the line number information, uncomment this to
24 | # hide the original source file name.
25 | #-renamesourcefileattribute SourceFile
26 |
--------------------------------------------------------------------------------
/app/src/androidTest/java/com/irontec/axier/mvvmexample/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.irontec.axier.mvvmexample;
2 |
3 | import android.content.Context;
4 | import android.support.test.InstrumentationRegistry;
5 | import android.support.test.runner.AndroidJUnit4;
6 |
7 | import org.junit.Test;
8 | import org.junit.runner.RunWith;
9 |
10 | import static org.junit.Assert.*;
11 |
12 | /**
13 | * Instrumentation test, which will execute on an Android device.
14 | *
15 | * @see Testing documentation
16 | */
17 | @RunWith(AndroidJUnit4.class)
18 | public class ExampleInstrumentedTest {
19 | @Test
20 | public void useAppContext() throws Exception {
21 | // Context of the app under test.
22 | Context appContext = InstrumentationRegistry.getTargetContext();
23 |
24 | assertEquals("com.irontec.axier.mvvmexample", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/app/src/main/java/com/irontec/axier/mvvmexample/mock/ArticleMockHelper.kt:
--------------------------------------------------------------------------------
1 | package com.irontec.axier.mvvmexample.mock
2 |
3 | import com.irontec.axier.mvvmexample.model.Article
4 | import java.util.*
5 |
6 | /**
7 | * Created by oneil on 28/07/2017.
8 | */
9 |
10 | object ArticleMockHelper {
11 |
12 | val mockArticleData: List
13 | get() {
14 | val list = ArrayList()
15 | for (i in 0..24) {
16 | val article = Article()
17 | article.title = "Nuevo evento de desarrollo"
18 | article.subtitle = "Los lugareños han creado un nuevo evento de desarrollo web cerca de su zona."
19 | article.excerpt = "La cita de referencia en España para los profesionales del marketing online vuelve al World Trade Center. Zaragoza acoge cada año a cientos de profesionales para aprender sobre SEO, Social Media, Analítica y Optimización, Desarrollo, actualizarse con los últimos cambios en Internet y realizar mucho… mucho networking."
20 | article.date = Date()
21 |
22 | list.add(article)
23 | }
24 | return list
25 | }
26 |
27 | }
28 |
--------------------------------------------------------------------------------
/app/src/main/java/com/irontec/axier/mvvmexample/model/Article.kt:
--------------------------------------------------------------------------------
1 | package com.irontec.axier.mvvmexample.model
2 |
3 | import java.util.*
4 |
5 | /**
6 | * Created by oneil on 28/07/2017.
7 | */
8 |
9 | class Article {
10 |
11 | var title: String? = null
12 | var subtitle: String? = null
13 | var excerpt: String? = null
14 | var date: Date? = null
15 | }
16 |
--------------------------------------------------------------------------------
/app/src/main/java/com/irontec/axier/mvvmexample/view/ArticleAdapter.kt:
--------------------------------------------------------------------------------
1 | package com.irontec.axier.mvvmexample.view
2 |
3 | import android.databinding.DataBindingUtil
4 | import android.support.v7.widget.RecyclerView
5 | import android.view.LayoutInflater
6 | import android.view.ViewGroup
7 |
8 | import com.irontec.axier.mvvmexample.R
9 | import com.irontec.axier.mvvmexample.databinding.RowArticleBinding
10 | import com.irontec.axier.mvvmexample.model.Article
11 | import com.irontec.axier.mvvmexample.viewmodel.ArticleViewModel
12 |
13 | /**
14 | * Created by oneil on 28/07/2017.
15 | */
16 |
17 | class ArticleAdapter(private val mArticles: List) : RecyclerView.Adapter() {
18 |
19 |
20 | override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): BindingHolder {
21 | val binding = DataBindingUtil.inflate(
22 | LayoutInflater.from(parent.context),
23 | R.layout.row_article, parent, false)
24 |
25 | return BindingHolder(binding)
26 | }
27 |
28 | override fun onBindViewHolder(holder: BindingHolder, position: Int) {
29 | val binding = holder.binding
30 | binding.avm = ArticleViewModel(mArticles[position])
31 | }
32 |
33 | override fun getItemCount(): Int {
34 | return mArticles.size
35 | }
36 |
37 | class BindingHolder(val binding: RowArticleBinding) : RecyclerView.ViewHolder(binding.mainLayout)
38 | }
39 |
--------------------------------------------------------------------------------
/app/src/main/java/com/irontec/axier/mvvmexample/view/MainActivity.kt:
--------------------------------------------------------------------------------
1 | package com.irontec.axier.mvvmexample.view
2 |
3 | import android.databinding.DataBindingUtil
4 | import android.os.Bundle
5 | import android.support.v7.app.AppCompatActivity
6 | import android.support.v7.widget.LinearLayoutManager
7 | import com.irontec.axier.mvvmexample.R
8 | import com.irontec.axier.mvvmexample.databinding.ActivityMainBinding
9 | import com.irontec.axier.mvvmexample.mock.ArticleMockHelper
10 |
11 | class MainActivity : AppCompatActivity() {
12 |
13 | override fun onCreate(savedInstanceState: Bundle?) {
14 | super.onCreate(savedInstanceState)
15 |
16 | val binding = DataBindingUtil.setContentView(this, R.layout.activity_main)
17 | val layoutManager = LinearLayoutManager(this)
18 | binding.contactList.layoutManager = layoutManager
19 |
20 | val articles = ArticleMockHelper.mockArticleData
21 |
22 | val adapter = ArticleAdapter(articles)
23 | binding.contactList.adapter = adapter
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/app/src/main/java/com/irontec/axier/mvvmexample/viewmodel/ArticleViewModel.kt:
--------------------------------------------------------------------------------
1 | package com.irontec.axier.mvvmexample.viewmodel
2 |
3 | import android.databinding.BaseObservable
4 | import android.databinding.Bindable
5 | import com.irontec.axier.mvvmexample.BR
6 | import com.irontec.axier.mvvmexample.model.Article
7 | import java.text.SimpleDateFormat
8 | import java.util.*
9 |
10 |
11 | /**
12 | * Created by oneil on 28/07/2017.
13 | */
14 |
15 | class ArticleViewModel(private val mArticle: Article) : BaseObservable() {
16 |
17 | var title: String?
18 | @Bindable
19 | get() = mArticle.title
20 | set(title) {
21 | mArticle.title = title
22 | notifyPropertyChanged(BR.title)
23 | }
24 |
25 | var subtitle: String?
26 | @Bindable
27 | get() = mArticle.subtitle
28 | set(subtitle) {
29 | mArticle.subtitle = subtitle
30 | notifyPropertyChanged(BR.subtitle)
31 | }
32 |
33 | var excerpt: String?
34 | @Bindable
35 | get() = mArticle.excerpt
36 | set(excerpt) {
37 | mArticle.excerpt = excerpt
38 | notifyPropertyChanged(BR.excerpt)
39 | }
40 |
41 | val formattedDate: String
42 | @Bindable
43 | get() {
44 | val sdf = SimpleDateFormat("EEE, d MMM yyyy HH:mm", Locale.getDefault())
45 | return sdf.format(mArticle.date)
46 | }
47 |
48 | fun setDate(date: Date) {
49 | mArticle.date = date
50 | notifyPropertyChanged(BR.formattedDate)
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
6 |
7 |
12 |
13 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/row_article.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
7 |
8 |
17 |
18 |
27 |
37 |
45 |
46 |
54 |
55 |
56 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/irontec/android-mvvm-example/724fa7e4c928749914966813c3d4884b13ca94b9/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/irontec/android-mvvm-example/724fa7e4c928749914966813c3d4884b13ca94b9/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/irontec/android-mvvm-example/724fa7e4c928749914966813c3d4884b13ca94b9/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/irontec/android-mvvm-example/724fa7e4c928749914966813c3d4884b13ca94b9/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/irontec/android-mvvm-example/724fa7e4c928749914966813c3d4884b13ca94b9/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #e91e63
4 | #b0174b
5 | #D6B62D
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | MvvmExample
3 |
4 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/app/src/test/java/com/irontec/axier/mvvmexample/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.irontec.axier.mvvmexample;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() throws Exception {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 | ext.kotlin_version = '1.2.21'
5 | repositories {
6 | jcenter()
7 | google()
8 | }
9 | dependencies {
10 | classpath 'com.android.tools.build:gradle:3.0.1'
11 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
12 |
13 | // NOTE: Do not place your application dependencies here; they belong
14 | // in the individual module build.gradle files
15 | }
16 | }
17 |
18 | allprojects {
19 | repositories {
20 | jcenter()
21 | google()
22 | }
23 | }
24 |
25 | task clean(type: Delete) {
26 | delete rootProject.buildDir
27 | }
28 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | org.gradle.jvmargs=-Xmx1536m
13 |
14 | # When configured, Gradle will run in incubating parallel mode.
15 | # This option should only be used with decoupled projects. More details, visit
16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
17 | # org.gradle.parallel=true
18 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/irontec/android-mvvm-example/724fa7e4c928749914966813c3d4884b13ca94b9/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Fri Feb 02 13:32:20 CET 2018
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
7 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
10 | DEFAULT_JVM_OPTS=""
11 |
12 | APP_NAME="Gradle"
13 | APP_BASE_NAME=`basename "$0"`
14 |
15 | # Use the maximum available, or set MAX_FD != -1 to use that value.
16 | MAX_FD="maximum"
17 |
18 | warn ( ) {
19 | echo "$*"
20 | }
21 |
22 | die ( ) {
23 | echo
24 | echo "$*"
25 | echo
26 | exit 1
27 | }
28 |
29 | # OS specific support (must be 'true' or 'false').
30 | cygwin=false
31 | msys=false
32 | darwin=false
33 | case "`uname`" in
34 | CYGWIN* )
35 | cygwin=true
36 | ;;
37 | Darwin* )
38 | darwin=true
39 | ;;
40 | MINGW* )
41 | msys=true
42 | ;;
43 | esac
44 |
45 | # Attempt to set APP_HOME
46 | # Resolve links: $0 may be a link
47 | PRG="$0"
48 | # Need this for relative symlinks.
49 | while [ -h "$PRG" ] ; do
50 | ls=`ls -ld "$PRG"`
51 | link=`expr "$ls" : '.*-> \(.*\)$'`
52 | if expr "$link" : '/.*' > /dev/null; then
53 | PRG="$link"
54 | else
55 | PRG=`dirname "$PRG"`"/$link"
56 | fi
57 | done
58 | SAVED="`pwd`"
59 | cd "`dirname \"$PRG\"`/" >/dev/null
60 | APP_HOME="`pwd -P`"
61 | cd "$SAVED" >/dev/null
62 |
63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
64 |
65 | # Determine the Java command to use to start the JVM.
66 | if [ -n "$JAVA_HOME" ] ; then
67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
68 | # IBM's JDK on AIX uses strange locations for the executables
69 | JAVACMD="$JAVA_HOME/jre/sh/java"
70 | else
71 | JAVACMD="$JAVA_HOME/bin/java"
72 | fi
73 | if [ ! -x "$JAVACMD" ] ; then
74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
75 |
76 | Please set the JAVA_HOME variable in your environment to match the
77 | location of your Java installation."
78 | fi
79 | else
80 | JAVACMD="java"
81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
82 |
83 | Please set the JAVA_HOME variable in your environment to match the
84 | location of your Java installation."
85 | fi
86 |
87 | # Increase the maximum file descriptors if we can.
88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
89 | MAX_FD_LIMIT=`ulimit -H -n`
90 | if [ $? -eq 0 ] ; then
91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
92 | MAX_FD="$MAX_FD_LIMIT"
93 | fi
94 | ulimit -n $MAX_FD
95 | if [ $? -ne 0 ] ; then
96 | warn "Could not set maximum file descriptor limit: $MAX_FD"
97 | fi
98 | else
99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
100 | fi
101 | fi
102 |
103 | # For Darwin, add options to specify how the application appears in the dock
104 | if $darwin; then
105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
106 | fi
107 |
108 | # For Cygwin, switch paths to Windows format before running java
109 | if $cygwin ; then
110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
112 | JAVACMD=`cygpath --unix "$JAVACMD"`
113 |
114 | # We build the pattern for arguments to be converted via cygpath
115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
116 | SEP=""
117 | for dir in $ROOTDIRSRAW ; do
118 | ROOTDIRS="$ROOTDIRS$SEP$dir"
119 | SEP="|"
120 | done
121 | OURCYGPATTERN="(^($ROOTDIRS))"
122 | # Add a user-defined pattern to the cygpath arguments
123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
125 | fi
126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
127 | i=0
128 | for arg in "$@" ; do
129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
131 |
132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
134 | else
135 | eval `echo args$i`="\"$arg\""
136 | fi
137 | i=$((i+1))
138 | done
139 | case $i in
140 | (0) set -- ;;
141 | (1) set -- "$args0" ;;
142 | (2) set -- "$args0" "$args1" ;;
143 | (3) set -- "$args0" "$args1" "$args2" ;;
144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
150 | esac
151 | fi
152 |
153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
154 | function splitJvmOpts() {
155 | JVM_OPTS=("$@")
156 | }
157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
159 |
160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
161 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/irontec/android-mvvm-example/724fa7e4c928749914966813c3d4884b13ca94b9/logo.png
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
--------------------------------------------------------------------------------