[
  {
    "path": ".gitignore",
    "content": "# Local configuration file (sdk path, etc)\nlocal.properties\n\n# Windows thumbnail db\nThumbs.db\n\n# OSX files\n.DS_Store\n\n# Proguard folder generated by Eclipse\nproguard/\n\n# Android Studio\n*.iml\n*.ipr\n*.iws\n.idea/\n.gradle/\nbuild/"
  },
  {
    "path": "LICENSE",
    "content": "Apache License\n                           Version 2.0, January 2004\n                        http://www.apache.org/licenses/\n\n   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n   1. Definitions.\n\n      \"License\" shall mean the terms and conditions for use, reproduction,\n      and distribution as defined by Sections 1 through 9 of this document.\n\n      \"Licensor\" shall mean the copyright owner or entity authorized by\n      the copyright owner that is granting the License.\n\n      \"Legal Entity\" shall mean the union of the acting entity and all\n      other entities that control, are controlled by, or are under common\n      control with that entity. For the purposes of this definition,\n      \"control\" means (i) the power, direct or indirect, to cause the\n      direction or management of such entity, whether by contract or\n      otherwise, or (ii) ownership of fifty percent (50%) or more of the\n      outstanding shares, or (iii) beneficial ownership of such entity.\n\n      \"You\" (or \"Your\") shall mean an individual or Legal Entity\n      exercising permissions granted by this License.\n\n      \"Source\" form shall mean the preferred form for making modifications,\n      including but not limited to software source code, documentation\n      source, and configuration files.\n\n      \"Object\" form shall mean any form resulting from mechanical\n      transformation or translation of a Source form, including but\n      not limited to compiled object code, generated documentation,\n      and conversions to other media types.\n\n      \"Work\" shall mean the work of authorship, whether in Source or\n      Object form, made available under the License, as indicated by a\n      copyright notice that is included in or attached to the work\n      (an example is provided in the Appendix below).\n\n      \"Derivative Works\" shall mean any work, whether in Source or Object\n      form, that is based on (or derived from) the Work and for which the\n      editorial revisions, annotations, elaborations, or other modifications\n      represent, as a whole, an original work of authorship. For the purposes\n      of this License, Derivative Works shall not include works that remain\n      separable from, or merely link (or bind by name) to the interfaces of,\n      the Work and Derivative Works thereof.\n\n      \"Contribution\" shall mean any work of authorship, including\n      the original version of the Work and any modifications or additions\n      to that Work or Derivative Works thereof, that is intentionally\n      submitted to Licensor for inclusion in the Work by the copyright owner\n      or by an individual or Legal Entity authorized to submit on behalf of\n      the copyright owner. For the purposes of this definition, \"submitted\"\n      means any form of electronic, verbal, or written communication sent\n      to the Licensor or its representatives, including but not limited to\n      communication on electronic mailing lists, source code control systems,\n      and issue tracking systems that are managed by, or on behalf of, the\n      Licensor for the purpose of discussing and improving the Work, but\n      excluding communication that is conspicuously marked or otherwise\n      designated in writing by the copyright owner as \"Not a Contribution.\"\n\n      \"Contributor\" shall mean Licensor and any individual or Legal Entity\n      on behalf of whom a Contribution has been received by Licensor and\n      subsequently incorporated within the Work.\n\n   2. Grant of Copyright License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      copyright license to reproduce, prepare Derivative Works of,\n      publicly display, publicly perform, sublicense, and distribute the\n      Work and such Derivative Works in Source or Object form.\n\n   3. Grant of Patent License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      (except as stated in this section) patent license to make, have made,\n      use, offer to sell, sell, import, and otherwise transfer the Work,\n      where such license applies only to those patent claims licensable\n      by such Contributor that are necessarily infringed by their\n      Contribution(s) alone or by combination of their Contribution(s)\n      with the Work to which such Contribution(s) was submitted. If You\n      institute patent litigation against any entity (including a\n      cross-claim or counterclaim in a lawsuit) alleging that the Work\n      or a Contribution incorporated within the Work constitutes direct\n      or contributory patent infringement, then any patent licenses\n      granted to You under this License for that Work shall terminate\n      as of the date such litigation is filed.\n\n   4. Redistribution. You may reproduce and distribute copies of the\n      Work or Derivative Works thereof in any medium, with or without\n      modifications, and in Source or Object form, provided that You\n      meet the following conditions:\n\n      (a) You must give any other recipients of the Work or\n          Derivative Works a copy of this License; and\n\n      (b) You must cause any modified files to carry prominent notices\n          stating that You changed the files; and\n\n      (c) You must retain, in the Source form of any Derivative Works\n          that You distribute, all copyright, patent, trademark, and\n          attribution notices from the Source form of the Work,\n          excluding those notices that do not pertain to any part of\n          the Derivative Works; and\n\n      (d) If the Work includes a \"NOTICE\" text file as part of its\n          distribution, then any Derivative Works that You distribute must\n          include a readable copy of the attribution notices contained\n          within such NOTICE file, excluding those notices that do not\n          pertain to any part of the Derivative Works, in at least one\n          of the following places: within a NOTICE text file distributed\n          as part of the Derivative Works; within the Source form or\n          documentation, if provided along with the Derivative Works; or,\n          within a display generated by the Derivative Works, if and\n          wherever such third-party notices normally appear. The contents\n          of the NOTICE file are for informational purposes only and\n          do not modify the License. You may add Your own attribution\n          notices within Derivative Works that You distribute, alongside\n          or as an addendum to the NOTICE text from the Work, provided\n          that such additional attribution notices cannot be construed\n          as modifying the License.\n\n      You may add Your own copyright statement to Your modifications and\n      may provide additional or different license terms and conditions\n      for use, reproduction, or distribution of Your modifications, or\n      for any such Derivative Works as a whole, provided Your use,\n      reproduction, and distribution of the Work otherwise complies with\n      the conditions stated in this License.\n\n   5. Submission of Contributions. Unless You explicitly state otherwise,\n      any Contribution intentionally submitted for inclusion in the Work\n      by You to the Licensor shall be under the terms and conditions of\n      this License, without any additional terms or conditions.\n      Notwithstanding the above, nothing herein shall supersede or modify\n      the terms of any separate license agreement you may have executed\n      with Licensor regarding such Contributions.\n\n   6. Trademarks. This License does not grant permission to use the trade\n      names, trademarks, service marks, or product names of the Licensor,\n      except as required for reasonable and customary use in describing the\n      origin of the Work and reproducing the content of the NOTICE file.\n\n   7. Disclaimer of Warranty. Unless required by applicable law or\n      agreed to in writing, Licensor provides the Work (and each\n      Contributor provides its Contributions) on an \"AS IS\" BASIS,\n      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n      implied, including, without limitation, any warranties or conditions\n      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n      PARTICULAR PURPOSE. You are solely responsible for determining the\n      appropriateness of using or redistributing the Work and assume any\n      risks associated with Your exercise of permissions under this License.\n\n   8. Limitation of Liability. In no event and under no legal theory,\n      whether in tort (including negligence), contract, or otherwise,\n      unless required by applicable law (such as deliberate and grossly\n      negligent acts) or agreed to in writing, shall any Contributor be\n      liable to You for damages, including any direct, indirect, special,\n      incidental, or consequential damages of any character arising as a\n      result of this License or out of the use or inability to use the\n      Work (including but not limited to damages for loss of goodwill,\n      work stoppage, computer failure or malfunction, or any and all\n      other commercial damages or losses), even if such Contributor\n      has been advised of the possibility of such damages.\n\n   9. Accepting Warranty or Additional Liability. While redistributing\n      the Work or Derivative Works thereof, You may choose to offer,\n      and charge a fee for, acceptance of support, warranty, indemnity,\n      or other liability obligations and/or rights consistent with this\n      License. However, in accepting such obligations, You may act only\n      on Your own behalf and on Your sole responsibility, not on behalf\n      of any other Contributor, and only if You agree to indemnify,\n      defend, and hold each Contributor harmless for any liability\n      incurred by, or claims asserted against, such Contributor by reason\n      of your accepting any such warranty or additional liability.\n\n   END OF TERMS AND CONDITIONS\n\n   APPENDIX: How to apply the Apache License to your work.\n\n      To apply the Apache License to your work, attach the following\n      boilerplate notice, with the fields enclosed by brackets \"{}\"\n      replaced with your own identifying information. (Don't include\n      the brackets!)  The text should be enclosed in the appropriate\n      comment syntax for the file format. We also recommend that a\n      file or class name and description of purpose be included on the\n      same \"printed page\" as the copyright notice for easier\n      identification within third-party archives.\n\n   Copyright 2014 Daniel Pedraza-Arcega\n\n   Licensed under the Apache License, Version 2.0 (the \"License\");\n   you may not use this file except in compliance with the License.\n   You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n   Unless required by applicable law or agreed to in writing, software\n   distributed under the License is distributed on an \"AS IS\" BASIS,\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n   See the License for the specific language governing permissions and\n   limitations under the License."
  },
  {
    "path": "README.md",
    "content": "MaterialNotes\n===========\n\nNote-taking app with Material Design for Android.\n\n![Demo](https://dl.dropboxusercontent.com/u/1995295/img/MaterialNotes/demo.gif)\n\nLicense\n=======\n\n    Copyright 2014 Daniel Pedraza-Arcega\n\n    Licensed under the Apache License, Version 2.0 (the \"License\");\n    you may not use this file except in compliance with the License.\n    You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n    Unless required by applicable law or agreed to in writing, software\n    distributed under the License is distributed on an \"AS IS\" BASIS,\n    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n    See the License for the specific language governing permissions and\n    limitations under the License.\n"
  },
  {
    "path": "app/build.gradle",
    "content": "apply plugin: 'com.android.application'\n\nandroid {\n    compileSdkVersion 21\n    buildToolsVersion \"21.1.1\"\n\n    defaultConfig {\n        applicationId \"com.materialnotes\"\n        minSdkVersion 7\n        targetSdkVersion 21\n        versionCode 1\n        versionName \"1.0\"\n    }\n    compileOptions {\n        sourceCompatibility JavaVersion.VERSION_1_7\n        targetCompatibility JavaVersion.VERSION_1_7\n    }\n    buildTypes {\n        release {\n            minifyEnabled false\n            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'\n        }\n    }\n}\n\ndependencies {\n    compile fileTree(dir: 'libs', include: ['*.jar'])\n    compile 'com.android.support:appcompat-v7:21.0.0'\n    compile 'com.android.support:cardview-v7:21.0.0'\n    compile 'com.shamanland:fab:0.0.5'\n    compile 'org.roboguice:roboguice:3.0'\n    provided 'org.roboguice:roboblender:3.0'\n}"
  },
  {
    "path": "app/proguard-rules.pro",
    "content": "# Add project specific ProGuard rules here.\n# By default, the flags in this file are appended to flags specified\n# in /opt/google/android-sdk/tools/proguard/proguard-android.txt\n# You can edit the include path and order by changing the proguardFiles\n# directive in build.gradle.\n#\n# For more details, see\n#   http://developer.android.com/guide/developing/tools/proguard.html\n\n# Add any project specific keep options here:\n\n# If your project uses WebView with JS, uncomment the following\n# and specify the fully qualified class name to the JavaScript interface\n# class:\n#-keepclassmembers class fqcn.of.javascript.interface.for.webview {\n#   public *;\n#}\n"
  },
  {
    "path": "app/src/main/AndroidManifest.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<manifest xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    package=\"com.materialnotes\">\n\n    <application\n        android:allowBackup=\"true\"\n        android:icon=\"@drawable/ic_launcher\"\n        android:label=\"@string/app_name\"\n        android:theme=\"@style/Theme.NotepadApp\">\n\n        <meta-data\n            android:name=\"roboguice.modules\"\n            android:value=\"com.materialnotes.config.ConfigModule\" />\n\n        <activity\n            android:name=\"com.materialnotes.activity.MainActivity\"\n            android:label=\"@string/title_activity_notes_list\">\n            <intent-filter>\n                <action android:name=\"android.intent.action.MAIN\" />\n\n                <category android:name=\"android.intent.category.LAUNCHER\" />\n            </intent-filter>\n        </activity>\n        <activity\n            android:name=\"com.materialnotes.activity.EditNoteActivity\"\n            android:label=\"@string/title_activity_edit_note\" />\n        <activity\n            android:name=\"com.materialnotes.activity.ViewNoteActivity\"\n            android:label=\"@string/title_activity_view_note\" />\n    </application>\n\n</manifest>"
  },
  {
    "path": "app/src/main/assets/licenses.html",
    "content": "<!DOCTYPE HTML>\n<html>\n    <style type=\"text/css\">\n        body { \n            font-family: sans-serif; \n        }\n        \n        pre { \n            background-color: #eeeeee; \n            padding: 1em; \n            white-space: pre-wrap; \n        }\n    </style>\n    <body>\n    \t<ul>\n            <li>android-support-v7-appcompat-v21.0.0.aar</li>\n            <li>android-support-v7-cardview-v21.0.0.aar</li>\n        </ul>\n        <pre>\nCopyright (c) 2005-2013, The Android Open Source Project\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n     http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n        </pre>\n        <ul>\n            <li>floating-action-button-v0.0.5-SNAPSHOT.aar</li>\n        </ul>\n        <pre>\nCopyright 2014 ShamanLand.Com\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n    http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n        </pre>\n        <ul>\n            <li>roboguice-v3.0.1.jar</li>\n            <li>roboblender-v3.0.1.jar</li>\n        </ul>\n        <pre>\nCopyright 2009-2014 roboguice committers\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n        </pre>\n    </body>\n</html>"
  },
  {
    "path": "app/src/main/assets/notes_schema-v1.sql",
    "content": "DROP TABLE IF EXISTS note;\n\nCREATE TABLE note (\n    _id INTEGER PRIMARY KEY AUTOINCREMENT,\n    title VARCHAR(50) NOT NULL,\n    content TEXT NOT NULL,\n    created_at BIGINT NOT NULL,\n    updated_at BIGINT NOT NULL,\n    UNIQUE (created_at)\n);"
  },
  {
    "path": "app/src/main/java/com/materialnotes/activity/EditNoteActivity.java",
    "content": "package com.materialnotes.activity;\n\nimport android.content.Context;\nimport android.content.Intent;\nimport android.os.Bundle;\nimport android.view.Menu;\nimport android.view.MenuItem;\nimport android.widget.EditText;\nimport android.widget.Toast;\n\nimport com.materialnotes.R;\nimport com.materialnotes.data.Note;\nimport com.materialnotes.util.Strings;\n\nimport java.util.Date;\n\nimport roboguice.activity.RoboActionBarActivity;\nimport roboguice.inject.ContentView;\nimport roboguice.inject.InjectView;\n\n/**\n * Actividad para editar notas.\n *\n * @author Daniel Pedraza Arcega\n */\n@ContentView(R.layout.activity_edit_note)\npublic class EditNoteActivity extends RoboActionBarActivity {\n\n    private static final String EXTRA_NOTE = \"EXTRA_NOTE\";\n\n    @InjectView(R.id.note_title)   private EditText noteTitleText;\n    @InjectView(R.id.note_content) private EditText noteContentText;\n\n    private Note note;\n\n    /**\n     * Construye el Intent para llamar a esta actividad con una nota ya existente.\n     *\n     * @param context el contexto que la llama.\n     * @param note la nota a editar.\n     * @return un Intent.\n     */\n    public static Intent buildIntent(Context context, Note note) {\n        Intent intent = new Intent(context, EditNoteActivity.class);\n        intent.putExtra(EXTRA_NOTE, note);\n        return intent;\n    }\n\n    /**\n     * Construye el Intent para llamar a esta actividad para crear una nota.\n     *\n     * @param context el contexto que la llama.\n     * @return un Intent.\n     */\n    public static Intent buildIntent(Context context) {\n        return buildIntent(context, null);\n    }\n\n    /**\n     * Recupera la nota editada.\n     *\n     * @param intent el Intent que vine en onActivityResult\n     * @return la nota actualizada\n     */\n    public static Note getExtraNote(Intent intent) {\n        return (Note) intent.getExtras().get(EXTRA_NOTE);\n    }\n\n    /** {@inheritDoc} */\n    @Override\n    protected void onCreate(Bundle savedInstanceState) {\n        super.onCreate(savedInstanceState);\n\t\t// Inicializa los componentes //////////////////////////////////////////////////////////////\n        getSupportActionBar().setDisplayHomeAsUpEnabled(true); // Muestra la flecha hacia atrás\n        note = (Note) getIntent().getSerializableExtra(EXTRA_NOTE); // Recuperar la nota del Intent\n        if (note != null) { // Editar nota existente\n            noteTitleText.setText(note.getTitle());\n            noteContentText.setText(note.getContent());\n        } else { // Nueva nota\n            note = new Note();\n            note.setCreatedAt(new Date());\n        }\n    }\n\n    /** {@inheritDoc} */\n    @Override\n    public boolean onCreateOptionsMenu(Menu menu) {\n        getMenuInflater().inflate(R.menu.edit_note, menu);\n        return true;\n    }\n\n    /** {@inheritDoc} */\n    @Override\n    public boolean onOptionsItemSelected(MenuItem item) {\n        switch (item.getItemId()) {\n            case android.R.id.home:\n                onBackPressed();\n                return true;\n            case R.id.action_save:\n                if (isNoteFormOk()) {\n                    setNoteResult();\n                    finish();\n                } else validateNoteForm();\n                return true;\n            default: return super.onOptionsItemSelected(item);\n        }\n    }\n\n    /** @return {@code true} si tiene titulo y contenido; {@code false} en cualquier otro caso. */\n    private boolean isNoteFormOk() {\n        return !Strings.isNullOrBlank(noteTitleText.getText().toString()) && !Strings.isNullOrBlank(noteContentText.getText().toString());\n    }\n\n    /**\n     * Actualiza el contenido del objeto Note con los campos de texto del layout y pone el objeto\n     * como resultado de esta actividad.\n     */\n    private void setNoteResult() {\n        note.setTitle(noteTitleText.getText().toString().trim());\n        note.setContent(noteContentText.getText().toString().trim());\n        note.setUpdatedAt(new Date());\n        Intent resultIntent = new Intent();\n        resultIntent.putExtra(EXTRA_NOTE, note);\n        setResult(RESULT_OK, resultIntent);\n    }\n\n    /** Muestra mensajes de validación de la forma de la nota. */\n    private void validateNoteForm() {\n        StringBuilder message = null;\n        if (Strings.isNullOrBlank(noteTitleText.getText().toString())) {\n            message = new StringBuilder().append(getString(R.string.title_required));\n        }\n        if (Strings.isNullOrBlank(noteContentText.getText().toString())) {\n            if (message == null) message = new StringBuilder().append(getString(R.string.content_required));\n            else message.append(\"\\n\").append(getString(R.string.content_required));\n        }\n        if (message != null) {\n            Toast.makeText(getApplicationContext(),\n                    message,\n                    Toast.LENGTH_LONG)\n                    .show();\n        }\n    }\n\n    /** {@inheritDoc} */\n    @Override\n    public void onBackPressed() {\n        // No se edito ningúna nota ni creo alguna nota\n        setResult(RESULT_CANCELED, new Intent());\n        finish();\n    }\n}"
  },
  {
    "path": "app/src/main/java/com/materialnotes/activity/MainActivity.java",
    "content": "package com.materialnotes.activity;\n\nimport android.app.AlertDialog;\nimport android.content.DialogInterface;\nimport android.content.Intent;\nimport android.os.Bundle;\nimport android.support.v7.view.ActionMode;\nimport android.view.Menu;\nimport android.view.MenuItem;\nimport android.view.View;\nimport android.webkit.WebView;\nimport android.widget.AdapterView;\nimport android.widget.ListView;\nimport android.widget.TextView;\n\nimport com.materialnotes.R;\nimport com.materialnotes.data.Note;\nimport com.materialnotes.data.dao.NoteDAO;\nimport com.materialnotes.view.ShowHideOnScroll;\nimport com.materialnotes.widget.AboutNoticeDialog;\nimport com.materialnotes.widget.NotesAdapter;\n\nimport com.shamanland.fab.FloatingActionButton;\n\nimport java.util.ArrayList;\n\nimport javax.inject.Inject;\n\nimport roboguice.activity.RoboActionBarActivity;\nimport roboguice.inject.ContentView;\nimport roboguice.inject.InjectView;\n\n/**\n * Actividad principal que presenta una lista de notas.\n *\n * @author Daniel Pedraza Arcega\n */\n@ContentView(R.layout.activity_main)\npublic class MainActivity extends RoboActionBarActivity {\n\n    private static final int NEW_NOTE_RESULT_CODE = 4;\n    private static final int EDIT_NOTE_RESULT_CODE = 5;\n\n    @InjectView(android.R.id.empty)   private TextView emptyListTextView;\n    @InjectView(android.R.id.list)    private ListView listView;\n    @InjectView(R.id.add_note_button) private FloatingActionButton addNoteButton;\n\n    @Inject private NoteDAO noteDAO;\n\n    private ArrayList<Integer> selectedPositions;\n    private ArrayList<NotesAdapter.NoteViewWrapper> notesData;\n    private NotesAdapter listAdapter;\n    private ActionMode.Callback actionModeCallback;\n    private ActionMode actionMode;\n\n    /** {@inheritDoc} */\n    @Override\n    protected void onCreate(Bundle savedInstanceState) {\n        super.onCreate(savedInstanceState);\n        // Inicializa los componentes //////////////////////////////////////////////////////////////\n        listView.setOnTouchListener(new ShowHideOnScroll(addNoteButton, getSupportActionBar())); // Esconde o muesta el FAB y la Action Bar\n        addNoteButton.setOnClickListener(new View.OnClickListener() {\n\n            @Override\n            public void onClick(View view) {\n                // Crear una nota nueva\n                startActivityForResult(EditNoteActivity.buildIntent(MainActivity.this), NEW_NOTE_RESULT_CODE);\n            }\n        });\n        selectedPositions = new ArrayList<>();\n        setupNotesAdapter();\n        setupActionModeCallback();\n        setListOnItemClickListenersWhenNoActionMode();\n        updateView();\n    }\n\n    /** {@inheritDoc} */\n    @Override\n    public boolean onCreateOptionsMenu(Menu menu) {\n        getMenuInflater().inflate(R.menu.main, menu);\n        return true;\n    }\n\n    /** {@inheritDoc} */\n    @Override\n    public boolean onOptionsItemSelected(MenuItem item) {\n        switch (item.getItemId()) {\n            case R.id.action_about_info:\n                new AboutNoticeDialog()\n                        .show(getSupportFragmentManager(), \"dialog_about_notice\");\n                return true;\n            case R.id.action_licenses_info:\n                WebView webView = new WebView(this);\n                webView.loadUrl(\"file:///android_asset/licenses.html\");\n                new AlertDialog.Builder(this)\n                        .setTitle(R.string.dialog_licenses_notice_title)\n                        .setView(webView)\n                        .setCancelable(true)\n                        .show();\n                return true;\n            default: return super.onOptionsItemSelected(item);\n        }\n    }\n\n    /** {@inheritDoc} */\n    @Override\n    protected void onActivityResult(int requestCode, int resultCode, Intent data) {\n        if (requestCode == NEW_NOTE_RESULT_CODE) {\n            if (resultCode == RESULT_OK) addNote(data);\n        }\n        if (requestCode == EDIT_NOTE_RESULT_CODE) {\n            if (resultCode == RESULT_OK) updateNote(data);\n        }\n\n        super.onActivityResult(requestCode, resultCode, data);\n    }\n\n    /** Crea la llamada al modo contextual. */\n    private void setupActionModeCallback() {\n        actionModeCallback = new ActionMode.Callback() {\n\n            /** {@inheritDoc} */\n            @Override\n            public boolean onCreateActionMode(ActionMode mode, Menu menu) {\n                setListOnItemClickListenersWhenActionMode();\n                // inflar menu contextual\n                mode.getMenuInflater().inflate(R.menu.context_note, menu);\n                return true;\n            }\n\n            /** {@inheritDoc} */\n            @Override\n            public boolean onPrepareActionMode(ActionMode mode, Menu menu) {\n                // Nada\n                return false;\n            }\n\n            /** {@inheritDoc} */\n            @Override\n            public boolean onActionItemClicked(final ActionMode mode, MenuItem item) {\n                switch (item.getItemId()) {\n                    // borrar notas solo si hay notas a borrar; sino se acaba el modo contextual.\n                    case R.id.action_delete:\n                        if (!selectedPositions.isEmpty()) {\n                            new AlertDialog.Builder(MainActivity.this)\n                                    .setMessage(getString(R.string.delete_notes_alert, selectedPositions.size()))\n                                    .setNegativeButton(android.R.string.no, null)\n                                    .setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {\n\n                                        @Override\n                                        public void onClick(DialogInterface dialog, int which) {\n                                            deleteNotes(selectedPositions);\n                                            mode.finish();\n                                        }\n                                    })\n                                    .show();\n                        } else mode.finish();\n                        return true;\n                    default:\n                        return false;\n                }\n            }\n\n            /** {@inheritDoc} */\n            @Override\n            public void onDestroyActionMode(ActionMode mode) {\n                // Regresar al modo normal\n                setListOnItemClickListenersWhenNoActionMode();\n                resetSelectedListItems();\n            }\n        };\n    }\n\n    /** Inicializa el adaptador de notas. */\n    private void setupNotesAdapter() {\n        notesData = new ArrayList<>();\n        for (Note note : noteDAO.fetchAll()) { // Convertir a wrapper\n            NotesAdapter.NoteViewWrapper noteViewWrapper = new NotesAdapter.NoteViewWrapper(note);\n            notesData.add(noteViewWrapper);\n        }\n        listAdapter = new NotesAdapter(notesData);\n        listView.setAdapter(listAdapter);\n    }\n\n    /** Actualiza la vista de esta actividad cuando hay notas o no hay notas. */\n    private void updateView() {\n        if (notesData.isEmpty()) { // Mostrar mensaje\n            listView.setVisibility(View.GONE);\n            emptyListTextView.setVisibility(View.VISIBLE);\n        } else { // Mostrar lista\n            listView.setVisibility(View.VISIBLE);\n            emptyListTextView.setVisibility(View.GONE);\n        }\n    }\n\n    /**\n     * Agrega una nota a lista y la fuente de datos.\n     *\n     * @param data los datos de la actividad de edición de notas.\n     */\n    private void addNote(Intent data) {\n        Note note = EditNoteActivity.getExtraNote(data);\n        noteDAO.insert(note);\n        NotesAdapter.NoteViewWrapper noteViewWrapper = new NotesAdapter.NoteViewWrapper(note);\n        notesData.add(noteViewWrapper);\n        updateView();\n        listAdapter.notifyDataSetChanged();\n    }\n\n    /**\n     * Borra notas de la lista y de la fuente de datos.\n     *\n     * @param selectedPositions las posiciones de las notas en la lista.\n     */\n    private void deleteNotes(ArrayList<Integer> selectedPositions) {\n        ArrayList<NotesAdapter.NoteViewWrapper> toRemoveList = new ArrayList<>(selectedPositions.size());\n        // Primero borra de la base de datos\n        for (int position : selectedPositions) {\n            NotesAdapter.NoteViewWrapper noteViewWrapper = notesData.get(position);\n            toRemoveList.add(noteViewWrapper);\n            noteDAO.delete(noteViewWrapper.getNote());\n        }\n        // Y luego de la vista (no al mismo tiempo porque pierdo las posiciones que hay que borrar)\n        for (NotesAdapter.NoteViewWrapper noteToRemove : toRemoveList) notesData.remove(noteToRemove);\n        updateView();\n        listAdapter.notifyDataSetChanged();\n    }\n\n    /**\n     * Actualiza una nota en la lista y la fuente de datos.\n     *\n     * @param data los datos de la actividad de edición de notas.\n     */\n    private void updateNote(Intent data) {\n        Note updatedNote = ViewNoteActivity.getExtraUpdatedNote(data);\n        noteDAO.update(updatedNote);\n        for (NotesAdapter.NoteViewWrapper noteViewWrapper : notesData) {\n            // Buscar la nota vieja para actulizarla en la vista\n            if (noteViewWrapper.getNote().getId().equals(updatedNote.getId())) {\n                noteViewWrapper.getNote().setTitle(updatedNote.getTitle());\n                noteViewWrapper.getNote().setContent(updatedNote.getContent());\n                noteViewWrapper.getNote().setUpdatedAt(updatedNote.getUpdatedAt());\n            }\n        }\n        listAdapter.notifyDataSetChanged();\n    }\n\n    /** Reinicia las notas seleccionadas a no seleccionadas y limpia la lista de seleccionados. */\n    private void resetSelectedListItems() {\n        for (NotesAdapter.NoteViewWrapper noteViewWrapper : notesData) noteViewWrapper.setSelected(false);\n        selectedPositions.clear();\n        listAdapter.notifyDataSetChanged();\n    }\n\n    /**\n     * Inicializa las acciones de la lista al hacer click en sus items cuando NO esta activo el\n     * modo contextual.\n     */\n    private void setListOnItemClickListenersWhenNoActionMode() {\n        listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {\n\n            @Override\n            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {\n                // Ver la nota al hacer click\n                startActivityForResult(ViewNoteActivity.buildIntent(MainActivity.this, notesData.get(position).getNote()), EDIT_NOTE_RESULT_CODE);\n            }\n        });\n        listView.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {\n\n            @Override\n            public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {\n                // Iniciar modo contextual para selección de items\n                notesData.get(position).setSelected(true);\n                listAdapter.notifyDataSetChanged();\n                selectedPositions.add(position);\n                actionMode = startSupportActionMode(actionModeCallback);\n                actionMode.setTitle(String.valueOf(selectedPositions.size()));\n                return true;\n            }\n        });\n    }\n\n    /**\n     * Inicializa las acciones de la lista al hacer click en sus items cuando esta activo el menu\n     * contextual.\n     */\n    private void setListOnItemClickListenersWhenActionMode() {\n        listView.setOnItemLongClickListener(null);\n        listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {\n\n            @Override\n            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {\n                // Agregar items a la lista de seleccionados y cambiarles el fondo.\n                // Si se deseleccionan todos los items, se acaba el modo contextual\n                if (selectedPositions.contains(position)) {\n                    selectedPositions.remove((Object)position); // no quiero el índice sino el objeto\n                    if (selectedPositions.isEmpty()) actionMode.finish();\n                    else {\n                        actionMode.setTitle(String.valueOf(selectedPositions.size()));\n                        notesData.get(position).setSelected(false);\n                        listAdapter.notifyDataSetChanged();\n                    }\n                } else {\n                    notesData.get(position).setSelected(true);\n                    listAdapter.notifyDataSetChanged();\n                    selectedPositions.add(position);\n                    actionMode.setTitle(String.valueOf(selectedPositions.size()));\n                }\n            }\n        });\n    }\n}"
  },
  {
    "path": "app/src/main/java/com/materialnotes/activity/ViewNoteActivity.java",
    "content": "package com.materialnotes.activity;\n\nimport android.content.Context;\nimport android.content.Intent;\nimport android.os.Bundle;\nimport android.view.MenuItem;\nimport android.view.View;\nimport android.widget.ScrollView;\nimport android.widget.TextView;\n\nimport com.materialnotes.R;\nimport com.materialnotes.data.Note;\n\nimport com.materialnotes.view.ShowHideOnScroll;\nimport com.shamanland.fab.FloatingActionButton;\n\nimport java.text.DateFormat;\n\nimport roboguice.activity.RoboActionBarActivity;\nimport roboguice.inject.ContentView;\nimport roboguice.inject.InjectView;\n\n/**\n * Actividad para visualizar una nota. Adicionalmente, se puede editar la nota en otra actividad.\n *\n * @author Daniel Pedraza Arcega\n */\n@ContentView(R.layout.activity_view_note)\npublic class ViewNoteActivity extends RoboActionBarActivity {\n\n    private static final int EDIT_NOTE_RESULT_CODE = 8;\n    private static final String EXTRA_NOTE = \"EXTRA_NOTE\";\n    private static final String EXTRA_UPDATED_NOTE = \"EXTRA_UPDATED_NOTE\";\n    private static final DateFormat DATETIME_FORMAT = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.MEDIUM);\n\n    @InjectView(R.id.scroll_view)          private ScrollView scrollView;\n    @InjectView(R.id.edit_note_button)     private FloatingActionButton editNoteButton;\n    @InjectView(R.id.note_title)           private TextView noteTitleText;\n    @InjectView(R.id.note_content)         private TextView noteContentText;\n    @InjectView(R.id.note_created_at_date) private TextView noteCreatedAtDateText;\n    @InjectView(R.id.note_updated_at_date) private TextView noteUpdatedAtDateText;\n\n    private Note note;\n\n    /**\n     * Construye el Intent para llamar a esta actividad.\n     *\n     * @param context el contexto que la llama.\n     * @param note la nota a visualizar.\n     * @return un Intent.\n     */\n    public static Intent buildIntent(Context context, Note note) {\n        Intent intent = new Intent(context, ViewNoteActivity.class);\n        intent.putExtra(EXTRA_NOTE, note);\n        return intent;\n    }\n\n    /**\n     * Recupera la nota actualizada en la actividad de edición de notas.\n     *\n     * @param intent el Intent que vine en onActivityResult\n     * @return la nota actualizada\n     */\n    public static Note getExtraUpdatedNote(Intent intent) {\n        return (Note) intent.getExtras().get(EXTRA_UPDATED_NOTE);\n    }\n\n    /** {@inheritDoc} */\n    @Override\n    protected void onCreate(Bundle savedInstanceState) {\n        super.onCreate(savedInstanceState);\n        // Inicializa los componentes //////////////////////////////////////////////////////////////\n        getSupportActionBar().setDisplayHomeAsUpEnabled(true); // Muestra la flecha hacia atrás\n        scrollView.setOnTouchListener(new ShowHideOnScroll(editNoteButton, getSupportActionBar())); // Esconde o muesta el FAB y la Action Bar\n        editNoteButton.setOnClickListener(new View.OnClickListener() {\n\n            @Override\n            public void onClick(View view) {\n                // Ir a la actividad de edición de notas\n                startActivityForResult(EditNoteActivity.buildIntent(ViewNoteActivity.this, note), EDIT_NOTE_RESULT_CODE);\n            }\n        });\n        note = (Note) getIntent().getSerializableExtra(EXTRA_NOTE); // Recuperar la nota del Intent\n        // Mostrar la información de la nota en el layout\n        noteTitleText.setText(note.getTitle());\n        noteContentText.setText(note.getContent());\n        noteCreatedAtDateText.setText(DATETIME_FORMAT.format(note.getCreatedAt()));\n        noteUpdatedAtDateText.setText(DATETIME_FORMAT.format(note.getUpdatedAt()));\n    }\n\n    /** {@inheritDoc} */\n    @Override\n    public boolean onOptionsItemSelected(MenuItem item) {\n        switch (item.getItemId()) {\n            case android.R.id.home:\n                onBackPressed(); // Cerrar esta actividad\n                return true;\n            default: return super.onOptionsItemSelected(item);\n        }\n    }\n\n    /** {@inheritDoc} */\n    @Override\n    protected void onActivityResult(int requestCode, int resultCode, Intent data) {\n        if (requestCode == EDIT_NOTE_RESULT_CODE) {\n            if (resultCode == RESULT_OK) {\n                // La nota fue editada correctamente y debe finalizar esta actividad con un resultado\n                Intent resultIntent = new Intent();\n                Note note = EditNoteActivity.getExtraNote(data);\n                resultIntent.putExtra(EXTRA_UPDATED_NOTE, note);\n                setResult(RESULT_OK, resultIntent);\n                finish();\n            } else if (resultCode == RESULT_CANCELED) onBackPressed();\n        }\n\n        super.onActivityResult(requestCode, resultCode, data);\n    }\n\n    /** {@inheritDoc} */\n    @Override\n    public void onBackPressed() {\n        // No se edito la nota\n        setResult(RESULT_CANCELED, new Intent());\n        finish();\n    }\n}"
  },
  {
    "path": "app/src/main/java/com/materialnotes/config/ConfigModule.java",
    "content": "package com.materialnotes.config;\n\nimport android.app.Application;\nimport android.database.sqlite.SQLiteOpenHelper;\n\nimport com.google.inject.AbstractModule;\nimport com.google.inject.name.Names;\n\nimport com.materialnotes.data.source.sqlite.NotesDatabaseHelper;\n\n/**\n * Clase para cablear dependencias de la aplicación\n *\n * @author Daniel Pedraza Arcega\n */\npublic class ConfigModule extends AbstractModule {\n\n    private final Application context;\n\n    public ConfigModule(Application context) {\n        this.context = context;\n    }\n\n    /** Cablea las implementaciones. */\n    @Override\n    protected void configure() {\n        bind(SQLiteOpenHelper.class)\n                .annotatedWith(Names.named(\"NotesDbHelper\"))\n                .toInstance(new NotesDatabaseHelper(context));\n    }\n}"
  },
  {
    "path": "app/src/main/java/com/materialnotes/data/Note.java",
    "content": "package com.materialnotes.data;\n\nimport java.io.Serializable;\nimport java.util.Date;\n\n/**\n * Clase que representa una nota de la aplicacación.\n *\n * @author Daniel Pedraza Arcega\n */\npublic class Note implements Serializable {\n\n    private static final long serialVersionUID = -831930284387787342L;\n\n    private Long id;\n    private String title;\n    private String content;\n    private Date createdAt;\n    private Date updatedAt;\n\n    public Long getId() {\n        return id;\n    }\n\n    public void setId(Long id) {\n        this.id = id;\n    }\n\n    public String getTitle() {\n        return title;\n    }\n\n    public void setTitle(String title) {\n        this.title = title;\n    }\n\n    public String getContent() {\n        return content;\n    }\n\n    public void setContent(String content) {\n        this.content = content;\n    }\n\n    public Date getCreatedAt() {\n        return createdAt;\n    }\n\n    public void setCreatedAt(Date createdAt) {\n        this.createdAt = createdAt;\n    }\n\n    public Date getUpdatedAt() {\n        return updatedAt;\n    }\n\n    public void setUpdatedAt(Date updatedAt) {\n        this.updatedAt = updatedAt;\n    }\n\n    @Override\n    public int hashCode() {\n        final int prime = 31;\n        int result = 1;\n        result = prime * result + ((content == null) ? 0 : content.hashCode());\n        result = prime * result + ((createdAt == null) ? 0 : createdAt.hashCode());\n        result = prime * result + ((id == null) ? 0 : id.hashCode());\n        result = prime * result + ((title == null) ? 0 : title.hashCode());\n        result = prime * result + ((updatedAt == null) ? 0 : updatedAt.hashCode());\n        return result;\n    }\n\n    @Override\n    public boolean equals(Object obj) {\n        if (this == obj) return true;\n        if (obj == null) return false;\n        if (getClass() != obj.getClass()) return false;\n        Note other = (Note) obj;\n        if (content == null) {\n            if (other.content != null) return false;\n        } else if (!content.equals(other.content)) return false;\n        if (createdAt == null) {\n            if (other.createdAt != null) return false;\n        } else if (!createdAt.equals(other.createdAt)) return false;\n        if (id == null) {\n            if (other.id != null) return false;\n        } else if (!id.equals(other.id)) return false;\n        if (title == null) {\n            if (other.title != null) return false;\n        } else if (!title.equals(other.title)) return false;\n        if (updatedAt == null) {\n            if (other.updatedAt != null) return false;\n        } else if (!updatedAt.equals(other.updatedAt)) return false;\n        return true;\n    }\n\n    @Override\n    public String toString() {\n        return new StringBuilder().append(\"Note [id=\").append(id).append(\", title=\").append(title)\n                .append(\", content=\").append(content).append(\", createdAt=\").append(createdAt)\n                .append(\", updatedAt=\").append(updatedAt).append(\"]\").toString();\n    }\n}"
  },
  {
    "path": "app/src/main/java/com/materialnotes/data/dao/NoteDAO.java",
    "content": "package com.materialnotes.data.dao;\n\nimport com.google.inject.ImplementedBy;\n\nimport com.materialnotes.data.Note;\nimport com.materialnotes.data.dao.impl.sqlite.NoteSQLiteDAO;\n\nimport java.util.List;\n\n/**\n * Interfaz que deben implementar todas las clases que sean fuente de datos de notas.\n *\n * @author Daniel Pedraza Arcega\n */\n@ImplementedBy(NoteSQLiteDAO.class)\npublic interface NoteDAO {\n\n    /** @return todas las notas de la fuente de datos*/\n    List<Note> fetchAll();\n\n    /**\n     * Inserta una nota en la fuente de datos.\n     *\n     * @param note la nota a insertar.\n     */\n    void insert(Note note);\n\n    /**\n     * Actualiza una nota en la fuente de datos.\n     *\n     * @param note la nota a actualizar.\n     */\n    void update(Note note);\n\n    /**\n     * Borra una nota en la fuente de datos.\n     *\n     * @param note la nota a borrar.\n     */\n    void delete(Note note);\n}"
  },
  {
    "path": "app/src/main/java/com/materialnotes/data/dao/impl/sqlite/NoteSQLiteDAO.java",
    "content": "package com.materialnotes.data.dao.impl.sqlite;\n\nimport android.content.ContentValues;\nimport android.database.Cursor;\nimport android.database.sqlite.SQLiteDatabase;\nimport android.database.sqlite.SQLiteOpenHelper;\nimport android.provider.BaseColumns;\nimport android.util.Log;\n\nimport com.materialnotes.data.Note;\nimport com.materialnotes.data.dao.NoteDAO;\n\nimport java.util.ArrayList;\nimport java.util.Date;\n\nimport javax.inject.Inject;\nimport javax.inject.Named;\n\n/**\n * Clase que recupera notas de una base de datos SQLite.\n *\n * @author Daniel Pedraza Arcega\n */\npublic class NoteSQLiteDAO implements NoteDAO {\n\n    private static final String TAG = NoteSQLiteDAO.class.getSimpleName();\n    private static final String WHERE_ID_CLAUSE = NoteEntry._ID + \" = ?\";\n\n    private final SQLiteOpenHelper databaseHelper;\n\n    /**\n     * Construye un NoteSQLiteDAO usando el SQLiteOpenHelper dado.\n     *\n     * @param databaseHelper un SQLiteOpenHelper.\n     */\n    @Inject\n    public NoteSQLiteDAO(@Named(\"NotesDbHelper\") SQLiteOpenHelper databaseHelper) {\n        this.databaseHelper = databaseHelper;\n    }\n\n    /**\n     * @see <a href=\"http://bit.ly/1whYCa6\">Read Information from a Database</a>\n     * @return recupera todas las notas de la tabla {@link NoteEntry#TABLE_NAME}\n     */\n    @Override\n    public ArrayList<Note> fetchAll() {\n        ArrayList<Note> result = null;\n        Cursor cursor = null;\n        SQLiteDatabase database = databaseHelper.getReadableDatabase();\n        try {\n            String[] columns = {NoteEntry._ID,\n                    NoteEntry.TITLE,\n                    NoteEntry.CONTENT,\n                    NoteEntry.CREATED_AT,\n                    NoteEntry.UPDATED_AT};\n            cursor = database.query(NoteEntry.TABLE_NAME, columns, null, null, null, null, null);\n            result = new ArrayList<>(cursor.getCount());\n            for (cursor.moveToFirst(); !cursor.isAfterLast(); cursor.moveToNext()) {\n                Note note = new Note();\n                note.setId(cursor.getLong(cursor.getColumnIndexOrThrow(NoteEntry._ID)));\n                note.setTitle(cursor.getString(cursor.getColumnIndexOrThrow(NoteEntry.TITLE)));\n                note.setContent(cursor.getString(cursor.getColumnIndexOrThrow(NoteEntry.CONTENT)));\n                note.setCreatedAt(new Date(cursor.getLong(cursor.getColumnIndexOrThrow(NoteEntry.CREATED_AT))));\n                note.setUpdatedAt(new Date(cursor.getLong(cursor.getColumnIndexOrThrow(NoteEntry.UPDATED_AT))));\n                result.add(note);\n            }\n        } catch (Exception ex) {\n            Log.e(TAG, \"Could not complete fetch all\", ex);\n        } finally {\n            if (cursor != null) {\n                try {\n                    cursor.close();\n                } catch (Exception ex) {\n                    Log.e(TAG, \"Couldn't close cursor correctly\");\n                }\n            }\n            database.close();\n        }\n        return result;\n    }\n\n    /**\n     * Inserta una nota en la tabla {@link NoteEntry#TABLE_NAME}.\n     *\n     * @see <a href=\"http://bit.ly/1D3oTNG\">Put Information into a Database</a>\n     * @param note la nota a insertar.\n     */\n    @Override\n    public void insert(Note note) {\n        SQLiteDatabase database = databaseHelper.getWritableDatabase();\n        database.beginTransaction();\n        try {\n            ContentValues values = new ContentValues();\n            values.put(NoteEntry.TITLE, note.getTitle());\n            values.put(NoteEntry.CONTENT, note.getContent());\n            values.put(NoteEntry.CREATED_AT, note.getCreatedAt().getTime());\n            values.put(NoteEntry.UPDATED_AT, note.getUpdatedAt().getTime());\n            long rowId = database.insert(NoteEntry.TABLE_NAME, null, values);\n            note.setId(rowId);\n            database.setTransactionSuccessful();\n        } catch (Exception ex) {\n            Log.e(TAG, \"Could not complete insert [\" + note + \"]\", ex);\n        } finally {\n            database.endTransaction();\n            database.close();\n        }\n    }\n\n    /**\n     * Actualiza una nota la tabla {@link NoteEntry#TABLE_NAME}.\n     *\n     * @see <a href=\"http://bit.ly/1tOS68i\">Update a Database</a>\n     * @param note la nota a actualizar.\n     */\n    @Override\n    public void update(Note note) {\n        SQLiteDatabase database = databaseHelper.getWritableDatabase();\n        database.beginTransaction();\n        try {\n            ContentValues values = new ContentValues();\n            values.put(NoteEntry.TITLE, note.getTitle());\n            values.put(NoteEntry.CONTENT, note.getContent());\n            values.put(NoteEntry.UPDATED_AT, note.getUpdatedAt().getTime());\n            String[] whereArgs = {String.valueOf(note.getId())};\n            database.update(NoteEntry.TABLE_NAME, values, WHERE_ID_CLAUSE, whereArgs);\n            database.setTransactionSuccessful();\n        } catch (Exception ex) {\n            Log.e(TAG, \"Could not complete update [\" + note + \"]\", ex);\n        } finally {\n            database.endTransaction();\n            database.close();\n        }\n    }\n\n    /**\n     * Borra una nota de la tabla {@link NoteEntry#TABLE_NAME}.\n     *\n     * @see <a href=\"http://bit.ly/1syEh1A\">Delete Information from a Database</a>\n     * @param note la nota a borrar.\n     */\n    @Override\n    public void delete(Note note) {\n        SQLiteDatabase database = databaseHelper.getWritableDatabase();\n        database.beginTransaction();\n        try {\n            String[] whereArgs = {String.valueOf(note.getId())};\n            database.delete(NoteEntry.TABLE_NAME, WHERE_ID_CLAUSE, whereArgs);\n            database.setTransactionSuccessful();\n        } catch (Exception ex) {\n            Log.e(TAG, \"Could not complete delete [\" + note + \"]\", ex);\n        } finally {\n            database.endTransaction();\n            database.close();\n        }\n    }\n\n    /** Constantes de la tabla de notas. */\n    private static class NoteEntry implements BaseColumns {\n        private static final String TABLE_NAME = \"note\";\n        private static final String TITLE = \"title\";\n        private static final String CONTENT = \"content\";\n        private static final String CREATED_AT = \"created_at\";\n        private static final String UPDATED_AT = \"updated_at\";\n    }\n}"
  },
  {
    "path": "app/src/main/java/com/materialnotes/data/source/sqlite/NotesDatabaseHelper.java",
    "content": "package com.materialnotes.data.source.sqlite;\n\nimport android.content.Context;\nimport android.database.sqlite.SQLiteDatabase;\nimport android.database.sqlite.SQLiteOpenHelper;\nimport android.util.Log;\n\nimport java.io.IOException;\nimport java.io.InputStream;\n\n/**\n * Ayudante para manejo de bases de datos SQLite.\n *\n * @author Daniel Pedraza Arcega\n * @see <a href=\"http://bit.ly/1s5nUI5\">Create a Database Using a SQL Helper</a>\n */\npublic class NotesDatabaseHelper extends SQLiteOpenHelper {\n\n    private static final String TAG = NotesDatabaseHelper.class.getSimpleName();\n    private static final String DATABASE_SCHEMA_FILE_NAME_PATTERN = \"notes_schema-v%s.sql\";\n    private static final String DATABASE_NAME = \"notes.db\";\n    private static final int DATABASE_VERSION = 1;\n\n    private final Context context;\n\n    /**\n     * Construye un NotesDatabaseHelper.\n     *\n     * @param context el contexto donde se crea este NotesDatabaseHelper.\n     */\n    public NotesDatabaseHelper(Context context) {\n        super(context, DATABASE_NAME, null, DATABASE_VERSION);\n        this.context = context;\n    }\n\n    /** {@inheritDoc} */\n    @Override\n    public void onCreate(SQLiteDatabase db) {\n        Log.v(TAG, \"Creating database version \" + DATABASE_VERSION + \"...\");\n        InputStream fileStream = null;\n        try {\n            // lee archivo notes_schema-v%s.sql para extraer las sentencias SQL\n            fileStream = context.getAssets().open(String.format(DATABASE_SCHEMA_FILE_NAME_PATTERN, DATABASE_VERSION));\n            String[] statements = SQLFileParser.getSQLStatements(fileStream);\n            // ejecuta las sentencias\n            for (String statement : statements) {\n                Log.v(TAG, statement);\n                db.execSQL(statement);\n            }\n        } catch (IOException ex) {\n            Log.e(TAG, \"Unable to open schema file\", ex);\n        } finally {\n            if (fileStream != null) {\n                try {\n                    fileStream.close();\n                } catch (IOException ex) {\n                    Log.e(TAG, \"Unable to close stream\", ex);\n                }\n            }\n        }\n    }\n\n    /** {@inheritDoc} */\n    @Override\n    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {\n        Log.w(TAG, \"Upgrading database from version \" + oldVersion + \" to \" + newVersion + \", which will destroy all old data\");\n        context.deleteDatabase(DATABASE_NAME);\n        onCreate(db);\n    }\n}"
  },
  {
    "path": "app/src/main/java/com/materialnotes/data/source/sqlite/SQLFileParser.java",
    "content": "package com.materialnotes.data.source.sqlite;\n\nimport android.util.Log;\n\nimport com.materialnotes.util.Strings;\n\nimport java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.InputStreamReader;\nimport java.util.regex.Pattern;\n\n/**\n * Clase para parsear archivos *.sql\n *\n * @author Daniel Pedraza Arcega\n */\nclass SQLFileParser {\n\n    private static final String TAG = SQLFileParser.class.getSimpleName();\n    private static final Pattern COMMENT_PATTERN = Pattern.compile(\"(?:/\\\\*[^;]*?\\\\*/)|(?:--[^;]*?$)\", Pattern.DOTALL | Pattern.MULTILINE);\n\n    /**\n     * Regresa todas las sentencias SQL contenidas en un archivo *.sql\n     *\n     * @param stream el stream del archivo *.sql\n     * @return las sentencias SQL.\n     */\n    static String[] getSQLStatements(InputStream stream) {\n        BufferedReader reader = null;\n        try {\n            reader = new BufferedReader(new InputStreamReader(stream));\n            int r;\n            StringBuilder sb = new StringBuilder();\n            while ((r = reader.read()) != -1) sb.append((char) r);\n            return COMMENT_PATTERN.matcher(sb).replaceAll(Strings.EMPTY).split(\";\");\n        } catch (IOException ex) {\n            Log.e(TAG, \"Unable to parse SQL Statements\", ex);\n            return null;\n        } finally {\n            if (reader != null) {\n                try {\n                    reader.close();\n                } catch (IOException ex) {\n                    Log.e(TAG, \"Unable to close stream\", ex);\n                }\n            }\n        }\n    }\n}"
  },
  {
    "path": "app/src/main/java/com/materialnotes/util/Strings.java",
    "content": "package com.materialnotes.util;\n\n/**\n * Clase con metodos y constantes miscelaneos de String.\n *\n * @author Daniel Pedraza Arcega\n */\npublic final class Strings {\n\n    /** Cadena vacia \"\". */\n    public static final String EMPTY = \"\";\n\n    /** Constructor. No debe ser invocado. */\n    private Strings() {\n        throw new IllegalAccessError(\"This class cannot be instantiated nor extended\");\n    }\n\n    /**\n     * Revisa si el string dado es {@code null} o vacio.\n     *\n     * @param str el string a revisar.\n     * @return {@code true} si es {@code null} o vacio; sino {@code false}.\n     */\n    public static boolean isNullOrBlank(String str) {\n        return str == null || str.trim().length() == 0;\n    }\n}"
  },
  {
    "path": "app/src/main/java/com/materialnotes/view/ShowHideOnScroll.java",
    "content": "package com.materialnotes.view;\n\nimport android.support.v7.app.ActionBar;\nimport android.view.View;\nimport android.view.animation.Animation;\nimport android.view.animation.AnimationUtils;\n\nimport com.materialnotes.R;\n\nimport com.shamanland.fab.FloatingActionButton;\nimport com.shamanland.fab.ScrollDetector;\n\n/**\n * Esconde y muestra un FloatingActionButton y ActionBar cuando una vista que tiene este listener\n * hace scroll hacia arriba o hacia abajo.\n *\n * Basado en <a href=\"http://bit.ly/10ZFVhL\">shamanland/floating-action-button ShowHideOnScroll.java</a>\n *\n * @author Daniel Pedraza Arcega\n */\npublic class ShowHideOnScroll extends ScrollDetector implements Animation.AnimationListener  {\n\n    private final FloatingActionButton fab;\n    private final ActionBar actionBar;\n\n    /**\n     * Constructor.\n     *\n     * @param fab un FloatingActionButton\n     * @param actionBar una ActionBar\n     */\n    public ShowHideOnScroll(FloatingActionButton fab, ActionBar actionBar) {\n        super(fab.getContext());\n        this.fab = fab;\n        this.actionBar = actionBar;\n    }\n\n    /** {@inheritDoc} */\n    @Override\n    public void onScrollDown() {\n        if (!areViewsVisible()) {\n            fab.setVisibility(View.VISIBLE);\n            actionBar.show();\n            animateFAB(R.anim.floating_action_button_show);\n        }\n    }\n\n    /** {@inheritDoc} */\n    @Override\n    public void onScrollUp() {\n        if (areViewsVisible()) {\n            fab.setVisibility(View.GONE);\n            actionBar.hide();\n            animateFAB(R.anim.floating_action_button_hide);\n        }\n    }\n\n    /** @return {@code true} si estan visibles el FAB y la ActionBar; {@code false} de otra forma. */\n    private boolean areViewsVisible() {\n        return fab.getVisibility() == View.VISIBLE && actionBar.isShowing();\n    }\n\n    /**\n     * Anima el FAB según la animación dada.\n     *\n     * @param anim una animación.\n     */\n    private void animateFAB(int anim) {\n        Animation a = AnimationUtils.loadAnimation(fab.getContext(), anim);\n        a.setAnimationListener(this);\n        fab.startAnimation(a);\n        setIgnore(true);\n    }\n\n    /** {@inheritDoc} */\n    @Override\n    public void onAnimationStart(Animation animation) {\n        // Nada\n    }\n\n    /** {@inheritDoc} */\n    @Override\n    public void onAnimationEnd(Animation animation) {\n        setIgnore(false);\n    }\n\n    /** {@inheritDoc} */\n    @Override\n    public void onAnimationRepeat(Animation animation) {\n        // Nada\n    }\n}"
  },
  {
    "path": "app/src/main/java/com/materialnotes/widget/AboutNoticeDialog.java",
    "content": "package com.materialnotes.widget;\n\nimport android.content.pm.PackageManager;\nimport android.os.Bundle;\nimport android.util.Log;\nimport android.view.LayoutInflater;\nimport android.view.View;\nimport android.view.ViewGroup;\nimport android.view.Window;\nimport android.widget.TextView;\n\nimport com.materialnotes.R;\n\nimport roboguice.fragment.RoboDialogFragment;\nimport roboguice.inject.InjectView;\n\n/**\n * Dialogo que muestra información acerca de aplicación.\n *\n * @author Daniel Pedraza Arcega\n */\npublic class AboutNoticeDialog extends RoboDialogFragment {\n\n    private static final String TAG = AboutNoticeDialog.class.getSimpleName();\n\n    @InjectView(R.id.version_text) private TextView versionText;\n\n    /**\n     * Crea la vista de este dialogo.\n     *\n     * @param inflater un inflater.\n     * @param container un container.\n     * @param savedInstanceState un bundle.\n     * @return la vista.\n     */\n    @Override\n    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {\n        return inflater.inflate(R.layout.dialog_about_notice, container, false);\n    }\n\n    /**\n     * Inicializa la vista creada.\n     *\n     * @param view la vista creada.\n     * @param savedInstanceState un bundle.\n     */\n    @Override\n    public void onViewCreated(View view, Bundle savedInstanceState) {\n        super.onViewCreated(view, savedInstanceState);\n        getDialog().requestWindowFeature(Window.FEATURE_NO_TITLE);\n        try {\n            String versionName = getActivity().getPackageManager().getPackageInfo(getActivity().getPackageName(), 0).versionName;\n            versionText.setText(getString(R.string.version_format, versionName));\n        } catch (PackageManager.NameNotFoundException ex) {\n            Log.e(TAG, \"Couldn't find version name\", ex);\n        }\n    }\n}"
  },
  {
    "path": "app/src/main/java/com/materialnotes/widget/NotesAdapter.java",
    "content": "package com.materialnotes.widget;\n\nimport android.view.LayoutInflater;\nimport android.view.View;\nimport android.view.ViewGroup;\nimport android.widget.BaseAdapter;\nimport android.widget.TextView;\n\nimport com.materialnotes.R;\nimport com.materialnotes.data.Note;\n\nimport java.text.DateFormat;\nimport java.util.List;\n\n/**\n * Adaptador de notas. Actua como intermediario entre la vista y los datos.\n *\n * @author Daniel Pedraza Arcega\n * @see <a href=\"http://bit.ly/1vZt3ny\">Building Layouts with an Adapter</a>\n */\npublic class NotesAdapter extends BaseAdapter {\n\n    /** Wrapper para notas. Util para cambiar el fondo de los item seleccionados. */\n    public static class NoteViewWrapper {\n\n        private final Note note;\n        private boolean isSelected;\n\n        /**\n         * Contruye un nuevo NoteWrapper con la nota dada.\n         *\n         * @param note una nota.\n         */\n        public NoteViewWrapper(Note note) {\n            this.note = note;\n        }\n\n        public Note getNote() {\n            return note;\n        }\n\n        public void setSelected(boolean isSelected) {\n            this.isSelected = isSelected;\n        }\n    }\n\n    private static final DateFormat DATETIME_FORMAT = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.MEDIUM);\n\n    private final List<NoteViewWrapper> data;\n\n    /**\n     * Constructor.\n     *\n     * @param data la lista de notas a usar como fuente de datos para este adaptador.\n     */\n    public NotesAdapter(List<NoteViewWrapper> data) {\n        this.data = data;\n    }\n\n    /** @return cuantos datos hay en la lista de notas. */\n    @Override\n    public int getCount() {\n        return data.size();\n    }\n\n    /**\n     * @param position la posición de la nota que se quiere\n     * @return la nota en la posición dada.\n     */\n    @Override\n    public NoteViewWrapper getItem(int position) {\n        return data.get(position);\n    }\n\n    /**\n     * @param position una posición\n     * @return la misma posición dada\n     */\n    @Override\n    public long getItemId(int position) {\n        return position;\n    }\n\n    /**\n     * Muestra los datos de la nota en la posición dada en una instancia del componente visual\n     * {@link com.materialnotes.R.layout#notes_row}.\n     *\n     * @see <a href=\"http://bit.ly/MJqzXb\">Hold View Objects in a View Holder</a>\n     * @param position la posición de la nota en curso.\n     * @param convertView el componente visual a usar.\n     * @param parent el componente visual padre del componente visual a usar.\n     * @return la vista con los datos.\n     */\n    @Override\n    public View getView(int position, View convertView, ViewGroup parent) {\n        ViewHolder holder;\n        if (convertView == null) { // inflar componente visual\n            convertView = LayoutInflater.from(parent.getContext()).inflate(R.layout.notes_row, parent, false);\n            holder = new ViewHolder(convertView);\n            convertView.setTag(holder);\n        } else holder = (ViewHolder) convertView.getTag(); // ya existe, solo es reciclarlo\n        // Inicializa la vista con los datos de la nota\n        NoteViewWrapper noteViewWrapper = data.get(position);\n        holder.noteIdText.setText(String.valueOf(noteViewWrapper.note.getId()));\n        holder.noteTitleText.setText(noteViewWrapper.note.getTitle());\n        // Corta la cadena a 80 caracteres y le agrega \"...\"\n        holder.noteContentText.setText(noteViewWrapper.note.getContent().length() >= 80 ? noteViewWrapper.note.getContent().substring(0, 80).concat(\"...\") : noteViewWrapper.note.getContent());\n        holder.noteDateText.setText(DATETIME_FORMAT.format(noteViewWrapper.note.getUpdatedAt()));\n        // Cambia el color del fondo si es seleccionado\n        if (noteViewWrapper.isSelected) holder.parent.setBackgroundColor(parent.getContext().getResources().getColor(R.color.selected_note));\n        // Sino lo regresa a transparente\n        else holder.parent.setBackgroundColor(parent.getContext().getResources().getColor(android.R.color.transparent));\n        return convertView;\n    }\n\n    /** Almacena componentes visuales para acceso rápido sin necesidad de buscarlos muy seguido.*/\n    private static class ViewHolder {\n\n        private TextView noteIdText;\n        private TextView noteTitleText;\n        private TextView noteContentText;\n        private TextView noteDateText;\n\n        private View parent;\n\n        /**\n         * Constructor. Encuentra todas los componentes visuales en el componente padre dado.\n         *\n         * @param parent un componente visual.\n         */\n        private ViewHolder(View parent) {\n            this.parent = parent;\n            noteIdText = (TextView) parent.findViewById(R.id.note_id);\n            noteTitleText = (TextView) parent.findViewById(R.id.note_title);\n            noteContentText = (TextView) parent.findViewById(R.id.note_content);\n            noteDateText = (TextView) parent.findViewById(R.id.note_date);\n        }\n    }\n}"
  },
  {
    "path": "app/src/main/res/layout/activity_edit_note.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<LinearLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"match_parent\"\n    android:orientation=\"vertical\">\n\n    <EditText\n        android:id=\"@+id/note_title\"\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"wrap_content\"\n        android:hint=\"@string/hint_note_title\"\n        android:singleLine=\"true\"\n        android:maxLength=\"50\">\n\n        <requestFocus />\n    </EditText>\n\n    <EditText\n        android:id=\"@+id/note_content\"\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"match_parent\"\n        android:gravity=\"start\"\n        android:inputType=\"textMultiLine\"\n        android:hint=\"@string/hint_note_content\" />\n\n</LinearLayout>"
  },
  {
    "path": "app/src/main/res/layout/activity_main.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<RelativeLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"match_parent\">\n\n    <ListView\n        android:id=\"@id/android:list\"\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"wrap_content\"\n        android:divider=\"@android:color/transparent\" />\n\n    <TextView\n        android:id=\"@id/android:empty\"\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"wrap_content\"\n        android:layout_centerVertical=\"true\"\n        android:gravity=\"center\"\n        android:text=\"@string/no_notes\"\n        android:textAppearance=\"?android:attr/textAppearanceLarge\" />\n\n    <com.shamanland.fab.FloatingActionButton\n        android:id=\"@+id/add_note_button\"\n        android:layout_width=\"wrap_content\"\n        android:layout_height=\"wrap_content\"\n        android:layout_margin=\"16dp\"\n        android:layout_alignParentBottom=\"true\"\n        android:layout_alignParentRight=\"true\"\n        android:src=\"@drawable/ic_add\" />\n\n</RelativeLayout>"
  },
  {
    "path": "app/src/main/res/layout/activity_view_note.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<RelativeLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"match_parent\">\n\n    <ScrollView\n        android:id=\"@+id/scroll_view\"\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"match_parent\">\n\n        <RelativeLayout\n            android:layout_width=\"match_parent\"\n            android:layout_height=\"wrap_content\"\n            android:orientation=\"vertical\">\n\n            <TextView\n                android:id=\"@+id/note_title\"\n                android:layout_width=\"wrap_content\"\n                android:layout_height=\"wrap_content\"\n                android:layout_alignParentLeft=\"true\"\n                android:layout_alignParentTop=\"true\"\n                android:layout_marginBottom=\"8dp\"\n                android:textAppearance=\"?android:attr/textAppearanceMedium\"\n                android:textColor=\"#ff000000\"\n                android:textStyle=\"bold\"\n                android:layout_margin=\"8dp\" />\n\n            <TextView\n                android:id=\"@+id/note_content\"\n                android:layout_width=\"wrap_content\"\n                android:layout_height=\"wrap_content\"\n                android:layout_below=\"@+id/note_title\"\n                android:layout_marginBottom=\"8dp\"\n                android:textColor=\"#ff000000\"\n                android:layout_margin=\"8dp\" />\n\n            <TableLayout\n                android:layout_width=\"wrap_content\"\n                android:layout_height=\"wrap_content\"\n                android:layout_alignParentLeft=\"true\"\n                android:layout_below=\"@+id/note_content\">\n\n                <TableRow\n                    android:layout_width=\"wrap_content\"\n                    android:layout_height=\"wrap_content\">\n\n                    <TextView\n                        android:layout_width=\"wrap_content\"\n                        android:layout_height=\"wrap_content\"\n                        android:textSize=\"12sp\"\n                        android:textStyle=\"italic\"\n                        android:textColor=\"#ff000000\"\n                        android:layout_marginLeft=\"8dp\"\n                        android:text=\"@string/label_created_at\" />\n\n                    <TextView\n                        android:id=\"@+id/note_created_at_date\"\n                        android:layout_width=\"wrap_content\"\n                        android:layout_height=\"wrap_content\"\n                        android:textSize=\"12sp\"\n                        android:layout_marginLeft=\"8dp\"\n                        android:textStyle=\"italic\"\n                        android:textColor=\"#ff000000\" />\n                </TableRow>\n\n                <TableRow\n                    android:layout_width=\"wrap_content\"\n                    android:layout_height=\"wrap_content\">\n\n                    <TextView\n                        android:layout_width=\"wrap_content\"\n                        android:layout_height=\"wrap_content\"\n                        android:textSize=\"12sp\"\n                        android:textStyle=\"italic\"\n                        android:textColor=\"#ff000000\"\n                        android:layout_marginLeft=\"8dp\"\n                        android:text=\"@string/label_updated_at\" />\n\n                    <TextView\n                        android:id=\"@+id/note_updated_at_date\"\n                        android:layout_width=\"wrap_content\"\n                        android:layout_height=\"wrap_content\"\n                        android:textSize=\"12sp\"\n                        android:layout_marginLeft=\"8dp\"\n                        android:textStyle=\"italic\"\n                        android:textColor=\"#ff000000\" />\n                </TableRow>\n\n            </TableLayout>\n\n        </RelativeLayout>\n    </ScrollView>\n\n    <com.shamanland.fab.FloatingActionButton\n        android:id=\"@+id/edit_note_button\"\n        android:layout_width=\"wrap_content\"\n        android:layout_height=\"wrap_content\"\n        android:layout_margin=\"16dp\"\n        android:layout_alignParentBottom=\"true\"\n        android:layout_alignParentRight=\"true\"\n        android:src=\"@drawable/ic_edit\" />\n</RelativeLayout>"
  },
  {
    "path": "app/src/main/res/layout/dialog_about_notice.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<LinearLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    android:orientation=\"horizontal\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"wrap_content\">\n\n    <ImageView\n        android:layout_width=\"wrap_content\"\n        android:layout_height=\"wrap_content\"\n        android:id=\"@+id/logo\"\n        android:src=\"@drawable/ic_launcher\"\n        android:layout_gravity=\"center\"\n        android:layout_margin=\"8dp\" />\n\n    <RelativeLayout\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"wrap_content\"\n        android:layout_marginRight=\"8dp\"\n        android:layout_marginBottom=\"8dp\">\n\n        <TextView\n            android:layout_width=\"wrap_content\"\n            android:layout_height=\"wrap_content\"\n            android:textAppearance=\"?android:attr/textAppearanceLarge\"\n            android:text=\"@string/app_name\"\n            android:id=\"@+id/app_name\"\n            android:layout_alignParentTop=\"true\"\n            android:layout_alignParentLeft=\"true\"\n            android:layout_marginLeft=\"8dp\"\n            android:layout_marginTop=\"8dp\" />\n\n        <TextView\n            android:layout_width=\"wrap_content\"\n            android:layout_height=\"wrap_content\"\n            android:textAppearance=\"?android:attr/textAppearanceMedium\"\n            android:id=\"@+id/version_text\"\n            android:layout_below=\"@+id/app_name\"\n            android:layout_marginLeft=\"8dp\" />\n\n        <TextView\n            android:layout_width=\"wrap_content\"\n            android:layout_height=\"wrap_content\"\n            android:textAppearance=\"?android:attr/textAppearanceSmall\"\n            android:text=\"@string/copyright_info\"\n            android:id=\"@+id/copyright\"\n            android:layout_below=\"@+id/version_text\"\n            android:layout_marginLeft=\"8dp\"\n            android:layout_marginTop=\"20dp\" />\n    </RelativeLayout>\n</LinearLayout>"
  },
  {
    "path": "app/src/main/res/layout/notes_row.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<RelativeLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    xmlns:card_view=\"http://schemas.android.com/apk/res-auto\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"wrap_content\">\n\n    <android.support.v7.widget.CardView\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"wrap_content\"\n        card_view:cardCornerRadius=\"4dp\"\n        card_view:cardElevation=\"4dp\"\n        card_view:contentPadding=\"10dp\"\n        card_view:cardUseCompatPadding=\"true\">\n\n        <RelativeLayout\n            android:layout_width=\"match_parent\"\n            android:layout_height=\"wrap_content\">\n\n            <TextView\n                android:id=\"@+id/note_id\"\n                android:layout_width=\"wrap_content\"\n                android:layout_height=\"wrap_content\"\n                android:visibility=\"gone\" />\n\n            <TextView\n                android:id=\"@+id/note_title\"\n                android:layout_width=\"wrap_content\"\n                android:layout_height=\"wrap_content\"\n                android:layout_alignParentLeft=\"true\"\n                android:layout_alignParentTop=\"true\"\n                android:layout_marginBottom=\"8dp\"\n                android:textAppearance=\"?android:attr/textAppearanceMedium\"\n                android:textColor=\"#ff000000\"\n                android:textStyle=\"bold\" />\n\n            <TextView\n                android:id=\"@+id/note_content\"\n                android:layout_width=\"wrap_content\"\n                android:layout_height=\"wrap_content\"\n                android:layout_below=\"@+id/note_title\"\n                android:layout_marginBottom=\"8dp\"\n                android:textColor=\"#ff000000\" />\n\n            <TextView\n                android:id=\"@+id/note_date\"\n                android:layout_width=\"wrap_content\"\n                android:layout_height=\"wrap_content\"\n                android:layout_alignParentBottom=\"true\"\n                android:layout_alignParentRight=\"true\"\n                android:layout_below=\"@+id/note_content\"\n                android:textSize=\"12sp\"\n                android:textStyle=\"italic\"\n                android:textColor=\"#ff000000\" />\n\n        </RelativeLayout>\n    </android.support.v7.widget.CardView>\n\n</RelativeLayout>"
  },
  {
    "path": "app/src/main/res/layout-v15/notes_row.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<RelativeLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    xmlns:card_view=\"http://schemas.android.com/apk/res-auto\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"wrap_content\">\n\n    <android.support.v7.widget.CardView\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"wrap_content\"\n        card_view:cardCornerRadius=\"4dp\"\n        card_view:cardElevation=\"4dp\"\n        card_view:cardUseCompatPadding=\"true\">\n\n        <RelativeLayout\n            android:layout_width=\"match_parent\"\n            android:layout_height=\"wrap_content\"\n            android:layout_margin=\"10dp\">\n\n            <TextView\n                android:id=\"@+id/note_id\"\n                android:layout_width=\"wrap_content\"\n                android:layout_height=\"wrap_content\"\n                android:visibility=\"gone\" />\n\n            <TextView\n                android:id=\"@+id/note_title\"\n                android:layout_width=\"wrap_content\"\n                android:layout_height=\"wrap_content\"\n                android:layout_alignParentLeft=\"true\"\n                android:layout_alignParentTop=\"true\"\n                android:layout_marginBottom=\"8dp\"\n                android:textAppearance=\"?android:attr/textAppearanceMedium\"\n                android:textColor=\"#ff000000\"\n                android:textStyle=\"bold\" />\n\n            <TextView\n                android:id=\"@+id/note_content\"\n                android:layout_width=\"wrap_content\"\n                android:layout_height=\"wrap_content\"\n                android:layout_below=\"@+id/note_title\"\n                android:layout_marginBottom=\"8dp\"\n                android:textColor=\"#ff000000\" />\n\n            <TextView\n                android:id=\"@+id/note_date\"\n                android:layout_width=\"wrap_content\"\n                android:layout_height=\"wrap_content\"\n                android:layout_alignParentBottom=\"true\"\n                android:layout_alignParentRight=\"true\"\n                android:layout_below=\"@+id/note_content\"\n                android:textSize=\"12sp\"\n                android:textStyle=\"italic\"\n                android:textColor=\"#ff000000\" />\n\n        </RelativeLayout>\n    </android.support.v7.widget.CardView>\n\n</RelativeLayout>"
  },
  {
    "path": "app/src/main/res/menu/context_note.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<menu xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    xmlns:NotepadApp=\"http://schemas.android.com/apk/res-auto\" >\n\n    <item\n        android:id=\"@+id/action_delete\"\n        NotepadApp:showAsAction=\"ifRoom\"\n        android:icon=\"@drawable/ic_action_delete\"\n        android:title=\"@string/action_delete\"/>\n\n</menu>"
  },
  {
    "path": "app/src/main/res/menu/edit_note.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<menu xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    xmlns:NotepadApp=\"http://schemas.android.com/apk/res-auto\" >\n\n    <item\n        android:id=\"@+id/action_save\"\n        NotepadApp:showAsAction=\"ifRoom\"\n        android:icon=\"@drawable/ic_action_save\"\n        android:title=\"@string/action_save\"/>\n\n</menu>"
  },
  {
    "path": "app/src/main/res/menu/main.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<menu xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    xmlns:NotepadApp=\"http://schemas.android.com/apk/res-auto\">\n\n    <item\n        android:id=\"@+id/action_about_info\"\n        NotepadApp:showAsAction=\"never\"\n        android:title=\"@string/action_about_notice\" />\n    <item\n        android:id=\"@+id/action_licenses_info\"\n        NotepadApp:showAsAction=\"never\"\n        android:title=\"@string/action_licenses_notice\" />\n\n</menu>"
  },
  {
    "path": "app/src/main/res/values/colors.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<resources>\n    <color name=\"selected_note\">#99d6eb</color>\n</resources>"
  },
  {
    "path": "app/src/main/res/values/strings.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<resources>\n\n    <string name=\"app_name\">MaterialNotes</string>\n\n    <!-- MainActivity strings -->\n    <string name=\"title_activity_notes_list\">Notes</string>\n    <string name=\"no_notes\">No notes yet</string>\n    <string name=\"action_delete\">Delete</string>\n    <string name=\"action_about_notice\">About</string>\n    <string name=\"action_licenses_notice\">Open source licenses</string>\n    <string name=\"delete_notes_alert\">Delete %s note(s)?</string>\n\n    <!-- Licenses dialog -->\n    <string name=\"dialog_licenses_notice_title\">Open source licenses</string>\n\n    <!-- About dialog -->\n    <string name=\"version_format\">Version %s</string>\n    <string name=\"copyright_info\">&#169; Daniel Pedraza-Arcega</string>\n\n    <!-- EditNoteActivity strings -->\n    <string name=\"title_activity_edit_note\">Edit note</string>\n    <string name=\"action_save\">Save</string>\n    <string name=\"hint_note_title\">Title</string>\n    <string name=\"hint_note_content\">Content</string>\n    <string name=\"title_required\">The note must have a title</string>\n    <string name=\"content_required\">The note must have content</string>\n\n    <!-- ViewNoteActivity strings -->\n    <string name=\"title_activity_view_note\">Note</string>\n    <string name=\"action_edit_note\">Edit note</string>\n    <string name=\"label_created_at\">Created at:</string>\n    <string name=\"label_updated_at\">Updated at:</string>\n\n</resources>"
  },
  {
    "path": "app/src/main/res/values/styles.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<resources>\n\n    <style name=\"Theme.NotepadApp\" parent=\"Theme.AppCompat.Light.DarkActionBar\">\n        <item name=\"colorPrimary\">#08617c</item>\n        <item name=\"colorPrimaryDark\">#053e50</item>\n        <item name=\"colorAccent\">#a9deff</item>\n        <item name=\"actionModeBackground\">@drawable/cab_background_top</item>\n        <item name=\"floatingActionButtonStyle\">@style/NotepadApp.Fab</item>\n    </style>\n\n    <style name=\"NotepadApp.Fab\" parent=\"FloatingActionButton\">\n        <item name=\"floatingActionButtonColor\">#e91e63</item>\n    </style>\n\n</resources>"
  },
  {
    "path": "build.gradle",
    "content": "// Top-level build file where you can add configuration options common to all sub-projects/modules.\n\nbuildscript {\n    repositories {\n        jcenter()\n    }\n    dependencies {\n        classpath 'com.android.tools.build:gradle:1.0.0'\n\n        // NOTE: Do not place your application dependencies here; they belong\n        // in the individual module build.gradle files\n    }\n}\n\nallprojects {\n    repositories {\n        jcenter()\n    }\n}\n"
  },
  {
    "path": "gradle/wrapper/gradle-wrapper.properties",
    "content": "#Wed Apr 10 15:27:10 PDT 2013\ndistributionBase=GRADLE_USER_HOME\ndistributionPath=wrapper/dists\nzipStoreBase=GRADLE_USER_HOME\nzipStorePath=wrapper/dists\ndistributionUrl=https\\://services.gradle.org/distributions/gradle-2.2.1-all.zip\n"
  },
  {
    "path": "gradle.properties",
    "content": "# Project-wide Gradle settings.\n\n# IDE (e.g. Android Studio) users:\n# Gradle settings configured through the IDE *will override*\n# any settings specified in this file.\n\n# For more details on how to configure your build environment visit\n# http://www.gradle.org/docs/current/userguide/build_environment.html\n\n# Specifies the JVM arguments used for the daemon process.\n# The setting is particularly useful for tweaking memory settings.\n# Default value: -Xmx10248m -XX:MaxPermSize=256m\n# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8\n\n# When configured, Gradle will run in incubating parallel mode.\n# This option should only be used with decoupled projects. More details, visit\n# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects\n# org.gradle.parallel=true"
  },
  {
    "path": "gradlew",
    "content": "#!/usr/bin/env bash\n\n##############################################################################\n##\n##  Gradle start up script for UN*X\n##\n##############################################################################\n\n# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.\nDEFAULT_JVM_OPTS=\"\"\n\nAPP_NAME=\"Gradle\"\nAPP_BASE_NAME=`basename \"$0\"`\n\n# Use the maximum available, or set MAX_FD != -1 to use that value.\nMAX_FD=\"maximum\"\n\nwarn ( ) {\n    echo \"$*\"\n}\n\ndie ( ) {\n    echo\n    echo \"$*\"\n    echo\n    exit 1\n}\n\n# OS specific support (must be 'true' or 'false').\ncygwin=false\nmsys=false\ndarwin=false\ncase \"`uname`\" in\n  CYGWIN* )\n    cygwin=true\n    ;;\n  Darwin* )\n    darwin=true\n    ;;\n  MINGW* )\n    msys=true\n    ;;\nesac\n\n# For Cygwin, ensure paths are in UNIX format before anything is touched.\nif $cygwin ; then\n    [ -n \"$JAVA_HOME\" ] && JAVA_HOME=`cygpath --unix \"$JAVA_HOME\"`\nfi\n\n# Attempt to set APP_HOME\n# Resolve links: $0 may be a link\nPRG=\"$0\"\n# Need this for relative symlinks.\nwhile [ -h \"$PRG\" ] ; do\n    ls=`ls -ld \"$PRG\"`\n    link=`expr \"$ls\" : '.*-> \\(.*\\)$'`\n    if expr \"$link\" : '/.*' > /dev/null; then\n        PRG=\"$link\"\n    else\n        PRG=`dirname \"$PRG\"`\"/$link\"\n    fi\ndone\nSAVED=\"`pwd`\"\ncd \"`dirname \\\"$PRG\\\"`/\" >&-\nAPP_HOME=\"`pwd -P`\"\ncd \"$SAVED\" >&-\n\nCLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar\n\n# Determine the Java command to use to start the JVM.\nif [ -n \"$JAVA_HOME\" ] ; then\n    if [ -x \"$JAVA_HOME/jre/sh/java\" ] ; then\n        # IBM's JDK on AIX uses strange locations for the executables\n        JAVACMD=\"$JAVA_HOME/jre/sh/java\"\n    else\n        JAVACMD=\"$JAVA_HOME/bin/java\"\n    fi\n    if [ ! -x \"$JAVACMD\" ] ; then\n        die \"ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME\n\nPlease set the JAVA_HOME variable in your environment to match the\nlocation of your Java installation.\"\n    fi\nelse\n    JAVACMD=\"java\"\n    which java >/dev/null 2>&1 || die \"ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.\n\nPlease set the JAVA_HOME variable in your environment to match the\nlocation of your Java installation.\"\nfi\n\n# Increase the maximum file descriptors if we can.\nif [ \"$cygwin\" = \"false\" -a \"$darwin\" = \"false\" ] ; then\n    MAX_FD_LIMIT=`ulimit -H -n`\n    if [ $? -eq 0 ] ; then\n        if [ \"$MAX_FD\" = \"maximum\" -o \"$MAX_FD\" = \"max\" ] ; then\n            MAX_FD=\"$MAX_FD_LIMIT\"\n        fi\n        ulimit -n $MAX_FD\n        if [ $? -ne 0 ] ; then\n            warn \"Could not set maximum file descriptor limit: $MAX_FD\"\n        fi\n    else\n        warn \"Could not query maximum file descriptor limit: $MAX_FD_LIMIT\"\n    fi\nfi\n\n# For Darwin, add options to specify how the application appears in the dock\nif $darwin; then\n    GRADLE_OPTS=\"$GRADLE_OPTS \\\"-Xdock:name=$APP_NAME\\\" \\\"-Xdock:icon=$APP_HOME/media/gradle.icns\\\"\"\nfi\n\n# For Cygwin, switch paths to Windows format before running java\nif $cygwin ; then\n    APP_HOME=`cygpath --path --mixed \"$APP_HOME\"`\n    CLASSPATH=`cygpath --path --mixed \"$CLASSPATH\"`\n\n    # We build the pattern for arguments to be converted via cygpath\n    ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`\n    SEP=\"\"\n    for dir in $ROOTDIRSRAW ; do\n        ROOTDIRS=\"$ROOTDIRS$SEP$dir\"\n        SEP=\"|\"\n    done\n    OURCYGPATTERN=\"(^($ROOTDIRS))\"\n    # Add a user-defined pattern to the cygpath arguments\n    if [ \"$GRADLE_CYGPATTERN\" != \"\" ] ; then\n        OURCYGPATTERN=\"$OURCYGPATTERN|($GRADLE_CYGPATTERN)\"\n    fi\n    # Now convert the arguments - kludge to limit ourselves to /bin/sh\n    i=0\n    for arg in \"$@\" ; do\n        CHECK=`echo \"$arg\"|egrep -c \"$OURCYGPATTERN\" -`\n        CHECK2=`echo \"$arg\"|egrep -c \"^-\"`                                 ### Determine if an option\n\n        if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then                    ### Added a condition\n            eval `echo args$i`=`cygpath --path --ignore --mixed \"$arg\"`\n        else\n            eval `echo args$i`=\"\\\"$arg\\\"\"\n        fi\n        i=$((i+1))\n    done\n    case $i in\n        (0) set -- ;;\n        (1) set -- \"$args0\" ;;\n        (2) set -- \"$args0\" \"$args1\" ;;\n        (3) set -- \"$args0\" \"$args1\" \"$args2\" ;;\n        (4) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" ;;\n        (5) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" \"$args4\" ;;\n        (6) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" \"$args4\" \"$args5\" ;;\n        (7) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" \"$args4\" \"$args5\" \"$args6\" ;;\n        (8) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" \"$args4\" \"$args5\" \"$args6\" \"$args7\" ;;\n        (9) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" \"$args4\" \"$args5\" \"$args6\" \"$args7\" \"$args8\" ;;\n    esac\nfi\n\n# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules\nfunction splitJvmOpts() {\n    JVM_OPTS=(\"$@\")\n}\neval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS\nJVM_OPTS[${#JVM_OPTS[*]}]=\"-Dorg.gradle.appname=$APP_BASE_NAME\"\n\nexec \"$JAVACMD\" \"${JVM_OPTS[@]}\" -classpath \"$CLASSPATH\" org.gradle.wrapper.GradleWrapperMain \"$@\"\n"
  },
  {
    "path": "gradlew.bat",
    "content": "@if \"%DEBUG%\" == \"\" @echo off\r\n@rem ##########################################################################\r\n@rem\r\n@rem  Gradle startup script for Windows\r\n@rem\r\n@rem ##########################################################################\r\n\r\n@rem Set local scope for the variables with windows NT shell\r\nif \"%OS%\"==\"Windows_NT\" setlocal\r\n\r\n@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.\r\nset DEFAULT_JVM_OPTS=\r\n\r\nset DIRNAME=%~dp0\r\nif \"%DIRNAME%\" == \"\" set DIRNAME=.\r\nset APP_BASE_NAME=%~n0\r\nset APP_HOME=%DIRNAME%\r\n\r\n@rem Find java.exe\r\nif defined JAVA_HOME goto findJavaFromJavaHome\r\n\r\nset JAVA_EXE=java.exe\r\n%JAVA_EXE% -version >NUL 2>&1\r\nif \"%ERRORLEVEL%\" == \"0\" goto init\r\n\r\necho.\r\necho ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.\r\necho.\r\necho Please set the JAVA_HOME variable in your environment to match the\r\necho location of your Java installation.\r\n\r\ngoto fail\r\n\r\n:findJavaFromJavaHome\r\nset JAVA_HOME=%JAVA_HOME:\"=%\r\nset JAVA_EXE=%JAVA_HOME%/bin/java.exe\r\n\r\nif exist \"%JAVA_EXE%\" goto init\r\n\r\necho.\r\necho ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%\r\necho.\r\necho Please set the JAVA_HOME variable in your environment to match the\r\necho location of your Java installation.\r\n\r\ngoto fail\r\n\r\n:init\r\n@rem Get command-line arguments, handling Windowz variants\r\n\r\nif not \"%OS%\" == \"Windows_NT\" goto win9xME_args\r\nif \"%@eval[2+2]\" == \"4\" goto 4NT_args\r\n\r\n:win9xME_args\r\n@rem Slurp the command line arguments.\r\nset CMD_LINE_ARGS=\r\nset _SKIP=2\r\n\r\n:win9xME_args_slurp\r\nif \"x%~1\" == \"x\" goto execute\r\n\r\nset CMD_LINE_ARGS=%*\r\ngoto execute\r\n\r\n:4NT_args\r\n@rem Get arguments from the 4NT Shell from JP Software\r\nset CMD_LINE_ARGS=%$\r\n\r\n:execute\r\n@rem Setup the command line\r\n\r\nset CLASSPATH=%APP_HOME%\\gradle\\wrapper\\gradle-wrapper.jar\r\n\r\n@rem Execute Gradle\r\n\"%JAVA_EXE%\" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% \"-Dorg.gradle.appname=%APP_BASE_NAME%\" -classpath \"%CLASSPATH%\" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%\r\n\r\n:end\r\n@rem End local scope for the variables with windows NT shell\r\nif \"%ERRORLEVEL%\"==\"0\" goto mainEnd\r\n\r\n:fail\r\nrem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of\r\nrem the _cmd.exe /c_ return code!\r\nif  not \"\" == \"%GRADLE_EXIT_CONSOLE%\" exit 1\r\nexit /b 1\r\n\r\n:mainEnd\r\nif \"%OS%\"==\"Windows_NT\" endlocal\r\n\r\n:omega\r\n"
  },
  {
    "path": "settings.gradle",
    "content": "include ':app'\n"
  }
]