This post is Part 2 in a series of posts in trying to understand the source code of WordPress for Android. You can find the previous post here: Understanding WordPress for Android – Part 1
How the app works:
First, we need to get a high-level overview of how the app works. (Note that the screenshots were taken on a 10-inch tablet and have been scaled to a smaller size. The experience on a phone may differ slightly.)
As soon as you launch the app, you are presented with a login screen, asking for your username and password. You also have the option to create an account and add a self-hosted WordPress site.
Once you login, you will notice a side pane with different items in a list. This is very similar to the side pane you see when you view your WordPress Dashboard in a desktop browser.
Clicking on an item in the list opens its corresponding view in the main pane on the right and the side pane disappears when in portrait mode. For example, when we click Stats in the side pane, this is how it appears:
The app also is responsive to the orientation of the device. For example, when I hold the tablet in Landscape mode, this is how the Stats section appears.
You can also find an Action Bar at the top with different buttons, which are context-sensitive to the item chosen in the side pane.
That brings us to the end of the high level overview. We will discuss how each component works, in detail, in upcoming blog posts.
WordPress for Android is an Open Source project released under the GNU GPL. The app’s complexity lies somewhere between simple and advanced, which makes it interesting to contribute to. This makes the learning curve not very hard and at the same time, one can learn a lot on Android development when you peek under the hood. You can find the source of the WordPress for Android app here: https://github.com/wordpress-mobile/WordPress-Android WordPress for Android uses Gradle as its build system. If you are not familiar with Gradle or any build system at all, this link useful might help you: http://tools.android.com/tech-docs/new-build-system/user-guide
Android default files and directories:
Some of these directories and files are present in any Android project, by default. You would want to read this official documentation on Android projects before proceeding below. I will not be explaining them, unless necessary.
There seems to be more than one release version of this app: main, release, debug and zbetagroup.
Let us look at the root level of the project in this blog post. I will try to explain (or point to links that explain) some basic Android concepts along the way, as well.
- .classpath – Tells the java compiler where to look for user-defined classes and packages
- .gitattributes – A simple text file that gives attributes to pathnames
- .gitignore – Files matching the pattern mentioned here are not tracked by Git
- .project – Contains project description. Not sure of its significance, yet.
- AndroidManifest.xml (Android default)
- AndroidManifestBetaGroup.xml – Seems to be related to the zbetagroup version of the app.
- AndroidManifestReleaseAndDebug.xml – Seems to be related to the release and debug version of the app.
- build.gradle – Gradle build script. This is where the Gradle project is defined.
- build.xml (Android default)
- custom_rules.xml – Defines custom rules for Ant. Not sure why it is present here (maybe the project was migrated from Ant to Gradle).
- default.properties – Some default properties. Not sure of its significance, yet.
- gradlew – The Gradle Wrapper file for Unix-based systems
- gradlew.bat – The Gradle Wrapper file for Windows systems
- lint.xml – Improving your code with lint
- local.properties-example – Rename this to local.properties (Android default) and add the SDK path as instructed in the README file
- proguard-project.txt – ProGuard
- project.properties (Android default)
- readme.md – README files generally provide instructions on how to get started with the project. It is now very common for any project in Github, as Github displays the contents of the root-level readme.md at the project home page itself.
I will keep this post updated as I understand the significance of some files. Watch out for future posts in this series.
Update: The second post in this series is now available here: https://anirudh24seven.wordpress.com/2014/03/02/understanding-wordpress-for-android-part-2/