├── app ├── .gitignore ├── src │ ├── main │ │ ├── res │ │ │ ├── mipmap-hdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-mdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xhdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxhdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxxhdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── drawable-hdpi │ │ │ │ ├── ic_cancel_white_36dp.png │ │ │ │ ├── ic_face_white_18dp.png │ │ │ │ ├── ic_favorite_white_18dp.png │ │ │ │ ├── ic_date_range_white_18dp.png │ │ │ │ ├── ic_extension_white_18dp.png │ │ │ │ ├── ic_bubble_chart_white_18dp.png │ │ │ │ ├── ic_check_circle_white_48dp.png │ │ │ │ └── ic_mode_comment_white_18dp.png │ │ │ ├── drawable-mdpi │ │ │ │ ├── ic_cancel_white_36dp.png │ │ │ │ ├── ic_face_white_18dp.png │ │ │ │ ├── ic_favorite_white_18dp.png │ │ │ │ ├── ic_date_range_white_18dp.png │ │ │ │ ├── ic_extension_white_18dp.png │ │ │ │ ├── ic_bubble_chart_white_18dp.png │ │ │ │ ├── ic_check_circle_white_48dp.png │ │ │ │ └── ic_mode_comment_white_18dp.png │ │ │ ├── drawable-xhdpi │ │ │ │ ├── ic_face_white_18dp.png │ │ │ │ ├── ic_cancel_white_36dp.png │ │ │ │ ├── ic_date_range_white_18dp.png │ │ │ │ ├── ic_extension_white_18dp.png │ │ │ │ ├── ic_favorite_white_18dp.png │ │ │ │ ├── ic_bubble_chart_white_18dp.png │ │ │ │ ├── ic_check_circle_white_48dp.png │ │ │ │ └── ic_mode_comment_white_18dp.png │ │ │ ├── drawable-xxhdpi │ │ │ │ ├── ic_face_white_18dp.png │ │ │ │ ├── ic_cancel_white_36dp.png │ │ │ │ ├── ic_extension_white_18dp.png │ │ │ │ ├── ic_favorite_white_18dp.png │ │ │ │ ├── ic_date_range_white_18dp.png │ │ │ │ ├── ic_bubble_chart_white_18dp.png │ │ │ │ ├── ic_check_circle_white_48dp.png │ │ │ │ └── ic_mode_comment_white_18dp.png │ │ │ ├── drawable-xxxhdpi │ │ │ │ ├── ic_face_white_18dp.png │ │ │ │ ├── ic_cancel_white_36dp.png │ │ │ │ ├── ic_favorite_white_18dp.png │ │ │ │ ├── ic_date_range_white_18dp.png │ │ │ │ ├── ic_extension_white_18dp.png │ │ │ │ ├── ic_bubble_chart_white_18dp.png │ │ │ │ ├── ic_check_circle_white_48dp.png │ │ │ │ └── ic_mode_comment_white_18dp.png │ │ │ ├── values │ │ │ │ ├── integers.xml │ │ │ │ ├── body.xml │ │ │ │ ├── colors.xml │ │ │ │ ├── soul.xml │ │ │ │ ├── mind.xml │ │ │ │ ├── dimens.xml │ │ │ │ ├── strings.xml │ │ │ │ └── styles.xml │ │ │ ├── drawable │ │ │ │ ├── circle.xml │ │ │ │ ├── circle_days.xml │ │ │ │ ├── circle_delete.xml │ │ │ │ ├── ic_equalizer_white_48px.xml │ │ │ │ ├── ic_lens_black_48px.xml │ │ │ │ ├── toggle_selector.xml │ │ │ │ ├── category.xml │ │ │ │ ├── toggle_state_off.xml │ │ │ │ ├── toggle_state_on.xml │ │ │ │ ├── ic_timelapse_black_48px.xml │ │ │ │ ├── ic_add_circle_white_48px.xml │ │ │ │ └── ic_grain_white_48px.xml │ │ │ ├── color │ │ │ │ ├── toggle_color_body.xml │ │ │ │ ├── toggle_color_mind.xml │ │ │ │ └── toggle_color_soul.xml │ │ │ ├── anim │ │ │ │ ├── slide_from_left.xml │ │ │ │ ├── slide_from_right.xml │ │ │ │ ├── slide_to_left.xml │ │ │ │ └── slide_to_right.xml │ │ │ └── layout │ │ │ │ ├── empty_archive.xml │ │ │ │ ├── activity_care.xml │ │ │ │ ├── today.xml │ │ │ │ ├── list_item.xml │ │ │ │ ├── fake_archive.xml │ │ │ │ ├── fake_day.xml │ │ │ │ ├── archive.xml │ │ │ │ ├── add_panel.xml │ │ │ │ ├── body.xml │ │ │ │ ├── soul.xml │ │ │ │ └── mind.xml │ │ ├── java │ │ │ └── pm │ │ │ │ └── anna │ │ │ │ └── takecare │ │ │ │ ├── DepthPageTransformer.java │ │ │ │ ├── EqualWidthHeightTextView.java │ │ │ │ ├── BaseActivity.java │ │ │ │ ├── WizardPagerAdapter.java │ │ │ │ ├── data │ │ │ │ ├── ArchiveDbHelper.java │ │ │ │ ├── ArchiveContract.java │ │ │ │ └── ArchiveProvider.java │ │ │ │ ├── ExpandAnimation.java │ │ │ │ ├── EditTextDatePicker.java │ │ │ │ ├── ArchiveCursorAdapter.java │ │ │ │ └── CareActivity.java │ │ └── AndroidManifest.xml │ ├── test │ │ └── java │ │ │ └── pm │ │ │ └── anna │ │ │ └── takecare │ │ │ └── ExampleUnitTest.java │ └── androidTest │ │ └── java │ │ └── pm │ │ └── anna │ │ └── takecare │ │ └── ExampleInstrumentedTest.java ├── proguard-rules.pro └── build.gradle ├── settings.gradle ├── screenshots ├── archive.png ├── new_layout.png ├── screenshot1.png ├── screenshot2.png ├── screens-final.png ├── screens-mobile.png └── random_messages_delete.png ├── .idea ├── copyright │ └── profiles_settings.xml ├── vcs.xml ├── modules.xml ├── runConfigurations.xml ├── compiler.xml ├── gradle.xml └── misc.xml ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── .gitignore ├── README.md ├── gradle.properties ├── gradlew.bat └── gradlew /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | -------------------------------------------------------------------------------- /screenshots/archive.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anna-wro/takecare/HEAD/screenshots/archive.png -------------------------------------------------------------------------------- /screenshots/new_layout.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anna-wro/takecare/HEAD/screenshots/new_layout.png -------------------------------------------------------------------------------- /screenshots/screenshot1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anna-wro/takecare/HEAD/screenshots/screenshot1.png -------------------------------------------------------------------------------- /screenshots/screenshot2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anna-wro/takecare/HEAD/screenshots/screenshot2.png -------------------------------------------------------------------------------- /screenshots/screens-final.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anna-wro/takecare/HEAD/screenshots/screens-final.png -------------------------------------------------------------------------------- /screenshots/screens-mobile.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anna-wro/takecare/HEAD/screenshots/screens-mobile.png -------------------------------------------------------------------------------- /.idea/copyright/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anna-wro/takecare/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /screenshots/random_messages_delete.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anna-wro/takecare/HEAD/screenshots/random_messages_delete.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anna-wro/takecare/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anna-wro/takecare/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anna-wro/takecare/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anna-wro/takecare/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anna-wro/takecare/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_cancel_white_36dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anna-wro/takecare/HEAD/app/src/main/res/drawable-hdpi/ic_cancel_white_36dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_face_white_18dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anna-wro/takecare/HEAD/app/src/main/res/drawable-hdpi/ic_face_white_18dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_cancel_white_36dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anna-wro/takecare/HEAD/app/src/main/res/drawable-mdpi/ic_cancel_white_36dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_face_white_18dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anna-wro/takecare/HEAD/app/src/main/res/drawable-mdpi/ic_face_white_18dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_face_white_18dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anna-wro/takecare/HEAD/app/src/main/res/drawable-xhdpi/ic_face_white_18dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_face_white_18dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anna-wro/takecare/HEAD/app/src/main/res/drawable-xxhdpi/ic_face_white_18dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_favorite_white_18dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anna-wro/takecare/HEAD/app/src/main/res/drawable-hdpi/ic_favorite_white_18dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_favorite_white_18dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anna-wro/takecare/HEAD/app/src/main/res/drawable-mdpi/ic_favorite_white_18dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_cancel_white_36dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anna-wro/takecare/HEAD/app/src/main/res/drawable-xhdpi/ic_cancel_white_36dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_cancel_white_36dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anna-wro/takecare/HEAD/app/src/main/res/drawable-xxhdpi/ic_cancel_white_36dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/ic_face_white_18dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anna-wro/takecare/HEAD/app/src/main/res/drawable-xxxhdpi/ic_face_white_18dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_date_range_white_18dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anna-wro/takecare/HEAD/app/src/main/res/drawable-hdpi/ic_date_range_white_18dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_extension_white_18dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anna-wro/takecare/HEAD/app/src/main/res/drawable-hdpi/ic_extension_white_18dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_date_range_white_18dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anna-wro/takecare/HEAD/app/src/main/res/drawable-mdpi/ic_date_range_white_18dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_extension_white_18dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anna-wro/takecare/HEAD/app/src/main/res/drawable-mdpi/ic_extension_white_18dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_date_range_white_18dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anna-wro/takecare/HEAD/app/src/main/res/drawable-xhdpi/ic_date_range_white_18dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_extension_white_18dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anna-wro/takecare/HEAD/app/src/main/res/drawable-xhdpi/ic_extension_white_18dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_favorite_white_18dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anna-wro/takecare/HEAD/app/src/main/res/drawable-xhdpi/ic_favorite_white_18dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_extension_white_18dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anna-wro/takecare/HEAD/app/src/main/res/drawable-xxhdpi/ic_extension_white_18dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_favorite_white_18dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anna-wro/takecare/HEAD/app/src/main/res/drawable-xxhdpi/ic_favorite_white_18dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/ic_cancel_white_36dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anna-wro/takecare/HEAD/app/src/main/res/drawable-xxxhdpi/ic_cancel_white_36dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/ic_favorite_white_18dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anna-wro/takecare/HEAD/app/src/main/res/drawable-xxxhdpi/ic_favorite_white_18dp.png -------------------------------------------------------------------------------- /app/src/main/res/values/integers.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 300 4 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_bubble_chart_white_18dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anna-wro/takecare/HEAD/app/src/main/res/drawable-hdpi/ic_bubble_chart_white_18dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_check_circle_white_48dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anna-wro/takecare/HEAD/app/src/main/res/drawable-hdpi/ic_check_circle_white_48dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_mode_comment_white_18dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anna-wro/takecare/HEAD/app/src/main/res/drawable-hdpi/ic_mode_comment_white_18dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_bubble_chart_white_18dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anna-wro/takecare/HEAD/app/src/main/res/drawable-mdpi/ic_bubble_chart_white_18dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_check_circle_white_48dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anna-wro/takecare/HEAD/app/src/main/res/drawable-mdpi/ic_check_circle_white_48dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_mode_comment_white_18dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anna-wro/takecare/HEAD/app/src/main/res/drawable-mdpi/ic_mode_comment_white_18dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_bubble_chart_white_18dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anna-wro/takecare/HEAD/app/src/main/res/drawable-xhdpi/ic_bubble_chart_white_18dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_check_circle_white_48dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anna-wro/takecare/HEAD/app/src/main/res/drawable-xhdpi/ic_check_circle_white_48dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_mode_comment_white_18dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anna-wro/takecare/HEAD/app/src/main/res/drawable-xhdpi/ic_mode_comment_white_18dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_date_range_white_18dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anna-wro/takecare/HEAD/app/src/main/res/drawable-xxhdpi/ic_date_range_white_18dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/ic_date_range_white_18dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anna-wro/takecare/HEAD/app/src/main/res/drawable-xxxhdpi/ic_date_range_white_18dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/ic_extension_white_18dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anna-wro/takecare/HEAD/app/src/main/res/drawable-xxxhdpi/ic_extension_white_18dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_bubble_chart_white_18dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anna-wro/takecare/HEAD/app/src/main/res/drawable-xxhdpi/ic_bubble_chart_white_18dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_check_circle_white_48dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anna-wro/takecare/HEAD/app/src/main/res/drawable-xxhdpi/ic_check_circle_white_48dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_mode_comment_white_18dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anna-wro/takecare/HEAD/app/src/main/res/drawable-xxhdpi/ic_mode_comment_white_18dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/ic_bubble_chart_white_18dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anna-wro/takecare/HEAD/app/src/main/res/drawable-xxxhdpi/ic_bubble_chart_white_18dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/ic_check_circle_white_48dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anna-wro/takecare/HEAD/app/src/main/res/drawable-xxxhdpi/ic_check_circle_white_48dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/ic_mode_comment_white_18dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anna-wro/takecare/HEAD/app/src/main/res/drawable-xxxhdpi/ic_mode_comment_white_18dp.png -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/workspace.xml 5 | /.idea/libraries 6 | .DS_Store 7 | /build 8 | /captures 9 | .externalNativeBuild 10 | /app/src/main/res/layout/activity_main.xml 11 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/circle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/circle_days.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/circle_delete.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Mon Dec 28 10:00:20 PST 2015 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip 7 | -------------------------------------------------------------------------------- /app/src/main/res/color/toggle_color_body.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/color/toggle_color_mind.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/color/toggle_color_soul.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_equalizer_white_48px.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/anim/slide_from_left.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/anim/slide_from_right.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/anim/slide_to_left.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/anim/slide_to_right.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_lens_black_48px.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/toggle_selector.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/category.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/toggle_state_off.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/toggle_state_on.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /app/src/test/java/pm/anna/takecare/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package pm.anna.takecare; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * @see Testing documentation 11 | */ 12 | public class ExampleUnitTest { 13 | @Test 14 | public void addition_isCorrect() throws Exception { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_timelapse_black_48px.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Take care xx 2 | 3 | An app helping you to take care of yourself. 4 | 5 | I created it as a part of [Google EU Scholarship - Android Development for Beginners](https://www.udacity.com/google-scholarships). It was my second project - a score keeper. 6 | 7 | During this time I documented all my progress on Udacity's forum. The forum will be closed after the scholarship's over, so ************I decided to publish my old posts [here](https://github.com/anna-wro/takecare/wiki) for future reference************. 8 | 9 | ![Screenshots](https://github.com/anna-wro/takecare/blob/master/screenshots/new_layout.png) 10 | -------------------------------------------------------------------------------- /.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /app/src/main/res/layout/empty_archive.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 11 | 12 | 18 | -------------------------------------------------------------------------------- /app/src/main/java/pm/anna/takecare/DepthPageTransformer.java: -------------------------------------------------------------------------------- 1 | package pm.anna.takecare; 2 | 3 | import android.support.v4.view.ViewPager; 4 | import android.view.View; 5 | 6 | public class DepthPageTransformer implements ViewPager.PageTransformer { 7 | 8 | public void transformPage(View view, float position) { 9 | int pageWidth = view.getWidth(); 10 | 11 | if (position <= 0) { // [-1,0] 12 | // Use the default slide transition when moving to the left page 13 | view.setTranslationX(0); 14 | 15 | } else if (position <= 1) { // (0,1] 16 | // Counteract the default slide transition 17 | view.setTranslationX(pageWidth * -position); 18 | 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_add_circle_white_48px.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 12 | 13 | -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in C:\Users\Anna\AppData\Local\Android\Sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_grain_white_48px.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 18 | 19 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | org.gradle.jvmargs=-Xmx1536m 13 | 14 | # When configured, Gradle will run in incubating parallel mode. 15 | # This option should only be used with decoupled projects. More details, visit 16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 17 | # org.gradle.parallel=true 18 | -------------------------------------------------------------------------------- /app/src/androidTest/java/pm/anna/takecare/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package pm.anna.takecare; 2 | 3 | import android.content.Context; 4 | import android.support.test.InstrumentationRegistry; 5 | import android.support.test.runner.AndroidJUnit4; 6 | 7 | import org.junit.Test; 8 | import org.junit.runner.RunWith; 9 | 10 | import static org.junit.Assert.*; 11 | 12 | /** 13 | * Instrumentation test, which will execute on an Android device. 14 | * 15 | * @see Testing documentation 16 | */ 17 | @RunWith(AndroidJUnit4.class) 18 | public class ExampleInstrumentedTest { 19 | @Test 20 | public void useAppContext() throws Exception { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getTargetContext(); 23 | 24 | assertEquals("pm.anna.takecare", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_care.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /app/src/main/res/values/body.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Adequate sleep\n◦◦ 4 | Adequate sleep\n●● 5 | Medicine taken\n◦◦ 6 | Medicine taken\n●● 7 | Healthy meals\n◦◦ 8 | Healthy meals\n●● 9 | Plenty of water\n◦ 10 | Plenty of water\n● 11 | Walk\n◦◦◦ 12 | Walk\n●●● 13 | Stretch\n◦◦ 14 | Stretch\n●● 15 | Time outside\n◦◦◦ 16 | Time outside\n●●● 17 | Beauty care\n◦◦ 18 | Beauty care\n●● 19 | 20 | -------------------------------------------------------------------------------- /app/src/main/java/pm/anna/takecare/EqualWidthHeightTextView.java: -------------------------------------------------------------------------------- 1 | package pm.anna.takecare; 2 | 3 | import android.content.Context; 4 | import android.util.AttributeSet; 5 | 6 | public class EqualWidthHeightTextView extends android.support.v7.widget.AppCompatTextView { 7 | 8 | public EqualWidthHeightTextView(Context context) { 9 | super(context); 10 | } 11 | 12 | public EqualWidthHeightTextView(Context context, AttributeSet attrs) { 13 | super(context, attrs); 14 | } 15 | 16 | public EqualWidthHeightTextView(Context context, AttributeSet attrs, int defStyleAttr) { 17 | super(context, attrs, defStyleAttr); 18 | } 19 | 20 | @Override 21 | protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { 22 | super.onMeasure(widthMeasureSpec, heightMeasureSpec); 23 | 24 | int h = this.getMeasuredHeight(); 25 | int w = this.getMeasuredWidth(); 26 | int r = Math.max(w,h); 27 | 28 | setMeasuredDimension(r, r); 29 | 30 | } 31 | } -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #FF8B6CC2 4 | #7750bc 5 | @android:color/black 6 | #fff 7 | #AAf5f5f5 8 | #1B000000 9 | #88000000 10 | #d1ceec 11 | #33f5f5f5 12 | #6fc3b3 13 | #56a697 14 | #6676CC 15 | #5866b0 16 | #FF8B6CC2 17 | #7750bc 18 | #aab4eb 19 | #f2f4ff 20 | #6676CC 21 | #cc666b 22 | #ffffff 23 | 24 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 25 5 | buildToolsVersion "25.0.2" 6 | defaultConfig { 7 | applicationId "pm.anna.takecare" 8 | minSdkVersion 15 9 | targetSdkVersion 25 10 | versionCode 1 11 | versionName "1.0" 12 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 13 | vectorDrawables.useSupportLibrary = true 14 | } 15 | buildTypes { 16 | release { 17 | minifyEnabled false 18 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 19 | } 20 | } 21 | } 22 | dependencies { 23 | compile fileTree(dir: 'libs', include: ['*.jar']) 24 | androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { 25 | exclude group: 'com.android.support', module: 'support-annotations' 26 | }) 27 | compile 'com.android.support:appcompat-v7:25.1.1' 28 | compile 'com.android.support:support-v4:25.1.1' 29 | compile 'com.android.support:support-vector-drawable:25.1.1' 30 | testCompile 'junit:junit:4.12' 31 | 32 | 33 | compile 'com.google.android.gms:play-services-appindexing:8.4.0' 34 | } 35 | 36 | -------------------------------------------------------------------------------- /app/src/main/java/pm/anna/takecare/BaseActivity.java: -------------------------------------------------------------------------------- 1 | package pm.anna.takecare; 2 | 3 | import android.content.Intent; 4 | import android.support.v7.app.AppCompatActivity; 5 | 6 | public class BaseActivity extends AppCompatActivity { 7 | 8 | 9 | 10 | @Override 11 | public void finish() { 12 | super.finish(); 13 | overridePendingTransitionExit(); 14 | } 15 | 16 | @Override 17 | public void startActivity(Intent intent) { 18 | super.startActivity(intent); 19 | overridePendingTransitionEnter(); 20 | } 21 | 22 | @Override 23 | public void onBackPressed() { 24 | super.onBackPressed(); 25 | overridePendingTransitionExit(); 26 | } 27 | /** 28 | * Overrides the pending Activity transition by performing the "Enter" Fade_animation. 29 | */ 30 | protected void overridePendingTransitionEnter() { 31 | overridePendingTransition(R.anim.slide_from_right, R.anim.slide_to_left); 32 | } 33 | 34 | /** 35 | * Overrides the pending Activity transition by performing the "Exit" Fade_animation. 36 | */ 37 | protected void overridePendingTransitionExit() { 38 | overridePendingTransition(R.anim.slide_from_left, R.anim.slide_to_right); 39 | } 40 | 41 | 42 | 43 | } 44 | -------------------------------------------------------------------------------- /app/src/main/res/values/soul.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Say «no»\n◦◦◦◦◦ 4 | Say «no»\n●●●●● 5 | Ask for help\n◦◦◦◦◦ 6 | Ask for help\n●●●●● 7 | Catch up \nwith friends\n◦◦◦ 8 | Catch up \nwith friends\n●●● 9 | Unplug\nfor an hour\n◦◦◦ 10 | Unplug\nfor an hour \n●●● 11 | Read a book\n◦ 12 | Read a book\n● 13 | Make\nsomeone smile\n◦◦ 14 | Make\nsomeone smile\n●● 15 | Baby animals \nvideos\n◦◦ 16 | Baby animals \nvideos\n●● 17 | Enjoyable\nactivities\n◦◦◦ 18 | Enjoyable\nactivities\n●●● 19 | Volunteering\n◦◦◦ 20 | Volunteering\n●●● 21 | Professional \nsupport\n◦◦◦ 22 | Professional \nsupport\n●●● 23 | -------------------------------------------------------------------------------- /app/src/main/res/values/mind.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | University\n◦◦◦ 4 | University\n●●● 5 | Making\nprogress\n◦◦◦ 6 | Making\nprogress\n●●● 7 | Design\n◦◦ 8 | Design\n●● 9 | Sign language\n◦◦◦ 10 | Sign language\n●●● 11 | Writing\n◦ 12 | Writing\n● 13 | Photography\n◦ 14 | Photography\n● 15 | Learning\nsomething new\n◦◦◦ 16 | Learning\nsomething new\n●●● 17 | Studying\n◦◦ 18 | Studying\n●● 19 | Front-end\ndevelopment\n◦◦ 20 | Front-end\ndevelopment\n●● 21 | Android\ndevelopment\n◦◦ 22 | Android\ndevelopment\n●● 23 | Music\n◦◦◦ 24 | Music\n●●● 25 | 26 | -------------------------------------------------------------------------------- /app/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 48dp 4 | 48dp 5 | 6 | 16dp 7 | 16dp 8 | 4dp 9 | 10 | 120dp 11 | 72dp 12 | 48dp 13 | 36dp 14 | 32dp 15 | 28dp 16 | 16dp 17 | 10dp 18 | 8dp 19 | 5dp 20 | 21 | 64sp 22 | 40sp 23 | 28sp 24 | 20sp 25 | 18sp 26 | 27 | 8dp 28 | 52dp 29 | 0dp 30 | 28dp 31 | 92dp 32 | -92dp 33 | 100dp 34 | 30dp 35 | 48dp 36 | 37 | 38 | -------------------------------------------------------------------------------- /app/src/main/res/layout/today.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | 10 | 14 | 15 | 20 | 21 | 26 | 27 | 29 | 30 | 32 | 33 | 38 | 39 | 44 | 45 | 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /app/src/main/res/layout/list_item.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 8 | 11 | 12 | 15 | 16 | 17 | 20 | 21 | 22 | 23 | 27 | 28 | 32 | 33 | 34 | 37 | 38 | 42 | 43 | 47 | 48 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /app/src/main/java/pm/anna/takecare/WizardPagerAdapter.java: -------------------------------------------------------------------------------- 1 | package pm.anna.takecare; 2 | 3 | import android.support.v4.view.PagerAdapter; 4 | import android.view.View; 5 | import android.view.ViewGroup; 6 | 7 | /** 8 | * Created by Anna on 13.02.2017. 9 | */ 10 | 11 | class WizardPagerAdapter extends PagerAdapter { 12 | 13 | public Object instantiateItem(ViewGroup collection, int position) { 14 | 15 | int resId = 0; 16 | 17 | switch (position) { 18 | case 0: 19 | resId = R.id.fake_archive; 20 | break; 21 | case 1: 22 | resId = R.id.activity_care; 23 | break; 24 | case 2: 25 | resId = R.id.layout_body; 26 | break; 27 | case 3: 28 | resId = R.id.layout_mind; 29 | break; 30 | case 4: 31 | resId = R.id.layout_soul; 32 | break; 33 | case 5: 34 | resId = R.id.archive; 35 | break; 36 | case 6: 37 | resId = R.id.fake_day; 38 | break; 39 | } 40 | 41 | return collection.findViewById(resId); 42 | 43 | } 44 | 45 | @Override 46 | public int getCount() { 47 | return 7; 48 | } 49 | 50 | @Override 51 | public boolean isViewFromObject(View arg0, Object arg1) { 52 | return arg0 == arg1; 53 | } 54 | 55 | @Override 56 | public void destroyItem(ViewGroup container, int position, Object object) { 57 | (container).removeView((View) object); 58 | } 59 | } -------------------------------------------------------------------------------- /app/src/main/res/layout/fake_archive.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | 10 | 13 | 14 | 18 | 19 | 23 | 24 | 25 | 30 | 31 | 35 | 36 | 39 | 40 | 43 | 44 | 47 | 48 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /app/src/main/java/pm/anna/takecare/data/ArchiveDbHelper.java: -------------------------------------------------------------------------------- 1 | package pm.anna.takecare.data; 2 | 3 | /** 4 | * Created by Anna on 18.02.2017. 5 | */ 6 | 7 | import android.content.Context; 8 | import android.database.sqlite.SQLiteDatabase; 9 | import android.database.sqlite.SQLiteOpenHelper; 10 | 11 | import pm.anna.takecare.data.ArchiveContract.ArchiveEntry; 12 | 13 | 14 | class ArchiveDbHelper extends SQLiteOpenHelper { 15 | 16 | public static final String LOG_TAG = ArchiveDbHelper.class.getSimpleName(); 17 | 18 | private static final String DATABASE_NAME = "archive.db"; 19 | private static final int DATABASE_VERSION = 2; 20 | 21 | ArchiveDbHelper(Context context) { 22 | super(context, DATABASE_NAME, null, DATABASE_VERSION); 23 | } 24 | 25 | @Override 26 | public void onCreate(SQLiteDatabase db) { 27 | String SQL_CREATE_ARCHIVE_TABLE = "CREATE TABLE " + ArchiveEntry.TABLE_NAME + " (" 28 | + ArchiveEntry._ID + " INTEGER PRIMARY KEY AUTOINCREMENT, " 29 | + ArchiveEntry.COLUMN_DATE + " TEXT NOT NULL, " 30 | + ArchiveEntry.COLUMN_POINTS_ALL + " INTEGER NOT NULL DEFAULT 0, " 31 | + ArchiveEntry.COLUMN_POINTS_BODY + " INTEGER DEFAULT 0, " 32 | + ArchiveEntry.COLUMN_POINTS_MIND + " INTEGER DEFAULT 0, " 33 | + ArchiveEntry.COLUMN_POINTS_SOUL + " INTEGER DEFAULT 0, " 34 | + ArchiveEntry.COLUMN_DESCRIPTION + " TEXT);"; 35 | 36 | db.execSQL(SQL_CREATE_ARCHIVE_TABLE); 37 | } 38 | 39 | @Override 40 | public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { 41 | 42 | } 43 | } -------------------------------------------------------------------------------- /app/src/main/java/pm/anna/takecare/data/ArchiveContract.java: -------------------------------------------------------------------------------- 1 | package pm.anna.takecare.data; 2 | 3 | import android.content.ContentResolver; 4 | import android.net.Uri; 5 | import android.provider.BaseColumns; 6 | 7 | /** 8 | * Created by Anna on 18.02.2017. 9 | */ 10 | 11 | public final class ArchiveContract { 12 | 13 | static final String CONTENT_AUTHORITY = "pm.anna.takecare"; 14 | private static final Uri BASE_CONTENT_URI = Uri.parse("content://" + CONTENT_AUTHORITY); 15 | static final String PATH_ARCHIVE = "archive"; 16 | 17 | private ArchiveContract() { 18 | } 19 | 20 | /* Inner class that defines the table contents */ 21 | public static class ArchiveEntry implements BaseColumns { 22 | public static final Uri CONTENT_URI = Uri.withAppendedPath(BASE_CONTENT_URI, PATH_ARCHIVE); 23 | static final String CONTENT_LIST_TYPE = 24 | ContentResolver.CURSOR_DIR_BASE_TYPE + "/" + CONTENT_AUTHORITY + "/" + PATH_ARCHIVE; 25 | static final String CONTENT_ITEM_TYPE = 26 | ContentResolver.CURSOR_ITEM_BASE_TYPE + "/" + CONTENT_AUTHORITY + "/" + PATH_ARCHIVE; 27 | 28 | static final String TABLE_NAME = "archive"; 29 | public static final String _ID = BaseColumns._ID; 30 | public static final String COLUMN_DATE = "date"; 31 | public static final String COLUMN_POINTS_ALL = "points"; 32 | public static final String COLUMN_POINTS_BODY = "body"; 33 | public static final String COLUMN_POINTS_MIND = "mind"; 34 | public static final String COLUMN_POINTS_SOUL = "soul"; 35 | public static final String COLUMN_DESCRIPTION = "description"; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fake_day.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 13 | 14 | 19 | 20 | 25 | 26 | 28 | 29 | 31 | 32 | 37 | 38 | 43 | 44 | 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /app/src/main/res/layout/archive.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | 10 | 13 | 14 | 18 | 19 | 23 | 24 | 25 | 26 | 27 | 32 | 33 | 37 | 38 | 41 | 42 | 46 | 47 | 51 | 52 | 55 | 56 | 57 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /app/src/main/java/pm/anna/takecare/ExpandAnimation.java: -------------------------------------------------------------------------------- 1 | package pm.anna.takecare; 2 | 3 | import android.view.View; 4 | import android.view.animation.Animation; 5 | import android.view.animation.Transformation; 6 | import android.widget.LinearLayout.LayoutParams; 7 | /** 8 | * Created by Anna on 24.02.2017. 9 | */ 10 | 11 | class ExpandAnimation extends Animation { 12 | private View mAnimatedView; 13 | private LayoutParams mViewLayoutParams; 14 | private int mMarginStart, mMarginEnd; 15 | private boolean mIsVisibleAfter = false; 16 | private boolean mWasEndedAlready = false; 17 | 18 | /** 19 | * Initialize the animation 20 | * @param view The layout we want to animate 21 | * @param duration The duration of the animation, in ms 22 | */ 23 | ExpandAnimation(View view, int duration) { 24 | 25 | setDuration(duration); 26 | mAnimatedView = view; 27 | mViewLayoutParams = (LayoutParams) view.getLayoutParams(); 28 | 29 | // decide to show or hide the view 30 | mIsVisibleAfter = (view.getVisibility() == View.VISIBLE); 31 | 32 | mMarginStart = mViewLayoutParams.bottomMargin; 33 | mMarginEnd = (mMarginStart == 0 ? (0- view.getHeight()) : 0); 34 | 35 | view.setVisibility(View.VISIBLE); 36 | } 37 | 38 | @Override 39 | protected void applyTransformation(float interpolatedTime, Transformation t) { 40 | super.applyTransformation(interpolatedTime, t); 41 | 42 | if (interpolatedTime < 1.0f) { 43 | 44 | // Calculating the new bottom margin, and setting it 45 | mViewLayoutParams.bottomMargin = mMarginStart 46 | + (int) ((mMarginEnd - mMarginStart) * interpolatedTime); 47 | 48 | // Invalidating the layout, making us seeing the changes we made 49 | mAnimatedView.requestLayout(); 50 | 51 | // Making sure we didn't run the ending before (it happens!) 52 | } else if (!mWasEndedAlready) { 53 | mViewLayoutParams.bottomMargin = mMarginEnd; 54 | mAnimatedView.requestLayout(); 55 | 56 | if (mIsVisibleAfter) { 57 | mAnimatedView.setVisibility(View.GONE); 58 | } 59 | mWasEndedAlready = true; 60 | } 61 | } 62 | } -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 19 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 46 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Take care xx 3 | Hi, Anna! 4 | Mind 5 | Body 6 | Soul 7 | Have you taken \ncare of yourself today? 8 | 0 9 | ◦ ◦ ◦ 10 | + 11 | Yup, that\'s how many days\nyou\'ve tracked. \nYou\'re awesome! 12 | Your archive is empty.\nToday\'s a great day to start! 13 | points 14 | Do you want to save this entry? 15 | You\'ve tracked another day! Yay! 16 | Oops! Something went wrong 17 | Delete last entry? 18 | \nYou\'ve already tracked\n your care today!\n\nDo you want to add\n new points or start over? 19 | These are your points today: 20 | Add 21 | Reset 22 | Any thoughts? 23 | Delete 24 | Cancel 25 | 26 | Yay! 27 | Well done! 28 | Congrats! 29 | Way to go! 30 | That\'s the way to do it! 31 | Marvelous! 32 | Keep up the good work! 33 | Good job! 34 | You\'re on the right track! 35 | Good work! 36 | Right on! 37 | Look at you go! 38 | Nice going! 39 | Great! 40 | I knew you could do it! 41 | Super! 42 | That\'s good! 43 | Keep it up! 44 | Nothing can stop you now! 45 | Nice going! 46 | You\'re doing beautifully! 47 | 48 | -------------------------------------------------------------------------------- /app/src/main/java/pm/anna/takecare/EditTextDatePicker.java: -------------------------------------------------------------------------------- 1 | package pm.anna.takecare; 2 | 3 | import android.app.Activity; 4 | import android.app.DatePickerDialog; 5 | import android.content.Context; 6 | import android.view.View; 7 | import android.widget.DatePicker; 8 | import android.widget.EditText; 9 | 10 | import java.text.ParseException; 11 | import java.text.SimpleDateFormat; 12 | import java.util.Calendar; 13 | import java.util.Date; 14 | import java.util.Locale; 15 | import java.util.TimeZone; 16 | 17 | class EditTextDatePicker implements View.OnClickListener, DatePickerDialog.OnDateSetListener { 18 | private EditText _editText; 19 | private int _day; 20 | private int _month; 21 | private int _year; 22 | private Context _context; 23 | private String _dayOfWeek; 24 | private String _monthWithZero; 25 | 26 | EditTextDatePicker(Context context, EditText editTextViewID) throws ParseException { 27 | Activity act = (Activity) context; 28 | this._editText = editTextViewID; 29 | this._editText.setOnClickListener(this); 30 | this._context = context; 31 | } 32 | 33 | @Override 34 | public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) { 35 | _year = year; 36 | _month = monthOfYear; 37 | _day = dayOfMonth; 38 | SimpleDateFormat dateformat = new SimpleDateFormat("EEE", Locale.US); 39 | Date date = new Date(_year, _month, _day - 1); 40 | _dayOfWeek = dateformat.format(date); 41 | SimpleDateFormat betterMonth = new SimpleDateFormat("MM", Locale.US); 42 | _monthWithZero = betterMonth.format(date); 43 | DisplayDate(); 44 | } 45 | 46 | @Override 47 | public void onClick(View v) { 48 | Calendar calendar = Calendar.getInstance(TimeZone.getDefault()); 49 | 50 | DatePickerDialog dialog = new DatePickerDialog(_context, R.style.dialog, this, 51 | calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH), 52 | calendar.get(Calendar.DAY_OF_MONTH)); 53 | DatePicker datePicker = dialog.getDatePicker(); 54 | datePicker.setMaxDate(calendar.getTimeInMillis()); 55 | dialog.show(); 56 | } 57 | 58 | // updates the date in the EditText 59 | private void DisplayDate() { 60 | String chosenDate = _day + "." + (_monthWithZero) + "." + _year + " (" + _dayOfWeek + ")"; 61 | _editText.setText(chosenDate); 62 | } 63 | } -------------------------------------------------------------------------------- /app/src/main/res/layout/add_panel.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 10 | 11 | 13 | 14 | 17 | 18 | 22 | 23 | 25 | 26 | 30 | 31 | 34 | 35 | 36 | 39 | 40 | 44 | 45 | 50 | 51 | 55 | 56 | 61 | 62 | 65 | 66 | 71 | 72 | 76 | 77 | 81 | 82 | 83 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /app/src/main/res/layout/body.xml: -------------------------------------------------------------------------------- 1 | 6 | 7 | 11 | 12 | 18 | 19 | 21 | 22 | 27 | 28 | 35 | 36 | 42 | 43 | 49 | 50 | 56 | 57 | 58 | 64 | 65 | 71 | 72 | 78 | 79 | 85 | 86 | 87 | 88 | -------------------------------------------------------------------------------- /app/src/main/java/pm/anna/takecare/ArchiveCursorAdapter.java: -------------------------------------------------------------------------------- 1 | package pm.anna.takecare; 2 | 3 | import android.content.Context; 4 | import android.database.Cursor; 5 | import android.view.LayoutInflater; 6 | import android.view.View; 7 | import android.view.ViewGroup; 8 | import android.widget.CursorAdapter; 9 | import android.widget.TextView; 10 | 11 | import pm.anna.takecare.data.ArchiveContract; 12 | 13 | class ArchiveCursorAdapter extends CursorAdapter { 14 | 15 | 16 | ArchiveCursorAdapter(Context context, Cursor c) { 17 | super(context, c, 0 /* flags */); 18 | } 19 | 20 | /** 21 | * Makes a new blank list item view. No data is set (or bound) to the views yet. 22 | * 23 | * @param context app context 24 | * @param cursor The cursor from which to get the data. The cursor is already 25 | * moved to the correct position. 26 | * @param parent The parent to which the new view is attached to 27 | * @return the newly created list item view. 28 | */ 29 | 30 | @Override 31 | public View newView(Context context, Cursor cursor, ViewGroup parent) { 32 | return LayoutInflater.from(context).inflate(R.layout.list_item, parent, false); 33 | } 34 | 35 | /** 36 | * This method binds the data (in the current row pointed to by cursor) to the given 37 | * list item layout. 38 | * 39 | * @param view Existing view, returned earlier by newView() method 40 | * @param context app context 41 | * @param cursor The cursor from which to get the data. The cursor is already moved to the 42 | * correct row. 43 | */ 44 | @Override 45 | public void bindView(View view, Context context, Cursor cursor) { 46 | // Find fields to populate in inflated template 47 | TextView tvDate = (TextView) view.findViewById(R.id.date); 48 | TextView tvPoints = (TextView) view.findViewById(R.id.points); 49 | TextView tvBody = (TextView) view.findViewById(R.id.body); 50 | TextView tvMind = (TextView) view.findViewById(R.id.mind); 51 | TextView tvSoul = (TextView) view.findViewById(R.id.soul); 52 | TextView tvThought = (TextView) view.findViewById(R.id.thoughts); 53 | int dateColumnIndex = cursor.getColumnIndex(ArchiveContract.ArchiveEntry.COLUMN_DATE); 54 | int pointsColumnIndex = cursor.getColumnIndex(ArchiveContract.ArchiveEntry.COLUMN_POINTS_ALL); 55 | int bodyColumnIndex = cursor.getColumnIndex(ArchiveContract.ArchiveEntry.COLUMN_POINTS_BODY); 56 | int mindColumnIndex = cursor.getColumnIndex(ArchiveContract.ArchiveEntry.COLUMN_POINTS_MIND); 57 | int soulColumnIndex = cursor.getColumnIndex(ArchiveContract.ArchiveEntry.COLUMN_POINTS_SOUL); 58 | int thoughtColumnIndex = cursor.getColumnIndex(ArchiveContract.ArchiveEntry.COLUMN_DESCRIPTION); 59 | 60 | String date = cursor.getString(dateColumnIndex); 61 | int points = cursor.getInt(pointsColumnIndex); 62 | int body = cursor.getInt(bodyColumnIndex); 63 | int mind = cursor.getInt(mindColumnIndex); 64 | int soul = cursor.getInt(soulColumnIndex); 65 | String thought = cursor.getString(thoughtColumnIndex); 66 | tvDate.setText(date); 67 | tvPoints.setText(String.valueOf(points + " pts")); 68 | tvBody.setText(String.valueOf(body)); 69 | tvMind.setText(String.valueOf(mind)); 70 | tvSoul.setText(String.valueOf(soul)); 71 | tvThought.setText(thought); 72 | 73 | } 74 | } -------------------------------------------------------------------------------- /app/src/main/res/layout/soul.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 10 | 11 | 17 | 18 | 20 | 21 | 25 | 26 | 33 | 34 | 40 | 41 | 47 | 48 | 54 | 55 | 56 | 62 | 63 | 69 | 70 | 76 | 77 | 83 | 84 | 85 | 91 | 92 | 98 | 99 | 100 | 101 | -------------------------------------------------------------------------------- /app/src/main/res/layout/mind.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 10 | 11 | 17 | 18 | 20 | 21 | 26 | 27 | 34 | 35 | 42 | 43 | 49 | 50 | 56 | 57 | 58 | 64 | 65 | 71 | 72 | 78 | 79 | 85 | 86 | 87 | 93 | 94 | 100 | 101 | 107 | 108 | 109 | 110 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 10 | DEFAULT_JVM_OPTS="" 11 | 12 | APP_NAME="Gradle" 13 | APP_BASE_NAME=`basename "$0"` 14 | 15 | # Use the maximum available, or set MAX_FD != -1 to use that value. 16 | MAX_FD="maximum" 17 | 18 | warn ( ) { 19 | echo "$*" 20 | } 21 | 22 | die ( ) { 23 | echo 24 | echo "$*" 25 | echo 26 | exit 1 27 | } 28 | 29 | # OS specific support (must be 'true' or 'false'). 30 | cygwin=false 31 | msys=false 32 | darwin=false 33 | case "`uname`" in 34 | CYGWIN* ) 35 | cygwin=true 36 | ;; 37 | Darwin* ) 38 | darwin=true 39 | ;; 40 | MINGW* ) 41 | msys=true 42 | ;; 43 | esac 44 | 45 | # Attempt to set APP_HOME 46 | # Resolve links: $0 may be a link 47 | PRG="$0" 48 | # Need this for relative symlinks. 49 | while [ -h "$PRG" ] ; do 50 | ls=`ls -ld "$PRG"` 51 | link=`expr "$ls" : '.*-> \(.*\)$'` 52 | if expr "$link" : '/.*' > /dev/null; then 53 | PRG="$link" 54 | else 55 | PRG=`dirname "$PRG"`"/$link" 56 | fi 57 | done 58 | SAVED="`pwd`" 59 | cd "`dirname \"$PRG\"`/" >/dev/null 60 | APP_HOME="`pwd -P`" 61 | cd "$SAVED" >/dev/null 62 | 63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 64 | 65 | # Determine the Java command to use to start the JVM. 66 | if [ -n "$JAVA_HOME" ] ; then 67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 68 | # IBM's JDK on AIX uses strange locations for the executables 69 | JAVACMD="$JAVA_HOME/jre/sh/java" 70 | else 71 | JAVACMD="$JAVA_HOME/bin/java" 72 | fi 73 | if [ ! -x "$JAVACMD" ] ; then 74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 75 | 76 | Please set the JAVA_HOME variable in your environment to match the 77 | location of your Java installation." 78 | fi 79 | else 80 | JAVACMD="java" 81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 82 | 83 | Please set the JAVA_HOME variable in your environment to match the 84 | location of your Java installation." 85 | fi 86 | 87 | # Increase the maximum file descriptors if we can. 88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then 89 | MAX_FD_LIMIT=`ulimit -H -n` 90 | if [ $? -eq 0 ] ; then 91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 92 | MAX_FD="$MAX_FD_LIMIT" 93 | fi 94 | ulimit -n $MAX_FD 95 | if [ $? -ne 0 ] ; then 96 | warn "Could not set maximum file descriptor limit: $MAX_FD" 97 | fi 98 | else 99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 100 | fi 101 | fi 102 | 103 | # For Darwin, add options to specify how the application appears in the dock 104 | if $darwin; then 105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 106 | fi 107 | 108 | # For Cygwin, switch paths to Windows format before running java 109 | if $cygwin ; then 110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 112 | JAVACMD=`cygpath --unix "$JAVACMD"` 113 | 114 | # We build the pattern for arguments to be converted via cygpath 115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 116 | SEP="" 117 | for dir in $ROOTDIRSRAW ; do 118 | ROOTDIRS="$ROOTDIRS$SEP$dir" 119 | SEP="|" 120 | done 121 | OURCYGPATTERN="(^($ROOTDIRS))" 122 | # Add a user-defined pattern to the cygpath arguments 123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 125 | fi 126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 127 | i=0 128 | for arg in "$@" ; do 129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 131 | 132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 134 | else 135 | eval `echo args$i`="\"$arg\"" 136 | fi 137 | i=$((i+1)) 138 | done 139 | case $i in 140 | (0) set -- ;; 141 | (1) set -- "$args0" ;; 142 | (2) set -- "$args0" "$args1" ;; 143 | (3) set -- "$args0" "$args1" "$args2" ;; 144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 150 | esac 151 | fi 152 | 153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules 154 | function splitJvmOpts() { 155 | JVM_OPTS=("$@") 156 | } 157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS 158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" 159 | 160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" 161 | -------------------------------------------------------------------------------- /app/src/main/java/pm/anna/takecare/data/ArchiveProvider.java: -------------------------------------------------------------------------------- 1 | package pm.anna.takecare.data; 2 | 3 | /** 4 | * Created by Anna on 19.02.2017. 5 | */ 6 | 7 | import android.content.ContentProvider; 8 | import android.content.ContentUris; 9 | import android.content.ContentValues; 10 | import android.content.UriMatcher; 11 | import android.database.Cursor; 12 | import android.database.sqlite.SQLiteDatabase; 13 | import android.net.Uri; 14 | import android.support.annotation.NonNull; 15 | import android.util.Log; 16 | 17 | import pm.anna.takecare.data.ArchiveContract.ArchiveEntry; 18 | 19 | import static pm.anna.takecare.data.ArchiveContract.CONTENT_AUTHORITY; 20 | 21 | /** 22 | * {@link ContentProvider} 23 | */ 24 | 25 | public class ArchiveProvider extends ContentProvider { 26 | 27 | public static final String LOG_TAG = ArchiveProvider.class.getSimpleName(); 28 | private static final int ARCHIVE = 100; 29 | private static final int ARCHIVE_ID = 101; 30 | private static final UriMatcher sUriMatcher = new UriMatcher(UriMatcher.NO_MATCH); 31 | 32 | static { 33 | sUriMatcher.addURI(CONTENT_AUTHORITY, ArchiveContract.PATH_ARCHIVE, ARCHIVE); 34 | sUriMatcher.addURI(CONTENT_AUTHORITY, ArchiveContract.PATH_ARCHIVE + "#", ARCHIVE_ID); 35 | } 36 | 37 | private ArchiveDbHelper mDbHelper; 38 | 39 | @Override 40 | public boolean onCreate() { 41 | mDbHelper = new ArchiveDbHelper(getContext()); 42 | return true; 43 | } 44 | 45 | /** 46 | * Perform the query for the given URI. Use the given projection, selection, selection arguments, and sort order. 47 | */ 48 | 49 | @Override 50 | public Cursor query(@NonNull Uri uri, String[] projection, String selection, String[] selectionArgs, 51 | String sortOrder) { 52 | SQLiteDatabase database = mDbHelper.getReadableDatabase(); 53 | Cursor cursor = null; 54 | 55 | int match = sUriMatcher.match(uri); 56 | switch (match) { 57 | case ARCHIVE: 58 | cursor = database.query(ArchiveEntry.TABLE_NAME, projection, selection, selectionArgs, 59 | null, null, sortOrder); 60 | break; 61 | case ARCHIVE_ID: 62 | selection = ArchiveContract.ArchiveEntry._ID + "=?"; 63 | selectionArgs = new String[]{String.valueOf(ContentUris.parseId(uri))}; 64 | cursor = database.query(ArchiveEntry.TABLE_NAME, projection, selection, selectionArgs, 65 | null, null, sortOrder); 66 | break; 67 | default: 68 | throw new IllegalArgumentException("Cannot query unknown URI " + uri); 69 | } 70 | cursor.setNotificationUri(getContext().getContentResolver(), uri); 71 | return cursor; 72 | } 73 | 74 | @Override 75 | public Uri insert(@NonNull Uri uri, ContentValues contentValues) { 76 | final int match = sUriMatcher.match(uri); 77 | switch (match) { 78 | case ARCHIVE: 79 | return insertArchiveItem(uri, contentValues); 80 | default: 81 | throw new IllegalArgumentException("Insertion is not supported for " + uri); 82 | } 83 | } 84 | 85 | private Uri insertArchiveItem(Uri uri, ContentValues values) { 86 | SQLiteDatabase database = mDbHelper.getWritableDatabase(); 87 | long id = database.insert(ArchiveEntry.TABLE_NAME, null, values); 88 | if (id == -1) { 89 | Log.e(LOG_TAG, "Failed to insert row for " + uri); 90 | return null; 91 | } 92 | 93 | getContext().getContentResolver().notifyChange(uri, null); 94 | return ContentUris.withAppendedId(uri, id); 95 | } 96 | 97 | /** 98 | * Updates the data at the given selection and selection arguments, with the new ContentValues. 99 | */ 100 | 101 | @Override 102 | public int update(@NonNull Uri uri, ContentValues contentValues, String selection, 103 | String[] selectionArgs) { 104 | final int match = sUriMatcher.match(uri); 105 | switch (match) { 106 | case ARCHIVE: 107 | return updateArchiveItem(uri, contentValues, selection, selectionArgs); 108 | case ARCHIVE_ID: 109 | selection = ArchiveEntry._ID + "=?"; 110 | selectionArgs = new String[]{String.valueOf(ContentUris.parseId(uri))}; 111 | return updateArchiveItem(uri, contentValues, selection, selectionArgs); 112 | default: 113 | throw new IllegalArgumentException("Update is not supported for " + uri); 114 | } 115 | } 116 | 117 | private int updateArchiveItem(Uri uri, ContentValues values, String selection, String[] selectionArgs) { 118 | 119 | String date = values.getAsString(ArchiveEntry.COLUMN_DATE); 120 | Integer all = values.getAsInteger(ArchiveEntry.COLUMN_POINTS_ALL); 121 | Integer body = values.getAsInteger(ArchiveEntry.COLUMN_POINTS_BODY); 122 | Integer mind = values.getAsInteger(ArchiveEntry.COLUMN_POINTS_MIND); 123 | Integer soul = values.getAsInteger(ArchiveEntry.COLUMN_POINTS_SOUL); 124 | String thought = values.getAsString(ArchiveEntry.COLUMN_DESCRIPTION); 125 | if (values.size() == 0) { 126 | return 0; 127 | } 128 | SQLiteDatabase database = mDbHelper.getWritableDatabase(); 129 | int rowsUpdated = database.update(ArchiveEntry.TABLE_NAME, values, selection, selectionArgs); 130 | // If 1 or more rows were updated, then notify all listeners that the data at the 131 | // given URI has changed 132 | if (rowsUpdated != 0) { 133 | getContext().getContentResolver().notifyChange(uri, null); 134 | } 135 | return database.update(ArchiveEntry.TABLE_NAME, values, selection, selectionArgs); 136 | } 137 | 138 | /** 139 | * Delete the data at the given selection and selection arguments. 140 | */ 141 | 142 | @Override 143 | public int delete(@NonNull Uri uri, String selection, String[] selectionArgs) { 144 | // Get writeable database 145 | SQLiteDatabase database = mDbHelper.getWritableDatabase(); 146 | 147 | // Track the number of rows that were deleted 148 | int rowsDeleted; 149 | 150 | final int match = sUriMatcher.match(uri); 151 | switch (match) { 152 | case ARCHIVE: 153 | // Delete all rows that match the selection and selection args 154 | rowsDeleted = database.delete(ArchiveEntry.TABLE_NAME, selection, selectionArgs); 155 | break; 156 | case ARCHIVE_ID: 157 | // Delete a single row given by the ID in the URI 158 | selection = ArchiveEntry._ID + "=?"; 159 | selectionArgs = new String[] { String.valueOf(ContentUris.parseId(uri)) }; 160 | rowsDeleted = database.delete(ArchiveEntry.TABLE_NAME, selection, selectionArgs); 161 | break; 162 | default: 163 | throw new IllegalArgumentException("Deletion is not supported for " + uri); 164 | } 165 | // If 1 or more rows were deleted, then notify all listeners that the data at the 166 | // given URI has changed 167 | if (rowsDeleted != 0) { 168 | getContext().getContentResolver().notifyChange(uri, null); 169 | } 170 | // Return the number of rows deleted 171 | return rowsDeleted; 172 | } 173 | 174 | @Override 175 | public String getType(@NonNull Uri uri) { 176 | final int match = sUriMatcher.match(uri); 177 | switch (match) { 178 | case ARCHIVE: 179 | return ArchiveEntry.CONTENT_LIST_TYPE; 180 | case ARCHIVE_ID: 181 | return ArchiveEntry.CONTENT_ITEM_TYPE; 182 | default: 183 | throw new IllegalStateException("Unknown URI " + uri + " with match " + match); 184 | } 185 | } 186 | } -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 11 | 12 | 20 | 21 | 25 | 26 | 34 | 35 | 40 | 41 | 47 | 48 | 52 | 53 | 54 | 58 | 59 | 65 | 66 | 67 | 68 | 75 | 76 | 83 | 84 | 90 | 91 | 97 | 98 | 108 | 109 | 119 | 120 | 130 | 131 | 142 | 143 | 148 | 149 | 154 | 155 | 160 | 161 | 162 | 163 | 170 | 171 | 177 | 178 | 187 | 188 | 193 | 194 | 197 | 198 | 202 | 203 | 206 | 207 | 210 | 211 | 214 | 215 | 218 | 219 | 225 | 226 | 237 | 238 | 244 | 245 | 246 | 247 | 256 | 257 | 261 | 262 | 269 | 270 | 274 | 275 | 280 | 281 | 286 | 287 | 290 | 291 | 294 | 295 | 298 | 299 | 300 | 301 | 306 | 307 | 315 | 316 | 320 | 321 | 327 | 328 | 331 | 332 | 335 | 336 | 339 | 340 | 344 | 345 | 357 | 358 | 359 | 360 | 366 | 367 | 384 | 385 | 395 | 396 | 404 | 405 | 413 | 414 | 418 | 419 | 423 | 424 | 427 | 428 | 431 | 432 | 435 | 436 | 439 | 440 | 446 | 447 | 450 | 451 | 452 | -------------------------------------------------------------------------------- /app/src/main/java/pm/anna/takecare/CareActivity.java: -------------------------------------------------------------------------------- 1 | package pm.anna.takecare; 2 | 3 | 4 | import android.content.ContentValues; 5 | import android.content.Context; 6 | import android.content.DialogInterface; 7 | import android.database.Cursor; 8 | import android.net.Uri; 9 | import android.os.Bundle; 10 | import android.support.v4.app.LoaderManager; 11 | import android.support.v4.content.ContextCompat; 12 | import android.support.v4.content.CursorLoader; 13 | import android.support.v4.content.Loader; 14 | import android.support.v4.view.ViewPager; 15 | import android.support.v7.app.AlertDialog; 16 | import android.text.Editable; 17 | import android.text.TextWatcher; 18 | import android.view.Gravity; 19 | import android.view.View; 20 | import android.view.inputmethod.InputMethodManager; 21 | import android.widget.AdapterView; 22 | import android.widget.Button; 23 | import android.widget.EditText; 24 | import android.widget.GridLayout; 25 | import android.widget.ImageButton; 26 | import android.widget.LinearLayout; 27 | import android.widget.ListView; 28 | import android.widget.RelativeLayout; 29 | import android.widget.TextView; 30 | import android.widget.Toast; 31 | import android.widget.ToggleButton; 32 | 33 | import java.text.ParseException; 34 | import java.text.SimpleDateFormat; 35 | import java.util.Calendar; 36 | import java.util.Locale; 37 | import java.util.Random; 38 | 39 | import pm.anna.takecare.data.ArchiveContract.ArchiveEntry; 40 | 41 | import static pm.anna.takecare.R.id.addButton; 42 | import static pm.anna.takecare.R.id.bodyPointsNumber; 43 | import static pm.anna.takecare.R.id.pager; 44 | 45 | public class CareActivity extends BaseActivity implements LoaderManager.LoaderCallbacks { 46 | 47 | private static final int ARCHIVE_LOADER = 0; 48 | 49 | ArchiveCursorAdapter mCursorAdapter; 50 | int howMany = 0; 51 | int bodyPoints = 0; 52 | int mindPoints = 0; 53 | int soulPoints = 0; 54 | int pointsNum = 0; 55 | String howManyBody = ""; 56 | String howManyMind = ""; 57 | String howManySoul = ""; 58 | String formattedDate; 59 | GridLayout mBodyList; 60 | GridLayout mMindList; 61 | GridLayout mSoulList; 62 | ViewPager mViewPager; 63 | TextView mHowMany; 64 | TextView mHowManyBody; 65 | TextView mHowManyMind; 66 | TextView mHowManySoul; 67 | TextView mBodyDots; 68 | TextView mMindDots; 69 | TextView mSoulDots; 70 | TextView mBodyDots_f; 71 | TextView mMindDots_f; 72 | TextView mSoulDots_f; 73 | TextView mPointsNumber; 74 | TextView mCommentDays; 75 | TextView mComment; 76 | TextView mComment_f; 77 | EditText mDateEdit; 78 | EditText mBodyPointsNumber; 79 | EditText mMindPointsNumber; 80 | EditText mSoulPointsNumber; 81 | EditText mThoughtsEdit; 82 | EqualWidthHeightTextView mHowMany_f; 83 | EqualWidthHeightTextView mHowManyDays; 84 | EqualWidthHeightTextView mHowManyDays_f; 85 | ImageButton mAddButton; 86 | EqualWidthHeightTextView mDeleteButton; 87 | LinearLayout mAddPanel; 88 | RelativeLayout mArchive; 89 | ListView mItemsList; 90 | ListView mItemsList_f; 91 | ImageButton mYesButton; 92 | ImageButton mNoButton; 93 | ImageButton mShowDetailsButton; 94 | ImageButton mShowSimpleButton; 95 | RelativeLayout mEmptyView; 96 | String mDoneArray[]; 97 | boolean detailsVisible = false; 98 | boolean savedToday = false; 99 | int wantsToAdd; 100 | 101 | @Override 102 | protected void onCreate(Bundle savedInstanceState) { 103 | super.onCreate(savedInstanceState); 104 | initUiElements(); 105 | makeSlides(); 106 | fakeSlides(); 107 | setDate(); 108 | addListeners(); 109 | initDatabase(); 110 | checkLastTime(); 111 | } 112 | 113 | private void initUiElements() { 114 | 115 | setContentView(R.layout.activity_care); 116 | mBodyList = (GridLayout) findViewById(R.id.body_list); 117 | mMindList = (GridLayout) findViewById(R.id.mind_list); 118 | mSoulList = (GridLayout) findViewById(R.id.soul_list); 119 | mHowMany = (TextView) findViewById(R.id.howMany); 120 | mComment = (TextView) findViewById(R.id.careText); 121 | mComment_f = (TextView) findViewById(R.id.careText_f); 122 | mHowManyBody = (TextView) findViewById(R.id.howManyBody); 123 | mHowManyMind = (TextView) findViewById(R.id.howManyMind); 124 | mHowManySoul = (TextView) findViewById(R.id.howManySoul); 125 | mHowManyDays = (EqualWidthHeightTextView) findViewById(R.id.howManyDays); 126 | mBodyDots = (TextView) findViewById(R.id.bodyDots); 127 | mMindDots = (TextView) findViewById(R.id.mindDots); 128 | mSoulDots = (TextView) findViewById(R.id.soulDots); 129 | mViewPager = (ViewPager) findViewById(pager); 130 | mItemsList = (ListView) findViewById(R.id.list); 131 | mPointsNumber = (TextView) findViewById(R.id.pointsNumber); 132 | mDateEdit = (EditText) findViewById(R.id.editDate); 133 | mAddButton = (ImageButton) findViewById(addButton); 134 | mCommentDays = (TextView) findViewById(R.id.comment_days); 135 | mBodyPointsNumber = (EditText) findViewById(bodyPointsNumber); 136 | mMindPointsNumber = (EditText) findViewById(R.id.mindPointsNumber); 137 | mSoulPointsNumber = (EditText) findViewById(R.id.soulPointsNumber); 138 | mAddPanel = (LinearLayout) findViewById(R.id.addPanel); 139 | mArchive = (RelativeLayout) findViewById(R.id.archive); 140 | mYesButton = (ImageButton) findViewById(R.id.yesButton); 141 | mNoButton = (ImageButton) findViewById(R.id.noButton); 142 | mEmptyView = (RelativeLayout) findViewById(R.id.empty); 143 | mDeleteButton = (EqualWidthHeightTextView) findViewById(R.id.deleteButton); 144 | mDoneArray = getResources().getStringArray(R.array.done); 145 | mShowDetailsButton = (ImageButton) findViewById(R.id.showDetails); 146 | mShowSimpleButton = (ImageButton) findViewById(R.id.showSimple); 147 | mThoughtsEdit = (EditText) findViewById(R.id.anyThoughts); 148 | } 149 | 150 | private void makeSlides() { 151 | WizardPagerAdapter adapter = new WizardPagerAdapter(); 152 | mViewPager.setAdapter(adapter); 153 | mViewPager.setOffscreenPageLimit(7); 154 | mViewPager.setCurrentItem(1, false); 155 | mViewPager.setPageTransformer(true, new DepthPageTransformer()); 156 | mAddPanel.setVisibility(View.INVISIBLE); 157 | mItemsList.setEmptyView(mEmptyView); 158 | } 159 | 160 | private void fakeSlides() { 161 | mHowMany_f = (EqualWidthHeightTextView) findViewById(R.id.howMany_f); 162 | mHowManyDays_f = (EqualWidthHeightTextView) findViewById(R.id.howManyDays_f); 163 | mBodyDots_f = (TextView) findViewById(R.id.bodyDots_f); 164 | mMindDots_f = (TextView) findViewById(R.id.mindDots_f); 165 | mSoulDots_f = (TextView) findViewById(R.id.soulDots_f); 166 | mItemsList_f = (ListView) findViewById(R.id.list_f); 167 | } 168 | 169 | private void setDate() { 170 | Calendar c = Calendar.getInstance(); 171 | SimpleDateFormat df = new SimpleDateFormat("dd.MM.yyyy (EEE)", Locale.US); 172 | formattedDate = df.format(c.getTime()); 173 | mDateEdit.setText(formattedDate); 174 | try { 175 | EditTextDatePicker fromDate = new EditTextDatePicker(this, mDateEdit); 176 | } catch (ParseException e) { 177 | e.printStackTrace(); 178 | } 179 | } 180 | 181 | private void addListeners() { 182 | 183 | mBodyPointsNumber.setOnFocusChangeListener(new View.OnFocusChangeListener() { 184 | @Override 185 | public void onFocusChange(View v, boolean hasFocus) { 186 | if (!hasFocus) { 187 | if (mBodyPointsNumber.getText().toString().equals("")) 188 | mBodyPointsNumber.setText("0"); 189 | } 190 | } 191 | }); 192 | mBodyPointsNumber.addTextChangedListener(new TextWatcher() { 193 | 194 | @Override 195 | public void beforeTextChanged(CharSequence s, int start, int count, int after) { 196 | } 197 | 198 | @Override 199 | public void onTextChanged(CharSequence s, int start, int before, int count) { 200 | } 201 | 202 | @Override 203 | public void afterTextChanged(final Editable s) { 204 | if ((!mBodyPointsNumber.getText().toString().equals("")) 205 | && mBodyPointsNumber.getText().toString().equals(s.toString())) { 206 | bodyPoints = Integer.parseInt(s.toString()); 207 | changeSum(); 208 | } 209 | } 210 | }); 211 | mMindPointsNumber.setOnFocusChangeListener(new View.OnFocusChangeListener() { 212 | @Override 213 | public void onFocusChange(View v, boolean hasFocus) { 214 | if (!hasFocus) { 215 | if (mMindPointsNumber.getText().toString().equals("")) 216 | mMindPointsNumber.setText("0"); 217 | } 218 | } 219 | }); 220 | mMindPointsNumber.addTextChangedListener(new TextWatcher() { 221 | 222 | @Override 223 | public void beforeTextChanged(CharSequence s, int start, int count, int after) { 224 | } 225 | 226 | @Override 227 | public void onTextChanged(CharSequence s, int start, int before, int count) { 228 | } 229 | 230 | @Override 231 | public void afterTextChanged(final Editable s) { 232 | if ((!mMindPointsNumber.getText().toString().equals("")) 233 | && mMindPointsNumber.getText().toString().equals(s.toString())) { 234 | mindPoints = Integer.parseInt(s.toString()); 235 | changeSum(); 236 | } 237 | } 238 | }); 239 | mSoulPointsNumber.setOnFocusChangeListener(new View.OnFocusChangeListener() { 240 | @Override 241 | public void onFocusChange(View v, boolean hasFocus) { 242 | if (!hasFocus) { 243 | if (mSoulPointsNumber.getText().toString().equals("")) 244 | mSoulPointsNumber.setText("0"); 245 | } 246 | } 247 | }); 248 | mSoulPointsNumber.addTextChangedListener(new TextWatcher() { 249 | 250 | @Override 251 | public void beforeTextChanged(CharSequence s, int start, int count, int after) { 252 | } 253 | 254 | @Override 255 | public void onTextChanged(CharSequence s, int start, int before, int count) { 256 | } 257 | 258 | @Override 259 | public void afterTextChanged(final Editable s) { 260 | if ((!mSoulPointsNumber.getText().toString().equals("")) 261 | && mSoulPointsNumber.getText().toString().equals(s.toString())) { 262 | soulPoints = Integer.parseInt(s.toString()); 263 | changeSum(); 264 | } 265 | } 266 | }); 267 | 268 | mAddButton.setOnClickListener(new View.OnClickListener() { 269 | @Override 270 | public void onClick(View v) { 271 | mAddPanel.setVisibility(View.VISIBLE); 272 | } 273 | }); 274 | 275 | mNoButton.setOnClickListener(new View.OnClickListener() { 276 | @Override 277 | public void onClick(View v) { 278 | hidePanel(); 279 | } 280 | }); 281 | 282 | mDeleteButton.setOnClickListener(new View.OnClickListener() { 283 | 284 | @Override 285 | public void onClick(View v) { 286 | showDeleteConfirmationDialog(); 287 | } 288 | }); 289 | 290 | mItemsList.setOnItemClickListener(new AdapterView.OnItemClickListener() { 291 | public void onItemClick(AdapterView parent, final View view, int position, long id) { 292 | 293 | View details = view.findViewById(R.id.details); 294 | 295 | // Creating the expand animation for the item 296 | ExpandAnimation expandAni = new ExpandAnimation(details, 500); 297 | 298 | // Start the animation on the toolbar 299 | details.startAnimation(expandAni); 300 | } 301 | }); 302 | mShowDetailsButton.setOnClickListener(new View.OnClickListener() { 303 | 304 | @Override 305 | public void onClick(View v) { 306 | if (!detailsVisible) { 307 | for (int i = 0; i < mItemsList.getAdapter().getCount(); i++) { 308 | mItemsList.performItemClick( 309 | getViewByPosition(i), 310 | i, 311 | mItemsList.getAdapter().getItemId(i)); 312 | } 313 | detailsVisible = true; 314 | } 315 | 316 | } 317 | }); 318 | mShowSimpleButton.setOnClickListener(new View.OnClickListener() { 319 | @Override 320 | public void onClick(View v) { 321 | mItemsList.setAdapter(mCursorAdapter); 322 | detailsVisible = false; 323 | } 324 | }); 325 | 326 | mViewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() { 327 | @Override 328 | public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { 329 | } 330 | 331 | @Override 332 | public void onPageSelected(int position) { 333 | 334 | // skip fake page (first), go to last page 335 | if (position == 0) { 336 | mViewPager.setCurrentItem(5, false); 337 | } 338 | 339 | // skip fake page (last), go to first page 340 | if (position == 6) { 341 | mViewPager.setCurrentItem(1, false); 342 | } 343 | } 344 | 345 | @Override 346 | public void onPageScrollStateChanged(int state) { 347 | 348 | } 349 | }); 350 | } 351 | 352 | 353 | /* * * ARCHIVE * * */ 354 | 355 | private void initDatabase() { 356 | mCursorAdapter = new ArchiveCursorAdapter(this, null); 357 | mItemsList.setAdapter(mCursorAdapter); 358 | mItemsList_f.setAdapter(mCursorAdapter); // fake list 359 | getSupportLoaderManager().initLoader(ARCHIVE_LOADER, null, this); 360 | } 361 | 362 | private void checkLastTime() { 363 | Cursor c = getContentResolver().query(ArchiveEntry.CONTENT_URI, null, null, null, null); 364 | assert c != null; 365 | c.moveToLast(); 366 | String lastDay = c.getString(c.getColumnIndex(ArchiveEntry.COLUMN_DATE)); 367 | if (lastDay.equals(formattedDate)) { 368 | 369 | savedToday = true; 370 | resetDots(); 371 | mComment.setText(getResources().getString(R.string.comment)); 372 | mComment_f.setText(getResources().getString(R.string.comment)); 373 | 374 | pointsNum = c.getInt(c.getColumnIndex(ArchiveEntry.COLUMN_POINTS_ALL)); 375 | 376 | howMany = pointsNum; 377 | changeCare(pointsNum); 378 | 379 | bodyPoints = c.getInt(c.getColumnIndex(ArchiveEntry.COLUMN_POINTS_BODY)); 380 | for (int i = 0; i < bodyPoints; i++) { 381 | howManyBody += "● "; 382 | } 383 | 384 | mindPoints = c.getInt(c.getColumnIndex(ArchiveEntry.COLUMN_POINTS_MIND)); 385 | for (int i = 0; i < mindPoints; i++) { 386 | howManyMind += "● "; 387 | } 388 | 389 | soulPoints = c.getInt(c.getColumnIndex(ArchiveEntry.COLUMN_POINTS_SOUL)); 390 | for (int i = 0; i < soulPoints; i++) { 391 | howManySoul += "● "; 392 | } 393 | 394 | changeCareBody(howManyBody); 395 | changeCareMind(howManyMind); 396 | changeCareSoul(howManySoul); 397 | wantsToAdd = 2; 398 | } 399 | c.close(); 400 | } 401 | 402 | private View getViewByPosition(int position) { 403 | int firstItemPosition = mItemsList.getFirstVisiblePosition(); 404 | int lastItemPosition = firstItemPosition + mItemsList.getChildCount() - 1; 405 | 406 | if (position < firstItemPosition || position > lastItemPosition) {//is invisible 407 | return mItemsList.getAdapter().getView(position, null, mItemsList); 408 | } else { 409 | int childIndex = position - firstItemPosition;//is visible 410 | return mItemsList.getChildAt(childIndex); 411 | } 412 | } 413 | 414 | public void insertArchiveItem(View v) { 415 | 416 | String date = mDateEdit.getText().toString(); 417 | String thought = mThoughtsEdit.getText().toString(); 418 | ContentValues values = new ContentValues(); 419 | values.put(ArchiveEntry.COLUMN_DATE, date); 420 | values.put(ArchiveEntry.COLUMN_POINTS_ALL, pointsNum); 421 | values.put(ArchiveEntry.COLUMN_POINTS_BODY, bodyPoints); 422 | values.put(ArchiveEntry.COLUMN_POINTS_MIND, mindPoints); 423 | values.put(ArchiveEntry.COLUMN_POINTS_SOUL, soulPoints); 424 | values.put(ArchiveEntry.COLUMN_DESCRIPTION, thought); 425 | 426 | if (savedToday && date.equals(formattedDate)) deleteArchiveItem(); 427 | Uri newUri = getContentResolver().insert(ArchiveEntry.CONTENT_URI, values); 428 | if (newUri == null) { 429 | Toast.makeText(this, getString(R.string.save_error), Toast.LENGTH_SHORT).show(); 430 | } else { 431 | Random generator = new Random(); 432 | int num = generator.nextInt(mDoneArray.length); 433 | Toast.makeText(this, mDoneArray[num], Toast.LENGTH_SHORT).show(); 434 | } 435 | 436 | resetPoints(); 437 | changeSum(); 438 | hidePanel(); 439 | checkLastTime(); 440 | } 441 | 442 | private void showDeleteConfirmationDialog() { 443 | AlertDialog.Builder builder = new AlertDialog.Builder(this); 444 | builder.setMessage(R.string.delete_dialog_msg); 445 | 446 | builder.setPositiveButton(R.string.delete, new DialogInterface.OnClickListener() { 447 | public void onClick(DialogInterface dialog, int id) { 448 | deleteArchiveItem(); 449 | } 450 | }); 451 | builder.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() { 452 | public void onClick(DialogInterface dialog, int id) { 453 | // User clicked the "Cancel" button, so dismiss the dialog 454 | if (dialog != null) { 455 | dialog.dismiss(); 456 | } 457 | } 458 | }); 459 | AlertDialog alertDialog = builder.create(); 460 | alertDialog.show(); 461 | 462 | Button negativeButton = alertDialog.getButton(DialogInterface.BUTTON_NEGATIVE); 463 | negativeButton.setTextColor(ContextCompat.getColor(this, R.color.green)); 464 | 465 | Button positiveButton = alertDialog.getButton(DialogInterface.BUTTON_POSITIVE); 466 | positiveButton.setTextColor(ContextCompat.getColor(this, R.color.circle_delete)); 467 | } 468 | 469 | private void deleteArchiveItem() { 470 | Cursor c = getContentResolver().query(ArchiveEntry.CONTENT_URI, null, null, null, null); 471 | assert c != null; 472 | c.moveToLast(); 473 | String dayToDelete = c.getString(c.getColumnIndex(ArchiveEntry._ID)); 474 | getContentResolver().delete(ArchiveEntry.CONTENT_URI, ArchiveEntry._ID + "=?", new String[]{dayToDelete}); 475 | c.close(); 476 | } 477 | 478 | /* * * CHANGE POINTS - BODY * * */ 479 | 480 | public void changePointsBody(View v) { 481 | int pointsToChange = Integer.parseInt((String) v.getTag()); 482 | ToggleButton selected = ((ToggleButton) v); 483 | boolean isChecked = selected.isChecked(); 484 | if (savedToday && wantsToAdd == 2) { 485 | selected.toggle(); 486 | checkIfWantsToAdd(); 487 | return; 488 | } 489 | if (isChecked) { 490 | howMany += pointsToChange; 491 | bodyPoints += pointsToChange; 492 | 493 | for (int i = 0; i < pointsToChange; i++) { 494 | howManyBody += "● "; 495 | } 496 | } else { 497 | howMany -= pointsToChange; 498 | bodyPoints -= pointsToChange; 499 | howManyBody = howManyBody.substring(0, howManyBody.length() - (pointsToChange * 2)); 500 | } 501 | changeCareBody(howManyBody); 502 | changeCare(howMany); 503 | } 504 | 505 | private void changeCareBody(String s) { 506 | if (s.length() > 0) { 507 | mBodyDots.setText(s); 508 | mBodyDots_f.setText(s); 509 | } else { 510 | mBodyDots.setText(""); 511 | mBodyDots_f.setText(""); 512 | } 513 | if (s.length() == 0) s = "◦ ◦ ◦"; 514 | mHowManyBody.setText(s); 515 | mBodyPointsNumber.setText(String.valueOf(bodyPoints)); 516 | } 517 | 518 | /* * * CHANGE POINTS - MIND * * */ 519 | 520 | public void changePointsMind(View v) { 521 | int pointsToChange = Integer.parseInt((String) v.getTag()); 522 | ToggleButton selected = ((ToggleButton) v); 523 | boolean isChecked = selected.isChecked(); 524 | if (savedToday && wantsToAdd == 2) { 525 | selected.toggle(); 526 | checkIfWantsToAdd(); 527 | return; 528 | } 529 | 530 | if (isChecked) { 531 | howMany += pointsToChange; 532 | mindPoints += pointsToChange; 533 | 534 | for (int i = 0; i < pointsToChange; i++) { 535 | howManyMind += "● "; 536 | } 537 | } else { 538 | howMany -= pointsToChange; 539 | mindPoints -= pointsToChange; 540 | howManyMind = howManyMind.substring(0, howManyMind.length() - (pointsToChange * 2)); 541 | } 542 | changeCareMind(howManyMind); 543 | changeCare(howMany); 544 | } 545 | 546 | private void changeCareMind(String s) { 547 | if (s.length() > 0) { 548 | mMindDots.setText(s); 549 | mMindDots_f.setText(s); 550 | } else { 551 | mMindDots.setText(""); 552 | mMindDots_f.setText(""); 553 | } 554 | if (s.length() == 0) s = "◦ ◦ ◦"; 555 | mHowManyMind.setText(s); 556 | mMindPointsNumber.setText(String.valueOf(mindPoints)); 557 | } 558 | 559 | /* * * CHANGE POINTS - SOUL * * */ 560 | 561 | public void changePointsSoul(View v) { 562 | int pointsToChange = Integer.parseInt((String) v.getTag()); 563 | ToggleButton selected = ((ToggleButton) v); 564 | boolean isChecked = selected.isChecked(); 565 | if (savedToday && wantsToAdd == 2) { 566 | selected.toggle(); 567 | checkIfWantsToAdd(); 568 | return; 569 | } 570 | if (isChecked) { 571 | howMany += pointsToChange; 572 | soulPoints += pointsToChange; 573 | 574 | for (int i = 0; i < pointsToChange; i++) { 575 | howManySoul += "● "; 576 | } 577 | } else { 578 | howMany -= pointsToChange; 579 | soulPoints -= pointsToChange; 580 | howManySoul = howManySoul.substring(0, howManySoul.length() - (pointsToChange * 2)); 581 | } 582 | changeCareSoul(howManySoul); 583 | changeCare(howMany); 584 | } 585 | 586 | private void changeCareSoul(String s) { 587 | if (s.length() > 0) { 588 | mSoulDots.setText(s); 589 | mSoulDots_f.setText(s); 590 | } else { 591 | mSoulDots.setText(""); 592 | mSoulDots.setText(""); 593 | } 594 | if (s.length() == 0) s = "◦ ◦ ◦"; 595 | mHowManySoul.setText(s); 596 | mSoulPointsNumber.setText(String.valueOf(soulPoints)); 597 | } 598 | 599 | /* * * POINTS-RELATED * * */ 600 | 601 | private void changeCare(int num) { 602 | preventNegative(); 603 | pointsNum = bodyPoints + soulPoints + mindPoints; 604 | mHowMany.setText(String.valueOf(num)); 605 | mHowMany_f.setText(String.valueOf(num)); 606 | mPointsNumber.setText(String.valueOf(pointsNum)); 607 | } 608 | 609 | private void checkIfWantsToAdd() { 610 | switch (wantsToAdd) { 611 | case 0: 612 | resetEverything(); 613 | wantsToAdd = 1; 614 | break; 615 | case 1: 616 | break; 617 | case 2: 618 | askWhatToDo(); 619 | break; 620 | } 621 | 622 | } 623 | 624 | private void askWhatToDo() { 625 | AlertDialog.Builder builder = new AlertDialog.Builder(this); 626 | builder.setMessage(R.string.today_dialog_msg); 627 | 628 | builder.setPositiveButton(R.string.add, new DialogInterface.OnClickListener() { 629 | public void onClick(DialogInterface dialog, int id) { 630 | wantsToAdd = 1; 631 | } 632 | }); 633 | builder.setNegativeButton(R.string.reset, new DialogInterface.OnClickListener() { 634 | public void onClick(DialogInterface dialog, int id) { 635 | resetEverything(); 636 | wantsToAdd = 1; 637 | } 638 | }); 639 | AlertDialog alertDialog = builder.create(); 640 | alertDialog.show(); 641 | TextView messageView = (TextView) alertDialog.findViewById(android.R.id.message); 642 | assert messageView != null; 643 | messageView.setGravity(Gravity.CENTER); 644 | 645 | Button negativeButton = alertDialog.getButton(DialogInterface.BUTTON_NEGATIVE); 646 | negativeButton.setTextColor(ContextCompat.getColor(this, R.color.circle_delete)); 647 | 648 | Button positiveButton = alertDialog.getButton(DialogInterface.BUTTON_POSITIVE); 649 | positiveButton.setTextColor(ContextCompat.getColor(this, R.color.green)); 650 | } 651 | 652 | private void resetEverything() { 653 | resetPoints(); 654 | resetDots(); 655 | mHowMany.setText(String.valueOf(0)); 656 | mHowMany_f.setText(String.valueOf(0)); 657 | howMany = 0; 658 | } 659 | 660 | private void resetDots(){ 661 | howManyMind = ""; 662 | howManyBody = ""; 663 | howManySoul = ""; 664 | changeCareBody(howManyBody); 665 | changeCareMind(howManyMind); 666 | changeCareSoul(howManySoul); 667 | }; 668 | 669 | private void preventNegative() { 670 | if (howMany < 0) howMany = 0; 671 | if (bodyPoints < 0) { 672 | bodyPoints = 0; 673 | mBodyPointsNumber.setText(String.valueOf(bodyPoints)); 674 | } 675 | if (mindPoints < 0) { 676 | mindPoints = 0; 677 | mMindPointsNumber.setText(String.valueOf(mindPoints)); 678 | } 679 | if (soulPoints < 0) { 680 | soulPoints = 0; 681 | mSoulPointsNumber.setText(String.valueOf(soulPoints)); 682 | } 683 | } 684 | 685 | private void changeSum() { 686 | pointsNum = bodyPoints + soulPoints + mindPoints; 687 | mPointsNumber.setText(String.valueOf(pointsNum)); 688 | } 689 | 690 | private void resetPoints() { 691 | pointsNum = bodyPoints = mindPoints = soulPoints = 0; 692 | mSoulPointsNumber.setText(String.valueOf(soulPoints)); 693 | mBodyPointsNumber.setText(String.valueOf(bodyPoints)); 694 | mMindPointsNumber.setText(String.valueOf(mindPoints)); 695 | mThoughtsEdit.setText(""); 696 | } 697 | 698 | private void hidePanel() { 699 | mAddPanel.setVisibility(View.INVISIBLE); 700 | View view = this.getCurrentFocus(); 701 | if (view != null) { 702 | InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); 703 | imm.hideSoftInputFromWindow(view.getWindowToken(), 0); 704 | } 705 | } 706 | 707 | /* * * CURSOR * * */ 708 | 709 | @Override 710 | public Loader onCreateLoader(int i, Bundle bundle) { 711 | String[] projection = { 712 | ArchiveEntry._ID, 713 | ArchiveEntry.COLUMN_DATE, 714 | ArchiveEntry.COLUMN_POINTS_ALL, 715 | ArchiveEntry.COLUMN_POINTS_BODY, 716 | ArchiveEntry.COLUMN_POINTS_MIND, 717 | ArchiveEntry.COLUMN_POINTS_SOUL, 718 | ArchiveEntry.COLUMN_DESCRIPTION 719 | }; 720 | 721 | return new CursorLoader(this, ArchiveEntry.CONTENT_URI, projection, null, null, null); 722 | } 723 | 724 | @Override 725 | public void onLoadFinished(Loader loader, Cursor data) { 726 | mCursorAdapter.swapCursor(data); 727 | int days = mCursorAdapter.getCount(); 728 | mHowManyDays.setText(String.valueOf(days)); 729 | mHowManyDays_f.setText(String.valueOf(days)); 730 | } 731 | 732 | @Override 733 | public void onLoaderReset(Loader loader) { 734 | mCursorAdapter.swapCursor(null); 735 | } 736 | 737 | } --------------------------------------------------------------------------------