├── app
├── .gitignore
├── src
│ ├── main
│ │ ├── assets
│ │ │ └── fonts
│ │ │ │ └── Questv1-Bold.otf
│ │ ├── res
│ │ │ ├── drawable-hdpi
│ │ │ │ ├── splash.9.png
│ │ │ │ └── ic_stat_s_controller.png
│ │ │ ├── drawable-mdpi
│ │ │ │ ├── splash.9.png
│ │ │ │ └── ic_stat_s_controller.png
│ │ │ ├── drawable-xhdpi
│ │ │ │ ├── splash.9.png
│ │ │ │ └── ic_stat_s_controller.png
│ │ │ ├── drawable-xxhdpi
│ │ │ │ ├── splash.9.png
│ │ │ │ └── ic_stat_s_controller.png
│ │ │ ├── mipmap-hdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-mdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-xhdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-xxhdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-xxxhdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ ├── values-ar
│ │ │ │ ├── dimens.xml
│ │ │ │ └── strings.xml
│ │ │ ├── values-v21
│ │ │ │ └── styles.xml
│ │ │ ├── drawable
│ │ │ │ ├── green_gradient.xml
│ │ │ │ ├── amber_gradient.xml
│ │ │ │ ├── ic_menu_home.xml
│ │ │ │ ├── custom_thumb.xml
│ │ │ │ ├── custom_progressbar.xml
│ │ │ │ ├── ic_menu_calculate.xml
│ │ │ │ ├── ic_menu_facebook.xml
│ │ │ │ ├── ic_menu_reminders.xml
│ │ │ │ ├── ic_help_outline_black_24dp.xml
│ │ │ │ ├── ic_menu_recipes.xml
│ │ │ │ ├── ic_share.xml
│ │ │ │ ├── custom_button.xml
│ │ │ │ ├── animation_button.xml
│ │ │ │ ├── ic_menu_twitter.xml
│ │ │ │ └── ic_launcher_background.xml
│ │ │ ├── mipmap-anydpi-v26
│ │ │ │ ├── ic_launcher.xml
│ │ │ │ └── ic_launcher_round.xml
│ │ │ ├── values
│ │ │ │ ├── dimens.xml
│ │ │ │ ├── drawables.xml
│ │ │ │ ├── styles.xml
│ │ │ │ ├── colors.xml
│ │ │ │ └── strings.xml
│ │ │ ├── menu
│ │ │ │ ├── main.xml
│ │ │ │ └── activity_main_drawer.xml
│ │ │ ├── layout
│ │ │ │ ├── activity_splash.xml
│ │ │ │ ├── app_bar_main.xml
│ │ │ │ ├── activity_main.xml
│ │ │ │ ├── nav_header_main.xml
│ │ │ │ ├── f5_layout.xml
│ │ │ │ ├── f1_layout.xml
│ │ │ │ ├── f2_layout.xml
│ │ │ │ ├── content_main.xml
│ │ │ │ ├── f3_layout.xml
│ │ │ │ ├── activity_api.xml
│ │ │ │ ├── fragment_about.xml
│ │ │ │ ├── activity_reminders.xml
│ │ │ │ └── f4_layout.xml
│ │ │ └── drawable-v24
│ │ │ │ └── ic_launcher_foreground.xml
│ │ ├── java
│ │ │ └── ahmux
│ │ │ │ └── nutritionpoint
│ │ │ │ ├── FragmentsCommunicator.java
│ │ │ │ ├── AlarmReceiver.java
│ │ │ │ ├── SplashActivity.java
│ │ │ │ ├── Fragment5.java
│ │ │ │ ├── AboutFragment.java
│ │ │ │ ├── Fragment1.java
│ │ │ │ ├── Fragment2.java
│ │ │ │ ├── NotificationsController.java
│ │ │ │ ├── Fragment3.java
│ │ │ │ ├── ApiActivity.java
│ │ │ │ ├── Fragment4.java
│ │ │ │ ├── RemindersActivity.java
│ │ │ │ └── MainActivity.java
│ │ └── AndroidManifest.xml
│ ├── test
│ │ └── java
│ │ │ └── ahmux
│ │ │ └── nutritionpoint
│ │ │ └── ExampleUnitTest.java
│ └── androidTest
│ │ └── java
│ │ └── ahmux
│ │ └── nutritionpoint
│ │ └── ExampleInstrumentedTest.java
├── proguard-rules.pro
└── build.gradle
├── settings.gradle
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── .idea
├── caches
│ └── build_file_checksums.ser
├── vcs.xml
├── runConfigurations.xml
├── gradle.xml
├── misc.xml
├── codeStyles
│ └── Project.xml
└── assetWizardSettings.xml
├── .gitignore
├── gradle.properties
├── gradlew.bat
├── README.md
└── gradlew
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Ahmux/Nutrition_Point/HEAD/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/.idea/caches/build_file_checksums.ser:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Ahmux/Nutrition_Point/HEAD/.idea/caches/build_file_checksums.ser
--------------------------------------------------------------------------------
/app/src/main/assets/fonts/Questv1-Bold.otf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Ahmux/Nutrition_Point/HEAD/app/src/main/assets/fonts/Questv1-Bold.otf
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/splash.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Ahmux/Nutrition_Point/HEAD/app/src/main/res/drawable-hdpi/splash.9.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/splash.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Ahmux/Nutrition_Point/HEAD/app/src/main/res/drawable-mdpi/splash.9.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/splash.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Ahmux/Nutrition_Point/HEAD/app/src/main/res/drawable-xhdpi/splash.9.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/splash.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Ahmux/Nutrition_Point/HEAD/app/src/main/res/drawable-xxhdpi/splash.9.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Ahmux/Nutrition_Point/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Ahmux/Nutrition_Point/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Ahmux/Nutrition_Point/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Ahmux/Nutrition_Point/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Ahmux/Nutrition_Point/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Ahmux/Nutrition_Point/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Ahmux/Nutrition_Point/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Ahmux/Nutrition_Point/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Ahmux/Nutrition_Point/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Ahmux/Nutrition_Point/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ic_stat_s_controller.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Ahmux/Nutrition_Point/HEAD/app/src/main/res/drawable-hdpi/ic_stat_s_controller.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/ic_stat_s_controller.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Ahmux/Nutrition_Point/HEAD/app/src/main/res/drawable-mdpi/ic_stat_s_controller.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_stat_s_controller.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Ahmux/Nutrition_Point/HEAD/app/src/main/res/drawable-xhdpi/ic_stat_s_controller.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_stat_s_controller.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Ahmux/Nutrition_Point/HEAD/app/src/main/res/drawable-xxhdpi/ic_stat_s_controller.png
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/libraries
5 | /.idea/modules.xml
6 | /.idea/workspace.xml
7 | .DS_Store
8 | /build
9 | /captures
10 | .externalNativeBuild
11 |
--------------------------------------------------------------------------------
/app/src/main/res/values-ar/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 30sp
5 | 30sp
6 |
7 |
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/java/ahmux/nutritionpoint/FragmentsCommunicator.java:
--------------------------------------------------------------------------------
1 | package ahmux.nutritionpoint;
2 |
3 | public interface FragmentsCommunicator {
4 |
5 | void respond(String data1, int data2);
6 |
7 | }
8 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Sat Sep 08 22:24:56 EET 2018
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
7 |
--------------------------------------------------------------------------------
/app/src/main/res/values-v21/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
9 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/green_gradient.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/amber_gradient.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
8 |
9 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_menu_home.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/custom_thumb.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | -
4 |
5 |
6 |
7 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/custom_progressbar.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | -
7 |
8 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/app/src/test/java/ahmux/nutritionpoint/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package ahmux.nutritionpoint;
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() {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 16dp
4 | 16dp
5 | 8dp
6 | 176dp
7 | 16dp
8 | 18sp
9 | 18sp
10 |
11 |
12 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_menu_calculate.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/java/ahmux/nutritionpoint/AlarmReceiver.java:
--------------------------------------------------------------------------------
1 | package ahmux.nutritionpoint;
2 |
3 | import android.content.BroadcastReceiver;
4 | import android.content.Context;
5 | import android.content.Intent;
6 | import android.widget.Toast;
7 |
8 | public class AlarmReceiver extends BroadcastReceiver {
9 |
10 | NotificationsController nc = new NotificationsController();
11 | int id=0;
12 |
13 | @Override
14 | public void onReceive(Context context, Intent intent) {
15 | nc.notify(context, context.getString(R.string.notification_string), id);
16 | id++; }
17 | }
18 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_menu_facebook.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_menu_reminders.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/main.xml:
--------------------------------------------------------------------------------
1 |
2 |
18 |
--------------------------------------------------------------------------------
/.idea/runConfigurations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
11 |
12 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_help_outline_black_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_menu_recipes.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/values/drawables.xml:
--------------------------------------------------------------------------------
1 |
2 | - @android:drawable/ic_menu_camera
3 | - @android:drawable/ic_menu_gallery
4 | - @android:drawable/ic_menu_slideshow
5 | - @android:drawable/ic_menu_manage
6 | - @android:drawable/ic_menu_share
7 | - @android:drawable/ic_menu_send
8 |
9 |
--------------------------------------------------------------------------------
/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_splash.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
15 |
16 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_share.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 | # IDE (e.g. Android Studio) users:
3 | # Gradle settings configured through the IDE *will override*
4 | # any settings specified in this file.
5 | # For more details on how to configure your build environment visit
6 | # http://www.gradle.org/docs/current/userguide/build_environment.html
7 | # Specifies the JVM arguments used for the daemon process.
8 | # The setting is particularly useful for tweaking memory settings.
9 | org.gradle.jvmargs=-Xmx1536m
10 | # When configured, Gradle will run in incubating parallel mode.
11 | # This option should only be used with decoupled projects. More details, visit
12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
13 | # org.gradle.parallel=true
14 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
22 |
--------------------------------------------------------------------------------
/app/src/androidTest/java/ahmux/nutritionpoint/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package ahmux.nutritionpoint;
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 | * Instrumented 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() {
21 | // Context of the app under test.
22 | Context appContext = InstrumentationRegistry.getTargetContext();
23 |
24 | assertEquals("ahmux.nutritionpoint", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/custom_button.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | -
5 |
6 |
7 |
10 |
12 |
13 |
14 |
15 | -
16 |
17 |
19 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/animation_button.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | -
5 |
6 |
10 |
11 |
14 |
16 |
17 |
18 | -
19 |
20 |
22 |
25 |
26 |
27 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3cb371
4 | #2e8b57
5 | #c0392b
6 | #def9df
7 | #6a7868
8 |
9 |
10 | #D500F9
11 | #4A148C
12 |
13 |
14 | #FFC400
15 | #FF6F00
16 |
17 |
18 | #00E676
19 | #1B5E20
20 | #99CC00
21 |
22 |
23 | #FF1744
24 | #B71C1C
25 |
26 |
27 |
--------------------------------------------------------------------------------
/app/src/main/java/ahmux/nutritionpoint/SplashActivity.java:
--------------------------------------------------------------------------------
1 | package ahmux.nutritionpoint;
2 |
3 | import android.content.Intent;
4 | import android.os.Handler;
5 | import android.support.v7.app.AppCompatActivity;
6 | import android.os.Bundle;
7 |
8 | public class SplashActivity extends AppCompatActivity {
9 | Handler splashHandler = new Handler();
10 |
11 | @Override
12 | protected void onCreate(Bundle savedInstanceState) {
13 | super.onCreate(savedInstanceState);
14 | setContentView(R.layout.activity_splash);
15 | splashHandler.postDelayed(splashRunnable, 2000);
16 | }
17 |
18 | //Create Runnable object r
19 | Runnable splashRunnable = new Runnable() {
20 | @Override
21 | public void run() {
22 | try{
23 | //start NavActivity
24 | Intent i = new Intent(SplashActivity.this, MainActivity.class);
25 | startActivity(i);
26 | //close SplashActivity
27 | finish();
28 | }catch (Exception e){}
29 | }
30 | };
31 | }
32 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_menu_twitter.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/app_bar_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
13 |
14 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
16 |
17 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 28
5 | defaultConfig {
6 | applicationId "ahmux.nutritionpoint"
7 | minSdkVersion 15
8 | targetSdkVersion 28
9 | versionCode 1
10 | versionName "1.0"
11 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
12 | }
13 | buildTypes {
14 | release {
15 | minifyEnabled false
16 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
17 | }
18 | }
19 | sourceSets { main { assets.srcDirs = ['src/main/assets', 'src/main/assets/'] } }
20 | }
21 |
22 | dependencies {
23 | implementation fileTree(dir: 'libs', include: ['*.jar'])
24 | implementation 'com.android.support:appcompat-v7:28.0.0-rc02'
25 | implementation 'com.android.support:design:28.0.0-rc01'
26 | implementation 'com.android.support.constraint:constraint-layout:1.1.3'
27 | implementation 'com.android.support:support-v4:28.0.0-rc02'
28 | testImplementation 'junit:junit:4.12'
29 | androidTestImplementation 'com.android.support.test:runner:1.0.2'
30 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
31 | }
32 |
--------------------------------------------------------------------------------
/app/src/main/res/values-ar/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | NutritionPoint
4 | من نحن
5 | اخـتر النـوع؟
6 | ذكر
7 | انثى
8 | ابدأ تحليل البيانات
9 | English
10 | HEALTH MONITOR
11 | ملخص البيانات
12 | عرض البيانات
13 | اعادة تحليل البيانات
14 | برجاء الضغط مرة اخرى للخروج
15 | وصفات اكل صحية
16 |
17 | التذكير بشرب كوب من الماء
18 | تذكير شرب الماء
19 | ضبط التنـبيـهات
20 | سنة
21 | كيلوجرام
22 | ذكر
23 | انثى
24 | السن
25 | الوزن
26 | الطول
27 | تحليل المعلومات
28 |
29 |
--------------------------------------------------------------------------------
/app/src/main/java/ahmux/nutritionpoint/Fragment5.java:
--------------------------------------------------------------------------------
1 | package ahmux.nutritionpoint;
2 |
3 |
4 | import android.graphics.Typeface;
5 | import android.os.Bundle;
6 | import android.support.annotation.NonNull;
7 | import android.support.annotation.Nullable;
8 | import android.support.v4.app.Fragment;
9 | import android.view.LayoutInflater;
10 | import android.view.View;
11 | import android.view.ViewGroup;
12 | import android.widget.Button;
13 | import android.widget.TextView;
14 | import android.widget.Toast;
15 |
16 |
17 | public class Fragment5 extends Fragment implements View.OnClickListener{
18 |
19 | Button b1,b2;
20 | FragmentsCommunicator fc;
21 | @Override
22 | public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
23 | View view = inflater.inflate(R.layout.f5_layout,container,false);
24 |
25 | b1 = (Button)view.findViewById(R.id.clearBtn);
26 | b1.setOnClickListener(this);
27 |
28 | b2 = (Button)view.findViewById(R.id.showBtn);
29 | b2.setOnClickListener(this);
30 |
31 | return view;
32 | }
33 |
34 | @Override
35 | public void onClick(View view) {
36 | fc = (FragmentsCommunicator) getActivity();
37 |
38 | if (view.getId() == R.id.clearBtn){
39 | fc.respond("clear", 1);
40 | }
41 | else if(view.getId() == R.id.showBtn){
42 | fc.respond("show", 1);
43 | }
44 | }
45 | }
--------------------------------------------------------------------------------
/app/src/main/res/layout/nav_header_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
14 |
15 |
22 |
23 |
29 |
30 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/activity_main_drawer.xml:
--------------------------------------------------------------------------------
1 |
2 |
43 |
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/app/src/main/java/ahmux/nutritionpoint/AboutFragment.java:
--------------------------------------------------------------------------------
1 | package ahmux.nutritionpoint;
2 |
3 |
4 | import android.content.Intent;
5 | import android.net.Uri;
6 | import android.os.Bundle;
7 | import android.support.v4.app.Fragment;
8 | import android.view.LayoutInflater;
9 | import android.view.View;
10 | import android.view.ViewGroup;
11 | import android.widget.ImageView;
12 |
13 |
14 | public class AboutFragment extends Fragment {
15 |
16 |
17 | @Override
18 | public View onCreateView(LayoutInflater inflater, ViewGroup container,
19 | Bundle savedInstanceState) {
20 | View view = inflater.inflate(R.layout.fragment_about, container, false);
21 |
22 | ImageView facebook = (ImageView) view.findViewById(R.id.imageView7);
23 | facebook.setOnClickListener(new View.OnClickListener() {
24 | @Override
25 | public void onClick(View view) {
26 | try {
27 | Intent fbIntent = new Intent(Intent.ACTION_VIEW);
28 | fbIntent.setData(Uri.parse("https://www.facebook.com/supportnutritionpoit"));
29 | startActivity(fbIntent);
30 | } catch (Exception e) {}
31 | }
32 | });
33 |
34 | ImageView twitter = (ImageView) view.findViewById(R.id.imageView8);
35 | twitter.setOnClickListener(new View.OnClickListener() {
36 | @Override
37 | public void onClick(View view) {
38 | try {
39 | Intent tIntent = new Intent(Intent.ACTION_VIEW);
40 | tIntent.setData(Uri.parse("https://twitter.com/dawlatyaktieen"));
41 | startActivity(tIntent);
42 | } catch (Exception e) {}
43 | }
44 | });
45 | return view;
46 | }
47 |
48 | }
49 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | Nutrition Point
3 | Open navigation drawer
4 | Close navigation drawer
5 | About
6 |
7 | Choose your Gender?
8 | MALE
9 | FEMALE
10 | START BODY ANALYSIS
11 | العربية
12 | Physical Activity
13 | HEALTH MONITOR
14 | YOUR PROFILE SUMMARY
15 | show Analysis
16 | Restart Body Analysis
17 | Press Back again to Exit
18 | Healthy Recipes
19 |
20 |
21 | reminder to drink a cup of water
22 | Water Reminder
23 | Reminders
24 | Years
25 | kg
26 | Male
27 | Female
28 |
29 |
30 | Hello blank fragment
31 | AGE
32 | Weight
33 | Height
34 | Analyze Data
35 |
36 |
--------------------------------------------------------------------------------
/.idea/codeStyles/Project.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/app/src/main/java/ahmux/nutritionpoint/Fragment1.java:
--------------------------------------------------------------------------------
1 | package ahmux.nutritionpoint;
2 |
3 |
4 | import android.content.res.AssetManager;
5 | import android.graphics.Typeface;
6 | import android.os.Bundle;
7 | import android.support.annotation.NonNull;
8 | import android.support.annotation.Nullable;
9 | import android.support.v4.app.Fragment;
10 | import android.view.LayoutInflater;
11 | import android.view.View;
12 | import android.view.ViewGroup;
13 | import android.widget.Button;
14 | import android.widget.TextView;
15 |
16 | public class Fragment1 extends Fragment implements View.OnClickListener {
17 |
18 | Button b1, b2;
19 | TextView tv1,tv2;
20 | View view;
21 | FragmentsCommunicator fc;
22 | Typeface tf;
23 |
24 |
25 | @Override
26 | public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
27 | view = inflater.inflate(R.layout.f1_layout, container, false);
28 |
29 | tf = Typeface.createFromAsset(getActivity().getAssets(), "fonts/Questv1-Bold.otf");
30 | tv1 = (TextView)view.findViewById(R.id.textView1);
31 | tv2 = (TextView)view.findViewById(R.id.textView2);
32 | tv1.setTypeface(tf);
33 | tv2.setTypeface(tf);
34 |
35 | b1 = (Button) view.findViewById(R.id.maleBtn);
36 | b2 = (Button) view.findViewById(R.id.femaleBtn);
37 | b1.setOnClickListener(this);
38 | b2.setOnClickListener(this);
39 | b1.setTypeface(tf);
40 | b2.setTypeface(tf);
41 |
42 | return view;
43 | }
44 |
45 | @Override
46 | public void onClick(View view) {
47 | fc = (FragmentsCommunicator) getActivity();
48 |
49 | if (view.getId() == R.id.maleBtn){
50 | fc.respond("male", 0);
51 |
52 | }else if (view.getId() == R.id.femaleBtn){
53 | fc.respond("female", 0);
54 | }
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
14 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
30 |
33 |
34 |
38 |
39 |
40 |
41 |
42 |
43 |
46 |
47 |
48 |
49 |
--------------------------------------------------------------------------------
/.idea/assetWizardSettings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/app/src/main/java/ahmux/nutritionpoint/Fragment2.java:
--------------------------------------------------------------------------------
1 | package ahmux.nutritionpoint;
2 |
3 |
4 | import android.os.Bundle;
5 | import android.support.v4.app.Fragment;
6 | import android.view.LayoutInflater;
7 | import android.view.View;
8 | import android.view.ViewGroup;
9 | import android.widget.Button;
10 | import android.widget.Toast;
11 |
12 | public class Fragment2 extends Fragment implements View.OnClickListener {
13 |
14 | Button b1,b2,b3,b4,b5;
15 | FragmentsCommunicator fc;
16 | @Override
17 | public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
18 | View view = inflater.inflate(R.layout.f2_layout, container, false);
19 |
20 | b1 = (Button) view.findViewById(R.id.button6);
21 | b2 = (Button) view.findViewById(R.id.button7);
22 | b3 = (Button) view.findViewById(R.id.button8);
23 | b4 = (Button) view.findViewById(R.id.button9);
24 | b5 = (Button) view.findViewById(R.id.button10);
25 |
26 | b1.setOnClickListener(this);
27 | b2.setOnClickListener(this);
28 | b3.setOnClickListener(this);
29 | b4.setOnClickListener(this);
30 | b5.setOnClickListener(this);
31 |
32 | return view;
33 | }
34 |
35 |
36 | @Override
37 | public void onClick(View view) {
38 | fc = (FragmentsCommunicator) getActivity();
39 | switch (view.getId()){
40 | case (R.id.button6):
41 | fc.respond("no activity", 0);
42 | break;
43 | case (R.id.button7):
44 | fc.respond("walking", 0);
45 | break;
46 | case (R.id.button8):
47 | fc.respond("exercize 1-2 days", 0);
48 | break;
49 | case (R.id.button9):
50 | fc.respond("exercize 3-5 days", 0);
51 | break;
52 | case (R.id.button10):
53 | fc.respond("everyday", 0);
54 | break;
55 | }
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v24/ic_launcher_foreground.xml:
--------------------------------------------------------------------------------
1 |
7 |
12 |
13 |
19 |
22 |
25 |
26 |
27 |
28 |
34 |
35 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/f5_layout.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
14 |
15 |
30 |
31 |
39 |
40 |
48 |
49 |
50 |
51 |
52 |
--------------------------------------------------------------------------------
/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 | set DIRNAME=%~dp0
12 | if "%DIRNAME%" == "" set DIRNAME=.
13 | set APP_BASE_NAME=%~n0
14 | set APP_HOME=%DIRNAME%
15 |
16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
17 | set DEFAULT_JVM_OPTS=
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 Windows variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 |
53 | :win9xME_args
54 | @rem Slurp the command line arguments.
55 | set CMD_LINE_ARGS=
56 | set _SKIP=2
57 |
58 | :win9xME_args_slurp
59 | if "x%~1" == "x" goto execute
60 |
61 | set CMD_LINE_ARGS=%*
62 |
63 | :execute
64 | @rem Setup the command line
65 |
66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
67 |
68 | @rem Execute Gradle
69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
70 |
71 | :end
72 | @rem End local scope for the variables with windows NT shell
73 | if "%ERRORLEVEL%"=="0" goto mainEnd
74 |
75 | :fail
76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
77 | rem the _cmd.exe /c_ return code!
78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
79 | exit /b 1
80 |
81 | :mainEnd
82 | if "%OS%"=="Windows_NT" endlocal
83 |
84 | :omega
85 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Nutrition Point Application
2 | ###### Android App to manage your Diet Plans,calculate calories and Healthy recipes
3 |
4 |
5 | Android Studio IDE
6 |
7 | Nutrition point app source code is built in Android Studio IDE.
8 |
9 | ##
10 |
11 |
12 | ##### Splash Screen
13 | Show a splash screen to user when user start your Android App.
14 |
15 | ##
16 |
17 | API
18 |
19 | API’s is used for fetching data from backend server. we used it to calculate calories for all food types and fetch hundreds of food recipes compatible with all Diet types and health cases.
20 |
21 | ##
22 |
23 | ##### Navigation Drawer Menu
24 | In Navigation Drawer menu the user will see many options to get most out of the App and moving between activities and Fragments.
25 |
26 | ##
27 |
28 | Advance Push Notification
29 |
30 | Nutrition Point App can send notifications for different Reminders. It calculates the amount of water your Body needs and the periods between notifications. also the times of your diet meals during the day.
31 |
32 | ##
33 |
34 | Exit Confirmation Toast
35 |
36 | When user try to exit the App, the confirmation toast will be displayed on screen asking user to click once again back button to exit.
37 |
38 | ##
39 |
40 | ##### Scroll View
41 |
42 | Nutrition Point content Vertically Scrolling. make the content vertically scrollable.
43 |
44 |
45 | ##
46 |
47 | #### Arabic Language Support
48 | Nutrition Point supports to help Arabic users
49 |
50 | ##
51 |
52 | ##### ScreenShots
53 |
54 | 
55 | 
56 |
57 |
58 |
59 |
60 |
61 |
62 |
--------------------------------------------------------------------------------
/app/src/main/java/ahmux/nutritionpoint/NotificationsController.java:
--------------------------------------------------------------------------------
1 | package ahmux.nutritionpoint;
2 |
3 | import android.annotation.SuppressLint;
4 | import android.annotation.TargetApi;
5 | import android.app.Notification;
6 | import android.app.NotificationManager;
7 | import android.app.PendingIntent;
8 | import android.content.Context;
9 | import android.content.Intent;
10 | import android.content.res.Resources;
11 | import android.graphics.Bitmap;
12 | import android.graphics.BitmapFactory;
13 | import android.net.Uri;
14 | import android.os.Build;
15 | import android.support.v4.app.NotificationCompat;
16 |
17 | public class NotificationsController {
18 |
19 | private static final String NOTIFICATION_TAG = "Nutrition Point";
20 |
21 | public static void notify(final Context context, final String notificatioTicker, final int number) {
22 | final Resources res = context.getResources();
23 | final Bitmap picture = BitmapFactory.decodeResource(res, R.mipmap.ic_launcher);
24 | final String title = "Nutrition Point";
25 | final String text = res.getString(R.string.notification_text, notificatioTicker);
26 |
27 | Intent backIntent = new Intent(context, MainActivity.class);
28 | final NotificationCompat.Builder builder = new NotificationCompat.Builder(context)
29 |
30 | .setDefaults(Notification.DEFAULT_ALL)
31 | .setSmallIcon(R.drawable.ic_stat_s_controller)
32 | .setContentTitle(title)
33 | .setContentText(text)
34 | .setPriority(NotificationCompat.PRIORITY_DEFAULT)
35 | .setLargeIcon(picture)
36 | .setTicker(notificatioTicker)
37 | .setNumber(number)
38 | .setStyle(new NotificationCompat.BigTextStyle()
39 | .bigText(text)
40 | .setBigContentTitle(title)
41 | .setSummaryText("Drink Some Water"))
42 |
43 | // Set the pending intent to be initiated when the user touche the notification.
44 | .setContentIntent(
45 | PendingIntent.getActivity(context, 0, backIntent,
46 | PendingIntent.FLAG_UPDATE_CURRENT))
47 | .setAutoCancel(true);
48 |
49 | notify(context, builder.build());
50 | }
51 |
52 | @TargetApi(Build.VERSION_CODES.ECLAIR)
53 | private static void notify(final Context context, final Notification notification) {
54 | final NotificationManager nm = (NotificationManager) context
55 | .getSystemService(Context.NOTIFICATION_SERVICE);
56 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ECLAIR) {
57 | nm.notify(NOTIFICATION_TAG, 0, notification);
58 | } else {
59 | nm.notify(NOTIFICATION_TAG.hashCode(), notification);
60 | }
61 | }
62 |
63 | }
64 |
--------------------------------------------------------------------------------
/app/src/main/java/ahmux/nutritionpoint/Fragment3.java:
--------------------------------------------------------------------------------
1 | package ahmux.nutritionpoint;
2 |
3 |
4 | import android.os.Bundle;
5 | import android.support.v4.app.Fragment;
6 | import android.view.Gravity;
7 | import android.view.LayoutInflater;
8 | import android.view.View;
9 | import android.view.ViewGroup;
10 | import android.widget.Button;
11 | import android.widget.EditText;
12 | import android.widget.NumberPicker;
13 | import android.widget.Toast;
14 |
15 | public class Fragment3 extends Fragment implements View.OnClickListener{
16 |
17 | Button b1;
18 | NumberPicker noPicker = null;
19 | FragmentsCommunicator fc;
20 | EditText et1, et2;
21 | int age;
22 |
23 | @Override
24 | public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
25 | View view = inflater.inflate(R.layout.f3_layout, container, false);
26 |
27 | fc = (FragmentsCommunicator) getActivity();
28 | b1 = (Button)view.findViewById(R.id.button);
29 | b1.setOnClickListener(this);
30 |
31 | et1 =(EditText) view.findViewById(R.id.editText1);
32 | et2 =(EditText) view.findViewById(R.id.editText2);
33 |
34 | noPicker = (NumberPicker)view.findViewById(R.id.numberPicker);
35 | noPicker.setMaxValue(100);
36 | noPicker.setMinValue(10);
37 | //selector wheel wraps when reaching the min/max value.
38 | noPicker.setWrapSelectorWheel(false);
39 | // special format --> noPicker.setFormatter();
40 | noPicker.setValue(30);
41 | noPicker.setSaveEnabled(false);
42 | noPicker.setOnValueChangedListener(new NumberPicker.OnValueChangeListener() {
43 | @Override
44 | public void onValueChange(NumberPicker numberPicker, int oldValue, int newValue) {
45 | age = newValue;
46 | }
47 | });
48 | return view;
49 | }
50 |
51 | @Override
52 | public void onClick(View view) {
53 | fc = (FragmentsCommunicator) getActivity();
54 |
55 | if (age == 0){
56 | Toast.makeText(getActivity(), "Please Enter your AGE!", Toast.LENGTH_SHORT).show();
57 | }else if (et1.getText().toString().matches("")) {
58 | Toast.makeText(getActivity(), "Please Enter your WEIGHT in kg!", Toast.LENGTH_SHORT).show();
59 | }else if(Integer.valueOf(et1.getText().toString()) < 20 || Integer.valueOf(et1.getText().toString()) > 250){
60 | Toast.makeText(getActivity(), "Please Enter valid WEIGHT in kg!", Toast.LENGTH_SHORT).show();
61 | }else if (et2.getText().toString().matches("")){
62 | Toast.makeText(getActivity(), "Please Enter your Height in cm!", Toast.LENGTH_SHORT).show();
63 | }else if(Integer.valueOf(et2.getText().toString()) < 60 || Integer.valueOf(et2.getText().toString()) > 220){
64 | Toast.makeText(getActivity(), "Please Enter valid Height in cm!", Toast.LENGTH_SHORT).show();
65 | }
66 | else{
67 | fc.respond("age", age );
68 | fc.respond("weight", Integer.valueOf(et1.getText().toString()));
69 | fc.respond("height", Integer.valueOf(et2.getText().toString()));
70 | fc.respond("analyze", 0);
71 | }
72 | }
73 | }
74 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/f1_layout.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
13 |
14 |
28 |
29 |
38 |
39 |
45 |
46 |
50 |
51 |
62 |
63 |
64 |
68 |
69 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/f2_layout.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
17 |
18 |
30 |
31 |
42 |
43 |
54 |
55 |
66 |
67 |
78 |
79 |
90 |
91 |
92 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/content_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
15 |
16 |
20 |
21 |
25 |
26 |
27 |
37 |
38 |
43 |
44 |
56 |
57 |
66 |
67 |
76 |
77 |
78 |
86 |
87 |
88 |
89 |
90 |
94 |
95 |
96 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/f3_layout.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
16 |
17 |
18 |
25 |
26 |
36 |
37 |
44 |
45 |
46 |
47 |
52 |
53 |
66 |
67 |
80 |
81 |
82 |
85 |
86 |
97 |
98 |
99 |
100 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_api.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
14 |
15 |
24 |
25 |
32 |
33 |
42 |
43 |
51 |
52 |
58 |
59 |
66 |
67 |
73 |
74 |
80 |
81 |
87 |
88 |
94 |
95 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
--------------------------------------------------------------------------------
/app/src/main/java/ahmux/nutritionpoint/ApiActivity.java:
--------------------------------------------------------------------------------
1 | package ahmux.nutritionpoint;
2 |
3 | import android.os.AsyncTask;
4 | import android.support.v7.app.AppCompatActivity;
5 | import android.os.Bundle;
6 | import android.view.View;
7 | import android.widget.EditText;
8 | import android.widget.TextView;
9 | import android.widget.Toast;
10 |
11 | import org.json.JSONArray;
12 | import org.json.JSONException;
13 | import org.json.JSONObject;
14 |
15 | import java.io.BufferedReader;
16 | import java.io.InputStreamReader;
17 | import java.net.HttpURLConnection;
18 | import java.net.URL;
19 |
20 | public class ApiActivity extends AppCompatActivity {
21 |
22 | String food;
23 | EditText et;
24 | TextView tv1, tv2,tv3, tv4, tv5;
25 | View v1, v2;
26 |
27 | @Override
28 | protected void onCreate(Bundle savedInstanceState) {
29 | super.onCreate(savedInstanceState);
30 | setContentView(R.layout.activity_api);
31 |
32 | et = (EditText)findViewById(R.id.editText);
33 | tv1 = (TextView)findViewById(R.id.textView13);
34 | tv2 = (TextView)findViewById(R.id.textView16);
35 | tv3 = (TextView)findViewById(R.id.textView17);
36 | tv4 = (TextView)findViewById(R.id.textView18);
37 | tv5 = (TextView)findViewById(R.id.textView19);
38 |
39 | }
40 |
41 |
42 | public void calculateClk(View view) {
43 | food = et.getText().toString();
44 | Toast.makeText(this, "Searching...", Toast.LENGTH_SHORT).show();
45 | new MyAsyncTask().execute();
46 | }
47 |
48 |
49 | /* #####AsyncTask Subclass################################################################### */
50 | private class MyAsyncTask extends AsyncTask{
51 |
52 | @Override
53 | protected String doInBackground(String... strings) {
54 |
55 | String allStrings;
56 | try{
57 | URL myUrl = new URL("https://api.nutritionix.com/v1_1/search/" +
58 | food +"?fields=item_name%2Citem_id%2Cnf_calories%2Cnf_total_fat" +
59 | "&appId=3fe5fa47&appKey=61729b9d2d8612a629467f0cdbbd6d2c");
60 | HttpURLConnection connection =(HttpURLConnection) myUrl.openConnection();
61 | connection.setConnectTimeout(700);
62 | connection.connect();
63 |
64 | //Create a new InputStreamReader
65 | InputStreamReader streamReader = new InputStreamReader(connection.getInputStream());
66 | //Create a new buffered reader and String Builder
67 | BufferedReader reader = new BufferedReader(streamReader);
68 |
69 | String inputLine;
70 | StringBuilder stringBuilder = new StringBuilder();
71 | //Check if the line we are reading is not null
72 | while((inputLine = reader.readLine()) != null){
73 | stringBuilder.append(inputLine);
74 | }
75 | reader.close();
76 | streamReader.close();
77 | allStrings = stringBuilder.toString();
78 | publishProgress(allStrings);
79 |
80 | }catch(Exception e){}
81 | return "";
82 | }
83 |
84 | @Override
85 | protected void onProgressUpdate(String... values) {
86 | try {
87 | JSONObject j = new JSONObject(values[0]);
88 |
89 | JSONArray h= (JSONArray) j.get("hits");
90 |
91 | JSONObject rec = h.getJSONObject(0);
92 |
93 | JSONObject fields = rec.getJSONObject("fields");
94 |
95 | String calories = fields.getString("nf_calories");
96 | String fat = fields.getString("nf_total_fat");
97 | String name = fields.getString("item_name");
98 |
99 |
100 | tv2.setText("Nutrition Facts");
101 | tv3.setText("Amount: " + name);
102 | tv4.setText("Calories: " +calories);
103 | tv5.setText("Total Fat: " + fat);
104 | v1 = findViewById(R.id.view);
105 | v1.setVisibility(View.VISIBLE);
106 | v2 = findViewById(R.id.view);
107 | v2.setVisibility(View.VISIBLE);
108 |
109 |
110 | } catch (JSONException e) {
111 | e.printStackTrace();
112 | }
113 | }
114 | }
115 | }
116 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_about.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
11 |
22 |
23 |
33 |
34 |
40 |
41 |
47 |
48 |
58 |
59 |
68 |
69 |
78 |
79 |
80 |
81 |
87 |
88 |
98 |
99 |
109 |
110 |
111 |
--------------------------------------------------------------------------------
/app/src/main/java/ahmux/nutritionpoint/Fragment4.java:
--------------------------------------------------------------------------------
1 | package ahmux.nutritionpoint;
2 |
3 |
4 | import android.content.Context;
5 | import android.content.Intent;
6 | import android.content.SharedPreferences;
7 | import android.graphics.Typeface;
8 | import android.os.Bundle;
9 | import android.support.annotation.NonNull;
10 | import android.support.annotation.Nullable;
11 | import android.support.v4.app.Fragment;
12 | import android.view.LayoutInflater;
13 | import android.view.View;
14 | import android.view.ViewGroup;
15 | import android.widget.Button;
16 | import android.widget.ImageView;
17 | import android.widget.SeekBar;
18 | import android.widget.TextView;
19 | import android.widget.Toast;
20 |
21 | public class Fragment4 extends Fragment implements View.OnClickListener{
22 |
23 | Button b1, b2, b3;
24 | String age, weight, height;
25 | TextView tv1,tv2, tv3, tv4, tv5, tv6;
26 | ImageView iv1, iv2;
27 | FragmentsCommunicator fc;
28 | SeekBar seekBar;
29 | double bmi, water;
30 |
31 |
32 |
33 | @Override
34 | public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
35 | View view = inflater.inflate(R.layout.f4_layout,container,false);
36 | Typeface tf = Typeface.createFromAsset(getActivity().getAssets(), "fonts/Questv1-Bold.otf");
37 |
38 | MainActivity activity = (MainActivity) getActivity();
39 | age = activity.getMyData("age");
40 | weight = activity.getMyData("weight");
41 | height = activity.getMyData("height");
42 |
43 |
44 | iv1 = (ImageView)view.findViewById(R.id.imageView1);
45 | iv1.setOnClickListener(this);
46 | iv2 = (ImageView)view.findViewById(R.id.imageView2);
47 | iv2.setOnClickListener(this);
48 |
49 | b1 = (Button)view.findViewById(R.id.okBtn);
50 | b1.setOnClickListener(this);
51 | b2 = (Button)view.findViewById(R.id.waterBtn);
52 | b2.setOnClickListener(this);
53 | b3 = (Button)view.findViewById(R.id.caloriesBtn);
54 | b3.setOnClickListener(this);
55 |
56 | tv1 = (TextView)view.findViewById(R.id.bmiTV1);
57 | tv2 = (TextView)view.findViewById(R.id.bmiTV2);
58 | tv3 = (TextView)view.findViewById(R.id.genderTV);
59 | tv4 = (TextView)view.findViewById(R.id.ageTV);
60 | tv5 = (TextView)view.findViewById(R.id.weightTV);
61 | tv6 = (TextView)view.findViewById(R.id.waterTV);
62 |
63 |
64 | tv3.setText(activity.getMyData("gender"));
65 | tv3.setTypeface(tf);
66 | tv4.setText(age +" "+ getString(R.string.years));
67 | tv4.setTypeface(tf);
68 | tv5.setText(weight +" " + getString(R.string.kg));
69 | tv5.setTypeface(tf);
70 |
71 |
72 | //BMI Calculations
73 | bmi = (Integer.valueOf(weight) * 10000) / (Integer.valueOf(height) * Integer.valueOf(height));
74 | tv1.setText("Your BMI: " + Math.round(bmi * 10d) / 10d);
75 | tv1.setTypeface(tf);
76 |
77 | if (bmi >= 30){
78 | tv2.setText("Obesity");
79 | }else if ((bmi >= 25) && (bmi < 30)){
80 | tv2.setText("Overweight");
81 | }else if (bmi <= 18){
82 | tv2.setText("Under Weight");
83 | }else if((bmi > 18) && (bmi < 25) ){
84 | tv2.setText("Normal");
85 | }
86 |
87 | seekBar = view.findViewById(R.id.seekBar);
88 | seekBar.setProgress((int)Math.round(bmi));
89 |
90 |
91 |
92 | //Calculate Body water
93 | if (Integer.valueOf(age) <= 30){
94 | water = (Integer.valueOf(weight) * 42 * 2.95) / (28.3 * 100);
95 |
96 | }else if (Integer.valueOf(age) > 30 && Integer.valueOf(age) <= 35){
97 | water = (Integer.valueOf(weight) * 37 * 2.95) / (28.3 * 100);
98 |
99 | }else if (Integer.valueOf(age) > 35){
100 | water = (Integer.valueOf(weight) * 32 * 2.95) / (28.3 * 100);
101 | }
102 |
103 | tv6.setText("You need: " + (Math.round(water * 10d) / 10d) + " L/day");
104 |
105 |
106 | return view;
107 | }
108 |
109 | @Override
110 | public void onClick(View view) {
111 | fc = (FragmentsCommunicator) getActivity();
112 | if(view.getId() == R.id.okBtn){
113 | fc.respond("metabolic", 40);
114 | fc.respond("ok",0);
115 | }else if(view.getId() == R.id.imageView1){
116 | Toast.makeText(getActivity(), "BMI = Body Mass Index", Toast.LENGTH_LONG).show();
117 | }else if(view.getId() == R.id.imageView2) {
118 | Toast.makeText(getActivity(), "Water Body needs", Toast.LENGTH_LONG).show();
119 | }else if(view.getId() == R.id.imageView3) {
120 | Toast.makeText(getActivity(), "Calories Analysis", Toast.LENGTH_LONG).show();
121 | }else if(view.getId() == R.id.waterBtn){
122 | Intent RemindersIntent = new Intent(getActivity(), RemindersActivity.class);
123 | startActivity(RemindersIntent);
124 | }else if(view.getId() == R.id.caloriesBtn) {
125 | Intent apiIntent = new Intent(getActivity(), ApiActivity.class);
126 | startActivity(apiIntent);
127 | }
128 | }
129 | }
130 |
--------------------------------------------------------------------------------
/app/src/main/java/ahmux/nutritionpoint/RemindersActivity.java:
--------------------------------------------------------------------------------
1 | package ahmux.nutritionpoint;
2 |
3 | /* ######################################## */
4 | /* Nutrition Point App developed by Ahmux */
5 | /* ##### Ahmux.freelander@gmail.com ###### */
6 | /* ######################################## */
7 |
8 | import android.app.Activity;
9 | import android.app.AlarmManager;
10 | import android.app.PendingIntent;
11 | import android.content.Context;
12 | import android.content.Intent;
13 | import android.content.SharedPreferences;
14 | import android.graphics.Color;
15 | import android.support.v7.app.ActionBar;
16 | import android.support.v7.app.AppCompatActivity;
17 | import android.os.Bundle;
18 | import android.view.View;
19 | import android.widget.Button;
20 | import android.widget.Toast;
21 |
22 | public class RemindersActivity extends AppCompatActivity implements View.OnClickListener {
23 |
24 | Button b1,b2, b3, b4, b5,b6,b7;
25 |
26 | @Override
27 | protected void onCreate(Bundle savedInstanceState) {
28 | super.onCreate(savedInstanceState);
29 | setContentView(R.layout.activity_reminders);
30 |
31 | ActionBar actionBar = getSupportActionBar();
32 | actionBar.setTitle(R.string.reminders_title);
33 |
34 | SharedPreferences sharedPreferences = getSharedPreferences("SettingsData", Activity.MODE_PRIVATE);
35 |
36 | b1 = (Button)findViewById(R.id.min15Btn);
37 | b1.setOnClickListener(this);
38 |
39 | b2 = (Button)findViewById(R.id.min30Btn);
40 | b2.setOnClickListener(this);
41 |
42 | b3 = (Button)findViewById(R.id.h1Btn);
43 | b3.setOnClickListener(this);
44 |
45 | b4 = (Button)findViewById(R.id.h2Btn);
46 | b4.setOnClickListener(this);
47 |
48 | b5 = (Button)findViewById(R.id.h4Btn);
49 | b5.setOnClickListener(this);
50 |
51 | b6 = (Button)findViewById(R.id.startBtn);
52 | b6.setOnClickListener(this);
53 |
54 | b7 = (Button)findViewById(R.id.stopBtn);
55 | b7.setOnClickListener(this);
56 | }
57 |
58 | @Override
59 | public void onClick(View view) {
60 | SharedPreferences sharedPreferences = getSharedPreferences("SettingsData", Activity.MODE_PRIVATE);
61 | SharedPreferences.Editor editor = sharedPreferences.edit();
62 | int delay = sharedPreferences.getInt("water_delay", 300);
63 |
64 |
65 | if (view.getId() == R.id.min15Btn || delay == 15){
66 | editor.putInt("water_delay", 15);
67 | b1.setTextColor(Color.parseColor("#FFCC00"));
68 | b2.setTextColor(Color.WHITE);
69 | b3.setTextColor(Color.WHITE);
70 | b4.setTextColor(Color.WHITE);
71 | b5.setTextColor(Color.WHITE);
72 | }
73 | else if (view.getId() == R.id.min30Btn || delay == 30){
74 | editor.putInt("water_delay", 30);
75 | b1.setTextColor(Color.WHITE);
76 | b2.setTextColor(Color.parseColor("#FFCC00"));
77 | b3.setTextColor(Color.WHITE);
78 | b4.setTextColor(Color.WHITE);
79 | b5.setTextColor(Color.WHITE);
80 | }
81 | else if (view.getId() == R.id.h1Btn || delay == 60){
82 | editor.putInt("water_delay", 60);
83 | b1.setTextColor(Color.WHITE);
84 | b2.setTextColor(Color.WHITE);
85 | b3.setTextColor(Color.parseColor("#FFCC00"));
86 | b4.setTextColor(Color.WHITE);
87 | b5.setTextColor(Color.WHITE);
88 | }
89 | else if (view.getId() == R.id.h2Btn || delay == 120){
90 | editor.putInt("water_delay", 120);
91 | b1.setTextColor(Color.WHITE);
92 | b2.setTextColor(Color.WHITE);
93 | b3.setTextColor(Color.WHITE);
94 | b4.setTextColor(Color.parseColor("#FFCC00"));
95 | b5.setTextColor(Color.WHITE);
96 | }
97 | else if (view.getId() == R.id.h4Btn || delay == 240){
98 | editor.putInt("water_delay", 240);
99 | b1.setTextColor(Color.WHITE);
100 | b2.setTextColor(Color.WHITE);
101 | b3.setTextColor(Color.WHITE);
102 | b4.setTextColor(Color.parseColor("#FFCC00"));
103 | b5.setTextColor(Color.WHITE);
104 | }
105 | else if (view.getId() == R.id.startBtn){
106 | AlarmManager alarmManager = (AlarmManager)getSystemService(Context.ALARM_SERVICE);
107 | Intent alarmIntent = new Intent(this, AlarmReceiver.class);
108 | PendingIntent pendingIntent = PendingIntent.getBroadcast(this,0, alarmIntent, PendingIntent.FLAG_UPDATE_CURRENT);
109 | alarmManager.setRepeating(AlarmManager.RTC_WAKEUP, System.currentTimeMillis(),delay*60*1000, pendingIntent);
110 | editor.putString("water_reminder", "true");
111 | }
112 | else if (view.getId() == R.id.stopBtn){
113 | editor.putString("water_reminder", "false");
114 | AlarmManager alarmManager = (AlarmManager)getSystemService(Context.ALARM_SERVICE);
115 | Intent alarmIntent = new Intent(this, AlarmReceiver.class);
116 | PendingIntent pendingIntent = PendingIntent.getBroadcast(this,0, alarmIntent, PendingIntent.FLAG_UPDATE_CURRENT);
117 | alarmManager.cancel(pendingIntent);
118 | Toast.makeText(this, "Water Reminders Stopped", Toast.LENGTH_SHORT).show();
119 | }
120 | }
121 | }
122 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env sh
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Attempt to set APP_HOME
10 | # Resolve links: $0 may be a link
11 | PRG="$0"
12 | # Need this for relative symlinks.
13 | while [ -h "$PRG" ] ; do
14 | ls=`ls -ld "$PRG"`
15 | link=`expr "$ls" : '.*-> \(.*\)$'`
16 | if expr "$link" : '/.*' > /dev/null; then
17 | PRG="$link"
18 | else
19 | PRG=`dirname "$PRG"`"/$link"
20 | fi
21 | done
22 | SAVED="`pwd`"
23 | cd "`dirname \"$PRG\"`/" >/dev/null
24 | APP_HOME="`pwd -P`"
25 | cd "$SAVED" >/dev/null
26 |
27 | APP_NAME="Gradle"
28 | APP_BASE_NAME=`basename "$0"`
29 |
30 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
31 | DEFAULT_JVM_OPTS=""
32 |
33 | # Use the maximum available, or set MAX_FD != -1 to use that value.
34 | MAX_FD="maximum"
35 |
36 | warn () {
37 | echo "$*"
38 | }
39 |
40 | die () {
41 | echo
42 | echo "$*"
43 | echo
44 | exit 1
45 | }
46 |
47 | # OS specific support (must be 'true' or 'false').
48 | cygwin=false
49 | msys=false
50 | darwin=false
51 | nonstop=false
52 | case "`uname`" in
53 | CYGWIN* )
54 | cygwin=true
55 | ;;
56 | Darwin* )
57 | darwin=true
58 | ;;
59 | MINGW* )
60 | msys=true
61 | ;;
62 | NONSTOP* )
63 | nonstop=true
64 | ;;
65 | esac
66 |
67 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
68 |
69 | # Determine the Java command to use to start the JVM.
70 | if [ -n "$JAVA_HOME" ] ; then
71 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
72 | # IBM's JDK on AIX uses strange locations for the executables
73 | JAVACMD="$JAVA_HOME/jre/sh/java"
74 | else
75 | JAVACMD="$JAVA_HOME/bin/java"
76 | fi
77 | if [ ! -x "$JAVACMD" ] ; then
78 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
79 |
80 | Please set the JAVA_HOME variable in your environment to match the
81 | location of your Java installation."
82 | fi
83 | else
84 | JAVACMD="java"
85 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
86 |
87 | Please set the JAVA_HOME variable in your environment to match the
88 | location of your Java installation."
89 | fi
90 |
91 | # Increase the maximum file descriptors if we can.
92 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
93 | MAX_FD_LIMIT=`ulimit -H -n`
94 | if [ $? -eq 0 ] ; then
95 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
96 | MAX_FD="$MAX_FD_LIMIT"
97 | fi
98 | ulimit -n $MAX_FD
99 | if [ $? -ne 0 ] ; then
100 | warn "Could not set maximum file descriptor limit: $MAX_FD"
101 | fi
102 | else
103 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
104 | fi
105 | fi
106 |
107 | # For Darwin, add options to specify how the application appears in the dock
108 | if $darwin; then
109 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
110 | fi
111 |
112 | # For Cygwin, switch paths to Windows format before running java
113 | if $cygwin ; then
114 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
115 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
116 | JAVACMD=`cygpath --unix "$JAVACMD"`
117 |
118 | # We build the pattern for arguments to be converted via cygpath
119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
120 | SEP=""
121 | for dir in $ROOTDIRSRAW ; do
122 | ROOTDIRS="$ROOTDIRS$SEP$dir"
123 | SEP="|"
124 | done
125 | OURCYGPATTERN="(^($ROOTDIRS))"
126 | # Add a user-defined pattern to the cygpath arguments
127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
129 | fi
130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
131 | i=0
132 | for arg in "$@" ; do
133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
135 |
136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
138 | else
139 | eval `echo args$i`="\"$arg\""
140 | fi
141 | i=$((i+1))
142 | done
143 | case $i in
144 | (0) set -- ;;
145 | (1) set -- "$args0" ;;
146 | (2) set -- "$args0" "$args1" ;;
147 | (3) set -- "$args0" "$args1" "$args2" ;;
148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
154 | esac
155 | fi
156 |
157 | # Escape application args
158 | save () {
159 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
160 | echo " "
161 | }
162 | APP_ARGS=$(save "$@")
163 |
164 | # Collect all arguments for the java command, following the shell quoting and substitution rules
165 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
166 |
167 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
168 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
169 | cd "$(dirname "$0")"
170 | fi
171 |
172 | exec "$JAVACMD" "$@"
173 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_reminders.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
13 |
14 |
22 |
23 |
27 |
28 |
38 |
39 |
47 |
48 |
52 |
53 |
62 |
63 |
72 |
73 |
81 |
82 |
91 |
92 |
100 |
101 |
102 |
106 |
107 |
116 |
117 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_launcher_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
10 |
15 |
20 |
25 |
30 |
35 |
40 |
45 |
50 |
55 |
60 |
65 |
70 |
75 |
80 |
85 |
90 |
95 |
100 |
105 |
110 |
115 |
120 |
125 |
130 |
135 |
140 |
145 |
150 |
155 |
160 |
165 |
170 |
171 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/f4_layout.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
14 |
15 |
19 |
20 |
29 |
30 |
38 |
39 |
43 |
44 |
53 |
54 |
63 |
64 |
73 |
74 |
75 |
76 |
77 |
78 |
86 |
87 |
91 |
92 |
96 |
97 |
106 |
107 |
116 |
117 |
118 |
128 |
129 |
137 |
138 |
150 |
151 |
152 |
153 |
154 |
162 |
163 |
167 |
168 |
172 |
173 |
182 |
183 |
191 |
192 |
193 |
203 |
204 |
212 |
213 |
214 |
215 |
216 |
224 |
228 |
232 |
233 |
242 |
243 |
251 |
252 |
253 |
262 |
263 |
271 |
272 |
273 |
274 |
275 |
276 |
277 |
278 |
279 |
280 |
281 |
282 |
283 |
284 |
285 |
286 |
287 |
288 |
293 |
294 |
295 |
296 |
297 |
--------------------------------------------------------------------------------
/app/src/main/java/ahmux/nutritionpoint/MainActivity.java:
--------------------------------------------------------------------------------
1 | package ahmux.nutritionpoint;
2 |
3 | /* ######################################## */
4 | /* Nutrition Point App developed by Ahmux */
5 | /* ##### Ahmux.freelander@gmail.com ###### */
6 | /* ######################################## */
7 |
8 | import android.app.Activity;
9 | import android.app.AlarmManager;
10 | import android.app.PendingIntent;
11 | import android.content.Context;
12 | import android.content.Intent;
13 | import android.content.SharedPreferences;
14 | import android.content.res.Configuration;
15 | import android.graphics.Typeface;
16 | import android.net.Uri;
17 | import android.os.Bundle;
18 | import android.support.v4.app.Fragment;
19 | import android.support.design.widget.NavigationView;
20 | import android.support.v4.view.GravityCompat;
21 | import android.support.v4.widget.DrawerLayout;
22 | import android.support.v7.app.ActionBarDrawerToggle;
23 | import android.support.v7.app.AppCompatActivity;
24 | import android.support.v7.widget.Toolbar;
25 | import android.util.DisplayMetrics;
26 | import android.view.Menu;
27 | import android.view.MenuItem;
28 | import android.widget.Button;
29 | import android.widget.Switch;
30 | import android.widget.TextView;
31 | import android.widget.Toast;
32 |
33 | import java.lang.reflect.Array;
34 | import java.util.Locale;
35 |
36 | public class MainActivity extends AppCompatActivity
37 | implements FragmentsCommunicator, NavigationView.OnNavigationItemSelectedListener {
38 |
39 | String fontPath = "fonts/Questv1-Bold.otf";
40 | Toast doubleBackToast;
41 | TextView tv1;
42 |
43 | @Override
44 | protected void onCreate(Bundle savedInstanceState) {
45 | super.onCreate(savedInstanceState);
46 | setContentView(R.layout.activity_main);
47 | Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
48 | setSupportActionBar(toolbar);
49 |
50 | tv1 = (TextView) findViewById(R.id.textView1);
51 |
52 | DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
53 | ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
54 | this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
55 | drawer.addDrawerListener(toggle);
56 | toggle.syncState();
57 |
58 | NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
59 | navigationView.setNavigationItemSelectedListener(this);
60 |
61 | loadLocale();
62 | saveData();
63 | waterReminder();
64 |
65 | // Loading Font Face
66 | Typeface tf = Typeface.createFromAsset(getAssets(), fontPath);
67 | tv1.setTypeface(tf);
68 |
69 | doubleBackToast = Toast.makeText(this,
70 | R.string.doubleBackToast, Toast.LENGTH_LONG);
71 | }
72 |
73 | /* ######### Communicate with Fragments ######################################################## */
74 | @Override
75 | //data1 is key, data2 is value
76 | public void respond(String data1, int data2) {
77 | SharedPreferences sharedPreferences = getSharedPreferences("UserData", Context.MODE_PRIVATE);
78 | SharedPreferences.Editor editor = sharedPreferences.edit();
79 |
80 | switch (data1){
81 | case("male"):
82 | editor.putString("gender", getString(R.string.Male));
83 | loadFragment(new Fragment2(), R.id.fullparentFramelayout);
84 | break;
85 | case("female"):
86 | editor.putString("gender", getString(R.string.Female));
87 | loadFragment(new Fragment2(),R.id.fullparentFramelayout);
88 | break;
89 | case("no activity"):
90 | editor.putString("physical_activity", "no activity");
91 | loadFragment(new Fragment3(), R.id.fullparentFramelayout);
92 | break;
93 | case("walking"):
94 | editor.putString("physical_activity", "walking");
95 | loadFragment(new Fragment3(), R.id.fullparentFramelayout);
96 | break;
97 | case("exercize 1-2 days"):
98 | loadFragment(new Fragment3(),R.id.fullparentFramelayout);
99 | break;
100 | case("exercize 3-5 days"):
101 | loadFragment(new Fragment3(), R.id.fullparentFramelayout);
102 | break;
103 | case("everyday"):
104 | loadFragment(new Fragment3(), R.id.fullparentFramelayout);
105 | break;
106 | case("age"):
107 | editor.putString("age", String.valueOf(data2));
108 | break;
109 | case("weight"):
110 | editor.putString("weight", String.valueOf(data2));
111 | break;
112 | case("height"):
113 | editor.putString("height", String.valueOf(data2));
114 | break;
115 | case("analyze"):
116 | loadFragment(new Fragment4(),R.id.fullparentFramelayout);
117 | break;
118 | case("ok"):
119 | Intent endIntent = new Intent(this, MainActivity .class);
120 | //set flags to clear back stack
121 | endIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
122 | startActivity(endIntent);
123 | break;
124 | case("clear"):
125 | Toast.makeText(this, "DATA CLEARED", Toast.LENGTH_SHORT).show();
126 | //clear data from shared preferences
127 | editor.clear();
128 | Intent clearIntent = new Intent(this, MainActivity .class);
129 | //clear back stack
130 | clearIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
131 | startActivity(clearIntent);
132 | break;
133 | case("show"):
134 | loadFragment(new Fragment4(),R.id.fullparentFramelayout);
135 | break;
136 | }
137 |
138 | editor.commit();
139 | }
140 | //Fragments loading method
141 | private void loadFragment(Fragment f, int layoutId) {
142 | android.support.v4.app.FragmentManager fm = getSupportFragmentManager();
143 | android.support.v4.app.FragmentTransaction ft = fm.beginTransaction();
144 |
145 | ft.replace(layoutId, f);
146 | ft.addToBackStack(null); // press back to go to previous fragment
147 | ft.commit();
148 | }
149 | /* ############################################################################################# */
150 |
151 |
152 | /* #############Saving data in Shared Preferences############################################### */
153 | private void saveData() {
154 | SharedPreferences sharedPreferences = getSharedPreferences("UserData", Context.MODE_PRIVATE);
155 | String gender = sharedPreferences.getString("gender", "N/A");
156 | String activity = sharedPreferences.getString("physical_activity", "N/A");
157 | String age = sharedPreferences.getString("age", "N/A");
158 | String weight = sharedPreferences.getString("weight", "N/A");
159 | String height = sharedPreferences.getString("height", "N/A");
160 | //choose start fraagment or End!
161 | android.support.v4.app.FragmentManager fm = getSupportFragmentManager();
162 | android.support.v4.app.FragmentTransaction ft = fm.beginTransaction();
163 | if (age.matches("N/A")) {
164 | ft.replace(R.id.mainFrameLayout, new Fragment1());
165 | ft.commit();
166 | } else {
167 | ft.replace(R.id.mainFrameLayout, new Fragment5());
168 | ft.commit();
169 | }
170 | }
171 | //Send data to Fragments
172 | public String getMyData(String s) {
173 | String myString = s;
174 | SharedPreferences sharedPreferences = getSharedPreferences("UserData", Context.MODE_PRIVATE);
175 | switch (s){
176 | case("gender"):
177 | myString = sharedPreferences.getString("gender", null);
178 | break;
179 | case("age"):
180 | myString = sharedPreferences.getString("age", null);
181 | break;
182 | case("weight"):
183 | myString = sharedPreferences.getString("weight", null);
184 | break;
185 | case("height"):
186 | myString = sharedPreferences.getString("height", null);
187 | break;
188 | }
189 |
190 | return myString;
191 | }
192 | /* ############################################################################################# */
193 |
194 |
195 | @Override
196 | public boolean onCreateOptionsMenu(Menu menu) {
197 | // Inflate the menu; this adds items to the action bar if it is present.
198 | getMenuInflater().inflate(R.menu.main, menu);
199 | return true;
200 | }
201 |
202 | @Override
203 | public boolean onOptionsItemSelected(MenuItem item) {
204 | int id = item.getItemId();
205 |
206 |
207 | if (id == R.id.action_about) {
208 | loadFragment(new AboutFragment(), R.id.fullparentFramelayout);
209 | return true;
210 | }
211 | else if (id == R.id.action_language){
212 | String langPref = "Language";
213 | SharedPreferences sharedPreferences = getSharedPreferences("SettingsData", Activity.MODE_PRIVATE);
214 | String language = sharedPreferences.getString(langPref, "en");
215 | if(language.matches("ar")){
216 | changeLang("en");
217 | }else{
218 | changeLang("ar");
219 | }
220 | Intent refresh = new Intent(this, MainActivity.class);
221 | refresh.setFlags(refresh.getFlags() | Intent.FLAG_ACTIVITY_NO_HISTORY); // Adds the FLAG_ACTIVITY_NO_HISTORY flag
222 | startActivity(refresh);
223 | finish();
224 | }
225 |
226 | return super.onOptionsItemSelected(item);
227 | }
228 |
229 | @SuppressWarnings("StatementWithEmptyBody")
230 | @Override
231 | public boolean onNavigationItemSelected(MenuItem item) {
232 | // Handle navigation view item clicks here.
233 | int id = item.getItemId();
234 |
235 | if (id == R.id.nav_home) {
236 | Intent intent = new Intent(this, MainActivity.class);
237 | startActivity(intent);
238 | } else if (id == R.id.nav_reminder) {
239 | Intent RemindersIntent = new Intent(this, RemindersActivity.class);
240 | startActivity(RemindersIntent);
241 |
242 | } else if (id == R.id.nav_Recipes) {
243 |
244 | } else if (id == R.id.nav_calculate) {
245 | Intent ApiIntent = new Intent(this, ApiActivity.class);
246 | startActivity(ApiIntent);
247 |
248 | } else if (id == R.id.nav_share) {
249 |
250 | } else if (id == R.id.nav_facebook) {
251 | try {
252 | Intent fbIntent = new Intent(Intent.ACTION_VIEW);
253 | fbIntent.setData(Uri.parse("https://www.facebook.com/supportnutritionpoit"));
254 | startActivity(fbIntent);
255 | } catch (Exception e) {
256 | }
257 | }
258 |
259 | DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
260 | drawer.closeDrawer(GravityCompat.START);
261 | return true;
262 | }
263 |
264 | /* ###### Water Reminder ######################################################################3 */
265 | public void waterReminder(){
266 | SharedPreferences sharedPreferences = getSharedPreferences("SettingsData", Activity.MODE_PRIVATE);
267 | int t = sharedPreferences.getInt("water_delay", 1000);
268 | if(sharedPreferences.getString("water_reminder", "false").matches("true")){
269 | AlarmManager alarmManager = (AlarmManager)getSystemService(Context.ALARM_SERVICE);
270 | Intent alarmIntent = new Intent(this, AlarmReceiver.class);
271 | PendingIntent pendingIntent = PendingIntent.getBroadcast(this,0, alarmIntent, PendingIntent.FLAG_UPDATE_CURRENT);
272 | alarmManager.setRepeating(AlarmManager.RTC_WAKEUP, System.currentTimeMillis(),t*60*1000, pendingIntent);
273 | }
274 | }
275 | /* ############################################################################################ */
276 |
277 |
278 | /* #########Change Language and restart Main Activity########################################### */
279 | public void loadLocale() {
280 | String langPref = "Language";
281 | SharedPreferences sharedPreferences = getSharedPreferences("SettingsData", Activity.MODE_PRIVATE);
282 | String language = sharedPreferences.getString(langPref, "");
283 | changeLang(language);
284 | }
285 | public void changeLang(String lang) {
286 | if (lang.equalsIgnoreCase(""))
287 | return;
288 | Locale myLocale = new Locale(lang, "MR");
289 | saveLocale(lang);
290 | Locale.setDefault(myLocale);
291 | android.content.res.Configuration config = new android.content.res.Configuration();
292 | config.locale = myLocale;
293 | getBaseContext().getResources().updateConfiguration(config,getBaseContext().getResources().getDisplayMetrics());
294 | }
295 | public void saveLocale(String lang) {
296 | String langPref = "Language";
297 | SharedPreferences sharedPreferences = getSharedPreferences("SettingsData", Activity.MODE_PRIVATE);
298 | SharedPreferences.Editor editor = sharedPreferences.edit();
299 | editor.putString(langPref, lang);
300 | editor.commit();
301 | }
302 | /* ############################################################################################ */
303 |
304 |
305 | @Override
306 | public void onBackPressed() {
307 | int backStackEntryCount = getSupportFragmentManager().getBackStackEntryCount();
308 | DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
309 | if (drawer.isDrawerOpen(GravityCompat.START)) {
310 | drawer.closeDrawer(GravityCompat.START);
311 | }
312 |
313 | /* ##### press back twice to exit method #################################// */
314 | else if (backStackEntryCount == 0) {
315 | if (doubleBackToast.getView().isShown()) {
316 | if (doubleBackToast != null) {
317 | doubleBackToast.cancel();
318 | super.onBackPressed();
319 | }
320 | }
321 | doubleBackToast.show();
322 | }else {
323 | super.onBackPressed();
324 | }
325 | /* ######################################################################// */
326 | }
327 | }
328 |
--------------------------------------------------------------------------------