diff --git a/.idea/modules.xml b/.idea/modules.xml index 92af58643bfa89c0f27e1531c072e9833294e9f8..abc31fc679bb491e423c03e7bd677ff03ed00d98 100644 --- a/.idea/modules.xml +++ b/.idea/modules.xml @@ -2,10 +2,8 @@ <project version="4"> <component name="ProjectModuleManager"> <modules> - <module fileurl="file://F:\informatika\pbd\fitness\android.iml" filepath="F:\informatika\pbd\fitness\android.iml" /> + <module fileurl="file://$PROJECT_DIR$/android.iml" filepath="$PROJECT_DIR$/android.iml" /> <module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" /> - <module fileurl="file://$PROJECT_DIR$/fitness.iml" filepath="$PROJECT_DIR$/fitness.iml" /> - <module fileurl="file://D:\tugas\sem6\pbd\tubes\android\fitness.iml" filepath="D:\tugas\sem6\pbd\tubes\android\fitness.iml" /> </modules> </component> </project> \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle index 1c45e7ed4898d16fa4e7d43fdfc7be5cdec2db45..9597d516cc8b7ab7a9c5a771b05657f60bdd936d 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -5,6 +5,7 @@ android { defaultConfig { applicationId "com.example.leo.fitnessdiy" minSdkVersion 16 + multiDexEnabled true targetSdkVersion 26 versionCode 1 versionName "1.0" diff --git a/app/src/main/java/com/example/leo/fitnessdiy/PlankActivity.java b/app/src/main/java/com/example/leo/fitnessdiy/PlankActivity.java index c6fdfb270d99e562b2c5b5779b339eb9fd847d74..e469d68e3ae30d5431b3fc7a224efd7e7aa54874 100644 --- a/app/src/main/java/com/example/leo/fitnessdiy/PlankActivity.java +++ b/app/src/main/java/com/example/leo/fitnessdiy/PlankActivity.java @@ -5,10 +5,25 @@ import android.net.Uri; import android.os.CountDownTimer; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; +import android.util.Log; import android.view.View; import android.widget.TextView; +import com.example.leo.fitnessdiy.Utilities.NetworkUtils; +import com.example.leo.fitnessdiy.model.History; +import com.example.leo.fitnessdiy.model.Users; +import com.example.leo.fitnessdiy.routes.api; + +import org.json.JSONArray; +import org.json.JSONException; +import org.json.JSONObject; + +import java.io.IOException; +import java.net.URL; +import java.util.ArrayList; + public class PlankActivity extends AppCompatActivity { + private String LOG_TAG = "TES PLANK ACTIVITY"; @Override protected void onCreate(Bundle savedInstanceState) { diff --git a/app/src/main/java/com/example/leo/fitnessdiy/model/Users.java b/app/src/main/java/com/example/leo/fitnessdiy/model/Users.java new file mode 100644 index 0000000000000000000000000000000000000000..cf9443e14aa6f448e56e5b1592361fc683a91918 --- /dev/null +++ b/app/src/main/java/com/example/leo/fitnessdiy/model/Users.java @@ -0,0 +1,66 @@ +package com.example.leo.fitnessdiy.model; + +public class Users { + private int id; + private String username; + private String password; + private String email; + private String phone_number; + private int age; + private String address; + private String level; + + public Users(int id, String username, String password, String email, String phone_number, int age, String address, String level) { + this.id = id; + this.username = username; + this.password = password; + this.email = email; + this.phone_number = phone_number; + this.age = age; + this.address = address; + this.level = level; + } + + public Users() { + this.id = 0; + this.username = ""; + this.password = ""; + this.email = ""; + this.phone_number = ""; + this.age = 0; + this.address = ""; + this.level = ""; + } + + public int getId() { + return id; + } + + public String getUsername() { + return username; + } + + public String getPassword() { + return password; + } + + public String getEmail() { + return email; + } + + public String getPhone_number() { + return phone_number; + } + + public int getAge() { + return age; + } + + public String getAddress() { + return address; + } + + public String getLevel() { + return level; + } +} diff --git a/app/src/main/java/com/example/leo/fitnessdiy/routes/api.java b/app/src/main/java/com/example/leo/fitnessdiy/routes/api.java index b02ca174a28c02c324771cd97f0bf1773b73fa6d..7ca2085f3cefa5c4938b3afcd9693df6b5ace17b 100644 --- a/app/src/main/java/com/example/leo/fitnessdiy/routes/api.java +++ b/app/src/main/java/com/example/leo/fitnessdiy/routes/api.java @@ -5,7 +5,11 @@ package com.example.leo.fitnessdiy.routes; */ public class api { - public static final String BASE_URL = "http://192.168.100.102/fitness_server/"; + public static final String BASE_URL = "http://10.0.2.2/fitness-server/"; + // kalo emulator 10.0.2.2 atau 10.0.0.2 + // atau ipconfig, cek ipv4 public static final String HISTORY_URL = BASE_URL + "history.php?user="; + + public static final String USERS_URL = BASE_URL + "users.php?user="; } diff --git a/app/src/main/res/layout/activity_plank.xml b/app/src/main/res/layout/activity_plank.xml index b4941ba5686e7365bc8a362dfdf3050d674059fe..84d255c47a2266e6c2b86eee567378df6b779e3e 100644 --- a/app/src/main/res/layout/activity_plank.xml +++ b/app/src/main/res/layout/activity_plank.xml @@ -1,84 +1,93 @@ <?xml version="1.0" encoding="utf-8"?> -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" +<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" - android:orientation="vertical" tools:context="com.example.leo.fitnessdiy.PlankActivity"> - <TextView - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_marginBottom="100dp" - android:text="@string/plank" /> - <Button - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="center_horizontal" - android:layout_marginBottom="30dp" - android:onClick="countDownPlank" - android:text="start" /> + <LinearLayout + android:layout_width="match_parent" + android:layout_height="match_parent" + android:orientation="vertical"> - <TextView - android:id="@+id/count_timer" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="center_horizontal" - android:textSize="32sp" - android:text="2 : 00" /> + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginBottom="50dp" + android:text="@string/plank" + android:textSize="32sp" /> - <TextView - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_marginBottom="30dp" - android:text="@string/plank_video" /> + <Button + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="center_horizontal" + android:layout_marginBottom="30dp" + android:onClick="countDownPlank" + android:text="start" /> + <TextView + android:id="@+id/count_timer" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="center_horizontal" + android:text="2 : 00" + android:textSize="32sp" /> + + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginBottom="30dp" + android:text="@string/plank_video" + android:textSize="30sp"/> - <!--<ScrollView--> - <!--android:layout_width="wrap_content"--> - <!--android:layout_height="wrap_content">--> <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" - android:orientation="horizontal" - android:tag="https://www.youtube.com/watch?v=TvxNkmjdhMM" + android:layout_margin="4dp" android:clickable="true" android:focusable="true" android:onClick="openVideo" - android:layout_margin="4dp" - > + android:orientation="vertical" + android:tag="https://www.youtube.com/watch?v=TvxNkmjdhMM"> + <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" - android:src="@drawable/plank_video_1"/> + android:layout_gravity="left" + android:src="@drawable/plank_video_1" /> + <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" - android:text="How to Plank"/> + android:text="How to Plank" + android:textSize="20sp" /> </LinearLayout> <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" - android:orientation="horizontal" - android:tag="https://www.youtube.com/watch?v=_nZgpZLf7ZA" + android:layout_margin="4dp" android:clickable="true" android:focusable="true" android:onClick="openVideo" - android:layout_margin="4dp"> + android:orientation="vertical" + android:tag="https://www.youtube.com/watch?v=_nZgpZLf7ZA"> + <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" - android:src="@drawable/plank_video_2"/> + android:layout_gravity="left" + android:src="@drawable/plank_video_2" /> + <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" - android:text="Benefits of Plank"/> + android:text="Benefits of Plank" + android:textSize="20sp" /> </LinearLayout> - <!--</ScrollView>--> - -</LinearLayout> + </LinearLayout> +</ScrollView>