Commit 6b038e4433703087576aaa067062438a7616b652

Authored by Dinh Chu
1 parent ba7d7409b2
Exists in master and in 1 other branch development

update

Showing 50 changed files with 575 additions and 135 deletions Inline Diff

1 <?xml version="1.0" encoding="UTF-8"?> 1 <?xml version="1.0" encoding="UTF-8"?>
2 <project version="4"> 2 <project version="4">
3 <component name="ProjectModuleManager"> 3 <component name="ProjectModuleManager">
4 <modules> 4 <modules>
5 <module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" /> 5 <module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" />
6 <module fileurl="file://$PROJECT_DIR$/lifelog_android.iml" filepath="$PROJECT_DIR$/lifelog_android.iml" /> 6 <module fileurl="file://$PROJECT_DIR$/lifelog_new.iml" filepath="$PROJECT_DIR$/lifelog_new.iml" />
7 <module fileurl="file://D:\Project\Git\lifelog_android\lifelogpedometer.iml" filepath="D:\Project\Git\lifelog_android\lifelogpedometer.iml" /> 7 <module fileurl="file://D:\Project\Git\lifelog_android\lifelogpedometer.iml" filepath="D:\Project\Git\lifelog_android\lifelogpedometer.iml" />
8 </modules> 8 </modules>
9 </component> 9 </component>
10 </project> 10 </project>
1 apply plugin: 'com.android.application' 1 apply plugin: 'com.android.application'
2 2
3 android { 3 android {
4 compileSdkVersion 25 4 compileSdkVersion 25
5 buildToolsVersion '26.0.2' 5 buildToolsVersion '26.0.2'
6 defaultConfig { 6 defaultConfig {
7 applicationId "com.dinhcv.lifelogpedometer" 7 applicationId "com.dinhcv.lifelogpedometer"
8 minSdkVersion 19 8 minSdkVersion 19
9 targetSdkVersion 25 9 targetSdkVersion 25
10 versionCode 1 10 versionCode 1
11 versionName "1.0" 11 versionName "1.0"
12 testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 12 testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
13 // Enabling multidex support. 13 // Enabling multidex support.
14 multiDexEnabled true 14 multiDexEnabled true
15 } 15 }
16 16
17 //flavorDimensions "default" 17 //flavorDimensions "default"
18 18
19 buildTypes { 19 buildTypes {
20 release { 20 release {
21 minifyEnabled false 21 minifyEnabled false
22 proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 22 proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
23 } 23 }
24 } 24 }
25 25
26 signingConfigs { 26 signingConfigs {
27 dev { 27 dev {
28 storeFile file("../keystores/...") 28 storeFile file("../keystores/...")
29 storePassword 'android' 29 storePassword 'android'
30 keyAlias 'androiddebugkey' 30 keyAlias 'androiddebugkey'
31 keyPassword 'android' 31 keyPassword 'android'
32 } 32 }
33 33
34 product { 34 product {
35 storeFile file("..keystores/...") 35 storeFile file("..keystores/...")
36 storePassword 'android' 36 storePassword 'android'
37 keyAlias 'androiddebugkey' 37 keyAlias 'androiddebugkey'
38 keyPassword 'android' 38 keyPassword 'android'
39 } 39 }
40 } 40 }
41 41
42 productFlavors { 42 productFlavors {
43 43
44 dev { 44 dev {
45 applicationId "com.dinhcv.lifelogpedometer" 45 applicationId "com.dinhcv.lifelogpedometer"
46 applicationIdSuffix "dev" 46 applicationIdSuffix "dev"
47 minSdkVersion 19 47 minSdkVersion 19
48 buildConfigField 'String', 'BASE_URL', '"http://clover.timesfun.jp:9001/"' 48 buildConfigField 'String', 'BASE_URL', '"http://clover.timesfun.jp:9001/"'
49 } 49 }
50 50
51 product { 51 product {
52 applicationId "com.dinhcv.lifelogpedometer" 52 applicationId "com.dinhcv.lifelogpedometer"
53 minSdkVersion 19 53 minSdkVersion 19
54 buildConfigField 'String', 'BASE_URL', '"http://clover.timesfun.jp:9001/"' 54 buildConfigField 'String', 'BASE_URL', '"http://clover.timesfun.jp:9001/"'
55 } 55 }
56 } 56 }
57 } 57 }
58 58
59 dependencies { 59 dependencies {
60 compile fileTree(include: ['*.jar'], dir: 'libs') 60 compile fileTree(include: ['*.jar'], dir: 'libs')
61 androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { 61 androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
62 exclude group: 'com.android.support', module: 'support-annotations' 62 exclude group: 'com.android.support', module: 'support-annotations'
63 }) 63 })
64 64
65 // Retrofit 65 // Retrofit
66 // JSON Parsing 66 // JSON Parsing
67 compile 'com.squareup.retrofit2:converter-gson:2.1.0' 67 compile 'com.squareup.retrofit2:converter-gson:2.1.0'
68 compile 'com.android.support:appcompat-v7:25.3.1' 68 compile 'com.android.support:appcompat-v7:25.3.1'
69 compile 'com.github.j4velin.colorpicker:colorpicker:1.2.3' 69 compile 'com.github.j4velin.colorpicker:colorpicker:1.2.3'
70 compile 'com.github.j4velin.EazeGraph:EazeGraph:1.0.2' 70 compile 'com.github.j4velin.EazeGraph:EazeGraph:1.0.2'
71 compile 'com.google.android.apps.dashclock:dashclock-api:2.0.0' 71 compile 'com.google.android.apps.dashclock:dashclock-api:2.0.0'
72 compile 'com.android.support:design:25.3.1' 72 compile 'com.android.support:design:25.3.1'
73 compile 'com.github.PhilJay:MPAndroidChart:v3.0.2' 73 compile 'com.github.PhilJay:MPAndroidChart:v3.0.2'
74 compile 'com.google.android.gms:play-services:11.0.4' 74 compile 'com.google.android.gms:play-services:11.0.4'
75 compile 'com.google.code.gson:gson:2.7' 75 compile 'com.google.code.gson:gson:2.7'
76 compile 'com.squareup.retrofit2:converter-gson:2.1.0' 76 compile 'com.squareup.retrofit2:converter-gson:2.1.0'
77 compile 'de.hdodenhof:circleimageview:2.1.0' 77 compile 'de.hdodenhof:circleimageview:2.1.0'
78 compile 'com.jakewharton:butterknife:8.6.0' 78 compile 'com.jakewharton:butterknife:8.6.0'
79 testCompile 'junit:junit:4.12' 79 testCompile 'junit:junit:4.12'
80 // Retrofit 80 // Retrofit
81
81 compile 'com.squareup.retrofit2:retrofit:2.1.0' 82 compile 'com.squareup.retrofit2:retrofit:2.1.0'
82 compile 'com.squareup.picasso:picasso:2.5.2' 83 compile 'com.squareup.picasso:picasso:2.5.2'
83 compile 'de.hdodenhof:circleimageview:2.1.0' 84 compile 'de.hdodenhof:circleimageview:2.1.0'
84 compile 'com.jakewharton:butterknife:8.6.0' 85 compile 'com.jakewharton:butterknife:8.6.0'
85 compile 'com.squareup.retrofit2:retrofit:2.1.0' 86 compile 'com.squareup.retrofit2:retrofit:2.1.0'
86 compile 'com.squareup.picasso:picasso:2.5.2' 87 compile 'com.squareup.picasso:picasso:2.5.2'
87 compile 'com.android.support:support-v4:25.3.1' 88 compile 'com.android.support:support-v4:25.3.1'
88 testCompile 'junit:junit:4.12' 89 testCompile 'junit:junit:4.12'
89 90
90 compile 'com.android.support:multidex:1.0.1' 91 compile 'com.android.support:multidex:1.0.1'
91 92
92 annotationProcessor 'com.jakewharton:butterknife-compiler:8.6.0' 93 annotationProcessor 'com.jakewharton:butterknife-compiler:8.6.0'
93 } 94 }
94 95
app/src/main/AndroidManifest.xml
1 <?xml version="1.0" encoding="utf-8"?> 1 <?xml version="1.0" encoding="utf-8"?>
2 <manifest xmlns:android="http://schemas.android.com/apk/res/android" 2 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
3 package="com.dinhcv.lifelogpedometer"> 3 package="com.dinhcv.lifelogpedometer">
4 4
5 <uses-feature 5 <uses-feature
6 android:name="android.hardware.sensor.stepcounter" 6 android:name="android.hardware.sensor.stepcounter"
7 android:required="true" /> 7 android:required="true" />
8 8
9 <uses-permission android:name="android.permission.INTERNET" /> 9 <uses-permission android:name="android.permission.INTERNET" />
10 <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> 10 <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
11 <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /> 11 <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
12 <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> 12 <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
13 <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" /> 13 <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
14 <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> 14 <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
15 <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
15 16
16 <application 17 <application
17 android:name=".LifeLogApplication" 18 android:name=".LifeLogApplication"
18 android:allowBackup="true" 19 android:allowBackup="true"
19 android:icon="@mipmap/ic_launcher" 20 android:icon="@mipmap/ic_launcher"
20 android:label="@string/app_name" 21 android:label="@string/app_name"
21 android:roundIcon="@mipmap/ic_launcher_round" 22 android:roundIcon="@mipmap/ic_launcher_round"
22 android:supportsRtl="true" 23 android:supportsRtl="true"
23 android:largeHeap="true" 24 android:largeHeap="true"
24 android:theme="@style/AppTheme"> 25 android:theme="@style/AppTheme">
25 <meta-data 26 <meta-data
26 android:name="com.google.android.maps.v2.API_KEY" 27 android:name="com.google.android.maps.v2.API_KEY"
27 android:value="AIzaSyCDKYsvb0iDXSRm9YnQ8kh5Gzpbpzcpz4s" /> 28 android:value="AIzaSyCDKYsvb0iDXSRm9YnQ8kh5Gzpbpzcpz4s" />
28 29
29 <activity 30 <activity
30 android:name=".activity.WelcomeActivity" 31 android:name=".activity.WelcomeActivity"
31 android:screenOrientation="portrait" 32 android:screenOrientation="portrait"
32 android:theme="@style/AppNoActionBar"> 33 android:theme="@style/AppNoActionBar">
33 <intent-filter> 34 <intent-filter>
34 <action android:name="android.intent.action.MAIN" /> 35 <action android:name="android.intent.action.MAIN" />
35 36
36 <category android:name="android.intent.category.LAUNCHER" /> 37 <category android:name="android.intent.category.LAUNCHER" />
37 </intent-filter> 38 </intent-filter>
38 </activity> 39 </activity>
39 <activity 40 <activity
40 android:name=".activity.LoginActivity" 41 android:name=".activity.LoginActivity"
41 android:screenOrientation="portrait" 42 android:screenOrientation="portrait"
42 android:theme="@style/AppNoActionBar"/> 43 android:theme="@style/AppNoActionBar"/>
43 44
44 <activity 45 <activity
45 android:name=".activity.PedometerActivity" 46 android:name=".activity.PedometerActivity"
46 android:screenOrientation="portrait" 47 android:screenOrientation="portrait"
47 android:theme="@style/AppNoActionBar"/> 48 android:theme="@style/AppNoActionBar"/>
48 <activity 49 <activity
49 android:name=".activity.RegisterActivity" 50 android:name=".activity.RegisterActivity"
50 android:screenOrientation="portrait" 51 android:screenOrientation="portrait"
51 android:theme="@style/AppNoActionBar"/> 52 android:theme="@style/AppNoActionBar"/>
52 <activity 53 <activity
53 android:name=".activity.InputConfirmCodeActivity" 54 android:name=".activity.InputConfirmCodeActivity"
54 android:screenOrientation="portrait" 55 android:screenOrientation="portrait"
55 android:theme="@style/AppNoActionBar"/> 56 android:theme="@style/AppNoActionBar"/>
56 57
57 58
58 <!--<activity--> 59 <!--<activity-->
59 <!--android:name=".activity.HistoryFragment"--> 60 <!--android:name=".activity.HistoryFragment"-->
60 <!--android:screenOrientation="portrait"--> 61 <!--android:screenOrientation="portrait"-->
61 <!--android:theme="@style/AppNoActionBar"></activity>--> 62 <!--android:theme="@style/AppNoActionBar"></activity>-->
62 63
63 </application> 64 </application>
64 65
65 </manifest> 66 </manifest>
app/src/main/java/com/dinhcv/lifelogpedometer/activity/HistoryContentFragment.java
1 package com.dinhcv.lifelogpedometer.activity; 1 package com.dinhcv.lifelogpedometer.activity;
2 2
3 import android.app.DatePickerDialog; 3 import android.app.DatePickerDialog;
4 import android.content.Context; 4 import android.content.Context;
5 import android.content.Intent; 5 import android.content.Intent;
6 import android.graphics.Color; 6 import android.graphics.Color;
7 import android.os.Bundle; 7 import android.os.Bundle;
8 import android.view.LayoutInflater; 8 import android.view.LayoutInflater;
9 import android.view.View; 9 import android.view.View;
10 import android.view.ViewGroup; 10 import android.view.ViewGroup;
11 import android.widget.Button; 11 import android.widget.Button;
12 import android.widget.DatePicker; 12 import android.widget.DatePicker;
13 import android.widget.ImageButton; 13 import android.widget.ImageButton;
14 import android.widget.ImageView;
14 import android.widget.LinearLayout; 15 import android.widget.LinearLayout;
15 import android.widget.TextView; 16 import android.widget.TextView;
16 17
17 import com.dinhcv.lifelogpedometer.R; 18 import com.dinhcv.lifelogpedometer.R;
18 import com.dinhcv.lifelogpedometer.interfaces.LLAPIManagerListener; 19 import com.dinhcv.lifelogpedometer.interfaces.LLAPIManagerListener;
19 import com.dinhcv.lifelogpedometer.model.structure.history.HistoryInfo; 20 import com.dinhcv.lifelogpedometer.model.structure.history.HistoryInfo;
20 import com.dinhcv.lifelogpedometer.portal.ApiServices; 21 import com.dinhcv.lifelogpedometer.portal.ApiServices;
21 import com.dinhcv.lifelogpedometer.portal.LLAPIManager; 22 import com.dinhcv.lifelogpedometer.portal.LLAPIManager;
22 import com.dinhcv.lifelogpedometer.utils.Const; 23 import com.dinhcv.lifelogpedometer.utils.Const;
23 import com.dinhcv.lifelogpedometer.utils.DayAxisValueFormatter; 24 import com.dinhcv.lifelogpedometer.utils.DayAxisValueFormatter;
24 import com.dinhcv.lifelogpedometer.utils.Debug; 25 import com.dinhcv.lifelogpedometer.utils.Debug;
25 import com.dinhcv.lifelogpedometer.utils.Utils; 26 import com.dinhcv.lifelogpedometer.utils.Utils;
26 import com.github.mikephil.charting.charts.BarChart; 27 import com.github.mikephil.charting.charts.BarChart;
27 import com.github.mikephil.charting.components.XAxis; 28 import com.github.mikephil.charting.components.XAxis;
28 import com.github.mikephil.charting.components.YAxis; 29 import com.github.mikephil.charting.components.YAxis;
29 import com.github.mikephil.charting.data.BarData; 30 import com.github.mikephil.charting.data.BarData;
30 import com.github.mikephil.charting.data.BarDataSet; 31 import com.github.mikephil.charting.data.BarDataSet;
31 import com.github.mikephil.charting.data.BarEntry; 32 import com.github.mikephil.charting.data.BarEntry;
32 import com.github.mikephil.charting.interfaces.datasets.IBarDataSet; 33 import com.github.mikephil.charting.interfaces.datasets.IBarDataSet;
33 34
34 import org.json.JSONException; 35 import org.json.JSONException;
35 import org.json.JSONObject; 36 import org.json.JSONObject;
36 37
37 import java.util.ArrayList; 38 import java.util.ArrayList;
38 import java.util.Calendar; 39 import java.util.Calendar;
39 import java.util.Date; 40 import java.util.Date;
40 import java.util.List; 41 import java.util.List;
41 42
42 import butterknife.BindView; 43 import butterknife.BindView;
43 import butterknife.ButterKnife; 44 import butterknife.ButterKnife;
44 import butterknife.OnClick; 45 import butterknife.OnClick;
45 46
46 import static com.github.mikephil.charting.utils.ColorTemplate.rgb; 47 import static com.github.mikephil.charting.utils.ColorTemplate.rgb;
47 48
48 public class HistoryContentFragment extends FragmentBase { 49 public class HistoryContentFragment extends FragmentBase {
49 50
50 @BindView(R.id.btn_left_date) 51 @BindView(R.id.btn_left_date)
51 ImageButton btnLeftDate; 52 ImageButton btnLeftDate;
52 @BindView(R.id.btn_right_date) 53 @BindView(R.id.btn_right_date)
53 ImageButton btnRightDate; 54 ImageButton btnRightDate;
54 @BindView(R.id.tv_date) 55 @BindView(R.id.tv_date)
55 TextView tvDate; 56 TextView tvDate;
56 @BindView(R.id.tv_week_day) 57 @BindView(R.id.tv_week_day)
57 TextView tvWeekDay; 58 TextView tvWeekDay;
58 private Button btnFace; 59 private ImageView btnFace;
59 private Button btnTwitter; 60 private ImageView btnTwitter;
60 private Button btnLine; 61 private ImageView btnLine;
61 private Button btnEmail; 62 private ImageView btnEmail;
62 private Button btnOther; 63 private ImageView btnOther;
63 @BindView(R.id.tv_steps) 64 @BindView(R.id.tv_steps)
64 TextView tvStep; 65 TextView tvStep;
65 @BindView(R.id.tv_remainingStep) 66 @BindView(R.id.tv_remainingStep)
66 TextView tvRemain; 67 TextView tvRemain;
67 @BindView(R.id.tv_stepRateDone) 68 @BindView(R.id.tv_stepRateDone)
68 TextView tvRateDone; 69 TextView tvRateDone;
69 @BindView(R.id.tv_smallRemain) 70 @BindView(R.id.tv_smallRemain)
70 TextView tvSmallRemain; 71 TextView tvSmallRemain;
71 @BindView(R.id.tv_stepGoal) 72 @BindView(R.id.tv_stepGoal)
72 TextView tvGoal; 73 TextView tvGoal;
73 74
74 @BindView(R.id.tv_caloConsumned) 75 @BindView(R.id.tv_caloConsumned)
75 TextView tvCaloConsumned; 76 TextView tvCaloConsumned;
76 @BindView(R.id.tv_distance) 77 @BindView(R.id.tv_distance)
77 TextView tvDistance; 78 TextView tvDistance;
78 @BindView(R.id.tv_time) 79 @BindView(R.id.tv_time)
79 TextView tvTime; 80 TextView tvTime;
80 81
81 @BindView(R.id.ll_bike) 82 @BindView(R.id.ll_bike)
82 LinearLayout llBike; 83 LinearLayout llBike;
83 @BindView(R.id.ll_walking) 84 @BindView(R.id.ll_walking)
84 LinearLayout llWalking; 85 LinearLayout llWalking;
85 @BindView(R.id.ll_running) 86 @BindView(R.id.ll_running)
86 LinearLayout llRunning; 87 LinearLayout llRunning;
87 @BindView(R.id.btn_oneDay) 88 @BindView(R.id.btn_oneDay)
88 Button btnOneDay; 89 Button btnOneDay;
89 @BindView(R.id.btn_oneWeek) 90 @BindView(R.id.btn_oneWeek)
90 Button btnOneWeek; 91 Button btnOneWeek;
91 @BindView(R.id.btn_oneMonth) 92 @BindView(R.id.btn_oneMonth)
92 Button btnOneMonth; 93 Button btnOneMonth;
93 @BindView(R.id.btn_threeMonth) 94 @BindView(R.id.btn_threeMonth)
94 Button btnThreeMonth; 95 Button btnThreeMonth;
95 @BindView(R.id.btn_sixMonth) 96 @BindView(R.id.btn_sixMonth)
96 Button btnSixMonth; 97 Button btnSixMonth;
97 98
98 // bar chart 99 // bar chart
99 private BarChart mBarChart; 100 private BarChart mBarChart;
100 private List<String> dateList; 101 private List<String> dateList;
101 private String[] mParties; 102 private String[] mParties;
102 private Integer[] mStep; 103 private Integer[] mStep;
103 104
104 private Date mAnaDate; 105 private Date mAnaDate;
105 private Calendar mCalendar; 106 private Calendar mCalendar;
106 107
107 private int mAnaDay; 108 private int mAnaDay;
108 private int mAnaMonth; 109 private int mAnaMonth;
109 private int mAnaYear; 110 private int mAnaYear;
110 111
111 private HistoryInfo mDataModWalking = new HistoryInfo(); 112 private HistoryInfo mDataModWalking = new HistoryInfo();
112 private HistoryInfo mDataModRunning = new HistoryInfo(); 113 private HistoryInfo mDataModRunning = new HistoryInfo();
113 private HistoryInfo mDataModBike = new HistoryInfo(); 114 private HistoryInfo mDataModBike = new HistoryInfo();
114 private HistoryInfo mDataCurrent = new HistoryInfo(); 115 private HistoryInfo mDataCurrent = new HistoryInfo();
115 116
116 private Const.DATA_TYPE dataType; 117 private Const.DATA_TYPE dataType;
117 private Const.STEP_TYPE stepType; 118 private Const.STEP_TYPE stepType;
118 119
119 private Context mContext; 120 private Context mContext;
120 private View mRootView; 121 private View mRootView;
121 122
122 private HistoryFragment mHistoryFragment; 123 private HistoryFragment mHistoryFragment;
123 124
124 public void setRootFragment(HistoryFragment frag) { 125 public void setRootFragment(HistoryFragment frag) {
125 this.mHistoryFragment = frag; 126 this.mHistoryFragment = frag;
126 } 127 }
127 128
128 @Override 129 @Override
129 public View onCreateView(final LayoutInflater inflater, final ViewGroup container, 130 public View onCreateView(final LayoutInflater inflater, final ViewGroup container,
130 final Bundle savedInstanceState) { 131 final Bundle savedInstanceState) {
131 mRootView = inflater.inflate(R.layout.fragment_history_content, null); 132 mRootView = inflater.inflate(R.layout.fragment_history_content, null);
132 ButterKnife.bind(this, mRootView); 133 ButterKnife.bind(this, mRootView);
133 mContext = getActivity(); 134 mContext = getActivity();
134 initView(mRootView); 135 initView(mRootView);
135 initData(); 136 initData();
136 137
137 return mRootView; 138 return mRootView;
138 } 139 }
139 140
140 141
141 private void initView(View view) { 142 private void initView(View view) {
142 btnFace = (Button) view.findViewById(R.id.btn_face); 143 btnFace = (ImageView) view.findViewById(R.id.btn_face);
143 btnTwitter = (Button) view.findViewById(R.id.btn_twitter); 144 btnTwitter = (ImageView) view.findViewById(R.id.btn_twitter);
144 btnLine = (Button) view.findViewById(R.id.btn_line); 145 btnLine = (ImageView) view.findViewById(R.id.btn_line);
145 btnEmail = (Button) view.findViewById(R.id.btn_email); 146 btnEmail = (ImageView) view.findViewById(R.id.btn_email);
146 btnOther = (Button) view.findViewById(R.id.btn_other); 147 btnOther = (ImageView) view.findViewById(R.id.btn_other);
147 148
148 mBarChart = (BarChart) view.findViewById(R.id.chart); 149 mBarChart = (BarChart) view.findViewById(R.id.chart);
149 } 150 }
150 151
151 152
152 /** 153 /**
153 * Show date picker dialog 154 * Show date picker dialog
154 */ 155 */
155 private void handleAnaDatePicker() { 156 private void handleAnaDatePicker() {
156 157
157 new DatePickerDialog(mContext, new DatePickerDialog.OnDateSetListener() { 158 new DatePickerDialog(mContext, new DatePickerDialog.OnDateSetListener() {
158 @Override 159 @Override
159 public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) { 160 public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) {
160 161
161 mCalendar = Calendar.getInstance(); 162 mCalendar = Calendar.getInstance();
162 mCalendar.set(year, monthOfYear, dayOfMonth); 163 mCalendar.set(year, monthOfYear, dayOfMonth);
163 mAnaYear = year; 164 mAnaYear = year;
164 mAnaMonth = monthOfYear; 165 mAnaMonth = monthOfYear;
165 mAnaDay = dayOfMonth; 166 mAnaDay = dayOfMonth;
166 Date date = mCalendar.getTime(); 167 Date date = mCalendar.getTime();
167 tvDate.setText(Utils.dateToStringFormatDayMonthYearJp(date)); 168 tvDate.setText(Utils.dateToStringFormatDayMonthYearJp(date));
168 tvWeekDay.setText(Utils.getWeekdayFromDate(date)); 169 tvWeekDay.setText(Utils.getWeekdayFromDate(date));
169 mAnaDate = date; 170 mAnaDate = date;
170 getHistoryData(dataType, mAnaDate); 171 getHistoryData(dataType, mAnaDate);
171 } 172 }
172 }, mAnaYear, mAnaMonth, mAnaDay).show(); 173 }, mAnaYear, mAnaMonth, mAnaDay).show();
173 174
174 } 175 }
175 176
176 177
177 /** 178 /**
178 * init data for 179 * init data for
179 */ 180 */
180 private void initData() { 181 private void initData() {
181 mCalendar = Calendar.getInstance(); 182 mCalendar = Calendar.getInstance();
182 mCalendar.setTime(new Date()); 183 mCalendar.setTime(new Date());
183 mAnaDate = mCalendar.getTime(); 184 mAnaDate = mCalendar.getTime();
184 mAnaYear = mCalendar.get(Calendar.YEAR); 185 mAnaYear = mCalendar.get(Calendar.YEAR);
185 mAnaMonth = mCalendar.get(Calendar.MONTH); 186 mAnaMonth = mCalendar.get(Calendar.MONTH);
186 mAnaDay = mCalendar.get(Calendar.DAY_OF_MONTH); 187 mAnaDay = mCalendar.get(Calendar.DAY_OF_MONTH);
187 188
188 tvDate.setText(Utils.dateToStringFormatDayMonthYearJp(mAnaDate)); 189 tvDate.setText(Utils.dateToStringFormatDayMonthYearJp(mAnaDate));
189 tvWeekDay.setText(Utils.getWeekdayFromDate(mAnaDate)); 190 tvWeekDay.setText(Utils.getWeekdayFromDate(mAnaDate));
190 191
191 dataType = Const.DATA_TYPE.ONE_DAY; 192 dataType = Const.DATA_TYPE.ONE_DAY;
192 stepType = Const.STEP_TYPE.WALKING; 193 stepType = Const.STEP_TYPE.WALKING;
193 updateUiType(); 194 updateUiType();
194 updateUiStepType(false, true, false); 195 updateUiStepType(false, true, false);
195 196
196 getHistoryData(dataType, mAnaDate); 197 getHistoryData(dataType, mAnaDate);
197 } 198 }
198 199
199 private void updateUiType() { 200 private void updateUiType() {
200 if (dataType == Const.DATA_TYPE.ONE_DAY) { 201 if (dataType == Const.DATA_TYPE.ONE_DAY) {
201 setButtonSelected(true, false, false, false, false); 202 setButtonSelected(true, false, false, false, false);
202 } else if (dataType == Const.DATA_TYPE.ONE_WEEK) { 203 } else if (dataType == Const.DATA_TYPE.ONE_WEEK) {
203 setButtonSelected(false, true, false, false, false); 204 setButtonSelected(false, true, false, false, false);
204 } else if (dataType == Const.DATA_TYPE.ONE_MONTH) { 205 } else if (dataType == Const.DATA_TYPE.ONE_MONTH) {
205 setButtonSelected(false, false, true, false, false); 206 setButtonSelected(false, false, true, false, false);
206 } else if (dataType == Const.DATA_TYPE.THREE_MONTH){ 207 } else if (dataType == Const.DATA_TYPE.THREE_MONTH){
207 setButtonSelected(false, false, false, true, false); 208 setButtonSelected(false, false, false, true, false);
208 } else if (dataType == Const.DATA_TYPE.SIX_MONTH){ 209 } else if (dataType == Const.DATA_TYPE.SIX_MONTH){
209 setButtonSelected(false, false, false, false, true); 210 setButtonSelected(false, false, false, false, true);
210 } 211 }
211 } 212 }
212 213
213 private void setButtonSelected(boolean b1, boolean b2, boolean b3, boolean b4, boolean b5 ) { 214 private void setButtonSelected(boolean b1, boolean b2, boolean b3, boolean b4, boolean b5 ) {
214 btnOneDay.setSelected(b1); 215 btnOneDay.setSelected(b1);
215 btnOneWeek.setSelected(b2); 216 btnOneWeek.setSelected(b2);
216 btnOneMonth.setSelected(b3); 217 btnOneMonth.setSelected(b3);
217 btnThreeMonth.setSelected(b4); 218 btnThreeMonth.setSelected(b4);
218 btnSixMonth.setSelected(b5); 219 btnSixMonth.setSelected(b5);
219 } 220 }
220 221
221 private void updateUiStepType(boolean b1, boolean b2, boolean b3) { 222 private void updateUiStepType(boolean b1, boolean b2, boolean b3) {
222 llBike.setSelected(b1); 223 llBike.setSelected(b1);
223 llWalking.setSelected(b2); 224 llWalking.setSelected(b2);
224 llRunning.setSelected(b3); 225 llRunning.setSelected(b3);
225 } 226 }
226 227
227 private void getHistoryData(Const.DATA_TYPE dataType, Date toDate){ 228 private void getHistoryData(Const.DATA_TYPE dataType, Date toDate){
228 229
229 Date fromDate = Utils.getFromDate(mAnaDate, dataType); 230 Date fromDate = Utils.getFromDate(mAnaDate, dataType);
230 231
231 showDialog(mContext); 232 showDialog(mContext);
232 ApiServices.history(fromDate, toDate, new LLAPIManagerListener() { 233 ApiServices.history(fromDate, toDate, new LLAPIManagerListener() {
233 @Override 234 @Override
234 public void onError(Error error) { 235 public void onError(Error error) {
235 Debug.error("Get data history error"); 236 Debug.error("Get data history error");
236 hiddenDialog(); 237 hiddenDialog();
237 showDialogNotData(); 238 showDialogNotData();
238 } 239 }
239 240
240 @Override 241 @Override
241 public void onSuccess(String json) { 242 public void onSuccess(String json) {
242 Debug.error("Get data history success"); 243 Debug.error("Get data history success");
243 hiddenDialog(); 244 hiddenDialog();
244 loadDataDone(json); 245 loadDataDone(json);
245 } 246 }
246 247
247 @Override 248 @Override
248 public void onSuccess(JSONObject object) { 249 public void onSuccess(JSONObject object) {
249 Debug.error("Get data history success"); 250 Debug.error("Get data history success");
250 hiddenDialog(); 251 hiddenDialog();
251 } 252 }
252 }); 253 });
253 } 254 }
254 255
255 private void showDialogNotData(){ 256 private void showDialogNotData(){
256 showAlerDialog(mContext, getResources().getString(R.string.can_not_get_data)); 257 showAlerDialog(mContext, getResources().getString(R.string.can_not_get_data));
257 } 258 }
258 259
259 private void loadDataDone(String jsonString) { 260 private void loadDataDone(String jsonString) {
260 JSONObject jsonObject = null; 261 JSONObject jsonObject = null;
261 try { 262 try {
262 jsonObject = new JSONObject(jsonString); 263 jsonObject = new JSONObject(jsonString);
263 int status = jsonObject.optInt("status"); 264 int status = jsonObject.optInt("status");
264 if (status == 1) { 265 if (status == 1) {
265 JSONObject jsonObject1 = jsonObject.optJSONObject("result"); 266 JSONObject jsonObject1 = jsonObject.optJSONObject("result");
266 JSONObject jsonMod1 = jsonObject1.getJSONObject("mode_1"); 267 JSONObject jsonMod1 = jsonObject1.getJSONObject("mode_1");
267 JSONObject jsonMod2 = jsonObject1.getJSONObject("mode_2"); 268 JSONObject jsonMod2 = jsonObject1.getJSONObject("mode_2");
268 JSONObject jsonMod3 = jsonObject1.getJSONObject("mode_3"); 269 JSONObject jsonMod3 = jsonObject1.getJSONObject("mode_3");
269 addDataModWalking(jsonMod1); 270 addDataModWalking(jsonMod1);
270 addDataModRunning(jsonMod2); 271 addDataModRunning(jsonMod2);
271 addDataModBike(jsonMod3); 272 addDataModBike(jsonMod3);
272 273
273 } 274 }
274 } catch (JSONException e) { 275 } catch (JSONException e) {
275 e.printStackTrace(); 276 e.printStackTrace();
276 mDataModWalking = new HistoryInfo(); 277 mDataModWalking = new HistoryInfo();
277 mDataModRunning = new HistoryInfo();; 278 mDataModRunning = new HistoryInfo();;
278 mDataModBike = new HistoryInfo();; 279 mDataModBike = new HistoryInfo();;
279 } 280 }
280 281
281 if (stepType == Const.STEP_TYPE.WALKING){ 282 if (stepType == Const.STEP_TYPE.WALKING){
282 mDataCurrent = mDataModWalking; 283 mDataCurrent = mDataModWalking;
283 }else if (stepType == Const.STEP_TYPE.RUNNING){ 284 }else if (stepType == Const.STEP_TYPE.RUNNING){
284 mDataCurrent = mDataModRunning; 285 mDataCurrent = mDataModRunning;
285 }else { 286 }else {
286 mDataCurrent = mDataModBike; 287 mDataCurrent = mDataModBike;
287 } 288 }
288 289
289 updateUI(); 290 updateUI();
290 } 291 }
291 292
292 private void updateUI(){ 293 private void updateUI(){
293 // get data server 294 // get data server
294 tvGoal.setText(getResources().getString(R.string.step_unit, mDataCurrent.getTaget())); 295 tvGoal.setText(getResources().getString(R.string.step_unit, mDataCurrent.getTaget()));
295 tvStep.setText(getResources().getString(R.string.step_unit, mDataCurrent.getSteps())); 296 tvStep.setText(getResources().getString(R.string.step_unit, mDataCurrent.getSteps()));
296 tvSmallRemain.setText(getResources().getString(R.string.step_unit_1, mDataCurrent.getStepRemain())); 297 tvSmallRemain.setText(getResources().getString(R.string.step_unit_1, mDataCurrent.getStepRemain()));
297 tvRemain.setText(getResources().getString(R.string.step_unit, mDataCurrent.getStepRemain())); 298 tvRemain.setText(getResources().getString(R.string.step_unit, mDataCurrent.getStepRemain()));
298 tvRateDone.setText(getResources().getString(R.string.percent_unit, Utils.convert2String2Decimal(mDataCurrent.getCompletePercent()))); 299 tvRateDone.setText(getResources().getString(R.string.percent_unit, Utils.convert2String2Decimal(mDataCurrent.getCompletePercent())));
299 tvCaloConsumned.setText(getResources().getString(R.string.kcal_unit, Utils.convert2String2Decimal(mDataCurrent.getKcal()))); 300 tvCaloConsumned.setText(getResources().getString(R.string.kcal_unit, Utils.convert2String2Decimal(mDataCurrent.getKcal())));
300 tvDistance.setText(getResources().getString(R.string.distance_unit, Utils.convert2String2Decimal(mDataCurrent.getDistance()))); 301 tvDistance.setText(getResources().getString(R.string.distance_unit, Utils.convert2String2Decimal(mDataCurrent.getDistance())));
301 tvTime.setText(getResources().getString(R.string.time_unit, Utils.convertTimeStringFromString(mDataCurrent.getTime()))); 302 tvTime.setText(getResources().getString(R.string.time_unit, Utils.convertTimeStringFromString(mDataCurrent.getTime())));
302 303
303 // update bar 304 // update bar
304 if (mDataCurrent.getDataChart() != null && mDataCurrent.getDataChart().size() == 24) { 305 if (mDataCurrent.getDataChart() != null && mDataCurrent.getDataChart().size() == 24) {
305 updateBars(); 306 updateBars();
306 } 307 }
307 308
308 } 309 }
309 310
310 private void updateBars() { 311 private void updateBars() {
311 dateList = new ArrayList<>(); 312 dateList = new ArrayList<>();
312 List<Integer> stepList = new ArrayList<>(); 313 List<Integer> stepList = new ArrayList<>();
313 314
314 stepList = mDataCurrent.getDataChart(); 315 stepList = mDataCurrent.getDataChart();
315 for (int i = 0; i < 24; i++){ 316 for (int i = 0; i < 24; i++){
316 dateList.add(String.valueOf(i)); 317 dateList.add(String.valueOf(i));
317 } 318 }
318 319
319 mStep = stepList.toArray(new Integer[0]); 320 mStep = stepList.toArray(new Integer[0]);
320 mParties = dateList.toArray(new String[0]); 321 mParties = dateList.toArray(new String[0]);
321 322
322 initGraph(); 323 initGraph();
323 } 324 }
324 325
325 private void initGraph(){ 326 private void initGraph(){
326 327
327 mBarChart.setDrawBarShadow(false); 328 mBarChart.setDrawBarShadow(false);
328 mBarChart.setDrawValueAboveBar(true); 329 mBarChart.setDrawValueAboveBar(true);
329 330
330 // if more than 60 entries are displayed in the chart, no values will be 331 // if more than 60 entries are displayed in the chart, no values will be
331 // drawn 332 // drawn
332 mBarChart.setMaxVisibleValueCount(60); 333 mBarChart.setMaxVisibleValueCount(60);
333 334
334 mBarChart.getDescription().setEnabled(false); 335 mBarChart.getDescription().setEnabled(false);
335 // scaling can now only be done on x- and y-axis separately 336 // scaling can now only be done on x- and y-axis separately
336 mBarChart.setPinchZoom(false); 337 mBarChart.setPinchZoom(false);
337 338
338 mBarChart.setDrawGridBackground(false); 339 mBarChart.setDrawGridBackground(false);
339 // mChart.setDrawYLabels(false); 340 // mChart.setDrawYLabels(false);
340 341
341 DayAxisValueFormatter xValueFormatter = new DayAxisValueFormatter(dateList); 342 DayAxisValueFormatter xValueFormatter = new DayAxisValueFormatter(dateList);
342 343
343 XAxis xAxis = mBarChart.getXAxis(); 344 XAxis xAxis = mBarChart.getXAxis();
344 xAxis.setLabelRotationAngle(0); 345 xAxis.setLabelRotationAngle(0);
345 xAxis.setPosition(XAxis.XAxisPosition.TOP); 346 xAxis.setPosition(XAxis.XAxisPosition.TOP);
346 xAxis.setDrawGridLines(true); 347 xAxis.setDrawGridLines(true);
347 xAxis.setLabelCount(10); 348 xAxis.setLabelCount(10);
348 xAxis.setTextColor(Color.WHITE); 349 xAxis.setTextColor(Color.WHITE);
349 xAxis.setValueFormatter(xValueFormatter); 350 xAxis.setValueFormatter(xValueFormatter);
350 351
351 352
352 YAxis leftAxis = mBarChart.getAxisLeft(); 353 YAxis leftAxis = mBarChart.getAxisLeft();
353 leftAxis.setDrawLabels(false); 354 leftAxis.setDrawLabels(false);
354 leftAxis.setDrawGridLines(false); 355 leftAxis.setDrawGridLines(false);
355 leftAxis.setAxisMinimum(0f); 356 leftAxis.setAxisMinimum(0f);
356 leftAxis.setAxisMaximum(10000f); 357 leftAxis.setAxisMaximum(10000f);
357 leftAxis.setDrawZeroLine(false); 358 leftAxis.setDrawZeroLine(false);
358 359
359 leftAxis.setEnabled(false); 360 leftAxis.setEnabled(false);
360 mBarChart.setDrawValueAboveBar(false); 361 mBarChart.setDrawValueAboveBar(false);
361 mBarChart.getAxisRight().setEnabled(false); 362 mBarChart.getAxisRight().setEnabled(false);
362 363
363 // set auto scale min max 364 // set auto scale min max
364 mBarChart.setAutoScaleMinMaxEnabled(true); 365 mBarChart.setAutoScaleMinMaxEnabled(true);
365 mBarChart.notifyDataSetChanged(); 366 mBarChart.notifyDataSetChanged();
366 367
367 // Set enimate y 368 // Set enimate y
368 mBarChart.animateY(2000); 369 mBarChart.animateY(2000);
369 370
370 setData(); 371 setData();
371 372
372 mBarChart.getLegend().setEnabled(false); 373 mBarChart.getLegend().setEnabled(false);
373 } 374 }
374 375
375 376
376 private void setData() { 377 private void setData() {
377 378
378 ArrayList<String> xVals = new ArrayList<>(); 379 ArrayList<String> xVals = new ArrayList<>();
379 for (int i = 0; i < mStep.length; i++) { 380 for (int i = 0; i < mStep.length; i++) {
380 xVals.add(mParties[i % mStep.length]); 381 xVals.add(mParties[i % mStep.length]);
381 } 382 }
382 383
383 ArrayList<BarEntry> yVals1 = new ArrayList<>(); 384 ArrayList<BarEntry> yVals1 = new ArrayList<>();
384 for (int i = 0; i < mStep.length; i++) { 385 for (int i = 0; i < mStep.length; i++) {
385 float val = (float) (mStep[i]*1); 386 float val = (float) (mStep[i]*1);
386 yVals1.add(new BarEntry(i, val)); 387 yVals1.add(new BarEntry(i, val));
387 } 388 }
388 389
389 BarDataSet set1; 390 BarDataSet set1;
390 391
391 if (mBarChart.getData() != null && mBarChart.getData().getDataSetCount() > 0) { 392 if (mBarChart.getData() != null && mBarChart.getData().getDataSetCount() > 0) {
392 set1 = (BarDataSet)mBarChart.getData().getDataSetByIndex(0); 393 set1 = (BarDataSet)mBarChart.getData().getDataSetByIndex(0);
393 set1.setValues(yVals1); 394 set1.setValues(yVals1);
394 mBarChart.getData().notifyDataChanged(); 395 mBarChart.getData().notifyDataChanged();
395 mBarChart.notifyDataSetChanged(); 396 mBarChart.notifyDataSetChanged();
396 } else { 397 } else {
397 ArrayList<Integer> colors = new ArrayList<>(); 398 ArrayList<Integer> colors = new ArrayList<>();
398 399
399 400
400 int[] MATERIAL_COLORS = {rgb("#40CDEF")}; 401 int[] MATERIAL_COLORS = {rgb("#40CDEF")};
401 402
402 for (int c : MATERIAL_COLORS) 403 for (int c : MATERIAL_COLORS)
403 colors.add(c); 404 colors.add(c);
404 405
405 set1 = new BarDataSet(yVals1, null); 406 set1 = new BarDataSet(yVals1, null);
406 407
407 set1.setColors(colors); 408 set1.setColors(colors);
408 409
409 ArrayList<IBarDataSet> dataSets = new ArrayList<>(); 410 ArrayList<IBarDataSet> dataSets = new ArrayList<>();
410 dataSets.add(set1); 411 dataSets.add(set1);
411 412
412 BarData data = new BarData(dataSets); 413 BarData data = new BarData(dataSets);
413 data.setValueTextSize(10f); 414 data.setValueTextSize(10f);
414 415
415 mBarChart.setData(data); 416 mBarChart.setData(data);
416 } 417 }
417 } 418 }
418 419
419 private void addDataModWalking(JSONObject jsonObject){ 420 private void addDataModWalking(JSONObject jsonObject){
420 if (jsonObject == null) return; 421 if (jsonObject == null) return;
421 mDataModWalking.setTaget(jsonObject.optInt("target")); 422 mDataModWalking.setTaget(jsonObject.optInt("target"));
422 mDataModWalking.setSteps(jsonObject.optInt("steps")); 423 mDataModWalking.setSteps(jsonObject.optInt("steps"));
423 mDataModWalking.setStepRemain(jsonObject.optInt("step_remain")); 424 mDataModWalking.setStepRemain(jsonObject.optInt("step_remain"));
424 mDataModWalking.setCompletePercent(jsonObject.optDouble("complete_percent")); 425 mDataModWalking.setCompletePercent(jsonObject.optDouble("complete_percent"));
425 mDataModWalking.setTime(jsonObject.optInt("time")); 426 mDataModWalking.setTime(jsonObject.optInt("time"));
426 mDataModWalking.setDistance(jsonObject.optInt("distance")); 427 mDataModWalking.setDistance(jsonObject.optInt("distance"));
427 mDataModWalking.setKcal(jsonObject.optInt("kcal")); 428 mDataModWalking.setKcal(jsonObject.optInt("kcal"));
428 429
429 JSONObject dataChart = jsonObject.optJSONObject("data_chart"); 430 JSONObject dataChart = jsonObject.optJSONObject("data_chart");
430 ArrayList<Integer> dataChartList = new ArrayList<>(); 431 ArrayList<Integer> dataChartList = new ArrayList<>();
431 dataChartList.add(dataChart.optInt("0")); 432 dataChartList.add(dataChart.optInt("0"));
432 dataChartList.add(dataChart.optInt("1")); 433 dataChartList.add(dataChart.optInt("1"));
433 dataChartList.add(dataChart.optInt("2")); 434 dataChartList.add(dataChart.optInt("2"));
434 dataChartList.add(dataChart.optInt("3")); 435 dataChartList.add(dataChart.optInt("3"));
435 dataChartList.add(dataChart.optInt("4")); 436 dataChartList.add(dataChart.optInt("4"));
436 dataChartList.add(dataChart.optInt("5")); 437 dataChartList.add(dataChart.optInt("5"));
437 dataChartList.add(dataChart.optInt("6")); 438 dataChartList.add(dataChart.optInt("6"));
438 dataChartList.add(dataChart.optInt("7")); 439 dataChartList.add(dataChart.optInt("7"));
439 dataChartList.add(dataChart.optInt("8")); 440 dataChartList.add(dataChart.optInt("8"));
440 dataChartList.add(dataChart.optInt("9")); 441 dataChartList.add(dataChart.optInt("9"));
441 dataChartList.add(dataChart.optInt("10")); 442 dataChartList.add(dataChart.optInt("10"));
442 dataChartList.add(dataChart.optInt("11")); 443 dataChartList.add(dataChart.optInt("11"));
443 dataChartList.add(dataChart.optInt("12")); 444 dataChartList.add(dataChart.optInt("12"));
444 dataChartList.add(dataChart.optInt("13")); 445 dataChartList.add(dataChart.optInt("13"));
445 dataChartList.add(dataChart.optInt("14")); 446 dataChartList.add(dataChart.optInt("14"));
446 dataChartList.add(dataChart.optInt("15")); 447 dataChartList.add(dataChart.optInt("15"));
447 dataChartList.add(dataChart.optInt("16")); 448 dataChartList.add(dataChart.optInt("16"));
448 dataChartList.add(dataChart.optInt("17")); 449 dataChartList.add(dataChart.optInt("17"));
449 dataChartList.add(dataChart.optInt("18")); 450 dataChartList.add(dataChart.optInt("18"));
450 dataChartList.add(dataChart.optInt("19")); 451 dataChartList.add(dataChart.optInt("19"));
451 dataChartList.add(dataChart.optInt("20")); 452 dataChartList.add(dataChart.optInt("20"));
452 dataChartList.add(dataChart.optInt("21")); 453 dataChartList.add(dataChart.optInt("21"));
453 dataChartList.add(dataChart.optInt("22")); 454 dataChartList.add(dataChart.optInt("22"));
454 dataChartList.add(dataChart.optInt("23")); 455 dataChartList.add(dataChart.optInt("23"));
455 456
456 mDataModWalking.setDataChart(dataChartList); 457 mDataModWalking.setDataChart(dataChartList);
457 } 458 }
458 459
459 private void addDataModRunning(JSONObject jsonObject){ 460 private void addDataModRunning(JSONObject jsonObject){
460 if (jsonObject == null) return; 461 if (jsonObject == null) return;
461 mDataModRunning.setTaget(jsonObject.optInt("target")); 462 mDataModRunning.setTaget(jsonObject.optInt("target"));
462 mDataModRunning.setSteps(jsonObject.optInt("steps")); 463 mDataModRunning.setSteps(jsonObject.optInt("steps"));
463 mDataModRunning.setStepRemain(jsonObject.optInt("step_remain")); 464 mDataModRunning.setStepRemain(jsonObject.optInt("step_remain"));
464 mDataModRunning.setCompletePercent(jsonObject.optDouble("complete_percent")); 465 mDataModRunning.setCompletePercent(jsonObject.optDouble("complete_percent"));
465 mDataModRunning.setTime(jsonObject.optInt("time")); 466 mDataModRunning.setTime(jsonObject.optInt("time"));
466 mDataModRunning.setDistance(jsonObject.optInt("distance")); 467 mDataModRunning.setDistance(jsonObject.optInt("distance"));
467 mDataModRunning.setKcal(jsonObject.optInt("kcal")); 468 mDataModRunning.setKcal(jsonObject.optInt("kcal"));
468 469
469 JSONObject dataChart = jsonObject.optJSONObject("data_chart"); 470 JSONObject dataChart = jsonObject.optJSONObject("data_chart");
470 ArrayList<Integer> dataChartList = new ArrayList<>(); 471 ArrayList<Integer> dataChartList = new ArrayList<>();
471 dataChartList.add(dataChart.optInt("0")); 472 dataChartList.add(dataChart.optInt("0"));
472 dataChartList.add(dataChart.optInt("1")); 473 dataChartList.add(dataChart.optInt("1"));
473 dataChartList.add(dataChart.optInt("2")); 474 dataChartList.add(dataChart.optInt("2"));
474 dataChartList.add(dataChart.optInt("3")); 475 dataChartList.add(dataChart.optInt("3"));
475 dataChartList.add(dataChart.optInt("4")); 476 dataChartList.add(dataChart.optInt("4"));
476 dataChartList.add(dataChart.optInt("5")); 477 dataChartList.add(dataChart.optInt("5"));
477 dataChartList.add(dataChart.optInt("6")); 478 dataChartList.add(dataChart.optInt("6"));
478 dataChartList.add(dataChart.optInt("7")); 479 dataChartList.add(dataChart.optInt("7"));
479 dataChartList.add(dataChart.optInt("8")); 480 dataChartList.add(dataChart.optInt("8"));
480 dataChartList.add(dataChart.optInt("9")); 481 dataChartList.add(dataChart.optInt("9"));
481 dataChartList.add(dataChart.optInt("10")); 482 dataChartList.add(dataChart.optInt("10"));
482 dataChartList.add(dataChart.optInt("11")); 483 dataChartList.add(dataChart.optInt("11"));
483 dataChartList.add(dataChart.optInt("12")); 484 dataChartList.add(dataChart.optInt("12"));
484 dataChartList.add(dataChart.optInt("13")); 485 dataChartList.add(dataChart.optInt("13"));
485 dataChartList.add(dataChart.optInt("14")); 486 dataChartList.add(dataChart.optInt("14"));
486 dataChartList.add(dataChart.optInt("15")); 487 dataChartList.add(dataChart.optInt("15"));
487 dataChartList.add(dataChart.optInt("16")); 488 dataChartList.add(dataChart.optInt("16"));
488 dataChartList.add(dataChart.optInt("17")); 489 dataChartList.add(dataChart.optInt("17"));
489 dataChartList.add(dataChart.optInt("18")); 490 dataChartList.add(dataChart.optInt("18"));
490 dataChartList.add(dataChart.optInt("19")); 491 dataChartList.add(dataChart.optInt("19"));
491 dataChartList.add(dataChart.optInt("20")); 492 dataChartList.add(dataChart.optInt("20"));
492 dataChartList.add(dataChart.optInt("21")); 493 dataChartList.add(dataChart.optInt("21"));
493 dataChartList.add(dataChart.optInt("22")); 494 dataChartList.add(dataChart.optInt("22"));
494 dataChartList.add(dataChart.optInt("23")); 495 dataChartList.add(dataChart.optInt("23"));
495 496
496 mDataModRunning.setDataChart(dataChartList); 497 mDataModRunning.setDataChart(dataChartList);
497 } 498 }
498 499
499 private void addDataModBike(JSONObject jsonObject){ 500 private void addDataModBike(JSONObject jsonObject){
500 if (jsonObject == null) return; 501 if (jsonObject == null) return;
501 mDataModBike.setTaget(jsonObject.optInt("target")); 502 mDataModBike.setTaget(jsonObject.optInt("target"));
502 mDataModBike.setSteps(jsonObject.optInt("steps")); 503 mDataModBike.setSteps(jsonObject.optInt("steps"));
503 mDataModBike.setStepRemain(jsonObject.optInt("step_remain")); 504 mDataModBike.setStepRemain(jsonObject.optInt("step_remain"));
504 mDataModBike.setCompletePercent(jsonObject.optDouble("complete_percent")); 505 mDataModBike.setCompletePercent(jsonObject.optDouble("complete_percent"));
505 mDataModBike.setTime(jsonObject.optInt("time")); 506 mDataModBike.setTime(jsonObject.optInt("time"));
506 mDataModBike.setDistance(jsonObject.optInt("distance")); 507 mDataModBike.setDistance(jsonObject.optInt("distance"));
507 mDataModBike.setKcal(jsonObject.optInt("kcal")); 508 mDataModBike.setKcal(jsonObject.optInt("kcal"));
508 509
509 JSONObject dataChart = jsonObject.optJSONObject("data_chart"); 510 JSONObject dataChart = jsonObject.optJSONObject("data_chart");
510 ArrayList<Integer> dataChartList = new ArrayList<>(); 511 ArrayList<Integer> dataChartList = new ArrayList<>();
511 dataChartList.add(dataChart.optInt("0")); 512 dataChartList.add(dataChart.optInt("0"));
512 dataChartList.add(dataChart.optInt("1")); 513 dataChartList.add(dataChart.optInt("1"));
513 dataChartList.add(dataChart.optInt("2")); 514 dataChartList.add(dataChart.optInt("2"));
514 dataChartList.add(dataChart.optInt("3")); 515 dataChartList.add(dataChart.optInt("3"));
515 dataChartList.add(dataChart.optInt("4")); 516 dataChartList.add(dataChart.optInt("4"));
516 dataChartList.add(dataChart.optInt("5")); 517 dataChartList.add(dataChart.optInt("5"));
517 dataChartList.add(dataChart.optInt("6")); 518 dataChartList.add(dataChart.optInt("6"));
518 dataChartList.add(dataChart.optInt("7")); 519 dataChartList.add(dataChart.optInt("7"));
519 dataChartList.add(dataChart.optInt("8")); 520 dataChartList.add(dataChart.optInt("8"));
520 dataChartList.add(dataChart.optInt("9")); 521 dataChartList.add(dataChart.optInt("9"));
521 dataChartList.add(dataChart.optInt("10")); 522 dataChartList.add(dataChart.optInt("10"));
522 dataChartList.add(dataChart.optInt("11")); 523 dataChartList.add(dataChart.optInt("11"));
523 dataChartList.add(dataChart.optInt("12")); 524 dataChartList.add(dataChart.optInt("12"));
524 dataChartList.add(dataChart.optInt("13")); 525 dataChartList.add(dataChart.optInt("13"));
525 dataChartList.add(dataChart.optInt("14")); 526 dataChartList.add(dataChart.optInt("14"));
526 dataChartList.add(dataChart.optInt("15")); 527 dataChartList.add(dataChart.optInt("15"));
527 dataChartList.add(dataChart.optInt("16")); 528 dataChartList.add(dataChart.optInt("16"));
528 dataChartList.add(dataChart.optInt("17")); 529 dataChartList.add(dataChart.optInt("17"));
529 dataChartList.add(dataChart.optInt("18")); 530 dataChartList.add(dataChart.optInt("18"));
530 dataChartList.add(dataChart.optInt("19")); 531 dataChartList.add(dataChart.optInt("19"));
531 dataChartList.add(dataChart.optInt("20")); 532 dataChartList.add(dataChart.optInt("20"));
532 dataChartList.add(dataChart.optInt("21")); 533 dataChartList.add(dataChart.optInt("21"));
533 dataChartList.add(dataChart.optInt("22")); 534 dataChartList.add(dataChart.optInt("22"));
534 dataChartList.add(dataChart.optInt("23")); 535 dataChartList.add(dataChart.optInt("23"));
535 536
536 mDataModBike.setDataChart(dataChartList); 537 mDataModBike.setDataChart(dataChartList);
537 } 538 }
538 539
539 @OnClick({R.id.btn_oneDay, R.id.btn_oneWeek, R.id.btn_oneMonth, R.id.btn_threeMonth, 540 @OnClick({R.id.btn_oneDay, R.id.btn_oneWeek, R.id.btn_oneMonth, R.id.btn_threeMonth,
540 R.id.btn_sixMonth, R.id.btn_left_date, R.id.btn_right_date, R.id.ll_bike, 541 R.id.btn_sixMonth, R.id.btn_left_date, R.id.btn_right_date, R.id.ll_bike,
541 R.id.ll_walking, R.id.ll_running, R.id.rl_stepView}) 542 R.id.ll_walking, R.id.ll_running, R.id.rl_stepView})
542 public void onClick(View v){ 543 public void onClick(View v){
543 switch (v.getId()){ 544 switch (v.getId()){
544 case R.id.btn_left_date: 545 case R.id.btn_left_date:
545 mCalendar = Calendar.getInstance(); 546 mCalendar = Calendar.getInstance();
546 mCalendar.setTime(mAnaDate); 547 mCalendar.setTime(mAnaDate);
547 mCalendar.add(Calendar.DAY_OF_MONTH, -1); 548 mCalendar.add(Calendar.DAY_OF_MONTH, -1);
548 Date date = mCalendar.getTime(); 549 Date date = mCalendar.getTime();
549 tvDate.setText(Utils.dateToStringFormatDayMonthYearJp(date)); 550 tvDate.setText(Utils.dateToStringFormatDayMonthYearJp(date));
550 tvWeekDay.setText(Utils.getWeekdayFromDate(date)); 551 tvWeekDay.setText(Utils.getWeekdayFromDate(date));
551 mAnaDate = date; 552 mAnaDate = date;
552 getHistoryData(dataType, mAnaDate); 553 getHistoryData(dataType, mAnaDate);
553 break; 554 break;
554 555
555 case R.id.btn_right_date: 556 case R.id.btn_right_date:
556 mCalendar = Calendar.getInstance(); 557 mCalendar = Calendar.getInstance();
557 mCalendar.setTime(mAnaDate); 558 mCalendar.setTime(mAnaDate);
558 mCalendar.add(Calendar.DAY_OF_MONTH, +1); 559 mCalendar.add(Calendar.DAY_OF_MONTH, +1);
559 Date date1 = mCalendar.getTime(); 560 Date date1 = mCalendar.getTime();
560 tvDate.setText(Utils.dateToStringFormatDayMonthYearJp(date1)); 561 tvDate.setText(Utils.dateToStringFormatDayMonthYearJp(date1));
561 tvWeekDay.setText(Utils.getWeekdayFromDate(date1)); 562 tvWeekDay.setText(Utils.getWeekdayFromDate(date1));
562 mAnaDate = date1; 563 mAnaDate = date1;
563 getHistoryData(dataType, mAnaDate); 564 getHistoryData(dataType, mAnaDate);
564 break; 565 break;
565 566
566 case R.id.btn_oneDay: 567 case R.id.btn_oneDay:
567 dataType = Const.DATA_TYPE.ONE_DAY; 568 dataType = Const.DATA_TYPE.ONE_DAY;
568 updateUiType(); 569 updateUiType();
569 getHistoryData(dataType, mAnaDate); 570 getHistoryData(dataType, mAnaDate);
570 break; 571 break;
571 572
572 case R.id.btn_oneWeek: 573 case R.id.btn_oneWeek:
573 dataType = Const.DATA_TYPE.ONE_WEEK; 574 dataType = Const.DATA_TYPE.ONE_WEEK;
574 updateUiType(); 575 updateUiType();
575 getHistoryData(dataType, mAnaDate); 576 getHistoryData(dataType, mAnaDate);
576 break; 577 break;
577 578
578 case R.id.btn_oneMonth: 579 case R.id.btn_oneMonth:
579 dataType = Const.DATA_TYPE.ONE_MONTH; 580 dataType = Const.DATA_TYPE.ONE_MONTH;
580 updateUiType(); 581 updateUiType();
581 getHistoryData(dataType, mAnaDate); 582 getHistoryData(dataType, mAnaDate);
582 break; 583 break;
583 584
584 case R.id.btn_threeMonth: 585 case R.id.btn_threeMonth:
585 dataType = Const.DATA_TYPE.THREE_MONTH; 586 dataType = Const.DATA_TYPE.THREE_MONTH;
586 updateUiType(); 587 updateUiType();
587 getHistoryData(dataType, mAnaDate); 588 getHistoryData(dataType, mAnaDate);
588 break; 589 break;
589 590
590 case R.id.btn_sixMonth: 591 case R.id.btn_sixMonth:
591 dataType = Const.DATA_TYPE.SIX_MONTH; 592 dataType = Const.DATA_TYPE.SIX_MONTH;
592 updateUiType(); 593 updateUiType();
593 getHistoryData(dataType, mAnaDate); 594 getHistoryData(dataType, mAnaDate);
594 break; 595 break;
595 596
596 case R.id.tv_date: 597 case R.id.tv_date:
597 handleAnaDatePicker(); 598 handleAnaDatePicker();
598 break; 599 break;
599 600
600 case R.id.ll_bike: 601 case R.id.ll_bike:
601 stepType = Const.STEP_TYPE.BIKE; 602 stepType = Const.STEP_TYPE.BIKE;
602 updateUiStepType(true, false, false); 603 updateUiStepType(true, false, false);
603 // add data 604 // add data
604 mDataCurrent = mDataModBike; 605 mDataCurrent = mDataModBike;
605 updateUI(); 606 updateUI();
606 break; 607 break;
607 608
608 case R.id.ll_walking: 609 case R.id.ll_walking:
609 stepType = Const.STEP_TYPE.WALKING; 610 stepType = Const.STEP_TYPE.WALKING;
610 updateUiStepType(false, true, false); 611 updateUiStepType(false, true, false);
611 // add data 612 // add data
612 mDataCurrent = mDataModWalking; 613 mDataCurrent = mDataModWalking;
613 updateUI(); 614 updateUI();
614 break; 615 break;
615 616
616 case R.id.ll_running: 617 case R.id.ll_running:
617 stepType = Const.STEP_TYPE.RUNNING; 618 stepType = Const.STEP_TYPE.RUNNING;
618 updateUiStepType(false, false, true); 619 updateUiStepType(false, false, true);
619 // add 620 // add
620 mDataCurrent = mDataModRunning; 621 mDataCurrent = mDataModRunning;
621 updateUI(); 622 updateUI();
622 break; 623 break;
623 624
624 case R.id.rl_stepView: 625 case R.id.rl_stepView:
625 mHistoryFragment.showDetailFragment(); 626 mHistoryFragment.showDetailFragment();
626 break; 627 break;
627 628
628 default: 629 default:
629 break; 630 break;
630 } 631 }
631 } 632 }
632 633
633 @Override 634 @Override
634 public void onActivityResult(int requestCode, int resultCode, Intent data) { 635 public void onActivityResult(int requestCode, int resultCode, Intent data) {
635 super.onActivityResult(requestCode, resultCode, data); 636 super.onActivityResult(requestCode, resultCode, data);
636 637
637 } 638 }
638 } 639 }
639 640
app/src/main/java/com/dinhcv/lifelogpedometer/activity/MapFragment.java
1 package com.dinhcv.lifelogpedometer.activity; 1 package com.dinhcv.lifelogpedometer.activity;
2 2
3 import android.Manifest;
3 import android.app.Activity; 4 import android.app.Activity;
4 import android.content.Context; 5 import android.content.Context;
6 import android.content.pm.PackageManager;
7 import android.location.Location;
8 import android.location.LocationListener;
9 import android.location.LocationManager;
5 import android.os.Bundle; 10 import android.os.Bundle;
6 import android.support.annotation.Nullable; 11 import android.support.annotation.Nullable;
12 import android.support.v4.app.ActivityCompat;
13 import android.support.v4.content.ContextCompat;
7 import android.support.v4.app.Fragment; 14 import android.support.v4.app.Fragment;
8 import android.util.Log; 15 import android.util.Log;
9 import android.view.LayoutInflater; 16 import android.view.LayoutInflater;
10 import android.view.View; 17 import android.view.View;
11 import android.view.ViewGroup; 18 import android.view.ViewGroup;
12 19
13 import com.dinhcv.lifelogpedometer.R; 20 import com.dinhcv.lifelogpedometer.R;
21 import com.google.android.gms.maps.CameraUpdateFactory;
14 import com.google.android.gms.maps.GoogleMap; 22 import com.google.android.gms.maps.GoogleMap;
15 import com.google.android.gms.maps.OnMapReadyCallback; 23 import com.google.android.gms.maps.OnMapReadyCallback;
24 import com.google.android.gms.maps.SupportMapFragment;
25 import com.google.android.gms.maps.model.LatLng;
26 import com.google.android.gms.maps.model.MarkerOptions;
27 import com.google.android.gms.maps.model.PolylineOptions;
16 28
29 import static android.content.Context.LOCATION_SERVICE;
30
17 public class MapFragment extends Fragment implements SettingFragmentPresenter, OnMapReadyCallback { 31 public class MapFragment extends Fragment implements SettingFragmentPresenter, OnMapReadyCallback {
18 private View mRootView; 32 private View mRootView;
33 private PolylineOptions polylineOptions = new PolylineOptions();
34 private LocationManager mLocationManager;
35 // The minimum distance to change Updates in meters
36 private static final long LOCATION_REFRESH_DISTANCE = 10;
19 37
38 // The minimum time between updates in milliseconds
39 private static final long LOCATION_REFRESH_TIME = 10000;
40
41 private double lat = 0;
42 private double log = 0;
43
44 private SupportMapFragment mapFragment;
45 private GoogleMap googleMap;
46
20 @Override 47 @Override
21 public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle 48 public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle
22 savedInstanceState) { 49 savedInstanceState) {
23 // Inflate the layout for this fragment 50 // Inflate the layout for this fragment
24 mRootView = inflater.inflate(R.layout.fragment_map, container, false); 51 mRootView = inflater.inflate(R.layout.fragment_map, container, false);
25 52
26 initView(mRootView); 53 initView(mRootView);
27 54
28 initData(); 55 initData();
29 56
30 return mRootView; 57 return mRootView;
31 } 58 }
32 59
33 /** 60 /**
34 * init view 61 * init view
35 * 62 *
36 * @param rootView view 63 * @param rootView view
37 */ 64 */
38 private void initView(View rootView) { 65 private void initView(View rootView) {
66 mapFragment = (SupportMapFragment) getChildFragmentManager()
67 .findFragmentById(R.id.map);
39 68
69 polylineOptions.color(ContextCompat.getColor(getActivity(),android.R.color.holo_red_dark));
70
40 } 71 }
41 72
42 /** 73 /**
43 * Init data 74 * Init data
44 */ 75 */
45 private void initData() { 76 private void initData() {
77 mLocationManager = (LocationManager) getActivity().getSystemService(LOCATION_SERVICE);
46 78
79 if (ActivityCompat.checkSelfPermission(getActivity(), Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(getActivity(), Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
80 return;
81 }
82 mLocationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, LOCATION_REFRESH_TIME,
83 LOCATION_REFRESH_DISTANCE, mLocationListener);
47 } 84 }
48 85
86 private final LocationListener mLocationListener = new LocationListener() {
87 @Override
88 public void onLocationChanged(final Location location) {
89 //your code here
90 lat = location.getLatitude();
91 log = location.getLongitude();
92 polylineOptions.add(new LatLng(lat, log));
93 if (googleMap!= null) {
94 googleMap.addPolyline(polylineOptions);
95 }
96 //update
97 update();
98 }
49 99
100 @Override
101 public void onStatusChanged(String s, int i, Bundle bundle) {
102
103 }
104
105 @Override
106 public void onProviderEnabled(String s) {
107
108 }
109
110 @Override
111 public void onProviderDisabled(String s) {
112
113 }
114 };
115
116 private void update(){
117 mapFragment.getMapAsync(this);
118 }
119
120 private void updateLine(){
121 LatLng sydney = new LatLng(-34, 151);
122 LatLng melbourne=new LatLng(37.813, 144.9631);
123 LatLng auckland=new LatLng(36.8485, 174.7633);
124
125 polylineOptions.add(new LatLng[]{sydney,melbourne,auckland});
126 if (googleMap!= null) {
127 googleMap.addPolyline(polylineOptions);
128 }
129 }
130
50 @Override 131 @Override
51 public void onAttach(Context context) { 132 public void onAttach(Context context) {
52 super.onAttach(context); 133 super.onAttach(context);
53 if (context instanceof Activity) { 134 if (context instanceof Activity) {
54 135
55 } 136 }
56 } 137 }
57 138
58 139
59 /** 140 /**
60 * Save data 141 * Save data
61 */ 142 */
62 @Override 143 @Override
63 public void onSaveData() { 144 public void onSaveData() {
64 } 145 }
65 146
66 @Override 147 @Override
67 public void onInvalidate(boolean isInit) { 148 public void onInvalidate(boolean isInit) {
68 initData(); 149 initData();
69 } 150 }
70 151
71 152
72 @Override 153 @Override
73 public void onViewStateRestored(@Nullable Bundle savedInstanceState) { 154 public void onViewStateRestored(@Nullable Bundle savedInstanceState) {
74 super.onViewStateRestored(savedInstanceState); 155 super.onViewStateRestored(savedInstanceState);
75 156
76 initData(); 157 initData();
77 } 158 }
78 159
79 @Override 160 @Override
80 public void onMapReady(GoogleMap googleMap) { 161 public void onMapReady(GoogleMap gm) {
162
163 googleMap = gm;
164 LatLng pos=new LatLng(lat, log);
165 googleMap.addMarker(new MarkerOptions()
166 .position(pos));
167 googleMap.animateCamera(CameraUpdateFactory.newLatLngZoom(pos, 15.0f));
168
81 Log.i("SonLT","Readdy"); 169 Log.i("SonLT","Readdy");
170
171 //updateLine();
82 } 172 }
83 } 173 }
84 174
app/src/main/java/com/dinhcv/lifelogpedometer/activity/PedometerActivity.java
1 package com.dinhcv.lifelogpedometer.activity; 1 package com.dinhcv.lifelogpedometer.activity;
2 2
3 import android.Manifest; 3 import android.Manifest;
4 import android.content.Context;
4 import android.content.Intent; 5 import android.content.Intent;
5 import android.os.Build; 6 import android.os.Build;
6 import android.os.Bundle; 7 import android.os.Bundle;
7 import android.support.design.widget.TabLayout; 8 import android.support.design.widget.TabLayout;
8 import android.support.v4.app.Fragment; 9 import android.support.v4.app.Fragment;
9 import android.support.v4.app.FragmentManager; 10 import android.support.v4.app.FragmentManager;
10 import android.support.v4.app.FragmentPagerAdapter; 11 import android.support.v4.app.FragmentPagerAdapter;
11 import android.support.v4.content.PermissionChecker; 12 import android.support.v4.content.PermissionChecker;
12 import android.support.v4.view.ViewPager; 13 import android.support.v4.view.ViewPager;
13 import android.support.v7.widget.PopupMenu; 14 import android.support.v7.widget.PopupMenu;
14 import android.support.v7.widget.Toolbar; 15 import android.support.v7.widget.Toolbar;
15 import android.view.Gravity; 16 import android.view.Gravity;
17 import android.view.LayoutInflater;
16 import android.view.MenuItem; 18 import android.view.MenuItem;
17 import android.view.View; 19 import android.view.View;
18 import android.view.Window; 20 import android.view.Window;
19 import android.view.WindowManager; 21 import android.view.WindowManager;
20 import android.widget.ImageView; 22 import android.widget.ImageView;
21 import android.widget.PopupWindow; 23 import android.widget.PopupWindow;
24 import android.widget.TabHost;
22 import android.widget.TextView; 25 import android.widget.TextView;
23 import android.widget.Toast; 26 import android.widget.Toast;
24 27
25 import com.dinhcv.lifelogpedometer.R; 28 import com.dinhcv.lifelogpedometer.R;
26 import com.dinhcv.lifelogpedometer.model.Shareprefer.Setting; 29 import com.dinhcv.lifelogpedometer.model.Shareprefer.Setting;
27 import com.dinhcv.lifelogpedometer.utils.Debug; 30 import com.dinhcv.lifelogpedometer.utils.Debug;
28 import com.dinhcv.lifelogpedometer.utils.Utils; 31 import com.dinhcv.lifelogpedometer.utils.Utils;
29 32
30 import java.util.ArrayList; 33 import java.util.ArrayList;
31 import java.util.List; 34 import java.util.List;
32 35
33 public class PedometerActivity extends ActivityBase { 36 public class PedometerActivity extends ActivityBase {
34 private Toolbar mToolBar; 37 private Toolbar mToolBar;
35 private ViewPager mViewPager; 38 private ViewPager mViewPager;
36 private int mCurrentTab = 0; 39 private int mCurrentTab = 0;
37 private TabLayout mTabLayout; 40 private TabLayout mTabLayout;
38 private TextView tvPageTitle; 41 private TextView tvPageTitle;
39 private ImageView ivHome; 42 private ImageView ivHome;
40 private ImageView imvMenu; 43 private ImageView imvMenu;
41 44
42 private TopFragment mTopFragment; 45 private TopFragment mTopFragment;
43 private HistoryFragment mHistoryFragment; 46 private HistoryFragment mHistoryFragment;
44 private SnsFragment mSnsFragment; 47 private SnsFragment mSnsFragment;
45 48
46 private int[] tabIcons = { 49 private int[] tabIcons = {
47 com.dinhcv.lifelogpedometer.R.drawable.ic_date, 50 R.drawable.today_ic,
48 R.drawable.ic_history, 51 R.drawable.history_ic,
49 R.drawable.ic_rank, 52 R.drawable.rank_ic,
50 R.drawable.ic_map, 53 R.drawable.map_ic,
51 R.drawable.ic_sns 54 R.drawable.sns_ic
52 }; 55 };
53 56
54 public enum TAB { 57 public enum TAB {
55 DATE_TAB(0), 58 DATE_TAB(0),
56 HISTORY_TAB(1), 59 HISTORY_TAB(1),
57 RANK_TAB(2), 60 RANK_TAB(2),
58 MAP_TAB(3), 61 MAP_TAB(3),
59 SNS_TAB(4); 62 SNS_TAB(4);
60 63
61 private final int index; 64 private final int index;
62 65
63 TAB(int index) { 66 TAB(int index) {
64 this.index = index; 67 this.index = index;
65 } 68 }
66 69
67 public int getValue() { 70 public int getValue() {
68 return index; 71 return index;
69 } 72 }
70 } 73 }
71 74
72 @Override 75 @Override
73 protected void onCreate(Bundle savedInstanceState) { 76 protected void onCreate(Bundle savedInstanceState) {
74 super.onCreate(savedInstanceState); 77 super.onCreate(savedInstanceState);
75 78
76 setContentView(R.layout.activity_pedometer); 79 setContentView(R.layout.activity_pedometer);
77 getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE); 80 getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
78 81
79 initView(); 82 initView();
80 83
81 if (android.support.v4.BuildConfig.DEBUG && Build.VERSION.SDK_INT >= 23 && PermissionChecker 84 if (android.support.v4.BuildConfig.DEBUG && Build.VERSION.SDK_INT >= 23 && PermissionChecker
82 .checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) != 85 .checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) !=
83 PermissionChecker.PERMISSION_GRANTED) { 86 PermissionChecker.PERMISSION_GRANTED) {
84 requestPermissions(new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, 0); 87 requestPermissions(new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, 0);
85 } 88 }
86 } 89 }
87 90
88 private void initView() { 91 private void initView() {
89 92
90 tvPageTitle = (TextView) findViewById(R.id.tv_pageTitle); 93 tvPageTitle = (TextView) findViewById(R.id.tv_pageTitle);
91 ivHome = (ImageView) findViewById(R.id.iv_home); 94 ivHome = (ImageView) findViewById(R.id.iv_home);
92 imvMenu = (ImageView) findViewById(R.id.imv_menu); 95 imvMenu = (ImageView) findViewById(R.id.imv_menu);
93 96
94 mViewPager = (ViewPager) findViewById(R.id.viewpager); 97 mViewPager = (ViewPager) findViewById(R.id.viewpager);
95 mViewPager.setOffscreenPageLimit(5); 98 mViewPager.setOffscreenPageLimit(5);
96 setupViewPager(mViewPager); 99 setupViewPager(mViewPager);
97 mTabLayout = (TabLayout) findViewById(R.id.tabs); 100 mTabLayout = (TabLayout) findViewById(R.id.tabs);
98 mTabLayout.setupWithViewPager(mViewPager); 101 mTabLayout.setupWithViewPager(mViewPager);
99 //Set tab selected 102 //Set tab selected
100 TabLayout.Tab tab = mTabLayout.getTabAt(mCurrentTab); 103 TabLayout.Tab tab = mTabLayout.getTabAt(mCurrentTab);
101 if (tab != null) { 104 if (tab != null) {
102 tab.select(); 105 tab.select();
103 } 106 }
107 //mTabLayout.addTab();
108 View view1 = getLayoutInflater().inflate(R.layout.customtab, null);
109 view1.findViewById(R.id.icon).setBackgroundResource(R.drawable.today_ic);
110 //mTabLayout.addTab(mTabLayout.newTab().setCustomView(view1));
104 111
112
113 View view2 = getLayoutInflater().inflate(R.layout.customtab, null);
114 view2.findViewById(R.id.icon).setBackgroundResource(R.drawable.history_ic);
115 //mTabLayout.addTab(mTabLayout.newTab().setCustomView(view2));
116
117
118 View view3 = getLayoutInflater().inflate(R.layout.customtab, null);
119 view3.findViewById(R.id.icon).setBackgroundResource(R.drawable.rank_ic);
120 //mTabLayout.addTab(mTabLayout.newTab().setCustomView(view3));
121
122
123 View view4 = getLayoutInflater().inflate(R.layout.customtab, null);
124 view4.findViewById(R.id.icon).setBackgroundResource(R.drawable.map_ic);
125 //mTabLayout.addTab(mTabLayout.newTab().setCustomView(view4));
126
127
128 View view5 = getLayoutInflater().inflate(R.layout.customtab, null);
129 view5.findViewById(R.id.icon).setBackgroundResource(R.drawable.sns_ic);
130 //mTabLayout.addTab(mTabLayout.newTab().setCustomView(view5));
131
132
133 mTabLayout.getTabAt(0).setCustomView(view1);
134 mTabLayout.getTabAt(1).setCustomView(view2);
135 mTabLayout.getTabAt(2).setCustomView(view3);
136 mTabLayout.getTabAt(3).setCustomView(view4);
137 mTabLayout.getTabAt(4).setCustomView(view5);
138
105 changeColorStatusBar(); 139 changeColorStatusBar();
106 setupTabIcons(); 140 //setupTabIcons();
107 141
108 //SonLT Add 142 //SonLT Add
109 ivHome.setOnClickListener(new View.OnClickListener() { 143 ivHome.setOnClickListener(new View.OnClickListener() {
110 @Override 144 @Override
111 public void onClick(View v) { 145 public void onClick(View v) {
112 switch (mCurrentTab){ 146 switch (mCurrentTab){
113 case 0: mTopFragment.clickBackToHome(); break; 147 case 0: mTopFragment.clickBackToHome(); break;
114 case 1: mHistoryFragment.clickBackToHome(); break; 148 case 1: mHistoryFragment.clickBackToHome(); break;
115 case 4: mSnsFragment.handleToolbarClick(0); break; 149 case 4: mSnsFragment.handleToolbarClick(0); break;
116 default: break; 150 default: break;
117 } 151 }
118 } 152 }
119 }); 153 });
120 154
121 imvMenu.setOnClickListener(new View.OnClickListener() { 155 imvMenu.setOnClickListener(new View.OnClickListener() {
122 @Override 156 @Override
123 public void onClick(View v) { 157 public void onClick(View v) {
124 //Creating the instance of PopupMenu 158 //Creating the instance of PopupMenu
125 PopupMenu popup = new PopupMenu(PedometerActivity.this, imvMenu); 159 PopupMenu popup = new PopupMenu(PedometerActivity.this, imvMenu);
126 //Inflating the Popup using xml file 160 //Inflating the Popup using xml file
127 popup.getMenuInflater().inflate(R.menu.main, popup.getMenu()); 161 popup.getMenuInflater().inflate(R.menu.main, popup.getMenu());
128 162
129 //registering popup with OnMenuItemClickListener 163 //registering popup with OnMenuItemClickListener
130 popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() { 164 popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
131 public boolean onMenuItemClick(MenuItem item) { 165 public boolean onMenuItemClick(MenuItem item) {
132 switch (item.getItemId()){ 166 switch (item.getItemId()){
133 case R.id.action_setting: 167 case R.id.action_setting:
134 Toast.makeText( 168 Toast.makeText(
135 PedometerActivity.this, 169 PedometerActivity.this,
136 "Have not spec : " + item.getTitle(), 170 "Have not spec : " + item.getTitle(),
137 Toast.LENGTH_SHORT 171 Toast.LENGTH_SHORT
138 ).show(); 172 ).show();
139 break; 173 break;
140 case R.id.action_profile: 174 case R.id.action_profile:
141 Toast.makeText( 175 Toast.makeText(
142 PedometerActivity.this, 176 PedometerActivity.this,
143 "Have not spec : " + item.getTitle(), 177 "Have not spec : " + item.getTitle(),
144 Toast.LENGTH_SHORT 178 Toast.LENGTH_SHORT
145 ).show(); 179 ).show();
146 break; 180 break;
147 case R.id.action_logout: 181 case R.id.action_logout:
148 logout(); 182 logout();
149 break; 183 break;
150 default: 184 default:
151 Debug.warn("Not run here"); 185 Debug.warn("Not run here");
152 break; 186 break;
153 } 187 }
154 188
155 return true; 189 return true;
156 } 190 }
157 }); 191 });
158 192
159 popup.show(); //showing popup menu 193 popup.show(); //showing popup menu
160 } 194 }
161 }); //closing the setOnClickListener method 195 }); //closing the setOnClickListener method
162 } 196 }
163 197
198 public TabHost.TabSpec setIndicator(Context ctx, TabHost.TabSpec spec, int viewId, int resId, String name) {
199 View v = LayoutInflater.from(ctx).inflate(R.layout.customtab, null);
200 ImageView imgTab = (ImageView) v.findViewById(viewId);
201 imgTab.setImageDrawable(getResources().getDrawable(resId));
202
203 return spec.setIndicator(v);
204 }
205
164 private void setupTabIcons() { 206 private void setupTabIcons() {
165 mTabLayout.getTabAt(0).setIcon(tabIcons[0]); 207 mTabLayout.getTabAt(0).setCustomView(tabIcons[0]);
166 mTabLayout.getTabAt(1).setIcon(tabIcons[1]); 208 mTabLayout.getTabAt(1).setIcon(tabIcons[1]);
167 mTabLayout.getTabAt(2).setIcon(tabIcons[2]); 209 mTabLayout.getTabAt(2).setIcon(tabIcons[2]);
168 mTabLayout.getTabAt(3).setIcon(tabIcons[3]); 210 mTabLayout.getTabAt(3).setIcon(tabIcons[3]);
169 mTabLayout.getTabAt(4).setIcon(tabIcons[4]); 211 mTabLayout.getTabAt(4).setIcon(tabIcons[4]);
170 } 212 }
171 213
172 214
173 private void setTabView() { 215 private void setTabView() {
174 216
175 for (int i = 0; i < mTabLayout.getTabCount(); i++) { 217 for (int i = 0; i < mTabLayout.getTabCount(); i++) {
176 TextView tv = (TextView) mTabLayout.getChildAt(0).findViewById(android.R.id.title); 218 TextView tv = (TextView) mTabLayout.getChildAt(0).findViewById(android.R.id.title);
177 //tv.setTextColor(Color.BLACK); 219 //tv.setTextColor(Color.BLACK);
178 tv.setPadding(10, 10, 10, 15); 220 tv.setPadding(10, 10, 10, 15);
179 tv.setTextSize((float) 20.0); 221 tv.setTextSize((float) 20.0);
180 //tv.setTypeface(null, Typeface.BOLD); 222 //tv.setTypeface(null, Typeface.BOLD);
181 //tv.setBackgroundResource(R.drawable.icon); 223 //tv.setBackgroundResource(R.drawable.icon);
182 tv.setHeight(100); 224 tv.setHeight(100);
183 tv.setWidth(100); 225 tv.setWidth(100);
184 } 226 }
185 227
186 } 228 }
187 229
188 private void changeColorStatusBar() { 230 private void changeColorStatusBar() {
189 if (android.os.Build.VERSION.SDK_INT >= 21) { 231 if (android.os.Build.VERSION.SDK_INT >= 21) {
190 Window window = this.getWindow(); 232 Window window = this.getWindow();
191 window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); 233 window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
192 window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); 234 window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
193 // window.setStatusBarColor(Utils.getColorWrapper(this, R.color.white)); 235 // window.setStatusBarColor(Utils.getColorWrapper(this, R.color.white));
194 } 236 }
195 } 237 }
196 238
197 // @Override 239 // @Override
198 // public boolean onCreateOptionsMenu(Menu menu) { 240 // public boolean onCreateOptionsMenu(Menu menu) {
199 // getMenuInflater().inflate(R.menu.setting_menu, menu); 241 // getMenuInflater().inflate(R.menu.setting_menu, menu);
200 // return true; 242 // return true;
201 // } 243 // }
202 244
203 @Override 245 @Override
204 public boolean onOptionsItemSelected(MenuItem item) { 246 public boolean onOptionsItemSelected(MenuItem item) {
205 return super.onOptionsItemSelected(item); 247 return super.onOptionsItemSelected(item);
206 } 248 }
207 249
208 /** 250 /**
209 * Setup pager 251 * Setup pager
210 * 252 *
211 * @param viewPager: view pager 253 * @param viewPager: view pager
212 */ 254 */
213 private void setupViewPager(ViewPager viewPager) { 255 private void setupViewPager(ViewPager viewPager) {
214 ViewPagerAdapter adapter = new ViewPagerAdapter(getSupportFragmentManager()); 256 ViewPagerAdapter adapter = new ViewPagerAdapter(getSupportFragmentManager());
215 mTopFragment = new TopFragment(); 257 mTopFragment = new TopFragment();
216 adapter.addFragment(mTopFragment, getString(R.string.date)); 258 adapter.addFragment(mTopFragment, getString(R.string.date));
217 mHistoryFragment = new HistoryFragment(); 259 mHistoryFragment = new HistoryFragment();
218 adapter.addFragment(mHistoryFragment, getString(R.string.history)); 260 adapter.addFragment(mHistoryFragment, getString(R.string.history));
219 adapter.addFragment(new RankFragment(), getString(R.string.ranking)); 261 adapter.addFragment(new RankFragment(), getString(R.string.ranking));
220 adapter.addFragment(new MapFragment(), getString(R.string.map)); 262 adapter.addFragment(new MapFragment(), getString(R.string.map));
221 mSnsFragment = new SnsFragment(); 263 mSnsFragment = new SnsFragment();
222 adapter.addFragment(mSnsFragment, getString(R.string.sns)); 264 adapter.addFragment(mSnsFragment, getString(R.string.sns));
223 viewPager.setAdapter(adapter); 265 viewPager.setAdapter(adapter);
224 } 266 }
225 267
226 /** 268 /**
227 * Class FragmentPagerAdapter 269 * Class FragmentPagerAdapter
228 */ 270 */
229 class ViewPagerAdapter extends FragmentPagerAdapter { 271 class ViewPagerAdapter extends FragmentPagerAdapter {
230 private final List<Fragment> mFragmentList = new ArrayList<>(); 272 private final List<Fragment> mFragmentList = new ArrayList<>();
231 private final List<String> mFragmentTitleList = new ArrayList<>(); 273 private final List<String> mFragmentTitleList = new ArrayList<>();
232 274
233 public ViewPagerAdapter(FragmentManager manager) { 275 public ViewPagerAdapter(FragmentManager manager) {
234 super(manager); 276 super(manager);
235 } 277 }
236 278
237 @Override 279 @Override
238 public Fragment getItem(int position) { 280 public Fragment getItem(int position) {
239 return mFragmentList.get(position); 281 return mFragmentList.get(position);
240 } 282 }
241 283
242 @Override 284 @Override
243 public int getCount() { 285 public int getCount() {
244 return mFragmentList.size(); 286 return mFragmentList.size();
245 } 287 }
246 288
247 private void addFragment(Fragment fragment, String title) { 289 private void addFragment(Fragment fragment, String title) {
248 mFragmentList.add(fragment); 290 mFragmentList.add(fragment);
249 mFragmentTitleList.add(title); 291 mFragmentTitleList.add(title);
250 } 292 }
251 293
252 @Override 294 @Override
253 public CharSequence getPageTitle(int position) { 295 public CharSequence getPageTitle(int position) {
254 return mFragmentTitleList.get(position); 296 //return mFragmentTitleList.get(position);
297 return null;
255 } 298 }
256 } 299 }
257 300
258 @Override 301 @Override
259 protected void onResume() { 302 protected void onResume() {
260 super.onResume(); 303 super.onResume();
261 mViewPager.addOnPageChangeListener(mPageChangeListener); 304 mViewPager.addOnPageChangeListener(mPageChangeListener);
262 } 305 }
263 306
264 @Override 307 @Override
265 protected void onPause() { 308 protected void onPause() {
266 super.onPause(); 309 super.onPause();
267 mViewPager.removeOnPageChangeListener(mPageChangeListener); 310 mViewPager.removeOnPageChangeListener(mPageChangeListener);
268 } 311 }
269 312
270 private int mLastTab = 0; 313 private int mLastTab = 0;
271 private final ViewPager.OnPageChangeListener mPageChangeListener = new ViewPager 314 private final ViewPager.OnPageChangeListener mPageChangeListener = new ViewPager
272 .OnPageChangeListener 315 .OnPageChangeListener
273 () { 316 () {
274 @Override 317 @Override
275 public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { 318 public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
276 //Nothing here 319 //Nothing here
277 } 320 }
278 321
279 @Override 322 @Override
280 public void onPageSelected(int position) { 323 public void onPageSelected(int position) {
281 ViewPagerAdapter adapter = (ViewPagerAdapter) mViewPager.getAdapter(); 324 ViewPagerAdapter adapter = (ViewPagerAdapter) mViewPager.getAdapter();
282 SettingFragmentPresenter presenter = (SettingFragmentPresenter) adapter.getItem 325 SettingFragmentPresenter presenter = (SettingFragmentPresenter) adapter.getItem
283 (position); 326 (position);
284 327
285 switch (position) { 328 switch (position) {
286 case 4: 329 case 4:
287 tvPageTitle.setText(getString(R.string.sns_fragment)); 330 tvPageTitle.setText(getString(R.string.sns_fragment));
288 ivHome.setVisibility(View.VISIBLE); 331 ivHome.setVisibility(View.VISIBLE);
289 break; 332 break;
290 case 1: 333 case 1:
291 tvPageTitle.setText(getString(R.string.today)); 334 tvPageTitle.setText(getString(R.string.today));
292 ivHome.setVisibility(View.VISIBLE); 335 ivHome.setVisibility(View.VISIBLE);
293 break; 336 break;
294 337
295 case 0: 338 case 0:
296 tvPageTitle.setText(getString(R.string.home)); 339 tvPageTitle.setText(getString(R.string.home));
297 ivHome.setVisibility(View.GONE); 340 ivHome.setVisibility(View.GONE);
298 break; 341 break;
299 342
300 default: 343 default:
301 tvPageTitle.setText(getString(R.string.home)); 344 tvPageTitle.setText(getString(R.string.home));
302 ivHome.setVisibility(View.GONE); 345 ivHome.setVisibility(View.GONE);
303 break; 346 break;
304 } 347 }
305 // if (position == 1){ 348 // if (position == 1){
306 // tvPageTitle.setText(getString(R.string.today)); 349 // tvPageTitle.setText(getString(R.string.today));
307 // ivHome.setVisibility(View.VISIBLE); 350 // ivHome.setVisibility(View.VISIBLE);
308 // }else { 351 // }else {
309 // tvPageTitle.setText(getString(R.string.home)); 352 // tvPageTitle.setText(getString(R.string.home));
310 // ivHome.setVisibility(View.GONE); 353 // ivHome.setVisibility(View.GONE);
311 // } 354 // }
312 355
313 presenter.onInvalidate(false); 356 presenter.onInvalidate(false);
314 mLastTab = position; 357 mLastTab = position;
315 mCurrentTab = position; 358 mCurrentTab = position;
316 } 359 }
317 360
318 @Override 361 @Override
319 public void onPageScrollStateChanged(int state) { 362 public void onPageScrollStateChanged(int state) {
320 //Nothing here 363 //Nothing here
321 if (state == ViewPager.SCROLL_STATE_SETTLING) { 364 if (state == ViewPager.SCROLL_STATE_SETTLING) {
322 if (mLastTab >= 0) { 365 if (mLastTab >= 0) {
323 ViewPagerAdapter adapter = (ViewPagerAdapter) mViewPager.getAdapter(); 366 ViewPagerAdapter adapter = (ViewPagerAdapter) mViewPager.getAdapter();
324 SettingFragmentPresenter presenter = (SettingFragmentPresenter) adapter 367 SettingFragmentPresenter presenter = (SettingFragmentPresenter) adapter
325 .getItem(mLastTab); 368 .getItem(mLastTab);
326 369
327 Debug.normal("Save data in tab:" + mLastTab); 370 Debug.normal("Save data in tab:" + mLastTab);
328 presenter.onSaveData(); 371 presenter.onSaveData();
329 } 372 }
330 } 373 }
331 } 374 }
332 }; 375 };
333 376
334 public void setVisibleIconHome(boolean isVisible){ 377 public void setVisibleIconHome(boolean isVisible){
335 if (isVisible) { 378 if (isVisible) {
336 ivHome.setVisibility(View.VISIBLE); 379 ivHome.setVisibility(View.VISIBLE);
337 }else { 380 }else {
338 ivHome.setVisibility(View.GONE); 381 ivHome.setVisibility(View.GONE);
339 } 382 }
340 383
341 setTitleTop(isVisible); 384 setTitleTop(isVisible);
342 } 385 }
343 386
344 public void setTitleTop(boolean isVisible){ 387 public void setTitleTop(boolean isVisible){
345 if (isVisible) { 388 if (isVisible) {
346 tvPageTitle.setText(getString(R.string.today)); 389 tvPageTitle.setText(getString(R.string.today));
347 }else { 390 }else {
348 tvPageTitle.setText(getString(R.string.home)); 391 tvPageTitle.setText(getString(R.string.home));
349 } 392 }
350 } 393 }
351 394
352 395
353 396
354 private void logout(){ 397 private void logout(){
355 // clear data 398 // clear data
356 Setting.clearUserIdSharepre(PedometerActivity.this); 399 Setting.clearUserIdSharepre(PedometerActivity.this);
357 // go to login 400 // go to login
358 Intent intent = new Intent(PedometerActivity.this, LoginActivity.class); 401 Intent intent = new Intent(PedometerActivity.this, LoginActivity.class);
359 intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); 402 intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
360 intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); 403 intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
361 startActivity(intent); 404 startActivity(intent);
362 } 405 }
363 406
364 } 407 }
365 408
app/src/main/java/com/dinhcv/lifelogpedometer/activity/RankFragment.java
1 package com.dinhcv.lifelogpedometer.activity; 1 package com.dinhcv.lifelogpedometer.activity;
2 2
3 import android.os.Bundle; 3 import android.os.Bundle;
4 import android.support.annotation.Nullable; 4 import android.support.annotation.Nullable;
5 import android.support.v4.widget.SwipeRefreshLayout; 5 import android.support.v4.widget.SwipeRefreshLayout;
6 import android.support.v7.widget.LinearLayoutManager; 6 import android.support.v7.widget.LinearLayoutManager;
7 import android.support.v7.widget.RecyclerView; 7 import android.support.v7.widget.RecyclerView;
8 import android.util.Log; 8 import android.util.Log;
9 import android.view.LayoutInflater; 9 import android.view.LayoutInflater;
10 import android.view.View; 10 import android.view.View;
11 import android.view.ViewGroup; 11 import android.view.ViewGroup;
12 import android.widget.Button; 12 import android.widget.Button;
13 import android.widget.ImageButton; 13 import android.widget.ImageButton;
14 import android.widget.ImageView; 14 import android.widget.ImageView;
15 import android.widget.TextView; 15 import android.widget.TextView;
16 16
17 import com.dinhcv.lifelogpedometer.R; 17 import com.dinhcv.lifelogpedometer.R;
18 import com.dinhcv.lifelogpedometer.adapter.RankingAdapter; 18 import com.dinhcv.lifelogpedometer.adapter.RankingAdapter;
19 import com.dinhcv.lifelogpedometer.model.structure.pojo.RankingInfo; 19 import com.dinhcv.lifelogpedometer.model.structure.pojo.RankingInfo;
20 import com.dinhcv.lifelogpedometer.model.structure.pojo.ResultResponse; 20 import com.dinhcv.lifelogpedometer.model.structure.pojo.ResultResponse;
21 import com.dinhcv.lifelogpedometer.model.structure.pojo.SnsTopicResponse; 21 import com.dinhcv.lifelogpedometer.model.structure.pojo.SnsTopicResponse;
22 import com.dinhcv.lifelogpedometer.network.ApiService; 22 import com.dinhcv.lifelogpedometer.network.ApiService;
23 import com.dinhcv.lifelogpedometer.network.ApiUtils; 23 import com.dinhcv.lifelogpedometer.network.ApiUtils;
24 import com.dinhcv.lifelogpedometer.portal.APIResponse; 24 import com.dinhcv.lifelogpedometer.portal.APIResponse;
25 import com.dinhcv.lifelogpedometer.utils.Utils; 25 import com.dinhcv.lifelogpedometer.utils.Utils;
26 26
27 import java.text.DateFormat; 27 import java.text.DateFormat;
28 import java.text.SimpleDateFormat; 28 import java.text.SimpleDateFormat;
29 import java.util.ArrayList; 29 import java.util.ArrayList;
30 import java.util.Calendar; 30 import java.util.Calendar;
31 import java.util.Date; 31 import java.util.Date;
32 import java.util.GregorianCalendar; 32 import java.util.GregorianCalendar;
33 import java.util.HashMap; 33 import java.util.HashMap;
34 import java.util.List; 34 import java.util.List;
35 import java.util.Map; 35 import java.util.Map;
36 36
37 import butterknife.BindView; 37 import butterknife.BindView;
38 import butterknife.ButterKnife; 38 import butterknife.ButterKnife;
39 import butterknife.OnClick; 39 import butterknife.OnClick;
40 import retrofit2.Call; 40 import retrofit2.Call;
41 import retrofit2.Callback; 41 import retrofit2.Callback;
42 import retrofit2.Response; 42 import retrofit2.Response;
43 43
44 public class RankFragment extends FragmentBase implements SettingFragmentPresenter { 44 public class RankFragment extends FragmentBase implements SettingFragmentPresenter {
45 45
46 private enum Mode { 46 private enum Mode {
47 WALK(1), 47 WALK(1),
48 RUN(2), 48 RUN(2),
49 BIKE(3), 49 BIKE(3),
50 ALL(0); 50 ALL(0);
51 51
52 private int mode; 52 private int mode;
53 53
54 Mode(int mode) { 54 Mode(int mode) {
55 this.mode = mode; 55 this.mode = mode;
56 } 56 }
57 57
58 public int getValue() { 58 public int getValue() {
59 return mode; 59 return mode;
60 } 60 }
61 61
62 public Mode valueOf(int value) { 62 public Mode valueOf(int value) {
63 switch (mode) { 63 switch (mode) {
64 case 0: 64 case 0:
65 return ALL; 65 return ALL;
66 case 1: 66 case 1:
67 return WALK; 67 return WALK;
68 case 2: 68 case 2:
69 return RUN; 69 return RUN;
70 case 3: 70 case 3:
71 return BIKE; 71 return BIKE;
72 default: 72 default:
73 return ALL; 73 return ALL;
74 } 74 }
75 } 75 }
76 } 76 }
77 77
78 private enum TypeJump { 78 private enum TypeJump {
79 DAILY(1), 79 DAILY(1),
80 WEEKLY(7), 80 WEEKLY(7),
81 MONTHLY(30), 81 MONTHLY(30),
82 YEARLY(365); 82 YEARLY(365);
83 private int jump; 83 private int jump;
84 84
85 TypeJump(int jump) { 85 TypeJump(int jump) {
86 this.jump = jump; 86 this.jump = jump;
87 } 87 }
88 88
89 public int getValue() { 89 public int getValue() {
90 return jump; 90 return jump;
91 } 91 }
92 } 92 }
93 93
94 @BindView(R.id.tv_start_date) 94 @BindView(R.id.tv_start_date)
95 TextView mTvStartDate; 95 TextView mTvStartDate;
96 @BindView(R.id.tv_end_date) 96 @BindView(R.id.tv_end_date)
97 TextView mTvEndDate; 97 TextView mTvEndDate;
98 @BindView(R.id.btn_back) 98 @BindView(R.id.btn_back)
99 ImageButton mBtnBack; 99 ImageView mBtnBack;
100 @BindView(R.id.btn_next) 100 @BindView(R.id.btn_next)
101 ImageView mBtnNext; 101 ImageView mBtnNext;
102 102
103 @BindView(R.id.btn_daily) 103 @BindView(R.id.btn_daily)
104 Button mBtnDaily; 104 Button mBtnDaily;
105 @BindView(R.id.btn_weekly) 105 @BindView(R.id.btn_weekly)
106 Button mBtnWeekly; 106 Button mBtnWeekly;
107 @BindView(R.id.btn_monthly) 107 @BindView(R.id.btn_monthly)
108 Button mBtnMonthly; 108 Button mBtnMonthly;
109 @BindView(R.id.btn_yearly) 109 @BindView(R.id.btn_yearly)
110 Button mBtnYearly; 110 Button mBtnYearly;
111 @BindView(R.id.btn_walk) 111 @BindView(R.id.btn_walk)
112 Button mBtnWalk; 112 Button mBtnWalk;
113 @BindView(R.id.btn_run) 113 @BindView(R.id.btn_run)
114 Button mBtnRun; 114 Button mBtnRun;
115 @BindView(R.id.btn_bike) 115 @BindView(R.id.btn_bike)
116 Button mBtnBike; 116 Button mBtnBike;
117 @BindView(R.id.btn_all) 117 @BindView(R.id.btn_all)
118 Button mBtnAll; 118 Button mBtnAll;
119 119
120 private ApiService mService; 120 private ApiService mService;
121 121
122 private Mode mCurrentMode = Mode.WALK; 122 private Mode mCurrentMode = Mode.WALK;
123 private TypeJump mCurrentJump = TypeJump.DAILY; 123 private TypeJump mCurrentJump = TypeJump.DAILY;
124 private int mCurrentPage = 1; 124 private int mCurrentPage = 1;
125 125
126 private View mRootView; 126 private View mRootView;
127 private List<RankingInfo> mRankList = new ArrayList<>(); 127 private List<RankingInfo> mRankList = new ArrayList<>();
128 128
129 private SwipeRefreshLayout mSwipeRefreshTopic; 129 private SwipeRefreshLayout mSwipeRefreshTopic;
130 private RecyclerView mRcvRank; 130 private RecyclerView mRcvRank;
131 private RankingAdapter mAdapter; 131 private RankingAdapter mAdapter;
132 private Date mStartDate = new Date(); 132 private Date mStartDate = new Date();
133 private Date mEndDate = new Date(); 133 private Date mEndDate = new Date();
134 134
135 private static final DateFormat FORMAT_DATE = new SimpleDateFormat("yyyyMMdd"); 135 private static final DateFormat FORMAT_DATE = new SimpleDateFormat("yyyyMMdd");
136 private static final String TAG = "RankFragment"; 136 private static final String TAG = "RankFragment";
137 137
138 @Override 138 @Override
139 public View onCreateView(LayoutInflater inflater, ViewGroup container, 139 public View onCreateView(LayoutInflater inflater, ViewGroup container,
140 Bundle savedInstanceState) { 140 Bundle savedInstanceState) {
141 // Inflate the layout for this fragment 141 // Inflate the layout for this fragment
142 mRootView = inflater.inflate(R.layout.fragment_rank, container, false); 142 mRootView = inflater.inflate(R.layout.fragment_rank, container, false);
143 ButterKnife.bind(this, mRootView); 143 ButterKnife.bind(this, mRootView);
144 mRcvRank = (RecyclerView) mRootView.findViewById(R.id.rcv_rank); 144 mRcvRank = (RecyclerView) mRootView.findViewById(R.id.rcv_rank);
145 145
146 initView(); 146 initView();
147 initData(); 147 initData();
148 148
149 return mRootView; 149 return mRootView;
150 } 150 }
151 151
152 private void initView() { 152 private void initView() {
153 mSwipeRefreshTopic = (SwipeRefreshLayout) mRootView.findViewById(R.id.swipe_ranking); 153 mSwipeRefreshTopic = (SwipeRefreshLayout) mRootView.findViewById(R.id.swipe_ranking);
154 mSwipeRefreshTopic.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { 154 mSwipeRefreshTopic.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
155 @Override 155 @Override
156 public void onRefresh() { 156 public void onRefresh() {
157 handleLoadRankList(); 157 handleLoadRankList();
158 } 158 }
159 }); 159 });
160 160
161 mAdapter = new RankingAdapter(getActivity(), mRankList); 161 mAdapter = new RankingAdapter(getActivity(), mRankList);
162 RecyclerView.LayoutManager mLayoutManager = new LinearLayoutManager(this.getContext()); 162 RecyclerView.LayoutManager mLayoutManager = new LinearLayoutManager(this.getContext());
163 mRcvRank.setLayoutManager(mLayoutManager); 163 mRcvRank.setLayoutManager(mLayoutManager);
164 mRcvRank.setAdapter(mAdapter); 164 mRcvRank.setAdapter(mAdapter);
165 165
166 initButtonStatus(); 166 initButtonStatus();
167 } 167 }
168 168
169 private void initData() { 169 private void initData() {
170 initStartDate(); 170 initStartDate();
171 showDateData(); 171 showDateData();
172 handleLoadRankList(); 172 handleLoadRankList();
173 } 173 }
174 174
175 private void showDateData() { 175 private void showDateData() {
176 mTvStartDate.setText(Utils.dateToStringFormatDayMonthYearJp(mStartDate)); 176 mTvStartDate.setText(Utils.dateToStringFormatDayMonthYearJp(mStartDate));
177 mTvEndDate.setText(Utils.dateToStringFormatDayMonthYearJp(mEndDate)); 177 mTvEndDate.setText(Utils.dateToStringFormatDayMonthYearJp(mEndDate));
178 } 178 }
179 179
180 @OnClick(R.id.btn_daily) 180 @OnClick(R.id.btn_daily)
181 public void clickDaily() { 181 public void clickDaily() {
182 mCurrentJump = TypeJump.DAILY; 182 mCurrentJump = TypeJump.DAILY;
183 initButtonStatus(); 183 initButtonStatus();
184 handleLoadRankList(); 184 handleLoadRankList();
185 } 185 }
186 186
187 @OnClick(R.id.btn_weekly) 187 @OnClick(R.id.btn_weekly)
188 public void clickWeekly() { 188 public void clickWeekly() {
189 mCurrentJump = TypeJump.WEEKLY; 189 mCurrentJump = TypeJump.WEEKLY;
190 initButtonStatus(); 190 initButtonStatus();
191 handleLoadRankList(); 191 handleLoadRankList();
192 } 192 }
193 193
194 @OnClick(R.id.btn_monthly) 194 @OnClick(R.id.btn_monthly)
195 public void clickMonthly() { 195 public void clickMonthly() {
196 mCurrentJump = TypeJump.MONTHLY; 196 mCurrentJump = TypeJump.MONTHLY;
197 initButtonStatus(); 197 initButtonStatus();
198 handleLoadRankList(); 198 handleLoadRankList();
199 } 199 }
200 200
201 @OnClick(R.id.btn_yearly) 201 @OnClick(R.id.btn_yearly)
202 public void clickYearly() { 202 public void clickYearly() {
203 mCurrentJump = TypeJump.YEARLY; 203 mCurrentJump = TypeJump.YEARLY;
204 initButtonStatus(); 204 initButtonStatus();
205 handleLoadRankList(); 205 handleLoadRankList();
206 } 206 }
207 207
208 @OnClick(R.id.btn_walk) 208 @OnClick(R.id.btn_walk)
209 public void clickWalk() { 209 public void clickWalk() {
210 mCurrentMode = Mode.WALK; 210 mCurrentMode = Mode.WALK;
211 initButtonStatus(); 211 initButtonStatus();
212 handleLoadRankList(); 212 handleLoadRankList();
213 } 213 }
214 214
215 @OnClick(R.id.btn_run) 215 @OnClick(R.id.btn_run)
216 public void clickRun() { 216 public void clickRun() {
217 mCurrentMode = Mode.RUN; 217 mCurrentMode = Mode.RUN;
218 initButtonStatus(); 218 initButtonStatus();
219 handleLoadRankList(); 219 handleLoadRankList();
220 } 220 }
221 221
222 @OnClick(R.id.btn_bike) 222 @OnClick(R.id.btn_bike)
223 public void clickBike() { 223 public void clickBike() {
224 mCurrentMode = Mode.BIKE; 224 mCurrentMode = Mode.BIKE;
225 initButtonStatus(); 225 initButtonStatus();
226 handleLoadRankList(); 226 handleLoadRankList();
227 } 227 }
228 228
229 @OnClick(R.id.btn_all) 229 @OnClick(R.id.btn_all)
230 public void clickAll() { 230 public void clickAll() {
231 mCurrentMode = Mode.ALL; 231 mCurrentMode = Mode.ALL;
232 initButtonStatus(); 232 initButtonStatus();
233 handleLoadRankList(); 233 handleLoadRankList();
234 } 234 }
235 235
236 @OnClick(R.id.btn_back) 236 @OnClick(R.id.btn_back)
237 public void clickBack() { 237 public void clickBack() {
238 mEndDate = mStartDate; 238 mEndDate = mStartDate;
239 mStartDate = calDateByStep(mEndDate, -mCurrentJump.getValue()); 239 mStartDate = calDateByStep(mEndDate, -mCurrentJump.getValue());
240 showDateData(); 240 showDateData();
241 handleLoadRankList(); 241 handleLoadRankList();
242 } 242 }
243 243
244 @OnClick(R.id.btn_next) 244 @OnClick(R.id.btn_next)
245 public void clickNext() { 245 public void clickNext() {
246 mStartDate = mEndDate; 246 mStartDate = mEndDate;
247 mEndDate = calDateByStep(mStartDate, mCurrentJump.getValue()); 247 mEndDate = calDateByStep(mStartDate, mCurrentJump.getValue());
248 showDateData(); 248 showDateData();
249 handleLoadRankList(); 249 handleLoadRankList();
250 } 250 }
251 251
252 private void initStartDate() { 252 private void initStartDate() {
253 mStartDate = calDateByStep(mEndDate, -mCurrentJump.getValue()); 253 mStartDate = calDateByStep(mEndDate, -mCurrentJump.getValue());
254 } 254 }
255 255
256 private void initButtonStatus() { 256 private void initButtonStatus() {
257 switch (mCurrentMode) { 257 switch (mCurrentMode) {
258 case WALK: 258 case WALK:
259 showButtonStatusByMode(1); 259 showButtonStatusByMode(1);
260 break; 260 break;
261 case RUN: 261 case RUN:
262 showButtonStatusByMode(2); 262 showButtonStatusByMode(2);
263 break; 263 break;
264 case BIKE: 264 case BIKE:
265 showButtonStatusByMode(3); 265 showButtonStatusByMode(3);
266 break; 266 break;
267 case ALL: 267 case ALL:
268 showButtonStatusByMode(4); 268 showButtonStatusByMode(4);
269 break; 269 break;
270 } 270 }
271 271
272 switch (mCurrentJump) { 272 switch (mCurrentJump) {
273 case DAILY: 273 case DAILY:
274 showButtonStatusByTypeJump(1); 274 showButtonStatusByTypeJump(1);
275 break; 275 break;
276 case WEEKLY: 276 case WEEKLY:
277 showButtonStatusByTypeJump(2); 277 showButtonStatusByTypeJump(2);
278 break; 278 break;
279 case MONTHLY: 279 case MONTHLY:
280 showButtonStatusByTypeJump(3); 280 showButtonStatusByTypeJump(3);
281 break; 281 break;
282 case YEARLY: 282 case YEARLY:
283 showButtonStatusByTypeJump(4); 283 showButtonStatusByTypeJump(4);
284 break; 284 break;
285 } 285 }
286 } 286 }
287 287
288 private void showButtonStatusByMode(int position) { 288 private void showButtonStatusByMode(int position) {
289 mBtnWalk.setEnabled(true); 289 mBtnWalk.setEnabled(true);
290 mBtnRun.setEnabled(true); 290 mBtnRun.setEnabled(true);
291 mBtnBike.setEnabled(true); 291 mBtnBike.setEnabled(true);
292 mBtnAll.setEnabled(true); 292 mBtnAll.setEnabled(true);
293 293
294 switch (position) { 294 switch (position) {
295 case 1: 295 case 1:
296 mBtnWalk.setEnabled(false); 296 mBtnWalk.setEnabled(false);
297 break; 297 break;
298 case 2: 298 case 2:
299 mBtnRun.setEnabled(false); 299 mBtnRun.setEnabled(false);
300 break; 300 break;
301 case 3: 301 case 3:
302 mBtnBike.setEnabled(false); 302 mBtnBike.setEnabled(false);
303 break; 303 break;
304 case 4: 304 case 4:
305 mBtnAll.setEnabled(false); 305 mBtnAll.setEnabled(false);
306 ; 306 ;
307 break; 307 break;
308 } 308 }
309 } 309 }
310 310
311 private void showButtonStatusByTypeJump(int position) { 311 private void showButtonStatusByTypeJump(int position) {
312 mBtnDaily.setEnabled(true); 312 mBtnDaily.setEnabled(true);
313 mBtnWeekly.setEnabled(true); 313 mBtnWeekly.setEnabled(true);
314 mBtnMonthly.setEnabled(true); 314 mBtnMonthly.setEnabled(true);
315 mBtnYearly.setEnabled(true); 315 mBtnYearly.setEnabled(true);
316 316
317 switch (position) { 317 switch (position) {
318 case 1: 318 case 1:
319 mBtnDaily.setEnabled(false); 319 mBtnDaily.setEnabled(false);
320 break; 320 break;
321 case 2: 321 case 2:
322 mBtnWeekly.setEnabled(false); 322 mBtnWeekly.setEnabled(false);
323 break; 323 break;
324 case 3: 324 case 3:
325 mBtnMonthly.setEnabled(false); 325 mBtnMonthly.setEnabled(false);
326 break; 326 break;
327 case 4: 327 case 4:
328 mBtnYearly.setEnabled(false); 328 mBtnYearly.setEnabled(false);
329 break; 329 break;
330 } 330 }
331 } 331 }
332 332
333 private Date calDateByStep(Date date, int numDay) { 333 private Date calDateByStep(Date date, int numDay) {
334 Calendar myCal = new GregorianCalendar(); 334 Calendar myCal = new GregorianCalendar();
335 myCal.setTime(date); 335 myCal.setTime(date);
336 myCal.add(Calendar.DATE, numDay); 336 myCal.add(Calendar.DATE, numDay);
337 return myCal.getTime(); 337 return myCal.getTime();
338 } 338 }
339 339
340 @Override 340 @Override
341 public void onSaveData() { 341 public void onSaveData() {
342 342
343 } 343 }
344 344
345 @Override 345 @Override
346 public void onInvalidate(boolean isInit) { 346 public void onInvalidate(boolean isInit) {
347 347
348 } 348 }
349 349
350 @Override 350 @Override
351 public void onViewStateRestored(@Nullable Bundle savedInstanceState) { 351 public void onViewStateRestored(@Nullable Bundle savedInstanceState) {
352 super.onViewStateRestored(savedInstanceState); 352 super.onViewStateRestored(savedInstanceState);
353 353
354 initData(); 354 initData();
355 } 355 }
356 356
357 public void handleLoadRankList() { 357 public void handleLoadRankList() {
358 mRankList.clear(); 358 mRankList.clear();
359 mAdapter.clearData(); 359 mAdapter.clearData();
360 mAdapter.notifyDataSetChanged(); 360 mAdapter.notifyDataSetChanged();
361 361
362 String startDate = FORMAT_DATE.format(mStartDate); 362 String startDate = FORMAT_DATE.format(mStartDate);
363 String endDate = FORMAT_DATE.format(mEndDate); 363 String endDate = FORMAT_DATE.format(mEndDate);
364 getRankList(mCurrentMode.getValue(), startDate, endDate, mCurrentPage); 364 getRankList(mCurrentMode.getValue(), startDate, endDate, mCurrentPage);
365 } 365 }
366 366
367 public void getRankList(int mode, String startDate, String endDate, int page) { 367 public void getRankList(int mode, String startDate, String endDate, int page) {
368 if (!mSwipeRefreshTopic.isRefreshing()) { 368 if (!mSwipeRefreshTopic.isRefreshing()) {
369 mSwipeRefreshTopic.setRefreshing(true); 369 mSwipeRefreshTopic.setRefreshing(true);
370 } 370 }
371 Map<String, String> header = new HashMap<>(); 371 Map<String, String> header = new HashMap<>();
372 header.put("token", APIResponse.getInstance().getToken()); 372 header.put("token", APIResponse.getInstance().getToken());
373 373
374 mService = ApiUtils.getApiService(); 374 mService = ApiUtils.getApiService();
375 mService.getRankingList(header, mode, startDate, endDate, page).enqueue(new Callback<ResultResponse<RankingInfo>>() { 375 mService.getRankingList(header, mode, startDate, endDate, page).enqueue(new Callback<ResultResponse<RankingInfo>>() {
376 @Override 376 @Override
377 public void onResponse(Call<ResultResponse<RankingInfo>> call, Response<ResultResponse<RankingInfo>> response) { 377 public void onResponse(Call<ResultResponse<RankingInfo>> call, Response<ResultResponse<RankingInfo>> response) {
378 if (response.isSuccessful()) { 378 if (response.isSuccessful()) {
379 mRankList = response.body().getResult(); 379 mRankList = response.body().getResult();
380 mAdapter.updateData(mRankList); 380 mAdapter.updateData(mRankList);
381 mAdapter.notifyDataSetChanged(); 381 mAdapter.notifyDataSetChanged();
382 Log.i("SonLT", "Success" + mRankList.size()); 382 Log.i("SonLT", "Success" + mRankList.size());
383 } else { 383 } else {
384 int statusCode = response.code(); 384 int statusCode = response.code();
385 // handle request errors depending on status code 385 // handle request errors depending on status code
386 Log.i("SonLT", "Fail " + statusCode); 386 Log.i("SonLT", "Fail " + statusCode);
387 } 387 }
388 if (mSwipeRefreshTopic.isRefreshing()) { 388 if (mSwipeRefreshTopic.isRefreshing()) {
389 mSwipeRefreshTopic.setRefreshing(false); 389 mSwipeRefreshTopic.setRefreshing(false);
390 } 390 }
391 } 391 }
392 392
393 @Override 393 @Override
394 public void onFailure(Call<ResultResponse<RankingInfo>> call, Throwable t) { 394 public void onFailure(Call<ResultResponse<RankingInfo>> call, Throwable t) {
395 Log.i("SonLT", "Success"); 395 Log.i("SonLT", "Success");
396 if (mSwipeRefreshTopic.isRefreshing()) { 396 if (mSwipeRefreshTopic.isRefreshing()) {
397 mSwipeRefreshTopic.setRefreshing(false); 397 mSwipeRefreshTopic.setRefreshing(false);
398 } 398 }
399 } 399 }
400 }); 400 });
401 } 401 }
402 } 402 }
403 403
app/src/main/java/com/dinhcv/lifelogpedometer/activity/TopDateFragment.java
1 package com.dinhcv.lifelogpedometer.activity; 1 package com.dinhcv.lifelogpedometer.activity;
2 2
3 import android.app.DatePickerDialog; 3 import android.app.DatePickerDialog;
4 import android.content.Context; 4 import android.content.Context;
5 import android.content.Intent; 5 import android.content.Intent;
6 import android.os.Bundle; 6 import android.os.Bundle;
7 import android.support.annotation.Nullable; 7 import android.support.annotation.Nullable;
8 import android.view.LayoutInflater; 8 import android.view.LayoutInflater;
9 import android.view.View; 9 import android.view.View;
10 import android.view.ViewGroup; 10 import android.view.ViewGroup;
11 import android.widget.DatePicker; 11 import android.widget.DatePicker;
12 import android.widget.ImageView; 12 import android.widget.ImageView;
13 import android.widget.LinearLayout; 13 import android.widget.LinearLayout;
14 import android.widget.TextView; 14 import android.widget.TextView;
15 15
16 import com.dinhcv.lifelogpedometer.R; 16 import com.dinhcv.lifelogpedometer.R;
17 import com.dinhcv.lifelogpedometer.adapter.NoticeAdapter; 17 import com.dinhcv.lifelogpedometer.adapter.NoticeAdapter;
18 import com.dinhcv.lifelogpedometer.customview.ExpandableListCustomView; 18 import com.dinhcv.lifelogpedometer.customview.ExpandableListCustomView;
19 import com.dinhcv.lifelogpedometer.interfaces.LLAPIManagerListener; 19 import com.dinhcv.lifelogpedometer.interfaces.LLAPIManagerListener;
20 import com.dinhcv.lifelogpedometer.model.structure.home.NoticeInfo; 20 import com.dinhcv.lifelogpedometer.model.structure.home.NoticeInfo;
21 import com.dinhcv.lifelogpedometer.model.structure.home.TagetInfo; 21 import com.dinhcv.lifelogpedometer.model.structure.home.TagetInfo;
22 import com.dinhcv.lifelogpedometer.portal.ApiServices; 22 import com.dinhcv.lifelogpedometer.portal.ApiServices;
23 import com.dinhcv.lifelogpedometer.portal.LLAPIManager; 23 import com.dinhcv.lifelogpedometer.portal.LLAPIManager;
24 import com.dinhcv.lifelogpedometer.utils.Const; 24 import com.dinhcv.lifelogpedometer.utils.Const;
25 import com.dinhcv.lifelogpedometer.utils.Debug; 25 import com.dinhcv.lifelogpedometer.utils.Debug;
26 import com.dinhcv.lifelogpedometer.utils.Utils; 26 import com.dinhcv.lifelogpedometer.utils.Utils;
27 27
28 import org.json.JSONArray; 28 import org.json.JSONArray;
29 import org.json.JSONException; 29 import org.json.JSONException;
30 import org.json.JSONObject; 30 import org.json.JSONObject;
31 31
32 import java.util.ArrayList; 32 import java.util.ArrayList;
33 import java.util.Calendar; 33 import java.util.Calendar;
34 import java.util.Date; 34 import java.util.Date;
35 import java.util.List; 35 import java.util.List;
36 36
37 import de.hdodenhof.circleimageview.CircleImageView;
38
37 public class TopDateFragment extends FragmentBase implements SettingFragmentPresenter { 39 public class TopDateFragment extends FragmentBase implements SettingFragmentPresenter {
38 40
39 private TextView tvDate; 41 private TextView tvDate;
40 private TextView tvStep; 42 private TextView tvStep;
41 private TextView tvRemain; 43 private TextView tvRemain;
42 private TextView tvRateDone; 44 private TextView tvRateDone;
43 private ImageView ivBack; 45 private ImageView ivBack;
44 private ImageView ivNext; 46 private ImageView ivNext;
45 47
46 private LinearLayout llBike; 48 private LinearLayout llBike;
47 private LinearLayout llWalking; 49 private LinearLayout llWalking;
48 private LinearLayout llRunning; 50 private LinearLayout llRunning;
49 51
50 private Date mAnaDate; 52 private Date mAnaDate;
51 private Calendar mCalendar; 53 private Calendar mCalendar;
52 54
53 private int mAnaDay; 55 private int mAnaDay;
54 private int mAnaMonth; 56 private int mAnaMonth;
55 private int mAnaYear; 57 private int mAnaYear;
56 private Context mContext; 58 private Context mContext;
57 59
58 private Const.STEP_TYPE stepType; 60 private Const.STEP_TYPE stepType;
59 private TagetInfo mTagetInfo = new TagetInfo(); 61 private TagetInfo mTagetInfo = new TagetInfo();
60 private ImageView ivToDay; 62 private CircleImageView ivToDay;
61 private ExpandableListCustomView lvNotice; 63 private ExpandableListCustomView lvNotice;
62 private NoticeAdapter mNoticeAdapter; 64 private NoticeAdapter mNoticeAdapter;
63 private View mRootview; 65 private View mRootview;
64 private TopFragment mTopFragment; 66 private TopFragment mTopFragment;
65 67
66 public void setRootFragment(TopFragment frag) { 68 public void setRootFragment(TopFragment frag) {
67 this.mTopFragment = frag; 69 this.mTopFragment = frag;
68 } 70 }
69 71
70 @Override 72 @Override
71 public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle 73 public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle
72 savedInstanceState) { 74 savedInstanceState) {
73 // Inflate the layout for this fragment 75 // Inflate the layout for this fragment
74 mRootview = inflater.inflate(R.layout.fragment_top_date, container, false); 76 mRootview = inflater.inflate(R.layout.fragment_top_date, container, false);
75 mContext = getActivity(); 77 mContext = getActivity();
76 initView(mRootview); 78 initView(mRootview);
77 initData(); 79 initData();
78 return mRootview; 80 return mRootview;
79 } 81 }
80 82
81 83
82 private void initView(View rootView) { 84 private void initView(View rootView) {
83 tvDate = (TextView) rootView.findViewById(R.id.tv_date); 85 tvDate = (TextView) rootView.findViewById(R.id.tv_date);
84 tvStep = (TextView) rootView.findViewById(R.id.tv_step); 86 tvStep = (TextView) rootView.findViewById(R.id.tv_step);
85 tvRemain = (TextView) rootView.findViewById(R.id.tv_remainingStep); 87 tvRemain = (TextView) rootView.findViewById(R.id.tv_remainingStep);
86 tvRateDone = (TextView) rootView.findViewById(R.id.tv_completeRate); 88 tvRateDone = (TextView) rootView.findViewById(R.id.tv_completeRate);
87 ivBack = (ImageView) rootView.findViewById(R.id.iv_back); 89 ivBack = (ImageView) rootView.findViewById(R.id.iv_back);
88 ivNext = (ImageView) rootView.findViewById(R.id.iv_next); 90 ivNext = (ImageView) rootView.findViewById(R.id.iv_next);
89 91
90 llBike = (LinearLayout) rootView.findViewById(R.id.ll_bike); 92 llBike = (LinearLayout) rootView.findViewById(R.id.ll_bike);
91 llWalking = (LinearLayout) rootView.findViewById(R.id.ll_walking); 93 llWalking = (LinearLayout) rootView.findViewById(R.id.ll_walking);
92 llRunning = (LinearLayout) rootView.findViewById(R.id.ll_running); 94 llRunning = (LinearLayout) rootView.findViewById(R.id.ll_running);
93 95
94 ivToDay = (ImageView) rootView.findViewById(R.id.iv_toDay); 96 ivToDay = (CircleImageView) rootView.findViewById(R.id.iv_toDay);
95 lvNotice = (ExpandableListCustomView) rootView.findViewById(R.id.lv_notice); 97 lvNotice = (ExpandableListCustomView) rootView.findViewById(R.id.lv_notice);
96 98
97 handleEvent(); 99 handleEvent();
98 } 100 }
99 101
100 private void handleEvent(){ 102 private void handleEvent(){
101 tvDate.setOnClickListener(new View.OnClickListener() { 103 tvDate.setOnClickListener(new View.OnClickListener() {
102 @Override 104 @Override
103 public void onClick(View view) { 105 public void onClick(View view) {
104 handleAnaDatePicker(); 106 handleAnaDatePicker();
105 } 107 }
106 }); 108 });
107 109
108 ivBack.setOnClickListener(new View.OnClickListener() { 110 ivBack.setOnClickListener(new View.OnClickListener() {
109 @Override 111 @Override
110 public void onClick(View view) { 112 public void onClick(View view) {
111 mCalendar = Calendar.getInstance(); 113 mCalendar = Calendar.getInstance();
112 mCalendar.setTime(mAnaDate); 114 mCalendar.setTime(mAnaDate);
113 mCalendar.add(Calendar.DAY_OF_MONTH, -1); 115 mCalendar.add(Calendar.DAY_OF_MONTH, -1);
114 Date date = mCalendar.getTime(); 116 Date date = mCalendar.getTime();
115 tvDate.setText(Utils.dateToStringFormatDayMonthYearJp(date)); 117 tvDate.setText(Utils.dateToStringFormatDayMonthYearJp(date));
116 mAnaDate = date; 118 mAnaDate = date;
117 getHomePage(mAnaDate, stepType); 119 getHomePage(mAnaDate, stepType);
118 getNews(mAnaDate); 120 getNews(mAnaDate);
119 } 121 }
120 }); 122 });
121 123
122 ivNext.setOnClickListener(new View.OnClickListener() { 124 ivNext.setOnClickListener(new View.OnClickListener() {
123 @Override 125 @Override
124 public void onClick(View view) { 126 public void onClick(View view) {
125 mCalendar = Calendar.getInstance(); 127 mCalendar = Calendar.getInstance();
126 mCalendar.setTime(mAnaDate); 128 mCalendar.setTime(mAnaDate);
127 mCalendar.add(Calendar.DAY_OF_MONTH, +1); 129 mCalendar.add(Calendar.DAY_OF_MONTH, +1);
128 Date date = mCalendar.getTime(); 130 Date date = mCalendar.getTime();
129 tvDate.setText(Utils.dateToStringFormatDayMonthYearJp(date)); 131 tvDate.setText(Utils.dateToStringFormatDayMonthYearJp(date));
130 mAnaDate = date; 132 mAnaDate = date;
131 getHomePage(mAnaDate, stepType); 133 getHomePage(mAnaDate, stepType);
132 getNews(mAnaDate); 134 getNews(mAnaDate);
133 } 135 }
134 }); 136 });
135 137
136 138
137 llWalking.setOnClickListener(new View.OnClickListener() { 139 llWalking.setOnClickListener(new View.OnClickListener() {
138 @Override 140 @Override
139 public void onClick(View view) { 141 public void onClick(View view) {
140 stepType = Const.STEP_TYPE.WALKING; 142 stepType = Const.STEP_TYPE.WALKING;
141 updateUiStepType(false, true, false); 143 updateUiStepType(false, true, false);
142 // add data 144 // add data
143 getHomePage(mAnaDate, stepType); 145 getHomePage(mAnaDate, stepType);
144 } 146 }
145 }); 147 });
146 148
147 llRunning.setOnClickListener(new View.OnClickListener() { 149 llRunning.setOnClickListener(new View.OnClickListener() {
148 @Override 150 @Override
149 public void onClick(View view) { 151 public void onClick(View view) {
150 stepType = Const.STEP_TYPE.RUNNING; 152 stepType = Const.STEP_TYPE.RUNNING;
151 updateUiStepType(false, false, true); 153 updateUiStepType(false, false, true);
152 // add 154 // add
153 getHomePage(mAnaDate, stepType); 155 getHomePage(mAnaDate, stepType);
154 } 156 }
155 }); 157 });
156 158
157 llBike.setOnClickListener(new View.OnClickListener() { 159 llBike.setOnClickListener(new View.OnClickListener() {
158 @Override 160 @Override
159 public void onClick(View view) { 161 public void onClick(View view) {
160 stepType = Const.STEP_TYPE.BIKE; 162 stepType = Const.STEP_TYPE.BIKE;
161 updateUiStepType(true, false, false); 163 updateUiStepType(true, false, false);
162 // add data 164 // add data
163 getHomePage(mAnaDate, stepType); 165 getHomePage(mAnaDate, stepType);
164 } 166 }
165 }); 167 });
166 168
167 ivToDay.setOnClickListener(new View.OnClickListener() { 169 ivToDay.setOnClickListener(new View.OnClickListener() {
168 @Override 170 @Override
169 public void onClick(View view) { 171 public void onClick(View view) {
170 mTopFragment.showDetailFragment(); 172 mTopFragment.showDetailFragment();
171 } 173 }
172 }); 174 });
173 175
174 } 176 }
175 177
176 private void updateUiStepType(boolean b1, boolean b2, boolean b3) { 178 private void updateUiStepType(boolean b1, boolean b2, boolean b3) {
177 llBike.setSelected(b1); 179 llBike.setSelected(b1);
178 llWalking.setSelected(b2); 180 llWalking.setSelected(b2);
179 llRunning.setSelected(b3); 181 llRunning.setSelected(b3);
180 } 182 }
181 183
182 /** 184 /**
183 * Show date picker dialog 185 * Show date picker dialog
184 */ 186 */
185 private void handleAnaDatePicker() { 187 private void handleAnaDatePicker() {
186 188
187 new DatePickerDialog(getActivity(), new DatePickerDialog.OnDateSetListener() { 189 new DatePickerDialog(getActivity(), new DatePickerDialog.OnDateSetListener() {
188 @Override 190 @Override
189 public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) { 191 public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) {
190 192
191 mCalendar = Calendar.getInstance(); 193 mCalendar = Calendar.getInstance();
192 mCalendar.set(year, monthOfYear, dayOfMonth); 194 mCalendar.set(year, monthOfYear, dayOfMonth);
193 mAnaYear = year; 195 mAnaYear = year;
194 mAnaMonth = monthOfYear; 196 mAnaMonth = monthOfYear;
195 mAnaDay = dayOfMonth; 197 mAnaDay = dayOfMonth;
196 Date date = mCalendar.getTime(); 198 Date date = mCalendar.getTime();
197 tvDate.setText(Utils.dateToStringFormatDayMonthYearJp(date)); 199 tvDate.setText(Utils.dateToStringFormatDayMonthYearJp(date));
198 mAnaDate = date; 200 mAnaDate = date;
199 201
200 getHomePage(mAnaDate, stepType); 202 getHomePage(mAnaDate, stepType);
201 getNews(mAnaDate); 203 getNews(mAnaDate);
202 } 204 }
203 }, mAnaYear, mAnaMonth, mAnaDay).show(); 205 }, mAnaYear, mAnaMonth, mAnaDay).show();
204 206
205 } 207 }
206 208
207 209
208 /** 210 /**
209 * init data for 211 * init data for
210 */ 212 */
211 private void initData() { 213 private void initData() {
212 mCalendar = Calendar.getInstance(); 214 mCalendar = Calendar.getInstance();
213 mCalendar.setTime(new Date()); 215 mCalendar.setTime(new Date());
214 mAnaDate = mCalendar.getTime(); 216 mAnaDate = mCalendar.getTime();
215 mAnaYear = mCalendar.get(Calendar.YEAR); 217 mAnaYear = mCalendar.get(Calendar.YEAR);
216 mAnaMonth = mCalendar.get(Calendar.MONTH); 218 mAnaMonth = mCalendar.get(Calendar.MONTH);
217 mAnaDay = mCalendar.get(Calendar.DAY_OF_MONTH); 219 mAnaDay = mCalendar.get(Calendar.DAY_OF_MONTH);
218 220
219 tvDate.setText(Utils.dateToStringFormatDayMonthYearJp(mAnaDate)); 221 tvDate.setText(Utils.dateToStringFormatDayMonthYearJp(mAnaDate));
220 222
221 stepType = Const.STEP_TYPE.WALKING; 223 stepType = Const.STEP_TYPE.WALKING;
222 updateUiStepType(false, true, false); 224 updateUiStepType(false, true, false);
223 getHomePage(mAnaDate, stepType); 225 getHomePage(mAnaDate, stepType);
224 getNews(mAnaDate); 226 getNews(mAnaDate);
225 } 227 }
226 228
227 229
228 private void getHomePage(Date date, Const.STEP_TYPE stepType){ 230 private void getHomePage(Date date, Const.STEP_TYPE stepType){
229 231
230 showDialog(mContext); 232 showDialog(mContext);
231 ApiServices.homePage(date, stepType, new LLAPIManagerListener() { 233 ApiServices.homePage(date, stepType, new LLAPIManagerListener() {
232 @Override 234 @Override
233 public void onError(Error error) { 235 public void onError(Error error) {
234 Debug.error("Get data history error"); 236 Debug.error("Get data history error");
235 hiddenDialog(); 237 hiddenDialog();
236 showDialogNotData(); 238 showDialogNotData();
237 } 239 }
238 240
239 @Override 241 @Override
240 public void onSuccess(String json) { 242 public void onSuccess(String json) {
241 Debug.error("Get data history success"); 243 Debug.error("Get data history success");
242 hiddenDialog(); 244 hiddenDialog();
243 loadDataDone(json); 245 loadDataDone(json);
244 } 246 }
245 247
246 @Override 248 @Override
247 public void onSuccess(JSONObject object) { 249 public void onSuccess(JSONObject object) {
248 Debug.error("Get data history success"); 250 Debug.error("Get data history success");
249 hiddenDialog(); 251 hiddenDialog();
250 } 252 }
251 }); 253 });
252 } 254 }
253 255
254 private void showDialogNotData(){ 256 private void showDialogNotData(){
255 showAlerDialog(mContext, getResources().getString(R.string.can_not_get_data)); 257 showAlerDialog(mContext, getResources().getString(R.string.can_not_get_data));
256 } 258 }
257 259
258 private void loadDataDone(String jsonString) { 260 private void loadDataDone(String jsonString) {
259 JSONObject jsonObject = null; 261 JSONObject jsonObject = null;
260 try { 262 try {
261 jsonObject = new JSONObject(jsonString); 263 jsonObject = new JSONObject(jsonString);
262 int status = jsonObject.optInt("status"); 264 int status = jsonObject.optInt("status");
263 if (status == 1) { 265 if (status == 1) {
264 JSONObject jsonObject1 = jsonObject.optJSONObject("result"); 266 JSONObject jsonObject1 = jsonObject.optJSONObject("result");
265 JSONObject targetInf = jsonObject1.getJSONObject("targetInf"); 267 JSONObject targetInf = jsonObject1.getJSONObject("targetInf");
266 JSONArray listNotice = jsonObject1.getJSONArray("listNotice"); 268 JSONArray listNotice = jsonObject1.getJSONArray("listNotice");
267 269
268 if (targetInf != null){ 270 if (targetInf != null){
269 String target = targetInf.optString("target_step"); 271 String target = targetInf.optString("target_step");
270 Debug.normal("Target: "+ target); 272 Debug.normal("Target: "+ target);
271 mTagetInfo.setTaget(targetInf.optString("target_step")); 273 mTagetInfo.setTaget(targetInf.optString("target_step"));
272 mTagetInfo.setSteps(targetInf.optString("num_step")); 274 mTagetInfo.setSteps(targetInf.optString("num_step"));
273 mTagetInfo.setStepRemain(targetInf.optString("remaining_step")); 275 mTagetInfo.setStepRemain(targetInf.optString("remaining_step"));
274 mTagetInfo.setCompletePercent(targetInf.optString("complete_percent")); 276 mTagetInfo.setCompletePercent(targetInf.optString("complete_percent"));
275 } 277 }
276 278
277 if (listNotice != null && listNotice.length() > 0) { 279 if (listNotice != null && listNotice.length() > 0) {
278 List<NoticeInfo> infoLists = new ArrayList<>(); 280 List<NoticeInfo> infoLists = new ArrayList<>();
279 for (int i = 0; i < listNotice.length(); i++){ 281 for (int i = 0; i < listNotice.length(); i++){
280 NoticeInfo noticeInfo = new NoticeInfo(); 282 NoticeInfo noticeInfo = new NoticeInfo();
281 JSONObject ob = (JSONObject) listNotice.get(i); 283 JSONObject ob = (JSONObject) listNotice.get(i);
282 noticeInfo.setId(ob.optInt("id")); 284 noticeInfo.setId(ob.optInt("id"));
283 noticeInfo.setContent(ob.optString("notice_content")); 285 noticeInfo.setContent(ob.optString("notice_content"));
284 infoLists.add(noticeInfo); 286 infoLists.add(noticeInfo);
285 } 287 }
286 288
287 mTagetInfo.setNoticeList(infoLists); 289 mTagetInfo.setNoticeList(infoLists);
288 } 290 }
289 291
290 } 292 }
291 } catch (JSONException e) { 293 } catch (JSONException e) {
292 e.printStackTrace(); 294 e.printStackTrace();
293 mTagetInfo = new TagetInfo();; 295 mTagetInfo = new TagetInfo();;
294 } 296 }
295 297
296 loadUI(); 298 loadUI();
297 } 299 }
298 300
299 301
300 private void loadUI(){ 302 private void loadUI(){
301 tvStep.setText(String.valueOf(mTagetInfo.getSteps())); 303 tvStep.setText(String.valueOf(mTagetInfo.getSteps()));
302 tvRemain.setText(String.valueOf(mTagetInfo.getStepRemain())); 304 tvRemain.setText(String.valueOf(mTagetInfo.getStepRemain()));
303 tvRateDone.setText(mContext.getResources().getString(R.string.percent_unit, mTagetInfo.getCompletePercent())); 305 tvRateDone.setText(mContext.getResources().getString(R.string.percent_unit, mTagetInfo.getCompletePercent()));
304 } 306 }
305 307
306 private void getNews(Date date){ 308 private void getNews(Date date){
307 309
308 ApiServices.getNews(date, new LLAPIManagerListener() { 310 ApiServices.getNews(date, new LLAPIManagerListener() {
309 @Override 311 @Override
310 public void onError(Error error) { 312 public void onError(Error error) {
311 Debug.error("Get data news error"); 313 Debug.error("Get data news error");
312 } 314 }
313 315
314 @Override 316 @Override
315 public void onSuccess(String json) { 317 public void onSuccess(String json) {
316 Debug.error("Get data news success"); 318 Debug.error("Get data news success");
317 loadNewsDone(json); 319 loadNewsDone(json);
318 } 320 }
319 321
320 @Override 322 @Override
321 public void onSuccess(JSONObject object) { 323 public void onSuccess(JSONObject object) {
322 Debug.error("Get data news success"); 324 Debug.error("Get data news success");
323 } 325 }
324 }); 326 });
325 } 327 }
326 328
327 private void loadNewsDone(String jsonString) { 329 private void loadNewsDone(String jsonString) {
328 330
329 List<NoticeInfo> contentList = new ArrayList<>(); 331 List<NoticeInfo> contentList = new ArrayList<>();
330 JSONObject jsonObject = null; 332 JSONObject jsonObject = null;
331 try { 333 try {
332 jsonObject = new JSONObject(jsonString); 334 jsonObject = new JSONObject(jsonString);
333 int status = jsonObject.optInt("status"); 335 int status = jsonObject.optInt("status");
334 if (status == 1) { 336 if (status == 1) {
335 JSONObject jsonResult = jsonObject.optJSONObject("result"); 337 JSONObject jsonResult = jsonObject.optJSONObject("result");
336 JSONArray listNotice = jsonResult.getJSONArray("listNotice"); 338 JSONArray listNotice = jsonResult.getJSONArray("listNotice");
337 339
338 if (listNotice != null) { 340 if (listNotice != null) {
339 341
340 for (int i = 0; i < listNotice.length(); i++) { 342 for (int i = 0; i < listNotice.length(); i++) {
341 JSONObject obContent = (JSONObject) listNotice.get(i); 343 JSONObject obContent = (JSONObject) listNotice.get(i);
342 String content = obContent.optString("notice_content"); 344 String content = obContent.optString("notice_content");
343 Debug.normal("Content: " + content); 345 Debug.normal("Content: " + content);
344 contentList.add(new NoticeInfo(i+1,content)); 346 contentList.add(new NoticeInfo(i+1,content));
345 } 347 }
346 } 348 }
347 349
348 } 350 }
349 } catch (JSONException e) { 351 } catch (JSONException e) {
350 e.printStackTrace(); 352 e.printStackTrace();
351 } 353 }
352 354
353 addNews(contentList); 355 addNews(contentList);
354 } 356 }
355 357
356 private void addNews(List<NoticeInfo> noticeInfos){ 358 private void addNews(List<NoticeInfo> noticeInfos){
357 if (noticeInfos != null && noticeInfos.size() >0){ 359 if (noticeInfos != null && noticeInfos.size() >0){
358 mNoticeAdapter = new NoticeAdapter(mContext, noticeInfos); 360 mNoticeAdapter = new NoticeAdapter(mContext, noticeInfos);
359 lvNotice.setAdapter(mNoticeAdapter); 361 lvNotice.setAdapter(mNoticeAdapter);
360 lvNotice.setExpanded(true); 362 lvNotice.setExpanded(true);
361 }else { 363 }else {
362 lvNotice.setAdapter(null); 364 lvNotice.setAdapter(null);
363 } 365 }
364 } 366 }
365 367
366 368
367 369
368 @Override 370 @Override
369 public void onAttach(Context context) { 371 public void onAttach(Context context) {
370 super.onAttach(context); 372 super.onAttach(context);
371 373
372 } 374 }
373 375
374 376
375 @Override 377 @Override
376 public void onSaveData() { 378 public void onSaveData() {
377 379
378 } 380 }
379 381
380 @Override 382 @Override
381 public void onInvalidate(boolean isInit) { 383 public void onInvalidate(boolean isInit) {
382 initData(); 384 initData();
383 } 385 }
384 386
385 @Override 387 @Override
386 public void onViewStateRestored(@Nullable Bundle savedInstanceState) { 388 public void onViewStateRestored(@Nullable Bundle savedInstanceState) {
387 super.onViewStateRestored(savedInstanceState); 389 super.onViewStateRestored(savedInstanceState);
388 390
389 initData(); 391 initData();
390 } 392 }
391 393
392 394
393 @Override 395 @Override
394 public void onActivityResult(int requestCode, int resultCode, Intent data) { 396 public void onActivityResult(int requestCode, int resultCode, Intent data) {
395 super.onActivityResult(requestCode, resultCode, data); 397 super.onActivityResult(requestCode, resultCode, data);
396 398
397 } 399 }
398 400
399 401
400 402
401 } 403 }
402 404
app/src/main/java/com/dinhcv/lifelogpedometer/activity/WelcomeActivity.java
1 package com.dinhcv.lifelogpedometer.activity; 1 package com.dinhcv.lifelogpedometer.activity;
2 2
3 import android.Manifest;
3 import android.app.ProgressDialog; 4 import android.app.ProgressDialog;
4 import android.content.DialogInterface; 5 import android.content.DialogInterface;
5 import android.content.Intent; 6 import android.content.Intent;
7 import android.content.pm.PackageManager;
6 import android.net.Uri; 8 import android.net.Uri;
9 import android.os.Build;
7 import android.os.Bundle; 10 import android.os.Bundle;
8 import android.os.Handler; 11 import android.os.Handler;
12 import android.support.v4.app.ActivityCompat;
13 import android.support.v4.content.ContextCompat;
9 import android.support.v7.app.AlertDialog; 14 import android.support.v7.app.AlertDialog;
15 import android.widget.Toast;
10 16
11 import com.dinhcv.lifelogpedometer.R; 17 import com.dinhcv.lifelogpedometer.R;
12 import com.dinhcv.lifelogpedometer.interfaces.LLAPIManagerListener; 18 import com.dinhcv.lifelogpedometer.interfaces.LLAPIManagerListener;
13 import com.dinhcv.lifelogpedometer.model.Shareprefer.Setting; 19 import com.dinhcv.lifelogpedometer.model.Shareprefer.Setting;
14 import com.dinhcv.lifelogpedometer.portal.ApiServices; 20 import com.dinhcv.lifelogpedometer.portal.ApiServices;
15 import com.dinhcv.lifelogpedometer.portal.LLAPIManager; 21 import com.dinhcv.lifelogpedometer.portal.LLAPIManager;
16 import com.dinhcv.lifelogpedometer.utils.Debug; 22 import com.dinhcv.lifelogpedometer.utils.Debug;
17 23
18 import org.json.JSONArray; 24 import org.json.JSONArray;
19 import org.json.JSONObject; 25 import org.json.JSONObject;
20 26
21 27
22 public class WelcomeActivity extends ActivityBase implements Runnable { 28 public class WelcomeActivity extends ActivityBase implements Runnable {
23 private boolean isRefresh = false; 29 private boolean isRefresh = false;
30 private static final int PERMISSIONS_REQUEST = 999;
31
24 @Override 32 @Override
25 protected void onCreate(Bundle savedInstanceState) { 33 protected void onCreate(Bundle savedInstanceState) {
26 super.onCreate(savedInstanceState); 34 super.onCreate(savedInstanceState);
27 setContentView(R.layout.activity_welcome); 35 setContentView(R.layout.activity_welcome);
28 checkRefreshToken(); 36 checkPermission();
29 } 37 }
30 38
31 private void checkRefreshToken(){ 39 private void checkRefreshToken(){
32 int id = Setting.getUserIdSharepre(WelcomeActivity.this); 40 int id = Setting.getUserIdSharepre(WelcomeActivity.this);
33 Debug.normal("String id: "+ id); 41 Debug.normal("String id: "+ id);
34 if (id != 0){ 42 if (id != 0){
35 handleRefreshToken(id); 43 handleRefreshToken(id);
36 }else { 44 }else {
37 refeshDone(); 45 refeshDone();
38 } 46 }
39 } 47 }
40 48
41 49
42 private void handleRefreshToken(int id) { 50 private void handleRefreshToken(int id) {
43 51
44 ApiServices.refreshToken(WelcomeActivity.this, id, new LLAPIManagerListener() { 52 ApiServices.refreshToken(WelcomeActivity.this, id, new LLAPIManagerListener() {
45 @Override 53 @Override
46 public void onError(Error error) { 54 public void onError(Error error) {
47 Debug.error("Version JSON result: ERROR " + error); 55 Debug.error("Version JSON result: ERROR " + error);
48 String err = getResources().getString(R.string.login_error); 56 String err = getResources().getString(R.string.login_error);
49 isRefresh = false; 57 isRefresh = false;
50 refeshDone(); 58 refeshDone();
51 } 59 }
52 60
53 @Override 61 @Override
54 public void onSuccess(String json) { 62 public void onSuccess(String json) {
55 Debug.warn("Version JSON result: " + json.toString()); 63 Debug.warn("Version JSON result: " + json.toString());
56 isRefresh = true; 64 isRefresh = true;
57 refeshDone(); 65 refeshDone();
58 } 66 }
59 67
60 @Override 68 @Override
61 public void onSuccess(JSONObject object) { 69 public void onSuccess(JSONObject object) {
62 Debug.warn("Version JSON object result: Success"); 70 Debug.warn("Version JSON object result: Success");
63 isRefresh = true; 71 isRefresh = true;
64 refeshDone(); 72 refeshDone();
65 } 73 }
66 }); 74 });
67 } 75 }
68 76
69 private void refeshDone(){ 77 private void refeshDone(){
70 Handler handler = new Handler(); 78 Handler handler = new Handler();
71 handler.postDelayed(WelcomeActivity.this, 2000); 79 handler.postDelayed(WelcomeActivity.this, 2000);
72 } 80 }
73 81
74 private void notifyErr(String err){ 82 private void notifyErr(String err){
75 AlertDialog.Builder alertDialog = new AlertDialog.Builder(WelcomeActivity.this); 83 AlertDialog.Builder alertDialog = new AlertDialog.Builder(WelcomeActivity.this);
76 alertDialog.setMessage(err); 84 alertDialog.setMessage(err);
77 alertDialog.setCancelable(false); 85 alertDialog.setCancelable(false);
78 alertDialog.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() { 86 alertDialog.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
79 @Override 87 @Override
80 public void onClick(DialogInterface dialog, int which) { 88 public void onClick(DialogInterface dialog, int which) {
81 finish(); 89 finish();
82 } 90 }
83 }); 91 });
84 AlertDialog alert = alertDialog.create(); 92 AlertDialog alert = alertDialog.create();
85 alert.show(); 93 alert.show();
86 } 94 }
87 95
88 @Override 96 @Override
89 public void run() { 97 public void run() {
90 // go to main screen 98 // go to main screen
91 if ( isRefresh) { 99 if ( isRefresh) {
92 gotoActivity(PedometerActivity.class); 100 gotoActivity(PedometerActivity.class);
93 } else { 101 } else {
94 // Bundle bundle = new Bundle(); 102 // Bundle bundle = new Bundle();
95 // bundle.putString(Const.URL, url); 103 // bundle.putString(Const.URL, url);
96 gotoActivity(LoginActivity.class); 104 gotoActivity(LoginActivity.class);
97 } 105 }
98 finish(); 106 finish();
99 } 107 }
100 108
101 @Override 109 @Override
102 protected void onResume() { 110 protected void onResume() {
103 super.onResume(); 111 super.onResume();
112 }
113
114 private void checkPermission() {
115 // Check all permission in android 6.0
116 if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
117 if ((ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION)
118 == PackageManager.PERMISSION_GRANTED) && (ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION)
119 == PackageManager.PERMISSION_GRANTED)) {
120 checkRefreshToken();
121
122 } else {
123 // Requset permisson of device
124 if (ActivityCompat.shouldShowRequestPermissionRationale(this, Manifest.permission
125 .ACCESS_COARSE_LOCATION)
126 && ActivityCompat.shouldShowRequestPermissionRationale(this, Manifest
127 .permission.ACCESS_FINE_LOCATION)) {
128 ActivityCompat.requestPermissions(this,
129 new String[]{Manifest.permission.ACCESS_COARSE_LOCATION,
130 Manifest.permission.ACCESS_FINE_LOCATION},
131 PERMISSIONS_REQUEST);
132
133 } else {
134 ActivityCompat.requestPermissions(this,
135 new String[]{Manifest.permission.ACCESS_COARSE_LOCATION,
136 Manifest.permission.ACCESS_FINE_LOCATION},
137 PERMISSIONS_REQUEST);
138 }
139 }
140
141 } else {
142 checkRefreshToken();
143 }
144 }
145
146 @Override
147 public void onRequestPermissionsResult(int requestCode, String[] permissions, int[]
148 grantResults) {
149 super.onRequestPermissionsResult(requestCode, permissions, grantResults);
150
151 if (requestCode == PERMISSIONS_REQUEST) {
152 if (grantResults.length > 0) {
153 if (grantResults[0] == PackageManager.PERMISSION_GRANTED
154 && grantResults[1] == PackageManager.PERMISSION_GRANTED
155 && grantResults[2] == PackageManager.PERMISSION_GRANTED) {
156 checkRefreshToken();
157 return;
158 }
159 } else {
160 Toast.makeText(this, "Permission was not granted ", Toast.LENGTH_SHORT).show();
161 finish();
162 }
163 } else {
164 super.onRequestPermissionsResult(requestCode, permissions, grantResults);
165 }
104 } 166 }
105 } 167 }
106 168
app/src/main/java/com/dinhcv/lifelogpedometer/adapter/RankingAdapter.java
1 package com.dinhcv.lifelogpedometer.adapter; 1 package com.dinhcv.lifelogpedometer.adapter;
2 2
3 import android.app.Activity; 3 import android.app.Activity;
4 import android.support.v7.widget.RecyclerView; 4 import android.support.v7.widget.RecyclerView;
5 import android.view.LayoutInflater; 5 import android.view.LayoutInflater;
6 import android.view.View; 6 import android.view.View;
7 import android.view.ViewGroup; 7 import android.view.ViewGroup;
8 import android.widget.ImageView; 8 import android.widget.ImageView;
9 import android.widget.TextView; 9 import android.widget.TextView;
10 10
11 import com.dinhcv.lifelogpedometer.R; 11 import com.dinhcv.lifelogpedometer.R;
12 import com.dinhcv.lifelogpedometer.model.structure.pojo.RankingInfo; 12 import com.dinhcv.lifelogpedometer.model.structure.pojo.RankingInfo;
13 import com.dinhcv.lifelogpedometer.network.ApiUtils; 13 import com.dinhcv.lifelogpedometer.network.ApiUtils;
14 import com.dinhcv.lifelogpedometer.utils.Utils; 14 import com.dinhcv.lifelogpedometer.utils.Utils;
15 import com.squareup.picasso.Picasso; 15 import com.squareup.picasso.Picasso;
16 16
17 import java.util.ArrayList; 17 import java.util.ArrayList;
18 import java.util.List; 18 import java.util.List;
19 19
20 import butterknife.BindView; 20 import butterknife.BindView;
21 import butterknife.ButterKnife; 21 import butterknife.ButterKnife;
22 22
23 /** 23 /**
24 * Created by Admin on 8/17/2017. 24 * Created by Admin on 8/17/2017.
25 */ 25 */
26 26
27 public class RankingAdapter extends RecyclerView.Adapter<RankingAdapter.MyViewHolder> { 27 public class RankingAdapter extends RecyclerView.Adapter<RankingAdapter.MyViewHolder> {
28 private List<RankingInfo> mRankingInfoList = new ArrayList<>(); 28 private List<RankingInfo> mRankingInfoList = new ArrayList<>();
29 private Activity mActivity; 29 private Activity mActivity;
30 30
31 public class MyViewHolder extends RecyclerView.ViewHolder { 31 public class MyViewHolder extends RecyclerView.ViewHolder {
32 @BindView(R.id.tv_position) 32 @BindView(R.id.tv_position)
33 TextView mTvPosition; 33 TextView mTvPosition;
34 @BindView(R.id.imv_user_icon) 34 @BindView(R.id.imv_user_icon)
35 ImageView mImvUserIcon; 35 ImageView mImvUserIcon;
36 @BindView(R.id.tv_time) 36 @BindView(R.id.tv_time)
37 TextView mTvTime; 37 TextView mTvTime;
38 @BindView(R.id.tv_steps) 38 @BindView(R.id.tv_steps)
39 TextView mTvSteps; 39 TextView mTvSteps;
40 @BindView(R.id.tv_distance) 40 @BindView(R.id.tv_distance)
41 TextView mTvDistance; 41 TextView mTvDistance;
42 @BindView(R.id.imv_position) 42 @BindView(R.id.imv_position)
43 ImageView mImvPosition; 43 ImageView mImvPosition;
44 44
45 public MyViewHolder(View view) { 45 public MyViewHolder(View view) {
46 super(view); 46 super(view);
47 ButterKnife.bind(this, view); 47 ButterKnife.bind(this, view);
48 } 48 }
49 } 49 }
50 50
51 public RankingAdapter(Activity activity, List<RankingInfo> list) { 51 public RankingAdapter(Activity activity, List<RankingInfo> list) {
52 mActivity = activity; 52 mActivity = activity;
53 mRankingInfoList.clear(); 53 mRankingInfoList.clear();
54 mRankingInfoList.addAll(list); 54 mRankingInfoList.addAll(list);
55 } 55 }
56 56
57 public void updateData(List<RankingInfo> list) { 57 public void updateData(List<RankingInfo> list) {
58 mRankingInfoList.clear(); 58 mRankingInfoList.clear();
59 mRankingInfoList.addAll(list); 59 mRankingInfoList.addAll(list);
60 } 60 }
61 61
62 public void clearData() { 62 public void clearData() {
63 mRankingInfoList.clear(); 63 mRankingInfoList.clear();
64 } 64 }
65 65
66 @Override 66 @Override
67 public RankingAdapter.MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { 67 public RankingAdapter.MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
68 View itemView = LayoutInflater.from(parent.getContext()) 68 View itemView = LayoutInflater.from(parent.getContext())
69 .inflate(R.layout.layout_rank_row, parent, false); 69 .inflate(R.layout.layout_rank_row, parent, false);
70 70
71 return new RankingAdapter.MyViewHolder(itemView); 71 return new RankingAdapter.MyViewHolder(itemView);
72 } 72 }
73 73
74 @Override 74 @Override
75 public void onBindViewHolder(RankingAdapter.MyViewHolder holder, int position) { 75 public void onBindViewHolder(RankingAdapter.MyViewHolder holder, int position) {
76 RankingInfo rankingInfo = mRankingInfoList.get(position); 76 RankingInfo rankingInfo = mRankingInfoList.get(position);
77 holder.mTvPosition.setText(rankingInfo.getRank()+""); 77 holder.mTvPosition.setText(rankingInfo.getRank()+"");
78 holder.mTvTime.setText(Utils.convertSecond2HourMinSecString(rankingInfo.getTime())); 78 holder.mTvTime.setText(Utils.convertSecond2HourMinSecString(rankingInfo.getTime()));
79 holder.mTvSteps.setText(rankingInfo.getSteps() + " ๆญฉ"); 79 holder.mTvSteps.setText(rankingInfo.getSteps() + " ๆญฉ");
80 holder.mTvDistance.setText(rankingInfo.getDistance() + " km"); 80 holder.mTvDistance.setText(rankingInfo.getDistance() + " km");
81 if (rankingInfo.getProfileImage() != null && !rankingInfo.getProfileImage().toString().isEmpty()) { 81 if (rankingInfo.getProfileImage() != null && !rankingInfo.getProfileImage().toString().isEmpty()) {
82 Picasso.with(mActivity).load(ApiUtils.BASE_URL + rankingInfo.getProfileImage().toString()).into( 82 Picasso.with(mActivity).load(ApiUtils.BASE_URL + rankingInfo.getProfileImage().toString()).into(
83 holder.mImvUserIcon); 83 holder.mImvUserIcon);
84 } 84 }
85 switch (rankingInfo.getRank()) { 85 switch (rankingInfo.getRank()) {
86 case 1: 86 case 1:
87 holder.mImvPosition.setBackground(Utils.getDrawableWrapper(mActivity, R.drawable.ic_first)); 87 holder.mImvPosition.setBackground(Utils.getDrawableWrapper(mActivity, R.drawable.no1));
88 break; 88 break;
89 case 2: 89 case 2:
90 holder.mImvPosition.setBackground(Utils.getDrawableWrapper(mActivity, R.drawable.ic_second)); 90 holder.mImvPosition.setBackground(Utils.getDrawableWrapper(mActivity, R.drawable.no2));
91 break; 91 break;
92 case 3: 92 case 3:
93 holder.mImvPosition.setBackground(Utils.getDrawableWrapper(mActivity, R.drawable.ic_third)); 93 holder.mImvPosition.setBackground(Utils.getDrawableWrapper(mActivity, R.drawable.no3));
94 break; 94 break;
95 } 95 }
96 } 96 }
97 97
98 @Override 98 @Override
99 public int getItemCount() { 99 public int getItemCount() {
100 return mRankingInfoList.size(); 100 return mRankingInfoList.size();
101 } 101 }
102 } 102 }
103 103
app/src/main/java/com/dinhcv/lifelogpedometer/customview/CircularImageView.java
File was created 1 package com.dinhcv.lifelogpedometer.customview;
2
3
4 import android.annotation.SuppressLint;
5 import android.content.Context;
6 import android.graphics.Bitmap;
7 import android.graphics.BitmapShader;
8 import android.graphics.Canvas;
9 import android.graphics.Color;
10 import android.graphics.Matrix;
11 import android.graphics.Paint;
12 import android.graphics.Shader;
13 import android.graphics.drawable.BitmapDrawable;
14 import android.graphics.drawable.Drawable;
15 import android.util.AttributeSet;
16 import android.util.Log;
17 import android.widget.ImageView;
18
19
20 @SuppressLint("AppCompatCustomView")
21 public class CircularImageView extends ImageView {
22 private static final ScaleType SCALE_TYPE = ScaleType.CENTER_CROP;
23
24 private static final float DEFAULT_BORDER_WIDTH = 4;
25 private static final float DEFAULT_SHADOW_RADIUS = 8.0f;
26 private float borderWidth;
27 private int canvasSize;
28 private float shadowRadius;
29 private int shadowColor = Color.BLACK;
30
31 private Bitmap image;
32 private Drawable drawable;
33 private Paint paint;
34 private Paint paintBorder;
35
36 public CircularImageView(final Context context) {
37 this(context, null);
38 }
39
40 public CircularImageView(Context context, AttributeSet attrs) {
41 this(context, attrs, 0);
42 }
43
44 public CircularImageView(Context context, AttributeSet attrs, int defStyleAttr) {
45 super(context, attrs, defStyleAttr);
46 init(context, attrs, defStyleAttr);
47 }
48
49 private void init(Context context, AttributeSet attrs, int defStyleAttr) {
50 paint = new Paint();
51 paint.setAntiAlias(true);
52
53 paintBorder = new Paint();
54 paintBorder.setAntiAlias(true);
55 }
56
57 public void setBorderWidth(float borderWidth) {
58 this.borderWidth = borderWidth;
59 requestLayout();
60 invalidate();
61 }
62
63 public void setBorderColor(int borderColor) {
64 if (paintBorder != null)
65 paintBorder.setColor(borderColor);
66 invalidate();
67 }
68
69 public void addShadow() {
70 if (shadowRadius == 0)
71 shadowRadius = DEFAULT_SHADOW_RADIUS;
72 drawShadow(shadowRadius, shadowColor);
73 invalidate();
74 }
75
76 public void setShadowRadius(float shadowRadius) {
77 drawShadow(shadowRadius, shadowColor);
78 invalidate();
79 }
80
81 public void setShadowColor(int shadowColor) {
82 drawShadow(shadowRadius, shadowColor);
83 invalidate();
84 }
85
86 @Override
87 public ScaleType getScaleType() {
88 return SCALE_TYPE;
89 }
90
91 @Override
92 public void setScaleType(ScaleType scaleType) {
93 if (scaleType != SCALE_TYPE) {
94 throw new IllegalArgumentException(String.format("ScaleType %s not supported. ScaleType.CENTER_CROP is used by default. So you don't need to use ScaleType.", scaleType));
95 }
96 }
97
98 @Override
99 public void onDraw(Canvas canvas) {
100 loadBitmap();
101
102 if (image == null)
103 return;
104
105 if (!isInEditMode()) {
106 canvasSize = canvas.getWidth();
107 if (canvas.getHeight() < canvasSize) {
108 canvasSize = canvas.getHeight();
109 }
110 }
111
112 int circleCenter = (int) (canvasSize - (borderWidth * 2)) / 2;
113 canvas.drawCircle(circleCenter + borderWidth, circleCenter + borderWidth, circleCenter + borderWidth - (shadowRadius + shadowRadius / 2), paintBorder);
114 canvas.drawCircle(circleCenter + borderWidth, circleCenter + borderWidth, circleCenter - (shadowRadius + shadowRadius / 2), paint);
115 }
116
117 private void loadBitmap() {
118 if (this.drawable == getDrawable())
119 return;
120
121 this.drawable = getDrawable();
122 this.image = drawableToBitmap(this.drawable);
123 updateShader();
124 }
125
126 @Override
127 protected void onSizeChanged(int w, int h, int oldw, int oldh) {
128 super.onSizeChanged(w, h, oldw, oldh);
129 canvasSize = w;
130 if (h < canvasSize)
131 canvasSize = h;
132 if (image != null)
133 updateShader();
134 }
135
136 private void drawShadow(float shadowRadius, int shadowColor) {
137 this.shadowRadius = shadowRadius;
138 this.shadowColor = shadowColor;
139 if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB) {
140 setLayerType(LAYER_TYPE_SOFTWARE, paintBorder);
141 }
142 paintBorder.setShadowLayer(shadowRadius, 0.0f, shadowRadius / 2, shadowColor);
143 }
144
145 private void updateShader() {
146 if (image == null)
147 return;
148
149 image = cropBitmap(image);
150
151 BitmapShader shader = new BitmapShader(image, Shader.TileMode.CLAMP, Shader.TileMode.CLAMP);
152
153 Matrix matrix = new Matrix();
154 matrix.setScale((float) canvasSize / (float) image.getWidth(), (float) canvasSize / (float) image.getHeight());
155 shader.setLocalMatrix(matrix);
156
157 paint.setShader(shader);
158 }
159
160 private Bitmap cropBitmap(Bitmap bitmap) {
161 Bitmap bmp;
162 if (bitmap.getWidth() >= bitmap.getHeight()) {
163 bmp = Bitmap.createBitmap(
164 bitmap,
165 bitmap.getWidth() / 2 - bitmap.getHeight() / 2,
166 0,
167 bitmap.getHeight(), bitmap.getHeight());
168 } else {
169 bmp = Bitmap.createBitmap(
170 bitmap,
171 0,
172 bitmap.getHeight() / 2 - bitmap.getWidth() / 2,
173 bitmap.getWidth(), bitmap.getWidth());
174 }
175 return bmp;
176 }
177
178 private Bitmap drawableToBitmap(Drawable drawable) {
179 if (drawable == null) {
180 return null;
181 } else if (drawable instanceof BitmapDrawable) {
182 return ((BitmapDrawable) drawable).getBitmap();
183 }
184
185 int intrinsicWidth = drawable.getIntrinsicWidth();
186 int intrinsicHeight = drawable.getIntrinsicHeight();
187
188 if (!(intrinsicWidth > 0 && intrinsicHeight > 0))
189 return null;
190
191 try {
192 Bitmap bitmap = Bitmap.createBitmap(intrinsicWidth, intrinsicHeight, Bitmap.Config.ARGB_8888);
193 Canvas canvas = new Canvas(bitmap);
194 drawable.setBounds(0, 0, canvas.getWidth(), canvas.getHeight());
195 drawable.draw(canvas);
196 return bitmap;
197 } catch (OutOfMemoryError e) {
198 Log.e(getClass().toString(), "Encountered OutOfMemoryError while generating bitmap!");
199 return null;
200 }
201 }
202
203 @Override
204 protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
205 int width = measureWidth(widthMeasureSpec);
206 int height = measureHeight(heightMeasureSpec);
207 setMeasuredDimension(width, height);
208 }
209
210 private int measureWidth(int measureSpec) {
211 int result;
212 int specMode = MeasureSpec.getMode(measureSpec);
213 int specSize = MeasureSpec.getSize(measureSpec);
214
215 if (specMode == MeasureSpec.EXACTLY) {
216 result = specSize;
217 } else if (specMode == MeasureSpec.AT_MOST) {
218 result = specSize;
219 } else {
220 result = canvasSize;
221 }
222
223 return result;
224 }
225
226 private int measureHeight(int measureSpecHeight) {
227 int result;
228 int specMode = MeasureSpec.getMode(measureSpecHeight);
229 int specSize = MeasureSpec.getSize(measureSpecHeight);
230
231 if (specMode == MeasureSpec.EXACTLY) {
232 result = specSize;
233 } else if (specMode == MeasureSpec.AT_MOST) {
234 result = specSize;
235 } else {
236 result = canvasSize;
237 }
238
239 return (result + 2);
240 }
241 }
app/src/main/res/drawable/back_ic.PNG

1.95 KB | W: | H:

7.72 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
app/src/main/res/drawable/goout_ic.PNG

2.81 KB | W: | H:

5.51 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
app/src/main/res/drawable/home_ic.PNG

1.45 KB | W: | H:

11.2 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
app/src/main/res/drawable/list_ic.PNG

786 Bytes | W: | H:

3.66 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
app/src/main/res/drawable/next_ic.PNG

1.96 KB | W: | H:

7.4 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
app/src/main/res/drawable/step_type_enabled.xml
1 <?xml version="1.0" encoding="utf-8"?> 1 <?xml version="1.0" encoding="utf-8"?>
2 2
3 <shape xmlns:android="http://schemas.android.com/apk/res/android" 3 <shape xmlns:android="http://schemas.android.com/apk/res/android"
4 android:shape="rectangle"> 4 android:shape="rectangle">
5 <gradient 5 <gradient
6 android:startColor="@color/tab_sub2_unselected" 6 android:startColor="@color/bg_header"
7 android:centerColor="@color/tab_sub2_unselected" 7 android:centerColor="@color/bg_header"
8 android:endColor="@color/tab_sub2_unselected" 8 android:endColor="@color/bg_header"
9 android:angle="90"/> 9 android:angle="90"/>
10 <padding 10 <padding
11 android:bottom="7dp" 11 android:bottom="7dp"
12 android:left="7dp" 12 android:left="7dp"
13 android:right="7dp" 13 android:right="7dp"
14 android:top="7dp" /> 14 android:top="7dp" />
15 <stroke 15 <stroke
16 android:width="2dip" 16 android:width="2dip"
17 android:color="@color/tab_sub2_unselected" /> 17 android:color="@color/bg_header" />
18 <corners android:radius="0dp" /> 18 <corners android:radius="0dp" />
19 </shape> 19 </shape>
app/src/main/res/drawable/tab_color_selector.xml
1 <?xml version="1.0" encoding="utf-8"?> 1 <?xml version="1.0" encoding="utf-8"?>
2 <selector xmlns:android="http://schemas.android.com/apk/res/android"> 2 <selector xmlns:android="http://schemas.android.com/apk/res/android">
3 <item android:drawable="@color/selected_tab_color" android:state_selected="true"/> 3 <item android:drawable="@color/selected_tab_color" android:state_selected="true"/>
4 <item android:drawable="@color/background_main"/> 4 <item android:drawable="@color/white"/>
5 </selector> 5 </selector>
app/src/main/res/drawable/test_selector.xml
File was created 1 <?xml version="1.0" encoding="utf-8"?>
2 <selector xmlns:android="http://schemas.android.com/apk/res/android">
3 <item android:drawable="@drawable/history_ic" android:state_selected="true"/>
4 <item android:drawable="@drawable/today_ic"/>
5 </selector>
app/src/main/res/drawable/walking_ic.PNG

3.04 KB | W: | H:

5.63 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
app/src/main/res/layout/activity_pedometer.xml
1 <?xml version="1.0" encoding="utf-8"?> 1 <?xml version="1.0" encoding="utf-8"?>
2 <RelativeLayout 2 <RelativeLayout
3 xmlns:android="http://schemas.android.com/apk/res/android" 3 xmlns:android="http://schemas.android.com/apk/res/android"
4 xmlns:tools="http://schemas.android.com/tools" 4 xmlns:tools="http://schemas.android.com/tools"
5 xmlns:app="http://schemas.android.com/apk/res-auto" 5 xmlns:app="http://schemas.android.com/apk/res-auto"
6 android:layout_width="match_parent" 6 android:layout_width="match_parent"
7 android:layout_height="match_parent"> 7 android:layout_height="match_parent"
8 android:background="@drawable/bg">
8 9
9 <include layout="@layout/layout_toolbar"/> 10 <include layout="@layout/layout_toolbar"/>
10 11
11 <android.support.v4.view.ViewPager 12 <android.support.v4.view.ViewPager
12 android:id="@+id/viewpager" 13 android:id="@+id/viewpager"
13 android:layout_width="match_parent" 14 android:layout_width="match_parent"
14 android:layout_height="match_parent" 15 android:layout_height="match_parent"
15 android:layout_above="@+id/appTab" 16 android:layout_above="@+id/appTab"
16 android:layout_below="@+id/ll_toolBar" 17 android:layout_below="@+id/ll_toolBar"
17 app:layout_behavior="@string/appbar_scrolling_view_behavior"/> 18 app:layout_behavior="@string/appbar_scrolling_view_behavior"/>
18 19
19 <android.support.design.widget.AppBarLayout 20 <android.support.design.widget.AppBarLayout
20 android:id="@+id/appTab" 21 android:id="@+id/appTab"
21 android:layout_width="match_parent" 22 android:layout_width="match_parent"
22 android:layout_height="wrap_content" 23 android:layout_height="wrap_content"
23 android:layout_alignParentBottom="true" 24 android:layout_alignParentBottom="true"
24 android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"> 25 android:theme="@style/ThemeOverlay.AppCompat.Light">
25 26
26 <android.support.design.widget.TabLayout 27 <android.support.design.widget.TabLayout
27 android:id="@+id/tabs" 28 android:id="@+id/tabs"
28 android:layout_width="match_parent" 29 android:layout_width="match_parent"
29 android:layout_height="wrap_content" 30 android:layout_height="wrap_content"
30 style="@style/custom_tab" 31 style="@style/custom_tab"
31 android:background="@drawable/tab_background" 32 android:background="@color/white"
32 app:tabBackground="@drawable/tab_color_selector" 33 app:tabBackground="@drawable/tab_color_selector"
33 app:tabGravity="fill" 34 app:tabGravity="fill"
34 app:tabMode="fixed"/> 35 app:tabMode="fixed"/>
35 </android.support.design.widget.AppBarLayout> 36 </android.support.design.widget.AppBarLayout>
36 37
37 </RelativeLayout> 38 </RelativeLayout>
38 39
app/src/main/res/layout/customtab.xml
File was created 1 <?xml version="1.0" encoding="utf-8"?>
2 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3 android:orientation="vertical"
4 android:layout_width="match_parent"
5 android:layout_height="match_parent"
6 android:padding="3dp">
7
8 <ImageView
9 android:layout_width="wrap_content"
10 android:layout_height="wrap_content"
11 android:adjustViewBounds="true"
12 android:src="@drawable/tab_ic"
13 android:id="@+id/icon"
14 android:layout_gravity="center" />
15 </LinearLayout>
app/src/main/res/layout/fragment_history.xml
1 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 1 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
2 xmlns:appNs="http://schemas.android.com/apk/res-auto" 2 xmlns:appNs="http://schemas.android.com/apk/res-auto"
3 android:layout_width="match_parent" 3 android:layout_width="match_parent"
4 android:layout_height="match_parent" 4 android:layout_height="match_parent"
5 android:background="@color/background_main"
6 android:orientation="vertical"> 5 android:orientation="vertical">
7 <FrameLayout 6 <FrameLayout
8 android:id="@+id/layout_history" 7 android:id="@+id/layout_history"
9 android:layout_width="match_parent" 8 android:layout_width="match_parent"
10 android:layout_height="match_parent"> 9 android:layout_height="match_parent">
11 </FrameLayout> 10 </FrameLayout>
12 </LinearLayout> 11 </LinearLayout>
13 12
app/src/main/res/layout/fragment_history_content.xml
1 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 1 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
2 xmlns:appNs="http://schemas.android.com/apk/res-auto" 2 xmlns:appNs="http://schemas.android.com/apk/res-auto"
3 android:layout_width="match_parent" 3 android:layout_width="match_parent"
4 android:layout_height="match_parent" 4 android:layout_height="match_parent">
5 android:background="@color/background_main">
6 5
7 <ScrollView 6 <ScrollView
8 android:layout_width="match_parent" 7 android:layout_width="match_parent"
9 android:layout_height="wrap_content" 8 android:layout_height="wrap_content"
10 android:layout_above="@+id/ll_stepType" 9 android:layout_above="@+id/ll_stepType"
11 android:layout_alignParentStart="true" 10 android:layout_alignParentStart="true"
12 android:layout_alignParentTop="true"> 11 android:layout_alignParentTop="true">
13 12
14 13
15 <LinearLayout 14 <LinearLayout
16 android:layout_width="match_parent" 15 android:layout_width="match_parent"
17 android:layout_height="wrap_content" 16 android:layout_height="wrap_content"
18 android:orientation="vertical"> 17 android:orientation="vertical">
19 18
20 <LinearLayout 19 <LinearLayout
21 android:id="@+id/layout_top" 20 android:id="@+id/layout_top"
22 android:layout_width="match_parent" 21 android:layout_width="match_parent"
23 android:layout_height="wrap_content" 22 android:layout_height="wrap_content"
24 android:orientation="vertical"> 23 android:orientation="vertical">
25 24
26 <RelativeLayout 25 <RelativeLayout
27 android:id="@+id/layout_date_controll" 26 android:id="@+id/layout_date_controll"
28 android:layout_width="match_parent" 27 android:layout_width="match_parent"
29 android:layout_height="44dp" 28 android:layout_height="44dp"
30 android:layout_alignParentTop="true" 29 android:layout_alignParentTop="true"
31 android:gravity="center_vertical"> 30 android:gravity="center_vertical">
32 31
33 <ImageButton 32 <ImageButton
34 android:id="@+id/btn_left_date" 33 android:id="@+id/btn_left_date"
35 android:layout_width="44dp" 34 android:layout_width="44dp"
36 android:layout_height="44dp" 35 android:layout_height="44dp"
37 android:layout_alignParentLeft="true" 36 android:layout_alignParentLeft="true"
38 android:layout_centerVertical="true" 37 android:layout_centerVertical="true"
39 android:layout_marginLeft="16dp" 38 android:layout_marginLeft="16dp"
40 android:background="@android:color/darker_gray" 39 android:background="@android:color/darker_gray"
41 android:padding="8dp" 40 android:padding="8dp"
42 android:scaleType="fitCenter" 41 android:scaleType="fitCenter"
43 android:src="@drawable/ic_left_arrow" /> 42 android:src="@drawable/ic_left_arrow" />
44 43
45 <TextView 44 <TextView
46 android:id="@+id/tv_date" 45 android:id="@+id/tv_date"
47 android:layout_width="wrap_content" 46 android:layout_width="wrap_content"
48 android:layout_height="match_parent" 47 android:layout_height="match_parent"
49 android:layout_toRightOf="@+id/btn_left_date" 48 android:layout_toRightOf="@+id/btn_left_date"
50 android:background="@android:color/white" 49 android:background="@android:color/white"
51 android:gravity="center_vertical" 50 android:gravity="center_vertical"
52 android:padding="8dp" 51 android:padding="8dp"
53 android:text="2017ๅนด1ๆœˆ1ๆ—ฅ" 52 android:text="2017ๅนด1ๆœˆ1ๆ—ฅ"
54 android:textColor="@android:color/black" 53 android:textColor="@android:color/black"
55 android:textSize="18sp" /> 54 android:textSize="18sp" />
56 55
57 <TextView 56 <TextView
58 android:id="@+id/tv_week_day" 57 android:id="@+id/tv_week_day"
59 android:layout_width="match_parent" 58 android:layout_width="match_parent"
60 android:layout_height="match_parent" 59 android:layout_height="match_parent"
61 android:layout_toLeftOf="@+id/btn_right_date" 60 android:layout_toLeftOf="@+id/btn_right_date"
62 android:layout_toRightOf="@+id/tv_date" 61 android:layout_toRightOf="@+id/tv_date"
63 android:background="@android:color/white" 62 android:background="@android:color/white"
64 android:gravity="center" 63 android:gravity="center"
65 android:text="ๆ—ฅๆ›œๆ—ฅ" 64 android:text="ๆ—ฅๆ›œๆ—ฅ"
66 android:textColor="@android:color/black" 65 android:textColor="@android:color/black"
67 android:textSize="18sp" /> 66 android:textSize="18sp" />
68 67
69 <ImageButton 68 <ImageButton
70 android:id="@+id/btn_right_date" 69 android:id="@+id/btn_right_date"
71 android:layout_width="44dp" 70 android:layout_width="44dp"
72 android:layout_height="44dp" 71 android:layout_height="44dp"
73 android:layout_alignParentRight="true" 72 android:layout_alignParentRight="true"
74 android:layout_centerVertical="true" 73 android:layout_centerVertical="true"
75 android:layout_marginRight="16dp" 74 android:layout_marginRight="16dp"
76 android:background="@android:color/darker_gray" 75 android:background="@android:color/darker_gray"
77 android:padding="8dp" 76 android:padding="8dp"
78 android:scaleType="fitCenter" 77 android:scaleType="fitCenter"
79 android:src="@drawable/ic_right_arrow" /> 78 android:src="@drawable/ic_right_arrow" />
80 </RelativeLayout> 79 </RelativeLayout>
81 80
82 <LinearLayout 81 <LinearLayout
83 android:layout_width="match_parent" 82 android:layout_width="match_parent"
84 android:layout_height="wrap_content" 83 android:layout_height="wrap_content"
85 android:layout_marginTop="20dp" 84 android:layout_marginTop="20dp"
86 android:orientation="horizontal" 85 android:orientation="horizontal"
87 android:weightSum="5"> 86 android:weightSum="5">
88 87
89 <Button 88 <Button
90 android:id="@+id/btn_oneDay" 89 android:id="@+id/btn_oneDay"
91 style="@style/button_normal_style" 90 style="@style/button_normal_style"
92 android:layout_width="0dp" 91 android:layout_width="0dp"
93 android:layout_height="match_parent" 92 android:layout_height="match_parent"
94 android:layout_weight="1" 93 android:layout_weight="1"
95 android:background="@drawable/button_background" 94 android:background="@drawable/button_background"
96 android:text="@string/one_day" /> 95 android:text="@string/one_day" />
97 96
98 <Button 97 <Button
99 android:id="@+id/btn_oneWeek" 98 android:id="@+id/btn_oneWeek"
100 style="@style/button_normal_style" 99 style="@style/button_normal_style"
101 android:layout_width="0dp" 100 android:layout_width="0dp"
102 android:layout_height="match_parent" 101 android:layout_height="match_parent"
103 android:layout_weight="1" 102 android:layout_weight="1"
104 android:background="@drawable/button_background" 103 android:background="@drawable/button_background"
105 android:text="@string/one_week" /> 104 android:text="@string/one_week" />
106 105
107 <Button 106 <Button
108 android:id="@+id/btn_oneMonth" 107 android:id="@+id/btn_oneMonth"
109 style="@style/button_normal_style" 108 style="@style/button_normal_style"
110 android:layout_width="0dp" 109 android:layout_width="0dp"
111 android:layout_height="match_parent" 110 android:layout_height="match_parent"
112 android:layout_weight="1" 111 android:layout_weight="1"
113 android:background="@drawable/button_background" 112 android:background="@drawable/button_background"
114 android:text="@string/one_month" /> 113 android:text="@string/one_month" />
115 114
116 <Button 115 <Button
117 android:id="@+id/btn_threeMonth" 116 android:id="@+id/btn_threeMonth"
118 style="@style/button_normal_style" 117 style="@style/button_normal_style"
119 android:layout_width="0dp" 118 android:layout_width="0dp"
120 android:layout_height="match_parent" 119 android:layout_height="match_parent"
121 android:layout_weight="1" 120 android:layout_weight="1"
122 android:background="@drawable/button_background" 121 android:background="@drawable/button_background"
123 android:text="@string/three_month" /> 122 android:text="@string/three_month" />
124 123
125 <Button 124 <Button
126 android:id="@+id/btn_sixMonth" 125 android:id="@+id/btn_sixMonth"
127 style="@style/button_normal_style" 126 style="@style/button_normal_style"
128 android:layout_width="0dp" 127 android:layout_width="0dp"
129 android:layout_height="match_parent" 128 android:layout_height="match_parent"
130 android:layout_weight="1" 129 android:layout_weight="1"
131 android:background="@drawable/button_background" 130 android:background="@drawable/button_background"
132 android:text="@string/six_month" /> 131 android:text="@string/six_month" />
133 132
134 </LinearLayout> 133 </LinearLayout>
135 </LinearLayout> 134 </LinearLayout>
136 135
137 <LinearLayout 136 <LinearLayout
138 android:id="@+id/rcv_rank" 137 android:id="@+id/rcv_rank"
139 android:layout_width="match_parent" 138 android:layout_width="match_parent"
140 android:layout_height="match_parent" 139 android:layout_height="match_parent"
141 android:layout_above="@+id/layout_bottom" 140 android:layout_above="@+id/layout_bottom"
142 android:layout_below="@+id/layout_top" 141 android:layout_below="@+id/layout_top"
143 android:orientation="vertical"> 142 android:orientation="vertical">
144 143
145 <include layout="@layout/history_page_7_content"/> 144 <include layout="@layout/history_page_7_content" />
146 145
147 <LinearLayout 146 <LinearLayout
148 android:layout_width="match_parent" 147 android:layout_width="match_parent"
149 android:layout_height="120dp" 148 android:layout_height="120dp"
150 android:orientation="vertical" 149 android:layout_marginTop="10dp"
151 android:layout_marginTop="10dp"> 150 android:orientation="vertical">
152 151
153 <!--<org.eazegraph.lib.charts.BarChart--> 152 <!--<org.eazegraph.lib.charts.BarChart-->
154 <!--xmlns:eaze="http://schemas.android.com/apk/res-auto"--> 153 <!--xmlns:eaze="http://schemas.android.com/apk/res-auto"-->
155 <!--android:id="@+id/bargraph"--> 154 <!--android:id="@+id/bargraph"-->
156 <!--android:layout_width="match_parent"--> 155 <!--android:layout_width="match_parent"-->
157 <!--android:layout_height="120dp"--> 156 <!--android:layout_height="120dp"-->
158 <!--android:layout_below="@+id/averageandtotaltext"--> 157 <!--android:layout_below="@+id/averageandtotaltext"-->
159 <!--eaze:egLegendHeight="0dp"--> 158 <!--eaze:egLegendHeight="0dp"-->
160 <!--eaze:egShowValues="false" />--> 159 <!--eaze:egShowValues="false" />-->
161 <com.github.mikephil.charting.charts.BarChart 160 <com.github.mikephil.charting.charts.BarChart
162 android:id="@+id/chart" 161 android:id="@+id/chart"
163 android:layout_width="match_parent" 162 android:layout_width="match_parent"
164 android:layout_height="match_parent" /> 163 android:layout_height="match_parent" />
165 164
166 165
167 </LinearLayout> 166 </LinearLayout>
168 167
169 168
170 </LinearLayout> 169 </LinearLayout>
171 170
172 <LinearLayout 171 <LinearLayout
173 android:id="@+id/layout_bottom" 172 android:id="@+id/layout_bottom"
174 android:layout_width="match_parent" 173 android:layout_width="match_parent"
175 android:layout_height="56dp" 174 android:layout_height="wrap_content"
175 android:gravity="right"
176 android:orientation="horizontal" 176 android:orientation="horizontal"
177 android:weightSum="5"> 177 android:weightSum="5">
178 178
179 <Button 179
180 <ImageView
180 android:id="@+id/btn_face" 181 android:id="@+id/btn_face"
181 style="@style/button_bot_page_7_style" 182 android:layout_width="wrap_content"
182 android:layout_width="0dp" 183 android:layout_height="wrap_content"
183 android:layout_height="match_parent"
184 android:layout_weight="1"
185 android:background="@drawable/button_background"
186 android:lines="2"
187 android:layout_margin="2dp" 184 android:layout_margin="2dp"
188 android:text="@string/facebook" /> 185 android:adjustViewBounds="true"
186 android:background="@drawable/face_ic" />
189 187
190 <Button 188
189 <ImageView
191 android:id="@+id/btn_twitter" 190 android:id="@+id/btn_twitter"
192 style="@style/button_bot_page_7_style" 191 android:layout_width="wrap_content"
193 android:layout_width="0dp" 192 android:layout_height="wrap_content"
194 android:layout_height="match_parent"
195 android:layout_weight="1"
196 android:background="@drawable/button_background"
197 android:lines="2"
198 android:layout_margin="2dp" 193 android:layout_margin="2dp"
199 android:text="@string/twitter" /> 194 android:adjustViewBounds="true"
195 android:background="@drawable/f2_ic" />
200 196
201 <Button 197
198 <ImageView
202 android:id="@+id/btn_line" 199 android:id="@+id/btn_line"
203 style="@style/button_bot_page_7_style" 200 android:layout_width="wrap_content"
204 android:layout_width="0dp" 201 android:layout_height="wrap_content"
205 android:layout_height="match_parent"
206 android:layout_weight="1"
207 android:background="@drawable/button_background"
208 android:lines="2"
209 android:layout_margin="2dp" 202 android:layout_margin="2dp"
210 android:text="@string/line" /> 203 android:adjustViewBounds="true"
204 android:background="@drawable/twitter_ic" />
211 205
212 <Button 206
207 <ImageView
213 android:id="@+id/btn_email" 208 android:id="@+id/btn_email"
214 style="@style/button_bot_page_7_style" 209 android:layout_width="wrap_content"
215 android:layout_width="0dp" 210 android:layout_height="wrap_content"
216 android:layout_height="match_parent"
217 android:layout_weight="1"
218 android:background="@drawable/button_background"
219 android:lines="2"
220 android:layout_margin="2dp" 211 android:layout_margin="2dp"
221 android:text="@string/mail" /> 212 android:adjustViewBounds="true"
213 android:background="@drawable/mail_ic" />
222 214
223 <Button 215 <ImageView
224 android:id="@+id/btn_other" 216 android:id="@+id/btn_other"
225 style="@style/button_bot_page_7_style" 217 android:layout_width="wrap_content"
226 android:layout_width="0dp" 218 android:layout_height="wrap_content"
227 android:layout_height="match_parent"
228 android:layout_weight="1"
229 android:background="@drawable/button_background"
230 android:lines="2"
231 android:layout_margin="2dp" 219 android:layout_margin="2dp"
232 android:text="@string/other" /> 220 android:adjustViewBounds="true"
app/src/main/res/layout/fragment_history_detail.xml
1 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 1 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
2 xmlns:appNs="http://schemas.android.com/apk/res-auto" 2 xmlns:appNs="http://schemas.android.com/apk/res-auto"
3 android:layout_width="match_parent" 3 android:layout_width="match_parent"
4 android:layout_height="match_parent" 4 android:layout_height="match_parent">
5 android:background="@color/background_main">
6 5
7 <ScrollView 6 <ScrollView
8 android:layout_width="match_parent" 7 android:layout_width="match_parent"
9 android:layout_height="wrap_content" 8 android:layout_height="wrap_content"
10 android:layout_above="@+id/ll_stepType" 9 android:layout_above="@+id/ll_stepType"
11 android:layout_alignParentStart="true" 10 android:layout_alignParentStart="true"
12 android:layout_alignParentTop="true"> 11 android:layout_alignParentTop="true">
13 12
14 13
15 <LinearLayout 14 <LinearLayout
16 android:layout_width="match_parent" 15 android:layout_width="match_parent"
17 android:layout_height="wrap_content" 16 android:layout_height="wrap_content"
18 android:orientation="vertical"> 17 android:orientation="vertical">
19 18
20 <LinearLayout 19 <LinearLayout
21 android:id="@+id/layout_top" 20 android:id="@+id/layout_top"
22 android:layout_width="match_parent" 21 android:layout_width="match_parent"
23 android:layout_height="wrap_content" 22 android:layout_height="wrap_content"
24 android:orientation="vertical"> 23 android:orientation="vertical">
25 24
26 <RelativeLayout 25 <RelativeLayout
27 android:id="@+id/layout_date_controll" 26 android:id="@+id/layout_date_controll"
28 android:layout_width="match_parent" 27 android:layout_width="match_parent"
29 android:layout_height="44dp" 28 android:layout_height="44dp"
30 android:layout_alignParentTop="true" 29 android:layout_alignParentTop="true"
31 android:gravity="center_vertical"> 30 android:gravity="center_vertical">
32 31
33 <ImageButton 32 <ImageButton
34 android:id="@+id/btn_left_date" 33 android:id="@+id/btn_left_date"
35 android:layout_width="44dp" 34 android:layout_width="44dp"
36 android:layout_height="44dp" 35 android:layout_height="44dp"
37 android:layout_alignParentLeft="true" 36 android:layout_alignParentLeft="true"
38 android:layout_centerVertical="true" 37 android:layout_centerVertical="true"
39 android:layout_marginLeft="16dp" 38 android:layout_marginLeft="16dp"
40 android:background="@android:color/darker_gray" 39 android:background="@android:color/darker_gray"
41 android:padding="8dp" 40 android:padding="8dp"
42 android:scaleType="fitCenter" 41 android:scaleType="fitCenter"
43 android:src="@drawable/ic_left_arrow" /> 42 android:src="@drawable/ic_left_arrow" />
44 43
45 <TextView 44 <TextView
46 android:id="@+id/tv_date" 45 android:id="@+id/tv_date"
47 android:layout_width="wrap_content" 46 android:layout_width="wrap_content"
48 android:layout_height="match_parent" 47 android:layout_height="match_parent"
49 android:layout_toRightOf="@+id/btn_left_date" 48 android:layout_toRightOf="@+id/btn_left_date"
50 android:background="@android:color/white" 49 android:background="@android:color/white"
51 android:gravity="center_vertical" 50 android:gravity="center_vertical"
52 android:padding="8dp" 51 android:padding="8dp"
53 android:text="2017ๅนด1ๆœˆ1ๆ—ฅ" 52 android:text="2017ๅนด1ๆœˆ1ๆ—ฅ"
54 android:textColor="@android:color/black" 53 android:textColor="@android:color/black"
55 android:textSize="18sp" /> 54 android:textSize="18sp" />
56 55
57 <TextView 56 <TextView
58 android:id="@+id/tv_week_day" 57 android:id="@+id/tv_week_day"
59 android:layout_width="match_parent" 58 android:layout_width="match_parent"
60 android:layout_height="match_parent" 59 android:layout_height="match_parent"
61 android:layout_toLeftOf="@+id/btn_right_date" 60 android:layout_toLeftOf="@+id/btn_right_date"
62 android:layout_toRightOf="@+id/tv_date" 61 android:layout_toRightOf="@+id/tv_date"
63 android:background="@android:color/white" 62 android:background="@android:color/white"
64 android:gravity="center" 63 android:gravity="center"
65 android:text="ๆ—ฅๆ›œๆ—ฅ" 64 android:text="ๆ—ฅๆ›œๆ—ฅ"
66 android:textColor="@android:color/black" 65 android:textColor="@android:color/black"
67 android:textSize="18sp" /> 66 android:textSize="18sp" />
68 67
69 <ImageButton 68 <ImageButton
70 android:id="@+id/btn_right_date" 69 android:id="@+id/btn_right_date"
71 android:layout_width="44dp" 70 android:layout_width="44dp"
72 android:layout_height="44dp" 71 android:layout_height="44dp"
73 android:layout_alignParentRight="true" 72 android:layout_alignParentRight="true"
74 android:layout_centerVertical="true" 73 android:layout_centerVertical="true"
75 android:layout_marginRight="16dp" 74 android:layout_marginRight="16dp"
76 android:background="@android:color/darker_gray" 75 android:background="@android:color/darker_gray"
77 android:padding="8dp" 76 android:padding="8dp"
78 android:scaleType="fitCenter" 77 android:scaleType="fitCenter"
79 android:src="@drawable/ic_right_arrow" /> 78 android:src="@drawable/ic_right_arrow" />
80 </RelativeLayout> 79 </RelativeLayout>
81 80
82 <LinearLayout 81 <LinearLayout
83 android:layout_width="match_parent" 82 android:layout_width="match_parent"
84 android:layout_height="wrap_content" 83 android:layout_height="wrap_content"
85 android:layout_marginTop="20dp" 84 android:layout_marginTop="20dp"
86 android:orientation="horizontal" 85 android:orientation="horizontal"
87 android:weightSum="5"> 86 android:weightSum="5">
88 87
89 <Button 88 <Button
90 android:id="@+id/btn_oneDay" 89 android:id="@+id/btn_oneDay"
91 style="@style/button_normal_style" 90 style="@style/button_normal_style"
92 android:layout_width="0dp" 91 android:layout_width="0dp"
93 android:layout_height="match_parent" 92 android:layout_height="match_parent"
94 android:layout_weight="1" 93 android:layout_weight="1"
95 android:background="@drawable/button_background" 94 android:background="@drawable/button_background"
96 android:text="@string/one_day" /> 95 android:text="@string/one_day" />
97 96
98 <Button 97 <Button
99 android:id="@+id/btn_oneWeek" 98 android:id="@+id/btn_oneWeek"
100 style="@style/button_normal_style" 99 style="@style/button_normal_style"
101 android:layout_width="0dp" 100 android:layout_width="0dp"
102 android:layout_height="match_parent" 101 android:layout_height="match_parent"
103 android:layout_weight="1" 102 android:layout_weight="1"
104 android:background="@drawable/button_background" 103 android:background="@drawable/button_background"
105 android:text="@string/one_week" /> 104 android:text="@string/one_week" />
106 105
107 <Button 106 <Button
108 android:id="@+id/btn_oneMonth" 107 android:id="@+id/btn_oneMonth"
109 style="@style/button_normal_style" 108 style="@style/button_normal_style"
110 android:layout_width="0dp" 109 android:layout_width="0dp"
111 android:layout_height="match_parent" 110 android:layout_height="match_parent"
112 android:layout_weight="1" 111 android:layout_weight="1"
113 android:background="@drawable/button_background" 112 android:background="@drawable/button_background"
114 android:text="@string/one_month" /> 113 android:text="@string/one_month" />
115 114
116 <Button 115 <Button
117 android:id="@+id/btn_threeMonth" 116 android:id="@+id/btn_threeMonth"
118 style="@style/button_normal_style" 117 style="@style/button_normal_style"
119 android:layout_width="0dp" 118 android:layout_width="0dp"
120 android:layout_height="match_parent" 119 android:layout_height="match_parent"
121 android:layout_weight="1" 120 android:layout_weight="1"
122 android:background="@drawable/button_background" 121 android:background="@drawable/button_background"
123 android:text="@string/three_month" /> 122 android:text="@string/three_month" />
124 123
125 <Button 124 <Button
126 android:id="@+id/btn_sixMonth" 125 android:id="@+id/btn_sixMonth"
127 style="@style/button_normal_style" 126 style="@style/button_normal_style"
128 android:layout_width="0dp" 127 android:layout_width="0dp"
129 android:layout_height="match_parent" 128 android:layout_height="match_parent"
130 android:layout_weight="1" 129 android:layout_weight="1"
131 android:background="@drawable/button_background" 130 android:background="@drawable/button_background"
132 android:text="@string/six_month" /> 131 android:text="@string/six_month" />
133 132
134 </LinearLayout> 133 </LinearLayout>
135 </LinearLayout> 134 </LinearLayout>
136 135
137 <LinearLayout 136 <LinearLayout
138 android:id="@+id/rcv_rank" 137 android:id="@+id/rcv_rank"
139 android:layout_width="match_parent" 138 android:layout_width="match_parent"
140 android:layout_height="match_parent" 139 android:layout_height="match_parent"
141 android:layout_above="@+id/layout_bottom" 140 android:layout_above="@+id/layout_bottom"
142 android:layout_below="@+id/layout_top" 141 android:layout_below="@+id/layout_top"
143 android:paddingTop="10dp" 142 android:paddingTop="10dp"
144 android:orientation="vertical"> 143 android:orientation="vertical">
145 144
146 145
147 <com.dinhcv.lifelogpedometer.customview.ExpandableListCustomView 146 <com.dinhcv.lifelogpedometer.customview.ExpandableListCustomView
148 android:id="@+id/lv_history" 147 android:id="@+id/lv_history"
149 android:layout_width="match_parent" 148 android:layout_width="match_parent"
150 android:layout_height="wrap_content" 149 android:layout_height="wrap_content"
151 android:divider="@null" 150 android:divider="@null"
152 android:visibility="visible" /> 151 android:visibility="visible" />
153 152
154 153
155 </LinearLayout> 154 </LinearLayout>
156 155
157 </LinearLayout> 156 </LinearLayout>
158 </ScrollView> 157 </ScrollView>
159 158
160 <include layout="@layout/type_step" /> 159 <include layout="@layout/type_step" />
161 </RelativeLayout> 160 </RelativeLayout>
162 161
app/src/main/res/layout/fragment_map.xml
1 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 1 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
2 xmlns:appNs="http://schemas.android.com/apk/res-auto" 2 xmlns:appNs="http://schemas.android.com/apk/res-auto"
3 android:layout_width="match_parent" 3 android:layout_width="match_parent"
4 android:layout_height="match_parent" 4 android:layout_height="match_parent">
5 android:background="@color/background_main">
6 5
7 <RelativeLayout 6 <RelativeLayout
8 android:id="@+id/layout_date_controll" 7 android:id="@+id/layout_date_controll"
9 android:layout_width="match_parent" 8 android:layout_width="match_parent"
10 android:layout_height="48dp" 9 android:layout_height="48dp"
11 android:layout_alignParentTop="true" 10 android:layout_alignParentTop="true"
12 android:gravity="center_vertical"> 11 android:gravity="center_vertical">
13 12
14 <ImageButton 13 <ImageButton
15 android:id="@+id/btn_left_date" 14 android:id="@+id/btn_left_date"
16 android:layout_width="44dp" 15 android:layout_width="48dp"
17 android:layout_height="44dp" 16 android:layout_height="48dp"
18 android:layout_alignParentLeft="true" 17 android:layout_alignParentLeft="true"
19 android:layout_centerVertical="true" 18 android:layout_centerVertical="true"
20 android:layout_marginLeft="16dp" 19 android:layout_marginLeft="16dp"
21 android:background="@android:color/darker_gray" 20 android:background="@android:color/darker_gray"
22 android:padding="8dp" 21 android:padding="8dp"
23 android:scaleType="fitCenter" 22 android:scaleType="fitCenter"
24 android:src="@drawable/ic_left_arrow" /> 23 android:src="@drawable/ic_left_arrow" />
25 24
26 <TextView 25 <TextView
27 android:id="@+id/tv_date" 26 android:id="@+id/tv_date"
28 android:layout_width="wrap_content" 27 android:layout_width="wrap_content"
29 android:layout_height="match_parent" 28 android:layout_height="match_parent"
30 android:layout_toRightOf="@+id/btn_left_date" 29 android:layout_toRightOf="@+id/btn_left_date"
31 android:background="@android:color/white" 30 android:background="@android:color/white"
32 android:gravity="center_vertical" 31 android:gravity="center_vertical"
33 android:padding="8dp" 32 android:padding="8dp"
34 android:text="2017ๅนด1ๆœˆ1ๆ—ฅ" 33 android:text="2017ๅนด1ๆœˆ1ๆ—ฅ"
35 android:textColor="@android:color/black" 34 android:textColor="@android:color/black"
36 android:textSize="18sp" /> 35 android:textSize="18sp" />
37 36
38 <TextView 37 <TextView
39 android:id="@+id/tv_week_day" 38 android:id="@+id/tv_week_day"
40 android:layout_width="match_parent" 39 android:layout_width="match_parent"
41 android:layout_height="match_parent" 40 android:layout_height="match_parent"
42 android:layout_toLeftOf="@+id/btn_right_date" 41 android:layout_toLeftOf="@+id/btn_right_date"
43 android:layout_toRightOf="@+id/tv_date" 42 android:layout_toRightOf="@+id/tv_date"
44 android:background="@android:color/white" 43 android:background="@android:color/white"
45 android:gravity="center" 44 android:gravity="center"
46 android:text="ๆ—ฅๆ›œๆ—ฅ" 45 android:text="ๆ—ฅๆ›œๆ—ฅ"
47 android:textColor="@android:color/black" 46 android:textColor="@android:color/black"
48 android:textSize="18sp" /> 47 android:textSize="18sp" />
49 48
50 <ImageButton 49 <ImageButton
51 android:id="@+id/btn_right_date" 50 android:id="@+id/btn_right_date"
52 android:layout_width="44dp" 51 android:layout_width="48dp"
53 android:layout_height="44dp" 52 android:layout_height="48dp"
54 android:layout_alignParentRight="true" 53 android:layout_alignParentRight="true"
55 android:layout_centerVertical="true" 54 android:layout_centerVertical="true"
56 android:layout_marginRight="16dp" 55 android:layout_marginRight="16dp"
57 android:background="@android:color/darker_gray" 56 android:background="@android:color/darker_gray"
58 android:padding="8dp" 57 android:padding="8dp"
59 android:scaleType="fitCenter" 58 android:scaleType="fitCenter"
60 android:src="@drawable/ic_right_arrow" /> 59 android:src="@drawable/ic_right_arrow" />
61 </RelativeLayout> 60 </RelativeLayout>
62 61
63 <fragment xmlns:android="http://schemas.android.com/apk/res/android" 62 <fragment xmlns:android="http://schemas.android.com/apk/res/android"
64 android:id="@+id/map" 63 android:id="@+id/map"
65 android:name="com.google.android.gms.maps.SupportMapFragment" 64 android:name="com.google.android.gms.maps.SupportMapFragment"
66 android:layout_width="match_parent" 65 android:layout_width="match_parent"
67 android:layout_height="match_parent" 66 android:layout_height="match_parent"
68 android:layout_above="@+id/layout_type_step" 67 android:layout_above="@+id/layout_type_step"
69 android:layout_below="@+id/layout_date_controll" /> 68 android:layout_below="@+id/layout_date_controll" />
70 69
71 <LinearLayout 70 <LinearLayout
72 android:id="@+id/layout_type_step" 71 android:id="@+id/layout_type_step"
73 android:layout_width="match_parent" 72 android:layout_width="match_parent"
74 android:layout_height="wrap_content" 73 android:layout_height="wrap_content"
75 android:layout_above="@+id/layout_timeline"> 74 android:layout_above="@+id/layout_timeline">
76 75
77 <RelativeLayout 76 <RelativeLayout
78 android:id="@+id/ll_stepType" 77 android:id="@+id/ll_stepType"
79 android:layout_width="match_parent" 78 android:layout_width="match_parent"
80 android:layout_height="wrap_content" 79 android:layout_height="wrap_content"
81 android:layout_alignParentBottom="true" 80 android:layout_alignParentBottom="true"
82 android:background="@color/tab_sub2_unselected"> 81 android:background="@color/bg_header">
83 82
84 <LinearLayout 83 <LinearLayout
85 android:layout_width="match_parent" 84 android:layout_width="match_parent"
86 android:layout_height="@dimen/toolbar_height" 85 android:layout_height="@dimen/toolbar_height"
87 android:orientation="horizontal" 86 android:orientation="horizontal"
88 android:weightSum="90"> 87 android:weightSum="90">
89 88
90 <LinearLayout 89 <LinearLayout
91 android:id="@+id/ll_bike" 90 android:id="@+id/ll_bike"
92 android:layout_width="0dp" 91 android:layout_width="0dp"
93 android:layout_height="match_parent" 92 android:layout_height="match_parent"
94 android:layout_weight="30" 93 android:layout_weight="30"
95 android:gravity="center" 94 android:gravity="center"
96 android:orientation="horizontal"> 95 android:orientation="horizontal">
97 96
98 <TextView 97 <TextView
99 android:layout_width="wrap_content" 98 android:layout_width="wrap_content"
100 android:layout_height="wrap_content" 99 android:layout_height="wrap_content"
101 android:text="@string/bike" 100 android:text="@string/bike"
102 android:textColor="@color/white" 101 android:textColor="@color/white"
103 android:textStyle="bold" /> 102 android:textStyle="bold" />
104 103
105 </LinearLayout> 104 </LinearLayout>
106 105
107 <LinearLayout 106 <LinearLayout
108 android:id="@+id/ll_walking" 107 android:id="@+id/ll_walking"
109 android:layout_width="0dp" 108 android:layout_width="0dp"
110 android:layout_height="match_parent" 109 android:layout_height="match_parent"
111 android:layout_weight="30" 110 android:layout_weight="30"
112 android:background="@color/selected_tab_color" 111 android:background="@color/selected_tab_color"
113 android:gravity="center" 112 android:gravity="center"
114 android:orientation="horizontal"> 113 android:orientation="horizontal">
115 114
116 <TextView 115 <TextView
117 android:layout_width="wrap_content" 116 android:layout_width="wrap_content"
118 android:layout_height="wrap_content" 117 android:layout_height="wrap_content"
119 android:text="@string/walking" 118 android:text="@string/walking"
120 android:textColor="@color/white" 119 android:textColor="@color/white"
121 android:textStyle="bold" /> 120 android:textStyle="bold" />
122 121
123 </LinearLayout> 122 </LinearLayout>
124 123
125 <LinearLayout 124 <LinearLayout
126 android:id="@+id/ll_running" 125 android:id="@+id/ll_running"
127 android:layout_width="0dp" 126 android:layout_width="0dp"
128 android:layout_height="match_parent" 127 android:layout_height="match_parent"
129 android:layout_weight="30" 128 android:layout_weight="30"
130 android:gravity="center" 129 android:gravity="center"
131 android:orientation="horizontal"> 130 android:orientation="horizontal">
132 131
133 <TextView 132 <TextView
134 android:layout_width="wrap_content" 133 android:layout_width="wrap_content"
135 android:layout_height="wrap_content" 134 android:layout_height="wrap_content"
136 android:text="@string/running" 135 android:text="@string/running"
137 android:textColor="@color/white" 136 android:textColor="@color/white"
138 android:textStyle="bold" /> 137 android:textStyle="bold" />
139 138
140 </LinearLayout> 139 </LinearLayout>
141 140
142 141
143 </LinearLayout> 142 </LinearLayout>
144 143
145 </RelativeLayout> 144 </RelativeLayout>
146 145
147 </LinearLayout> 146 </LinearLayout>
148 147
149 <LinearLayout 148 <LinearLayout
150 android:id="@+id/layout_timeline" 149 android:id="@+id/layout_timeline"
151 android:layout_width="match_parent" 150 android:layout_width="match_parent"
152 android:layout_height="48dp" 151 android:layout_height="48dp"
153 android:layout_alignParentBottom="true" 152 android:layout_alignParentBottom="true"
154 android:background="@android:color/black" 153 android:background="@android:color/black"
155 android:gravity="center_vertical" 154 android:gravity="center_vertical"
156 android:orientation="horizontal"> 155 android:orientation="horizontal">
157 156
158 <TextView 157 <TextView
159 android:layout_width="wrap_content" 158 android:layout_width="wrap_content"
160 android:layout_height="wrap_content" 159 android:layout_height="wrap_content"
161 android:layout_marginLeft="4dp" 160 android:layout_marginLeft="4dp"
162 android:layout_marginRight="4dp" 161 android:layout_marginRight="4dp"
163 android:text="TIME LINE" 162 android:text="TIME LINE"
164 android:textColor="@android:color/white" /> 163 android:textColor="@android:color/white" />
165 164
166 <TextView 165 <TextView
167 android:layout_width="wrap_content" 166 android:layout_width="wrap_content"
168 android:layout_height="wrap_content" 167 android:layout_height="wrap_content"
169 android:layout_marginLeft="4dp" 168 android:layout_marginLeft="4dp"
170 android:layout_marginRight="4dp" 169 android:layout_marginRight="4dp"
171 android:text="12:05:01" 170 android:text="12:05:01"
172 android:textColor="@android:color/white" /> 171 android:textColor="@android:color/white" />
173 172
174 <SeekBar 173 <SeekBar
175 android:layout_width="match_parent" 174 android:layout_width="match_parent"
176 android:layout_height="match_parent" 175 android:layout_height="match_parent"
177 android:layout_marginLeft="4dp" 176 android:layout_marginLeft="4dp"
178 android:layout_marginRight="4dp" 177 android:layout_marginRight="4dp"
179 android:progress="50" 178 android:progress="50"
180 android:progressDrawable="@drawable/seekbar_style" /> 179 android:progressDrawable="@drawable/seekbar_style" />
181 </LinearLayout> 180 </LinearLayout>
182 </RelativeLayout> 181 </RelativeLayout>
183 182
app/src/main/res/layout/fragment_rank.xml
1 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 1 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
2 xmlns:appNs="http://schemas.android.com/apk/res-auto" 2 xmlns:appNs="http://schemas.android.com/apk/res-auto"
3 android:layout_width="match_parent" 3 android:layout_width="match_parent"
4 android:layout_height="match_parent" 4 android:layout_height="match_parent">
5 android:background="@color/background_main">
6 5
7 <LinearLayout 6 <LinearLayout
8 android:id="@+id/layout_top" 7 android:id="@+id/layout_top"
9 android:layout_width="match_parent" 8 android:layout_width="match_parent"
10 android:layout_height="wrap_content" 9 android:layout_height="wrap_content"
11 android:orientation="vertical"> 10 android:orientation="vertical">
12 11
13 <LinearLayout 12 <LinearLayout
14 android:layout_width="match_parent" 13 android:layout_width="match_parent"
15 android:layout_height="36dp" 14 android:layout_height="36dp"
16 android:orientation="horizontal" 15 android:orientation="horizontal"
17 android:weightSum="4"> 16 android:weightSum="4">
18 17
19 <Button 18 <Button
20 android:id="@+id/btn_daily" 19 android:id="@+id/btn_daily"
21 style="@style/button_normal_style" 20 style="@style/button_normal_style"
22 android:layout_width="0dp" 21 android:layout_width="0dp"
23 android:layout_height="match_parent" 22 android:layout_height="match_parent"
24 android:layout_weight="1" 23 android:layout_weight="1"
25 android:background="@drawable/button_background" 24 android:background="@drawable/button_background"
26 android:text="ใƒ‡ใ‚คใƒชใƒผ" /> 25 android:text="ใƒ‡ใ‚คใƒชใƒผ" />
27 26
28 <Button 27 <Button
29 android:id="@+id/btn_weekly" 28 android:id="@+id/btn_weekly"
30 style="@style/button_normal_style" 29 style="@style/button_normal_style"
31 android:layout_width="0dp" 30 android:layout_width="0dp"
32 android:layout_height="match_parent" 31 android:layout_height="match_parent"
33 android:layout_weight="1" 32 android:layout_weight="1"
34 android:background="@drawable/button_background" 33 android:background="@drawable/button_background"
35 android:text="้€ฑ้–“" /> 34 android:text="้€ฑ้–“" />
36 35
37 <Button 36 <Button
38 android:id="@+id/btn_monthly" 37 android:id="@+id/btn_monthly"
39 style="@style/button_normal_style" 38 style="@style/button_normal_style"
40 android:layout_width="0dp" 39 android:layout_width="0dp"
41 android:layout_height="match_parent" 40 android:layout_height="match_parent"
42 android:layout_weight="1" 41 android:layout_weight="1"
43 android:background="@drawable/button_background" 42 android:background="@drawable/button_background"
44 android:text="ๆœˆ้–“" /> 43 android:text="ๆœˆ้–“" />
45 44
46 <Button 45 <Button
47 android:id="@+id/btn_yearly" 46 android:id="@+id/btn_yearly"
48 style="@style/button_normal_style" 47 style="@style/button_normal_style"
49 android:layout_width="0dp" 48 android:layout_width="0dp"
50 android:layout_height="match_parent" 49 android:layout_height="match_parent"
51 android:layout_weight="1" 50 android:layout_weight="1"
52 android:background="@drawable/button_background" 51 android:background="@drawable/button_background"
53 android:text="ๅนด้–“" /> 52 android:text="ๅนด้–“" />
54 </LinearLayout> 53 </LinearLayout>
55 54
56 <RelativeLayout 55 <RelativeLayout
57 android:layout_width="match_parent" 56 android:layout_width="match_parent"
58 android:layout_height="48dp" 57 android:layout_height="48dp"
59 android:background="@android:color/black"
60 android:gravity="center_vertical"> 58 android:gravity="center_vertical">
61 59
62 <ImageButton 60 <ImageView
63 android:id="@+id/btn_back" 61 android:id="@+id/btn_back"
64 android:layout_width="40dp" 62 android:layout_width="40dp"
65 android:layout_height="40dp" 63 android:layout_height="40dp"
66 android:layout_centerVertical="true" 64 android:layout_centerVertical="true"
67 android:layout_marginLeft="8dp" 65 android:layout_marginLeft="8dp"
68 android:background="@android:color/white"
69 android:padding="2dp" 66 android:padding="2dp"
70 android:scaleType="fitCenter" 67 android:scaleType="fitCenter"
71 android:src="@drawable/back_ic" /> 68 android:src="@drawable/back_ic" />
72 69
73 <TextView 70 <TextView
74 android:id="@+id/tv_start_date" 71 android:id="@+id/tv_start_date"
75 android:layout_width="match_parent" 72 android:layout_width="match_parent"
76 android:layout_height="match_parent" 73 android:layout_height="match_parent"
77 android:layout_centerInParent="true" 74 android:layout_centerInParent="true"
78 android:layout_toLeftOf="@+id/tv_center" 75 android:layout_toLeftOf="@+id/tv_center"
79 android:layout_toRightOf="@+id/btn_back" 76 android:layout_toRightOf="@+id/btn_back"
80 android:gravity="center" 77 android:gravity="center"
81 android:text="2016ๅนด 1ๆœˆ22ๆ—ฅ" 78 android:text="2016ๅนด 1ๆœˆ22ๆ—ฅ"
82 android:textColor="@android:color/white" 79 android:textColor="@android:color/white"
83 android:textSize="14sp" /> 80 android:textSize="14sp" />
84 81
85 <TextView 82 <TextView
86 android:id="@+id/tv_center" 83 android:id="@+id/tv_center"
87 android:layout_width="wrap_content" 84 android:layout_width="wrap_content"
88 android:layout_height="match_parent" 85 android:layout_height="match_parent"
89 android:layout_centerInParent="true" 86 android:layout_centerInParent="true"
90 android:gravity="center" 87 android:gravity="center"
91 android:text="-" 88 android:text="-"
92 android:textColor="@android:color/white" 89 android:textColor="@android:color/white"
93 android:textSize="18sp" /> 90 android:textSize="18sp" />
94 91
95 <TextView 92 <TextView
96 android:id="@+id/tv_end_date" 93 android:id="@+id/tv_end_date"
97 android:layout_width="match_parent" 94 android:layout_width="match_parent"
98 android:layout_height="match_parent" 95 android:layout_height="match_parent"
99 android:layout_centerInParent="true" 96 android:layout_centerInParent="true"
100 android:layout_toLeftOf="@+id/btn_next" 97 android:layout_toLeftOf="@+id/btn_next"
101 android:layout_toRightOf="@+id/tv_center" 98 android:layout_toRightOf="@+id/tv_center"
102 android:gravity="center" 99 android:gravity="center"
103 android:text="2017ๅนด 1ๆœˆ21ๆ—ฅ" 100 android:text="2017ๅนด 1ๆœˆ21ๆ—ฅ"
104 android:textColor="@android:color/white" 101 android:textColor="@android:color/white"
105 android:textSize="14sp" /> 102 android:textSize="14sp" />
106 103
107 <ImageButton 104 <ImageView
108 android:id="@+id/btn_next" 105 android:id="@+id/btn_next"
109 android:layout_width="40dp" 106 android:layout_width="40dp"
110 android:layout_height="40dp" 107 android:layout_height="40dp"
111 android:layout_alignParentRight="true" 108 android:layout_alignParentRight="true"
112 android:layout_centerVertical="true" 109 android:layout_centerVertical="true"
113 android:layout_marginRight="8dp" 110 android:layout_marginRight="8dp"
114 android:background="@android:color/white"
115 android:padding="2dp" 111 android:padding="2dp"
116 android:scaleType="fitCenter" 112 android:scaleType="fitCenter"
117 android:src="@drawable/next_ic" /> 113 android:src="@drawable/next_ic" />
118 </RelativeLayout> 114 </RelativeLayout>
119 115
120 <LinearLayout 116 <LinearLayout
121 android:layout_width="match_parent" 117 android:layout_width="match_parent"
122 android:layout_height="36dp" 118 android:layout_height="36dp"
123 android:orientation="horizontal" 119 android:orientation="horizontal"
124 android:weightSum="4"> 120 android:weightSum="4">
125 121
126 <Button 122 <Button
127 android:id="@+id/btn_walk" 123 android:id="@+id/btn_walk"
128 style="@style/button_normal_style" 124 style="@style/button_normal_style"
129 android:layout_width="0dp" 125 android:layout_width="0dp"
130 android:layout_height="match_parent" 126 android:layout_height="match_parent"
131 android:layout_weight="1" 127 android:layout_weight="1"
132 android:background="@drawable/button_background" 128 android:background="@drawable/button_background"
133 android:text="walk" /> 129 android:text="walk" />
134 130
135 <Button 131 <Button
136 android:id="@+id/btn_run" 132 android:id="@+id/btn_run"
137 style="@style/button_normal_style" 133 style="@style/button_normal_style"
138 android:layout_width="0dp" 134 android:layout_width="0dp"
139 android:layout_height="match_parent" 135 android:layout_height="match_parent"
140 android:layout_weight="1" 136 android:layout_weight="1"
141 android:background="@drawable/button_background" 137 android:background="@drawable/button_background"
142 android:text="run" /> 138 android:text="run" />
143 139
144 <Button 140 <Button
145 android:id="@+id/btn_bike" 141 android:id="@+id/btn_bike"
146 style="@style/button_normal_style" 142 style="@style/button_normal_style"
147 android:layout_width="0dp" 143 android:layout_width="0dp"
148 android:layout_height="match_parent" 144 android:layout_height="match_parent"
149 android:layout_weight="1" 145 android:layout_weight="1"
150 android:background="@drawable/button_background" 146 android:background="@drawable/button_background"
151 android:text="Bike" /> 147 android:text="Bike" />
152 148
153 <Button 149 <Button
154 android:id="@+id/btn_all" 150 android:id="@+id/btn_all"
155 style="@style/button_normal_style" 151 style="@style/button_normal_style"
156 android:layout_width="0dp" 152 android:layout_width="0dp"
157 android:layout_height="match_parent" 153 android:layout_height="match_parent"
158 android:layout_weight="1" 154 android:layout_weight="1"
159 android:background="@drawable/button_background" 155 android:background="@drawable/button_background"
160 android:text="All" /> 156 android:text="All" />
161 </LinearLayout> 157 </LinearLayout>
162 </LinearLayout> 158 </LinearLayout>
163 159
164 <android.support.v4.widget.SwipeRefreshLayout 160 <android.support.v4.widget.SwipeRefreshLayout
165 android:id="@+id/swipe_ranking" 161 android:id="@+id/swipe_ranking"
166 android:layout_width="match_parent" 162 android:layout_width="match_parent"
167 android:layout_height="match_parent" 163 android:layout_height="match_parent"
168 android:layout_above="@+id/layout_bottom" 164 android:layout_above="@+id/layout_bottom"
169 android:layout_below="@+id/layout_top"> 165 android:layout_below="@+id/layout_top">
170 166
171 <android.support.v7.widget.RecyclerView 167 <android.support.v7.widget.RecyclerView
172 android:id="@+id/rcv_rank" 168 android:id="@+id/rcv_rank"
173 android:layout_width="match_parent" 169 android:layout_width="match_parent"
174 android:layout_height="match_parent"> 170 android:layout_height="match_parent">
175 171
176 </android.support.v7.widget.RecyclerView> 172 </android.support.v7.widget.RecyclerView>
177 </android.support.v4.widget.SwipeRefreshLayout> 173 </android.support.v4.widget.SwipeRefreshLayout>
178 174
179 <LinearLayout 175 <LinearLayout
180 android:id="@+id/layout_bottom" 176 android:id="@+id/layout_bottom"
181 android:layout_width="match_parent" 177 android:layout_width="match_parent"
182 android:layout_height="56dp" 178 android:layout_height="56dp"
183 android:layout_alignParentBottom="true" 179 android:layout_alignParentBottom="true"
184 android:orientation="horizontal" 180 android:orientation="horizontal"
185 android:weightSum="4"> 181 android:weightSum="4">
186 182
187 <Button 183 <Button
188 style="@style/button_normal_style" 184 style="@style/button_normal_style"
189 android:layout_width="0dp" 185 android:layout_width="0dp"
190 android:layout_height="match_parent" 186 android:layout_height="match_parent"
191 android:layout_weight="1" 187 android:layout_weight="1"
192 android:background="@drawable/button_background" 188 android:background="@drawable/button_background"
193 android:lines="2" 189 android:lines="2"
194 android:text="ใ‚ซใƒ†ใ‚ดใƒชใƒผๅˆฅใƒฉใƒณใ‚ญใƒณใ‚ฐ" /> 190 android:text="ใ‚ซใƒ†ใ‚ดใƒชใƒผๅˆฅใƒฉใƒณใ‚ญใƒณใ‚ฐ" />
195 191
196 <Button 192 <Button
197 style="@style/button_normal_style" 193 style="@style/button_normal_style"
198 android:layout_width="0dp" 194 android:layout_width="0dp"
199 android:layout_height="match_parent" 195 android:layout_height="match_parent"
200 android:layout_weight="1" 196 android:layout_weight="1"
201 android:background="@drawable/button_background" 197 android:background="@drawable/button_background"
202 android:lines="2" 198 android:lines="2"
203 android:text="ใ‚ฐใƒซใƒผใƒ—ๅฏพๆŠ—ใƒฉใƒณใ‚ญใƒณใ‚ฐ" /> 199 android:text="ใ‚ฐใƒซใƒผใƒ—ๅฏพๆŠ—ใƒฉใƒณใ‚ญใƒณใ‚ฐ" />
204 200
205 <Button 201 <Button
206 style="@style/button_normal_style" 202 style="@style/button_normal_style"
207 android:layout_width="0dp" 203 android:layout_width="0dp"
208 android:layout_height="match_parent" 204 android:layout_height="match_parent"
209 android:layout_weight="1" 205 android:layout_weight="1"
210 android:background="@drawable/button_background" 206 android:background="@drawable/button_background"
211 android:lines="2" 207 android:lines="2"
212 android:text="ใ‚ฐใƒซใƒผใƒ—ๅ†…ใƒฉใƒณใ‚ญใƒณใ‚ฐ" /> 208 android:text="ใ‚ฐใƒซใƒผใƒ—ๅ†…ใƒฉใƒณใ‚ญใƒณใ‚ฐ" />
213 209
214 <Button 210 <Button
215 style="@style/button_normal_style" 211 style="@style/button_normal_style"
216 android:layout_width="0dp" 212 android:layout_width="0dp"
217 android:layout_height="match_parent" 213 android:layout_height="match_parent"
218 android:layout_weight="1" 214 android:layout_weight="1"
219 android:background="@drawable/button_background" 215 android:background="@drawable/button_background"
220 android:lines="2" 216 android:lines="2"
221 android:text="ใใฎไป–" /> 217 android:text="ใใฎไป–" />
222 </LinearLayout> 218 </LinearLayout>
223 </RelativeLayout> 219 </RelativeLayout>
224 220
app/src/main/res/layout/fragment_sns.xml
1 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 1 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
2 xmlns:appNs="http://schemas.android.com/apk/res-auto" 2 xmlns:appNs="http://schemas.android.com/apk/res-auto"
3 android:layout_width="match_parent" 3 android:layout_width="match_parent"
4 android:layout_height="match_parent" 4 android:layout_height="match_parent"
5 android:background="@color/background_main"
6 android:orientation="vertical"> 5 android:orientation="vertical">
7 <FrameLayout 6 <FrameLayout
8 android:id="@+id/layout_sns" 7 android:id="@+id/layout_sns"
9 android:layout_width="match_parent" 8 android:layout_width="match_parent"
10 android:layout_height="match_parent"> 9 android:layout_height="match_parent">
11 </FrameLayout> 10 </FrameLayout>
12 </LinearLayout> 11 </LinearLayout>
13 12
app/src/main/res/layout/fragment_sns_create_group.xml
1 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 1 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
2 xmlns:tools="http://schemas.android.com/tools" 2 xmlns:tools="http://schemas.android.com/tools"
3 android:layout_width="match_parent" 3 android:layout_width="match_parent"
4 android:layout_height="match_parent" 4 android:layout_height="match_parent"
5 android:background="@color/background_main"
6 tools:context="com.dinhcv.lifelogpedometer.activity.SnsCreateGroupFragment"> 5 tools:context="com.dinhcv.lifelogpedometer.activity.SnsCreateGroupFragment">
7 <!-- TODO: Update blank fragment layout --> 6 <!-- TODO: Update blank fragment layout -->
8 <ScrollView 7 <ScrollView
9 android:layout_width="match_parent" 8 android:layout_width="match_parent"
10 android:layout_height="match_parent" 9 android:layout_height="match_parent"
11 android:layout_above="@+id/layout_bottom"> 10 android:layout_above="@+id/layout_bottom">
12 11
13 <LinearLayout 12 <LinearLayout
14 android:layout_width="match_parent" 13 android:layout_width="match_parent"
15 android:layout_height="match_parent" 14 android:layout_height="match_parent"
16 android:orientation="vertical" 15 android:orientation="vertical"
17 android:padding="8dp"> 16 android:padding="8dp">
18 17
19 <LinearLayout 18 <LinearLayout
20 android:layout_width="match_parent" 19 android:layout_width="match_parent"
21 android:layout_height="wrap_content" 20 android:layout_height="wrap_content"
22 android:gravity="center_vertical" 21 android:gravity="center_vertical"
23 android:orientation="horizontal"> 22 android:orientation="horizontal">
24 23
25 <TextView 24 <TextView
26 android:layout_width="60dp" 25 android:layout_width="60dp"
27 android:layout_height="wrap_content" 26 android:layout_height="wrap_content"
28 android:text="ๅ็งฐ" 27 android:text="ๅ็งฐ"
29 android:textColor="@android:color/white" 28 android:textColor="@android:color/white"
30 android:textSize="@dimen/textsize_medium" /> 29 android:textSize="@dimen/textsize_medium" />
31 30
32 <EditText 31 <EditText
33 android:id="@+id/edt_name" 32 android:id="@+id/edt_name"
34 android:layout_width="match_parent" 33 android:layout_width="match_parent"
35 android:layout_height="wrap_content" 34 android:layout_height="wrap_content"
36 android:background="@drawable/rounded_edittext" 35 android:background="@drawable/rounded_edittext"
37 android:gravity="center_vertical" 36 android:gravity="center_vertical"
38 android:lines="1" 37 android:lines="1"
39 android:textSize="@dimen/textsize_medium" /> 38 android:textSize="@dimen/textsize_medium" />
40 </LinearLayout> 39 </LinearLayout>
41 40
42 <LinearLayout 41 <LinearLayout
43 android:layout_width="match_parent" 42 android:layout_width="match_parent"
44 android:layout_height="wrap_content" 43 android:layout_height="wrap_content"
45 android:layout_marginTop="8dp" 44 android:layout_marginTop="8dp"
46 android:gravity="center_vertical" 45 android:gravity="center_vertical"
47 android:orientation="horizontal"> 46 android:orientation="horizontal">
48 47
49 <TextView 48 <TextView
50 android:layout_width="60dp" 49 android:layout_width="60dp"
51 android:layout_height="wrap_content" 50 android:layout_height="wrap_content"
52 android:text="WALK" 51 android:text="WALK"
53 android:textColor="@android:color/white" 52 android:textColor="@android:color/white"
54 android:textSize="@dimen/textsize_medium" /> 53 android:textSize="@dimen/textsize_medium" />
55 54
56 <ToggleButton 55 <ToggleButton
57 android:id="@+id/toggle_walk" 56 android:id="@+id/toggle_walk"
58 style="@style/toggle_on_off_style" 57 style="@style/toggle_on_off_style"
59 android:layout_width="36dp" 58 android:layout_width="36dp"
60 android:layout_height="36dp" 59 android:layout_height="36dp"
61 android:checked="true" /> 60 android:checked="true" />
62 61
63 <TextView 62 <TextView
64 android:layout_width="60dp" 63 android:layout_width="60dp"
65 android:layout_height="wrap_content" 64 android:layout_height="wrap_content"
66 android:layout_marginLeft="32dp" 65 android:layout_marginLeft="32dp"
67 android:text="BIKE" 66 android:text="BIKE"
68 android:textColor="@android:color/white" 67 android:textColor="@android:color/white"
69 android:textSize="@dimen/textsize_medium" /> 68 android:textSize="@dimen/textsize_medium" />
70 69
71 <ToggleButton 70 <ToggleButton
72 android:id="@+id/toggle_bike" 71 android:id="@+id/toggle_bike"
73 style="@style/toggle_on_off_style" 72 style="@style/toggle_on_off_style"
74 android:layout_width="36dp" 73 android:layout_width="36dp"
75 android:layout_height="36dp" 74 android:layout_height="36dp"
76 android:checked="true" /> 75 android:checked="true" />
77 </LinearLayout> 76 </LinearLayout>
78 77
79 <LinearLayout 78 <LinearLayout
80 android:layout_width="match_parent" 79 android:layout_width="match_parent"
81 android:layout_height="wrap_content" 80 android:layout_height="wrap_content"
82 android:gravity="center_vertical" 81 android:gravity="center_vertical"
83 android:orientation="horizontal"> 82 android:orientation="horizontal">
84 83
85 <TextView 84 <TextView
86 android:layout_width="60dp" 85 android:layout_width="60dp"
87 android:layout_height="wrap_content" 86 android:layout_height="wrap_content"
88 android:text="RUN" 87 android:text="RUN"
89 android:textColor="@android:color/white" 88 android:textColor="@android:color/white"
90 android:textSize="@dimen/textsize_medium" /> 89 android:textSize="@dimen/textsize_medium" />
91 90
92 <ToggleButton 91 <ToggleButton
93 android:id="@+id/toggle_run" 92 android:id="@+id/toggle_run"
94 style="@style/toggle_on_off_style" 93 style="@style/toggle_on_off_style"
95 android:layout_width="36dp" 94 android:layout_width="36dp"
96 android:layout_height="36dp" 95 android:layout_height="36dp"
97 android:checked="true" /> 96 android:checked="true" />
98 97
99 <TextView 98 <TextView
100 android:layout_width="60dp" 99 android:layout_width="60dp"
101 android:layout_height="wrap_content" 100 android:layout_height="wrap_content"
102 android:layout_marginLeft="32dp" 101 android:layout_marginLeft="32dp"
103 android:text="STEP" 102 android:text="STEP"
104 android:textColor="@android:color/white" 103 android:textColor="@android:color/white"
105 android:textSize="@dimen/textsize_medium" /> 104 android:textSize="@dimen/textsize_medium" />
106 105
107 <ToggleButton 106 <ToggleButton
108 android:id="@+id/toggle_step" 107 android:id="@+id/toggle_step"
109 style="@style/toggle_on_off_style" 108 style="@style/toggle_on_off_style"
110 android:layout_width="36dp" 109 android:layout_width="36dp"
111 android:layout_height="36dp" 110 android:layout_height="36dp"
112 android:checked="true" 111 android:checked="true"
113 android:textSize="@dimen/textsize_medium" /> 112 android:textSize="@dimen/textsize_medium" />
114 </LinearLayout> 113 </LinearLayout>
115 114
116 <LinearLayout 115 <LinearLayout
117 android:layout_width="match_parent" 116 android:layout_width="match_parent"
118 android:layout_height="wrap_content" 117 android:layout_height="wrap_content"
119 android:gravity="center_vertical" 118 android:gravity="center_vertical"
120 android:orientation="horizontal"> 119 android:orientation="horizontal">
121 120
122 <TextView 121 <TextView
123 android:layout_width="60dp" 122 android:layout_width="60dp"
124 android:layout_height="wrap_content" 123 android:layout_height="wrap_content"
125 android:text="ใ‚ธใƒ " 124 android:text="ใ‚ธใƒ "
126 android:textColor="@android:color/white" 125 android:textColor="@android:color/white"
127 android:textSize="@dimen/textsize_medium" /> 126 android:textSize="@dimen/textsize_medium" />
128 127
129 <ToggleButton 128 <ToggleButton
130 android:id="@+id/toggle_gym" 129 android:id="@+id/toggle_gym"
131 style="@style/toggle_on_off_style" 130 style="@style/toggle_on_off_style"
132 android:layout_width="36dp" 131 android:layout_width="36dp"
133 android:layout_height="36dp" 132 android:layout_height="36dp"
134 android:checked="true" /> 133 android:checked="true" />
135 134
136 <TextView 135 <TextView
137 android:layout_width="60dp" 136 android:layout_width="60dp"
138 android:layout_height="wrap_content" 137 android:layout_height="wrap_content"
139 android:layout_marginLeft="32dp" 138 android:layout_marginLeft="32dp"
140 android:text="ๅˆๅฟƒ่€…" 139 android:text="ๅˆๅฟƒ่€…"
141 android:textColor="@android:color/white" 140 android:textColor="@android:color/white"
142 android:textSize="@dimen/textsize_medium" /> 141 android:textSize="@dimen/textsize_medium" />
143 142
144 <ToggleButton 143 <ToggleButton
145 android:id="@+id/toggle_beginner" 144 android:id="@+id/toggle_beginner"
146 style="@style/toggle_on_off_style" 145 style="@style/toggle_on_off_style"
147 android:layout_width="36dp" 146 android:layout_width="36dp"
148 android:layout_height="36dp" 147 android:layout_height="36dp"
149 android:checked="true" /> 148 android:checked="true" />
150 </LinearLayout> 149 </LinearLayout>
151 150
152 <LinearLayout 151 <LinearLayout
153 android:layout_width="match_parent" 152 android:layout_width="match_parent"
154 android:layout_height="wrap_content" 153 android:layout_height="wrap_content"
155 android:layout_marginTop="8dp" 154 android:layout_marginTop="8dp"
156 android:gravity="top" 155 android:gravity="top"
157 android:orientation="horizontal"> 156 android:orientation="horizontal">
158 157
159 <TextView 158 <TextView
160 android:layout_width="60dp" 159 android:layout_width="60dp"
161 android:layout_height="wrap_content" 160 android:layout_height="wrap_content"
162 android:text="็›ฎๆจ™" 161 android:text="็›ฎๆจ™"
163 android:textColor="@android:color/white" 162 android:textColor="@android:color/white"
164 android:textSize="@dimen/textsize_medium" /> 163 android:textSize="@dimen/textsize_medium" />
165 164
166 <EditText 165 <EditText
167 android:id="@+id/edt_goal" 166 android:id="@+id/edt_goal"
168 android:layout_width="match_parent" 167 android:layout_width="match_parent"
169 android:layout_height="wrap_content" 168 android:layout_height="wrap_content"
170 android:background="@drawable/rounded_edittext" 169 android:background="@drawable/rounded_edittext"
171 android:gravity="top" 170 android:gravity="top"
172 android:lines="4" 171 android:lines="4"
173 android:textSize="@dimen/textsize_medium" /> 172 android:textSize="@dimen/textsize_medium" />
174 </LinearLayout> 173 </LinearLayout>
175 174
176 <LinearLayout 175 <LinearLayout
177 android:layout_width="match_parent" 176 android:layout_width="match_parent"
178 android:layout_height="wrap_content" 177 android:layout_height="wrap_content"
179 android:layout_marginTop="8dp" 178 android:layout_marginTop="8dp"
180 android:orientation="horizontal"> 179 android:orientation="horizontal">
181 180
182 <TextView 181 <TextView
183 android:layout_width="60dp" 182 android:layout_width="60dp"
184 android:layout_height="wrap_content" 183 android:layout_height="wrap_content"
185 android:layout_gravity="top" 184 android:layout_gravity="top"
186 android:text="ใƒžใƒƒใƒ—" 185 android:text="ใƒžใƒƒใƒ—"
187 android:textColor="@android:color/white" 186 android:textColor="@android:color/white"
188 android:textSize="@dimen/textsize_medium" /> 187 android:textSize="@dimen/textsize_medium" />
189 188
190 <Button 189 <Button
191 android:id="@+id/btn_map_creation" 190 android:id="@+id/btn_map_creation"
192 android:layout_width="wrap_content" 191 android:layout_width="wrap_content"
193 android:layout_height="36dp" 192 android:layout_height="36dp"
194 android:background="@drawable/button_background" 193 android:background="@drawable/button_background"
195 android:text="ใƒžใƒƒใƒ—ไฝœๆˆ" 194 android:text="ใƒžใƒƒใƒ—ไฝœๆˆ"
196 android:textSize="@dimen/textsize_medium" /> 195 android:textSize="@dimen/textsize_medium" />
197 </LinearLayout> 196 </LinearLayout>
198 197
199 <LinearLayout 198 <LinearLayout
200 android:layout_width="match_parent" 199 android:layout_width="match_parent"
201 android:layout_height="wrap_content" 200 android:layout_height="wrap_content"
202 android:layout_marginTop="8dp" 201 android:layout_marginTop="8dp"
203 android:orientation="horizontal"> 202 android:orientation="horizontal">
204 203
205 <TextView 204 <TextView
206 android:layout_width="wrap_content" 205 android:layout_width="wrap_content"
207 android:layout_height="wrap_content" 206 android:layout_height="wrap_content"
208 android:layout_gravity="top" 207 android:layout_gravity="top"
209 android:text="๏ผ‘ๆ—ฅ็›ฎๆจ™" 208 android:text="๏ผ‘ๆ—ฅ็›ฎๆจ™"
210 android:textColor="@android:color/white" 209 android:textColor="@android:color/white"
211 android:textSize="@dimen/textsize_medium" /> 210 android:textSize="@dimen/textsize_medium" />
212 211
213 </LinearLayout> 212 </LinearLayout>
214 213
215 <LinearLayout 214 <LinearLayout
216 android:layout_width="match_parent" 215 android:layout_width="match_parent"
217 android:layout_height="wrap_content" 216 android:layout_height="wrap_content"
218 android:layout_marginTop="8dp" 217 android:layout_marginTop="8dp"
219 android:gravity="center_vertical" 218 android:gravity="center_vertical"
220 android:orientation="horizontal"> 219 android:orientation="horizontal">
221 220
222 <TextView 221 <TextView
223 android:layout_width="60dp" 222 android:layout_width="60dp"
224 android:layout_height="wrap_content" 223 android:layout_height="wrap_content"
225 android:text="WALK" 224 android:text="WALK"
226 android:textColor="@android:color/white" 225 android:textColor="@android:color/white"
227 android:textSize="@dimen/textsize_medium" /> 226 android:textSize="@dimen/textsize_medium" />
228 227
229 <EditText 228 <EditText
230 android:id="@+id/edt_walk_goal" 229 android:id="@+id/edt_walk_goal"
231 android:layout_width="100dp" 230 android:layout_width="100dp"
232 android:layout_height="wrap_content" 231 android:layout_height="wrap_content"
233 android:background="@drawable/rounded_edittext" 232 android:background="@drawable/rounded_edittext"
234 android:gravity="center_vertical" 233 android:gravity="center_vertical"
235 android:inputType="number" 234 android:inputType="number"
236 android:lines="1" 235 android:lines="1"
237 android:textSize="@dimen/textsize_medium" /> 236 android:textSize="@dimen/textsize_medium" />
238 237
239 <TextView 238 <TextView
240 android:layout_width="wrap_content" 239 android:layout_width="wrap_content"
241 android:layout_height="wrap_content" 240 android:layout_height="wrap_content"
242 android:layout_marginLeft="4dp" 241 android:layout_marginLeft="4dp"
243 android:text="m" 242 android:text="m"
244 android:textColor="@android:color/white" 243 android:textColor="@android:color/white"
245 android:textSize="@dimen/textsize_medium" /> 244 android:textSize="@dimen/textsize_medium" />
246 245
247 </LinearLayout> 246 </LinearLayout>
248 247
249 <LinearLayout 248 <LinearLayout
250 android:layout_width="match_parent" 249 android:layout_width="match_parent"
251 android:layout_height="wrap_content" 250 android:layout_height="wrap_content"
252 android:layout_marginTop="8dp" 251 android:layout_marginTop="8dp"
253 android:gravity="center_vertical" 252 android:gravity="center_vertical"
254 android:orientation="horizontal"> 253 android:orientation="horizontal">
255 254
256 <TextView 255 <TextView
257 android:layout_width="60dp" 256 android:layout_width="60dp"
258 android:layout_height="wrap_content" 257 android:layout_height="wrap_content"
259 android:text="RUN" 258 android:text="RUN"
260 android:textColor="@android:color/white" 259 android:textColor="@android:color/white"
261 android:textSize="@dimen/textsize_medium" /> 260 android:textSize="@dimen/textsize_medium" />
262 261
263 <EditText 262 <EditText
264 android:id="@+id/edt_run_goal" 263 android:id="@+id/edt_run_goal"
265 android:layout_width="100dp" 264 android:layout_width="100dp"
266 android:layout_height="wrap_content" 265 android:layout_height="wrap_content"
267 android:background="@drawable/rounded_edittext" 266 android:background="@drawable/rounded_edittext"
268 android:gravity="center_vertical" 267 android:gravity="center_vertical"
269 android:inputType="number" 268 android:inputType="number"
270 android:lines="1" 269 android:lines="1"
271 android:textSize="@dimen/textsize_medium" /> 270 android:textSize="@dimen/textsize_medium" />
272 271
273 <TextView 272 <TextView
274 android:layout_width="wrap_content" 273 android:layout_width="wrap_content"
275 android:layout_height="wrap_content" 274 android:layout_height="wrap_content"
276 android:layout_marginLeft="4dp" 275 android:layout_marginLeft="4dp"
277 android:text="m" 276 android:text="m"
278 android:textColor="@android:color/white" 277 android:textColor="@android:color/white"
279 android:textSize="@dimen/textsize_medium" /> 278 android:textSize="@dimen/textsize_medium" />
280 279
281 </LinearLayout> 280 </LinearLayout>
282 281
283 <LinearLayout 282 <LinearLayout
284 android:layout_width="match_parent" 283 android:layout_width="match_parent"
285 android:layout_height="wrap_content" 284 android:layout_height="wrap_content"
286 android:layout_marginTop="8dp" 285 android:layout_marginTop="8dp"
287 android:gravity="center_vertical" 286 android:gravity="center_vertical"
288 android:orientation="horizontal"> 287 android:orientation="horizontal">
289 288
290 <TextView 289 <TextView
291 android:layout_width="60dp" 290 android:layout_width="60dp"
292 android:layout_height="wrap_content" 291 android:layout_height="wrap_content"
293 android:text="BIKE" 292 android:text="BIKE"
294 android:textColor="@android:color/white" 293 android:textColor="@android:color/white"
295 android:textSize="@dimen/textsize_medium" /> 294 android:textSize="@dimen/textsize_medium" />
296 295
297 <EditText 296 <EditText
298 android:id="@+id/edt_bike_goal" 297 android:id="@+id/edt_bike_goal"
299 android:layout_width="100dp" 298 android:layout_width="100dp"
300 android:layout_height="wrap_content" 299 android:layout_height="wrap_content"
301 android:background="@drawable/rounded_edittext" 300 android:background="@drawable/rounded_edittext"
302 android:gravity="center_vertical" 301 android:gravity="center_vertical"
303 android:inputType="number" 302 android:inputType="number"
304 android:lines="1" 303 android:lines="1"
305 android:textSize="@dimen/textsize_medium" /> 304 android:textSize="@dimen/textsize_medium" />
306 305
307 <TextView 306 <TextView
308 android:layout_width="wrap_content" 307 android:layout_width="wrap_content"
309 android:layout_height="wrap_content" 308 android:layout_height="wrap_content"
310 android:layout_marginLeft="4dp" 309 android:layout_marginLeft="4dp"
311 android:text="m" 310 android:text="m"
312 android:textColor="@android:color/white" 311 android:textColor="@android:color/white"
313 android:textSize="@dimen/textsize_medium" /> 312 android:textSize="@dimen/textsize_medium" />
314 313
315 </LinearLayout> 314 </LinearLayout>
316 </LinearLayout> 315 </LinearLayout>
317 </ScrollView> 316 </ScrollView>
318 317
319 <LinearLayout 318 <LinearLayout
320 android:id="@+id/layout_bottom" 319 android:id="@+id/layout_bottom"
321 android:layout_width="match_parent" 320 android:layout_width="match_parent"
322 android:layout_height="wrap_content" 321 android:layout_height="wrap_content"
323 android:layout_alignParentBottom="true" 322 android:layout_alignParentBottom="true"
324 android:orientation="vertical"> 323 android:orientation="vertical">
325 324
326 <Button 325 <Button
327 android:id="@+id/btn_create_group" 326 android:id="@+id/btn_create_group"
328 android:layout_width="match_parent" 327 android:layout_width="match_parent"
329 android:layout_height="wrap_content" 328 android:layout_height="wrap_content"
330 android:textSize="@dimen/textsize_medium" 329 android:textSize="@dimen/textsize_medium"
331 android:layout_marginBottom="8dp" 330 android:layout_marginBottom="8dp"
332 android:layout_marginLeft="16dp" 331 android:layout_marginLeft="16dp"
333 android:layout_marginRight="16dp" 332 android:layout_marginRight="16dp"
334 android:layout_marginTop="8dp" 333 android:layout_marginTop="8dp"
335 android:background="@drawable/button_background" 334 android:background="@drawable/button_background"
336 android:text="ใ‚ฐใƒซใƒผใƒ—ใ‚’ไฝœๆˆใ™ใ‚‹" /> 335 android:text="ใ‚ฐใƒซใƒผใƒ—ใ‚’ไฝœๆˆใ™ใ‚‹" />
337 </LinearLayout> 336 </LinearLayout>
338 </RelativeLayout> 337 </RelativeLayout>
339 338
app/src/main/res/layout/fragment_sns_detail.xml
1 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 1 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
2 android:layout_width="match_parent" 2 android:layout_width="match_parent"
3 android:layout_height="match_parent" 3 android:layout_height="match_parent">
4 android:background="@color/background_main">
5 4
6 <LinearLayout 5 <LinearLayout
7 android:id="@+id/layout_main_sns_screen" 6 android:id="@+id/layout_main_sns_screen"
8 android:layout_width="match_parent" 7 android:layout_width="match_parent"
9 android:layout_height="match_parent" 8 android:layout_height="match_parent"
10 android:background="@color/background_main"
11 android:orientation="vertical"> 9 android:orientation="vertical">
12 10
13 <TextView 11 <TextView
14 android:id="@+id/tv_title" 12 android:id="@+id/tv_title"
15 android:layout_width="match_parent" 13 android:layout_width="match_parent"
16 android:layout_height="wrap_content" 14 android:layout_height="wrap_content"
17 android:layout_marginLeft="16dp" 15 android:layout_marginLeft="16dp"
18 android:layout_marginRight="16dp" 16 android:layout_marginRight="16dp"
19 android:layout_marginTop="8dp" 17 android:layout_marginTop="8dp"
20 android:text="..." 18 android:text="..."
21 android:textColor="@android:color/white" 19 android:textColor="@android:color/white"
22 android:textSize="@dimen/textsize_large" /> 20 android:textSize="@dimen/textsize_large" />
23 21
24 <LinearLayout 22 <LinearLayout
25 android:layout_width="match_parent" 23 android:layout_width="match_parent"
26 android:layout_height="72dp" 24 android:layout_height="72dp"
27 android:layout_marginLeft="16dp" 25 android:layout_marginLeft="16dp"
28 android:layout_marginRight="16dp" 26 android:layout_marginRight="16dp"
29 android:layout_marginTop="8dp" 27 android:layout_marginTop="8dp"
30 android:orientation="horizontal" 28 android:orientation="horizontal"
31 android:weightSum="100"> 29 android:weightSum="100">
32 30
33 <LinearLayout 31 <LinearLayout
34 android:layout_width="0dp" 32 android:layout_width="0dp"
35 android:layout_height="wrap_content" 33 android:layout_height="wrap_content"
36 android:layout_weight="60" 34 android:layout_weight="60"
37 android:orientation="vertical"> 35 android:orientation="vertical">
38 36
39 <TextView 37 <TextView
40 android:id="@+id/tv_run_active_mode" 38 android:id="@+id/tv_run_active_mode"
41 android:layout_width="wrap_content" 39 android:layout_width="wrap_content"
42 android:layout_height="wrap_content" 40 android:layout_height="wrap_content"
43 android:text="ใƒฉใƒณใƒ‹ใƒณใ‚ฐ" 41 android:text="ใƒฉใƒณใƒ‹ใƒณใ‚ฐ"
44 android:textColor="@android:color/white" 42 android:textColor="@android:color/white"
45 android:textSize="@dimen/textsize_medium" /> 43 android:textSize="@dimen/textsize_medium" />
46 44
47 <TextView 45 <TextView
48 android:id="@+id/tv_walk_active_mode" 46 android:id="@+id/tv_walk_active_mode"
49 android:layout_width="wrap_content" 47 android:layout_width="wrap_content"
50 android:layout_height="wrap_content" 48 android:layout_height="wrap_content"
51 android:text="ใ‚ฆใ‚ฉใƒผใ‚ญใƒณใ‚ฐ" 49 android:text="ใ‚ฆใ‚ฉใƒผใ‚ญใƒณใ‚ฐ"
52 android:textColor="@android:color/white" 50 android:textColor="@android:color/white"
53 android:textSize="@dimen/textsize_medium" /> 51 android:textSize="@dimen/textsize_medium" />
54 52
55 <TextView 53 <TextView
56 android:id="@+id/tv_bike_active_mode" 54 android:id="@+id/tv_bike_active_mode"
57 android:layout_width="wrap_content" 55 android:layout_width="wrap_content"
58 android:layout_height="wrap_content" 56 android:layout_height="wrap_content"
59 android:text="ใƒใ‚คใ‚ฏ" 57 android:text="ใƒใ‚คใ‚ฏ"
60 android:textColor="@android:color/white" 58 android:textColor="@android:color/white"
61 android:textSize="@dimen/textsize_medium" /> 59 android:textSize="@dimen/textsize_medium" />
62 </LinearLayout> 60 </LinearLayout>
63 61
64 <ImageView 62 <ImageView
65 android:id="@+id/imv_beginer_icon" 63 android:id="@+id/imv_beginer_icon"
66 android:layout_width="0dp" 64 android:layout_width="0dp"
67 android:layout_height="match_parent" 65 android:layout_height="match_parent"
68 android:layout_weight="40" 66 android:layout_weight="40"
69 android:src="@drawable/ic_beginer_user" /> 67 android:src="@drawable/ic_beginer_user" />
70 </LinearLayout> 68 </LinearLayout>
71 69
72 <TextView 70 <TextView
73 android:id="@+id/tv_goal" 71 android:id="@+id/tv_goal"
74 android:layout_width="match_parent" 72 android:layout_width="match_parent"
75 android:layout_height="wrap_content" 73 android:layout_height="wrap_content"
76 android:layout_marginLeft="16dp" 74 android:layout_marginLeft="16dp"
77 android:layout_marginRight="16dp" 75 android:layout_marginRight="16dp"
78 android:layout_marginTop="8dp" 76 android:layout_marginTop="8dp"
79 android:text="..." 77 android:text="..."
80 android:textColor="@android:color/white" 78 android:textColor="@android:color/white"
81 android:textSize="@dimen/textsize_medium" /> 79 android:textSize="@dimen/textsize_medium" />
82 80
83 <LinearLayout 81 <LinearLayout
84 android:id="@+id/layout_run_active_mode" 82 android:id="@+id/layout_run_active_mode"
85 android:layout_width="match_parent" 83 android:layout_width="match_parent"
86 android:layout_height="wrap_content" 84 android:layout_height="wrap_content"
87 android:layout_marginLeft="16dp" 85 android:layout_marginLeft="16dp"
88 android:layout_marginRight="16dp" 86 android:layout_marginRight="16dp"
89 android:layout_marginTop="8dp" 87 android:layout_marginTop="8dp"
90 android:orientation="horizontal"> 88 android:orientation="horizontal">
91 89
92 <TextView 90 <TextView
93 android:layout_width="wrap_content" 91 android:layout_width="wrap_content"
94 android:layout_height="wrap_content" 92 android:layout_height="wrap_content"
95 android:layout_marginRight="8dp" 93 android:layout_marginRight="8dp"
96 android:text="๏ผ‘ๆ—ฅ" 94 android:text="๏ผ‘ๆ—ฅ"
97 android:textColor="@android:color/white" 95 android:textColor="@android:color/white"
98 android:textSize="@dimen/textsize_medium" /> 96 android:textSize="@dimen/textsize_medium" />
99 97
100 <TextView 98 <TextView
101 android:layout_width="wrap_content" 99 android:layout_width="wrap_content"
102 android:layout_height="wrap_content" 100 android:layout_height="wrap_content"
103 android:layout_marginRight="8dp" 101 android:layout_marginRight="8dp"
104 android:text="็›ฎๆจ™" 102 android:text="็›ฎๆจ™"
105 android:textColor="@android:color/white" 103 android:textColor="@android:color/white"
106 android:textSize="@dimen/textsize_medium" /> 104 android:textSize="@dimen/textsize_medium" />
107 105
108 <TextView 106 <TextView
109 android:layout_width="wrap_content" 107 android:layout_width="wrap_content"
110 android:layout_height="wrap_content" 108 android:layout_height="wrap_content"
111 android:layout_marginRight="8dp" 109 android:layout_marginRight="8dp"
112 android:text="RUN" 110 android:text="RUN"
113 android:textColor="@android:color/white" 111 android:textColor="@android:color/white"
114 android:textSize="@dimen/textsize_medium" /> 112 android:textSize="@dimen/textsize_medium" />
115 113
116 <TextView 114 <TextView
117 android:id="@+id/tv_target_run" 115 android:id="@+id/tv_target_run"
118 android:layout_width="wrap_content" 116 android:layout_width="wrap_content"
119 android:layout_height="wrap_content" 117 android:layout_height="wrap_content"
120 android:text="..." 118 android:text="..."
121 android:textColor="@android:color/white" 119 android:textColor="@android:color/white"
122 android:textSize="@dimen/textsize_medium" /> 120 android:textSize="@dimen/textsize_medium" />
123 </LinearLayout> 121 </LinearLayout>
124 122
125 <LinearLayout 123 <LinearLayout
126 android:id="@+id/layout_walk_active_mode" 124 android:id="@+id/layout_walk_active_mode"
127 android:layout_width="match_parent" 125 android:layout_width="match_parent"
128 android:layout_height="wrap_content" 126 android:layout_height="wrap_content"
129 android:layout_marginLeft="16dp" 127 android:layout_marginLeft="16dp"
130 android:layout_marginRight="16dp" 128 android:layout_marginRight="16dp"
131 android:orientation="horizontal"> 129 android:orientation="horizontal">
132 130
133 <TextView 131 <TextView
134 android:layout_width="wrap_content" 132 android:layout_width="wrap_content"
135 android:layout_height="wrap_content" 133 android:layout_height="wrap_content"
136 android:layout_marginRight="8dp" 134 android:layout_marginRight="8dp"
137 android:text="๏ผ‘ๆ—ฅ" 135 android:text="๏ผ‘ๆ—ฅ"
138 android:textColor="@android:color/white" 136 android:textColor="@android:color/white"
139 android:textSize="@dimen/textsize_medium" /> 137 android:textSize="@dimen/textsize_medium" />
140 138
141 <TextView 139 <TextView
142 android:layout_width="wrap_content" 140 android:layout_width="wrap_content"
143 android:layout_height="wrap_content" 141 android:layout_height="wrap_content"
144 android:layout_marginRight="8dp" 142 android:layout_marginRight="8dp"
145 android:text="็›ฎๆจ™" 143 android:text="็›ฎๆจ™"
146 android:textColor="@android:color/white" 144 android:textColor="@android:color/white"
147 android:textSize="@dimen/textsize_medium" /> 145 android:textSize="@dimen/textsize_medium" />
148 146
149 <TextView 147 <TextView
150 android:layout_width="wrap_content" 148 android:layout_width="wrap_content"
151 android:layout_height="wrap_content" 149 android:layout_height="wrap_content"
152 android:layout_marginRight="8dp" 150 android:layout_marginRight="8dp"
153 android:text="WALK" 151 android:text="WALK"
154 android:textColor="@android:color/white" 152 android:textColor="@android:color/white"
155 android:textSize="@dimen/textsize_medium" /> 153 android:textSize="@dimen/textsize_medium" />
156 154
157 <TextView 155 <TextView
158 android:id="@+id/tv_target_walk" 156 android:id="@+id/tv_target_walk"
159 android:layout_width="wrap_content" 157 android:layout_width="wrap_content"
160 android:layout_height="wrap_content" 158 android:layout_height="wrap_content"
161 android:text="..." 159 android:text="..."
162 android:textColor="@android:color/white" 160 android:textColor="@android:color/white"
163 android:textSize="@dimen/textsize_medium" /> 161 android:textSize="@dimen/textsize_medium" />
164 </LinearLayout> 162 </LinearLayout>
165 163
166 <LinearLayout 164 <LinearLayout
167 android:id="@+id/layout_bike_active_mode" 165 android:id="@+id/layout_bike_active_mode"
168 android:layout_width="match_parent" 166 android:layout_width="match_parent"
169 android:layout_height="wrap_content" 167 android:layout_height="wrap_content"
170 android:layout_marginLeft="16dp" 168 android:layout_marginLeft="16dp"
171 android:layout_marginRight="16dp" 169 android:layout_marginRight="16dp"
172 android:orientation="horizontal"> 170 android:orientation="horizontal">
173 171
174 <TextView 172 <TextView
175 android:layout_width="wrap_content" 173 android:layout_width="wrap_content"
176 android:layout_height="wrap_content" 174 android:layout_height="wrap_content"
177 android:layout_marginRight="8dp" 175 android:layout_marginRight="8dp"
178 android:text="๏ผ‘ๆ—ฅ" 176 android:text="๏ผ‘ๆ—ฅ"
179 android:textColor="@android:color/white" 177 android:textColor="@android:color/white"
180 android:textSize="@dimen/textsize_medium" /> 178 android:textSize="@dimen/textsize_medium" />
181 179
182 <TextView 180 <TextView
183 android:layout_width="wrap_content" 181 android:layout_width="wrap_content"
184 android:layout_height="wrap_content" 182 android:layout_height="wrap_content"
185 android:layout_marginRight="8dp" 183 android:layout_marginRight="8dp"
186 android:text="็›ฎๆจ™" 184 android:text="็›ฎๆจ™"
187 android:textColor="@android:color/white" 185 android:textColor="@android:color/white"
188 android:textSize="@dimen/textsize_medium" /> 186 android:textSize="@dimen/textsize_medium" />
189 187
190 <TextView 188 <TextView
191 android:layout_width="wrap_content" 189 android:layout_width="wrap_content"
192 android:layout_height="wrap_content" 190 android:layout_height="wrap_content"
193 android:layout_marginRight="8dp" 191 android:layout_marginRight="8dp"
194 android:text="BIKE" 192 android:text="BIKE"
195 android:textColor="@android:color/white" 193 android:textColor="@android:color/white"
196 android:textSize="@dimen/textsize_medium" /> 194 android:textSize="@dimen/textsize_medium" />
197 195
198 <TextView 196 <TextView
199 android:id="@+id/tv_target_bike" 197 android:id="@+id/tv_target_bike"
200 android:layout_width="wrap_content" 198 android:layout_width="wrap_content"
201 android:layout_height="wrap_content" 199 android:layout_height="wrap_content"
202 android:text="..." 200 android:text="..."
203 android:textColor="@android:color/white" 201 android:textColor="@android:color/white"
204 android:textSize="@dimen/textsize_medium" /> 202 android:textSize="@dimen/textsize_medium" />
205 </LinearLayout> 203 </LinearLayout>
206 204
207 <LinearLayout 205 <LinearLayout
208 android:layout_width="match_parent" 206 android:layout_width="match_parent"
209 android:layout_height="wrap_content" 207 android:layout_height="wrap_content"
210 android:layout_marginLeft="16dp" 208 android:layout_marginLeft="16dp"
211 android:layout_marginRight="16dp" 209 android:layout_marginRight="16dp"
212 android:layout_marginTop="8dp" 210 android:layout_marginTop="8dp"
213 android:orientation="horizontal" 211 android:orientation="horizontal"
214 android:weightSum="100"> 212 android:weightSum="100">
215 213
216 <Button 214 <Button
217 android:id="@+id/btn_view_member" 215 android:id="@+id/btn_view_member"
218 android:layout_width="0dp" 216 android:layout_width="0dp"
219 android:layout_height="wrap_content" 217 android:layout_height="wrap_content"
220 android:layout_marginRight="4dp" 218 android:layout_marginRight="4dp"
221 android:layout_weight="50" 219 android:layout_weight="50"
222 android:background="@drawable/button_blue_bg" 220 android:background="@drawable/button_blue_bg"
223 android:text="ใƒกใƒณใƒใƒผใ‚’่ฆ‹ใ‚‹" 221 android:text="ใƒกใƒณใƒใƒผใ‚’่ฆ‹ใ‚‹"
224 android:textColor="@android:color/white" /> 222 android:textColor="@android:color/white" />
225 223
226 <Button 224 <Button
227 android:id="@+id/btn_join_group" 225 android:id="@+id/btn_join_group"
228 android:layout_width="0dp" 226 android:layout_width="0dp"
229 android:layout_height="wrap_content" 227 android:layout_height="wrap_content"
230 android:layout_marginLeft="4dp" 228 android:layout_marginLeft="4dp"
231 android:layout_weight="50" 229 android:layout_weight="50"
232 android:background="@drawable/button_blue_bg" 230 android:background="@drawable/button_blue_bg"
233 android:text="ใ‚ฐใƒซใƒผใƒ—ใซๅ‚ๅŠ ใ™ใ‚‹" 231 android:text="ใ‚ฐใƒซใƒผใƒ—ใซๅ‚ๅŠ ใ™ใ‚‹"
234 android:textColor="@android:color/white" /> 232 android:textColor="@android:color/white" />
235 </LinearLayout> 233 </LinearLayout>
236 234
237 <android.support.v4.widget.SwipeRefreshLayout 235 <android.support.v4.widget.SwipeRefreshLayout
238 android:id="@+id/swipe_topic" 236 android:id="@+id/swipe_topic"
239 android:layout_width="match_parent" 237 android:layout_width="match_parent"
240 android:layout_height="match_parent" 238 android:layout_height="match_parent"
241 android:layout_marginTop="8dp"> 239 android:layout_marginTop="8dp">
242 240
243 <android.support.v7.widget.RecyclerView 241 <android.support.v7.widget.RecyclerView
244 android:id="@+id/rcv_topic" 242 android:id="@+id/rcv_topic"
245 android:layout_width="match_parent" 243 android:layout_width="match_parent"
246 android:layout_height="match_parent" 244 android:layout_height="match_parent"
247 android:layout_marginTop="8dp" 245 android:layout_marginTop="8dp"
248 android:scrollbars="vertical" /> 246 android:scrollbars="vertical" />
249 </android.support.v4.widget.SwipeRefreshLayout> 247 </android.support.v4.widget.SwipeRefreshLayout>
250 </LinearLayout> 248 </LinearLayout>
251 249
252 <LinearLayout 250 <LinearLayout
253 android:id="@+id/layout_pb_loading" 251 android:id="@+id/layout_pb_loading"
254 android:layout_width="match_parent" 252 android:layout_width="match_parent"
255 android:layout_height="match_parent" 253 android:layout_height="match_parent"
256 android:alpha="0.4" 254 android:alpha="0.4"
257 android:background="@android:color/darker_gray" 255 android:background="@android:color/darker_gray"
258 android:clickable="true" 256 android:clickable="true"
259 android:gravity="center_horizontal"> 257 android:gravity="center_horizontal">
260 258
261 <ProgressBar 259 <ProgressBar
262 android:id="@+id/pb_loading" 260 android:id="@+id/pb_loading"
263 android:layout_width="48dp" 261 android:layout_width="48dp"
264 android:layout_height="48dp" 262 android:layout_height="48dp"
265 android:layout_centerHorizontal="true" 263 android:layout_centerHorizontal="true"
266 android:layout_marginTop="16dp" /> 264 android:layout_marginTop="16dp" />
267 </LinearLayout> 265 </LinearLayout>
268 </RelativeLayout> 266 </RelativeLayout>
app/src/main/res/layout/fragment_sns_my_group.xml
1 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 1 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
2 xmlns:tools="http://schemas.android.com/tools" 2 xmlns:tools="http://schemas.android.com/tools"
3 android:layout_width="match_parent" 3 android:layout_width="match_parent"
4 android:layout_height="match_parent" 4 android:layout_height="match_parent"
5 android:background="@color/background_main"
6 tools:context="com.dinhcv.lifelogpedometer.activity.SnsMyGroupFragment"> 5 tools:context="com.dinhcv.lifelogpedometer.activity.SnsMyGroupFragment">
7 6
8 <LinearLayout 7 <LinearLayout
9 android:id="@+id/layout_top" 8 android:id="@+id/layout_top"
10 android:layout_width="match_parent" 9 android:layout_width="match_parent"
11 android:layout_height="wrap_content" 10 android:layout_height="wrap_content"
12 android:orientation="vertical" 11 android:orientation="vertical"
13 android:padding="16dp" 12 android:padding="16dp"
14 android:layout_alignParentTop="true" 13 android:layout_alignParentTop="true"
15 android:layout_alignParentStart="true"> 14 android:layout_alignParentStart="true">
16 15
17 <RelativeLayout 16 <RelativeLayout
18 android:layout_width="match_parent" 17 android:layout_width="match_parent"
19 android:layout_height="40dp"> 18 android:layout_height="40dp">
20 19
21 <Spinner 20 <Spinner
22 android:id="@+id/spinner_my_group" 21 android:id="@+id/spinner_my_group"
23 android:layout_width="match_parent" 22 android:layout_width="match_parent"
24 android:layout_height="40dp" 23 android:layout_height="40dp"
25 android:background="@drawable/edittext_search_bg" /> 24 android:background="@drawable/edittext_search_bg" />
26 25
27 <ImageView 26 <ImageView
28 android:id="@+id/imv_spinner_my_group" 27 android:id="@+id/imv_spinner_my_group"
29 android:layout_width="52dp" 28 android:layout_width="52dp"
30 android:layout_height="match_parent" 29 android:layout_height="match_parent"
31 android:layout_alignParentRight="true" 30 android:layout_alignParentRight="true"
32 android:background="#232ef4" 31 android:background="#232ef4"
33 android:padding="4dp" 32 android:padding="4dp"
34 android:src="@drawable/ic_spinner_expand" /> 33 android:src="@drawable/ic_spinner_expand" />
35 </RelativeLayout> 34 </RelativeLayout>
36 35
37 <LinearLayout 36 <LinearLayout
38 android:layout_width="match_parent" 37 android:layout_width="match_parent"
39 android:layout_height="wrap_content" 38 android:layout_height="wrap_content"
40 android:layout_marginTop="16dp" 39 android:layout_marginTop="16dp"
41 android:background="@android:color/white" 40 android:background="@android:color/white"
42 android:orientation="vertical"> 41 android:orientation="vertical">
43 42
44 <TextView 43 <TextView
45 android:id="@+id/tv_title" 44 android:id="@+id/tv_title"
46 android:layout_width="match_parent" 45 android:layout_width="match_parent"
47 android:layout_height="wrap_content" 46 android:layout_height="wrap_content"
48 android:layout_marginLeft="8dp" 47 android:layout_marginLeft="8dp"
49 android:layout_marginRight="8dp" 48 android:layout_marginRight="8dp"
50 android:layout_marginTop="4dp" 49 android:layout_marginTop="4dp"
51 android:text="..." 50 android:text="..."
52 android:textColor="@android:color/black" 51 android:textColor="@android:color/black"
53 android:textSize="@dimen/textsize_large" /> 52 android:textSize="@dimen/textsize_large" />
54 53
55 <LinearLayout 54 <LinearLayout
56 android:layout_width="match_parent" 55 android:layout_width="match_parent"
57 android:layout_height="76dp" 56 android:layout_height="76dp"
58 android:layout_marginLeft="8dp" 57 android:layout_marginLeft="8dp"
59 android:layout_marginRight="8dp" 58 android:layout_marginRight="8dp"
60 android:layout_marginTop="4dp" 59 android:layout_marginTop="4dp"
61 android:orientation="horizontal" 60 android:orientation="horizontal"
62 android:weightSum="100"> 61 android:weightSum="100">
63 62
64 <LinearLayout 63 <LinearLayout
65 android:layout_width="0dp" 64 android:layout_width="0dp"
66 android:layout_height="wrap_content" 65 android:layout_height="wrap_content"
67 android:layout_weight="60" 66 android:layout_weight="60"
68 android:orientation="vertical"> 67 android:orientation="vertical">
69 68
70 <TextView 69 <TextView
71 android:id="@+id/tv_run_active_mode" 70 android:id="@+id/tv_run_active_mode"
72 android:layout_width="wrap_content" 71 android:layout_width="wrap_content"
73 android:layout_height="wrap_content" 72 android:layout_height="wrap_content"
74 android:text="ใƒฉใƒณใƒ‹ใƒณใ‚ฐ" 73 android:text="ใƒฉใƒณใƒ‹ใƒณใ‚ฐ"
75 android:textColor="@android:color/black" 74 android:textColor="@android:color/black"
76 android:textSize="@dimen/textsize_medium" /> 75 android:textSize="@dimen/textsize_medium" />
77 76
78 <TextView 77 <TextView
79 android:id="@+id/tv_walk_active_mode" 78 android:id="@+id/tv_walk_active_mode"
80 android:layout_width="wrap_content" 79 android:layout_width="wrap_content"
81 android:layout_height="wrap_content" 80 android:layout_height="wrap_content"
82 android:text="ใ‚ฆใ‚ฉใƒผใ‚ญใƒณใ‚ฐ" 81 android:text="ใ‚ฆใ‚ฉใƒผใ‚ญใƒณใ‚ฐ"
83 android:textColor="@android:color/black" 82 android:textColor="@android:color/black"
84 android:textSize="@dimen/textsize_medium" /> 83 android:textSize="@dimen/textsize_medium" />
85 84
86 <TextView 85 <TextView
87 android:id="@+id/tv_bike_active_mode" 86 android:id="@+id/tv_bike_active_mode"
88 android:layout_width="wrap_content" 87 android:layout_width="wrap_content"
89 android:layout_height="wrap_content" 88 android:layout_height="wrap_content"
90 android:text="ใƒใ‚คใ‚ฏ" 89 android:text="ใƒใ‚คใ‚ฏ"
91 android:textColor="@android:color/black" 90 android:textColor="@android:color/black"
92 android:textSize="@dimen/textsize_medium" /> 91 android:textSize="@dimen/textsize_medium" />
93 </LinearLayout> 92 </LinearLayout>
94 93
95 <Button 94 <Button
96 android:layout_width="0dp" 95 android:layout_width="0dp"
97 android:layout_height="36dp" 96 android:layout_height="36dp"
98 android:layout_gravity="bottom" 97 android:layout_gravity="bottom"
99 android:background="@drawable/button_background" 98 android:background="@drawable/button_background"
100 android:layout_marginBottom="8dp" 99 android:layout_marginBottom="8dp"
101 android:layout_weight="40" 100 android:layout_weight="40"
102 android:gravity="center" 101 android:gravity="center"
103 android:text="VMAP" /> 102 android:text="VMAP" />
104 </LinearLayout> 103 </LinearLayout>
105 </LinearLayout> 104 </LinearLayout>
106 105
107 <TextView 106 <TextView
108 android:id="@+id/tv_goal" 107 android:id="@+id/tv_goal"
109 android:layout_width="match_parent" 108 android:layout_width="match_parent"
110 android:layout_height="wrap_content" 109 android:layout_height="wrap_content"
111 android:layout_marginTop="8dp" 110 android:layout_marginTop="8dp"
112 android:text="..." 111 android:text="..."
113 android:textColor="@android:color/white" 112 android:textColor="@android:color/white"
114 android:textSize="@dimen/textsize_medium" /> 113 android:textSize="@dimen/textsize_medium" />
115 114
116 <Button 115 <Button
117 android:id="@+id/btn_show_member" 116 android:id="@+id/btn_show_member"
118 android:layout_width="120dp" 117 android:layout_width="120dp"
119 android:layout_height="36dp" 118 android:layout_height="36dp"
120 android:layout_gravity="right" 119 android:layout_gravity="right"
121 android:layout_marginTop="8dp" 120 android:layout_marginTop="8dp"
122 android:background="@drawable/button_background" 121 android:background="@drawable/button_background"
123 android:text="ใƒกใƒณใƒใƒผ" /> 122 android:text="ใƒกใƒณใƒใƒผ" />
124 </LinearLayout> 123 </LinearLayout>
125 124
126 <android.support.v4.widget.SwipeRefreshLayout 125 <android.support.v4.widget.SwipeRefreshLayout
127 android:id="@+id/swipe_topic" 126 android:id="@+id/swipe_topic"
128 android:layout_width="match_parent" 127 android:layout_width="match_parent"
129 android:layout_height="match_parent" 128 android:layout_height="match_parent"
130 android:layout_below="@id/layout_top"> 129 android:layout_below="@id/layout_top">
131 130
132 <android.support.v7.widget.RecyclerView 131 <android.support.v7.widget.RecyclerView
133 android:id="@+id/rcv_member" 132 android:id="@+id/rcv_member"
134 android:layout_width="match_parent" 133 android:layout_width="match_parent"
135 android:layout_height="match_parent" 134 android:layout_height="match_parent"
136 android:layout_marginTop="8dp" 135 android:layout_marginTop="8dp"
137 android:scrollbars="vertical" /> 136 android:scrollbars="vertical" />
138 </android.support.v4.widget.SwipeRefreshLayout> 137 </android.support.v4.widget.SwipeRefreshLayout>
139 </RelativeLayout> 138 </RelativeLayout>
140 139
app/src/main/res/layout/fragment_sns_search.xml
1 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 1 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
2 android:id="@+id/layout_search_sns_screen" 2 android:id="@+id/layout_search_sns_screen"
3 android:layout_width="match_parent" 3 android:layout_width="match_parent"
4 android:layout_height="match_parent" 4 android:layout_height="match_parent"
5 android:background="@color/background_main"
6 android:orientation="vertical"> 5 android:orientation="vertical">
7 6
8 <TextView 7 <TextView
9 android:layout_width="wrap_content" 8 android:layout_width="wrap_content"
10 android:layout_height="wrap_content" 9 android:layout_height="wrap_content"
11 android:layout_gravity="center_horizontal" 10 android:layout_gravity="center_horizontal"
12 android:layout_margin="8dp" 11 android:layout_margin="8dp"
13 android:text="ใ‚ชใ‚นใ‚นใƒกใ‚ฐใƒซใƒผใƒ—" 12 android:text="ใ‚ชใ‚นใ‚นใƒกใ‚ฐใƒซใƒผใƒ—"
14 android:textColor="@android:color/white" 13 android:textColor="@android:color/white"
15 android:textSize="26sp" /> 14 android:textSize="26sp" />
16 15
17 <RelativeLayout 16 <RelativeLayout
18 android:layout_width="match_parent" 17 android:layout_width="match_parent"
19 android:layout_height="wrap_content" 18 android:layout_height="wrap_content"
20 android:layout_marginTop="4dp"> 19 android:layout_marginTop="4dp">
21 20
22 <EditText 21 <EditText
23 android:id="@+id/edt_search_input" 22 android:id="@+id/edt_search_input"
24 style="@android:style/Animation.InputMethod" 23 style="@android:style/Animation.InputMethod"
25 android:layout_width="match_parent" 24 android:layout_width="match_parent"
26 android:layout_height="36dp" 25 android:layout_height="36dp"
27 android:layout_marginLeft="8dp" 26 android:layout_marginLeft="8dp"
28 android:layout_marginRight="8dp" 27 android:layout_marginRight="8dp"
29 android:layout_toLeftOf="@+id/layout_search_button" 28 android:layout_toLeftOf="@+id/layout_search_button"
30 android:background="@drawable/edittext_search_bg" 29 android:background="@drawable/edittext_search_bg"
31 android:gravity="center_vertical" 30 android:gravity="center_vertical"
32 android:hint="ๆคœ็ดขใ‚ญใƒผใƒฏใƒผใƒ‰" 31 android:hint="ๆคœ็ดขใ‚ญใƒผใƒฏใƒผใƒ‰"
33 android:lines="1" 32 android:lines="1"
34 android:textColor="@android:color/black" 33 android:textColor="@android:color/black"
35 android:textSize="16sp" /> 34 android:textSize="16sp" />
36 35
37 <LinearLayout 36 <LinearLayout
38 android:id="@+id/layout_search_button" 37 android:id="@+id/layout_search_button"
39 android:layout_width="wrap_content" 38 android:layout_width="wrap_content"
40 android:layout_height="wrap_content" 39 android:layout_height="wrap_content"
41 android:layout_alignParentRight="true" 40 android:layout_alignParentRight="true"
42 android:orientation="vertical"> 41 android:orientation="vertical">
43 42
44 <Button 43 <Button
45 android:id="@+id/btn_search" 44 android:id="@+id/btn_search"
46 android:layout_width="match_parent" 45 android:layout_width="match_parent"
47 android:layout_height="36dp" 46 android:layout_height="36dp"
48 android:layout_marginRight="8dp" 47 android:layout_marginRight="8dp"
49 android:layout_weight="30" 48 android:layout_weight="30"
50 android:background="@drawable/button_background" 49 android:background="@drawable/button_background"
51 android:text="ๆคœ็ดข" /> 50 android:text="ๆคœ็ดข" />
52 51
53 <Button 52 <Button
54 android:id="@+id/btn_create_group" 53 android:id="@+id/btn_create_group"
55 android:layout_width="wrap_content" 54 android:layout_width="wrap_content"
56 android:layout_height="36dp" 55 android:layout_height="36dp"
57 android:layout_marginRight="8dp" 56 android:layout_marginRight="8dp"
58 android:layout_marginTop="8dp" 57 android:layout_marginTop="8dp"
59 android:layout_weight="30" 58 android:layout_weight="30"
60 android:background="@drawable/button_background" 59 android:background="@drawable/button_background"
61 android:text="ใ‚ฐใƒซใƒผใƒ—ไฝœๆˆ" /> 60 android:text="ใ‚ฐใƒซใƒผใƒ—ไฝœๆˆ" />
62 </LinearLayout> 61 </LinearLayout>
63 </RelativeLayout> 62 </RelativeLayout>
64 63
65 64
66 <LinearLayout 65 <LinearLayout
67 android:layout_width="match_parent" 66 android:layout_width="match_parent"
68 android:layout_height="48dp" 67 android:layout_height="48dp"
69 android:orientation="horizontal" 68 android:orientation="horizontal"
70 android:weightSum="100"> 69 android:weightSum="100">
71 70
72 71
73 </LinearLayout> 72 </LinearLayout>
74 73
75 <RelativeLayout 74 <RelativeLayout
76 android:layout_width="match_parent" 75 android:layout_width="match_parent"
77 android:layout_height="match_parent"> 76 android:layout_height="match_parent">
78 77
79 <android.support.v7.widget.RecyclerView 78 <android.support.v7.widget.RecyclerView
80 android:id="@+id/rcv_search_result" 79 android:id="@+id/rcv_search_result"
81 android:layout_width="match_parent" 80 android:layout_width="match_parent"
82 android:layout_height="match_parent" 81 android:layout_height="match_parent"
83 android:layout_marginTop="8dp" /> 82 android:layout_marginTop="8dp" />
84 83
85 <ProgressBar 84 <ProgressBar
86 android:id="@+id/pb_seaching" 85 android:id="@+id/pb_seaching"
87 android:layout_width="48dp" 86 android:layout_width="48dp"
88 android:layout_height="48dp" 87 android:layout_height="48dp"
89 android:layout_centerHorizontal="true" 88 android:layout_centerHorizontal="true"
90 android:layout_marginTop="16dp" /> 89 android:layout_marginTop="16dp" />
91 </RelativeLayout> 90 </RelativeLayout>
92 </LinearLayout> 91 </LinearLayout>
app/src/main/res/layout/fragment_sns_topic.xml
1 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 1 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
2 android:id="@+id/layout_main_sns_screen" 2 android:id="@+id/layout_main_sns_screen"
3 android:layout_width="match_parent" 3 android:layout_width="match_parent"
4 android:layout_height="match_parent" 4 android:layout_height="match_parent"
5 android:background="@color/background_main"
6 android:orientation="vertical" 5 android:orientation="vertical"
7 android:visibility="visible"> 6 android:visibility="visible">
8 7
9 <LinearLayout 8 <LinearLayout
10 android:id="@+id/layout_top" 9 android:id="@+id/layout_top"
11 android:layout_width="match_parent" 10 android:layout_width="match_parent"
12 android:layout_height="wrap_content" 11 android:layout_height="wrap_content"
13 android:gravity="center" 12 android:gravity="center"
14 android:orientation="vertical"> 13 android:orientation="vertical">
15 14
16 <Button 15 <Button
17 android:id="@+id/btn_recommended_group" 16 android:id="@+id/btn_recommended_group"
18 android:layout_width="match_parent" 17 android:layout_width="match_parent"
19 android:layout_height="wrap_content" 18 android:layout_height="wrap_content"
20 android:layout_marginLeft="36dp" 19 android:layout_marginLeft="36dp"
21 android:layout_marginRight="36dp" 20 android:layout_marginRight="36dp"
22 android:layout_marginTop="24dp" 21 android:layout_marginTop="24dp"
23 android:background="@drawable/button_background" 22 android:background="@drawable/button_background"
24 android:text="ใ‚ชใ‚นใ‚นใƒกใ‚ฐใƒซใƒผใƒ—" /> 23 android:text="ใ‚ชใ‚นใ‚นใƒกใ‚ฐใƒซใƒผใƒ—" />
25 24
26 <Button 25 <Button
27 android:id="@+id/btn_my_group" 26 android:id="@+id/btn_my_group"
28 android:layout_width="match_parent" 27 android:layout_width="match_parent"
29 android:layout_height="wrap_content" 28 android:layout_height="wrap_content"
30 android:layout_marginBottom="24dp" 29 android:layout_marginBottom="24dp"
31 android:layout_marginLeft="36dp" 30 android:layout_marginLeft="36dp"
32 android:layout_marginRight="36dp" 31 android:layout_marginRight="36dp"
33 android:layout_marginTop="16dp" 32 android:layout_marginTop="16dp"
34 android:background="@drawable/button_background" 33 android:background="@drawable/button_background"
35 android:text="ใƒžใ‚คใ‚ฐใƒซใƒผใƒ—" /> 34 android:text="ใƒžใ‚คใ‚ฐใƒซใƒผใƒ—" />
36 </LinearLayout> 35 </LinearLayout>
37 36
38 <LinearLayout 37 <LinearLayout
39 android:id="@+id/layout_topic" 38 android:id="@+id/layout_topic"
40 android:layout_width="match_parent" 39 android:layout_width="match_parent"
41 android:layout_height="match_parent" 40 android:layout_height="match_parent"
42 android:layout_below="@id/layout_top" 41 android:layout_below="@id/layout_top"
43 android:orientation="vertical"> 42 android:orientation="vertical">
44 43
45 <TextView 44 <TextView
46 android:layout_width="wrap_content" 45 android:layout_width="wrap_content"
47 android:layout_height="wrap_content" 46 android:layout_height="wrap_content"
48 android:layout_gravity="center_horizontal" 47 android:layout_gravity="center_horizontal"
49 android:text="ๆœ€่ฟ‘ใฎ่ฉฑ้กŒ" 48 android:text="ๆœ€่ฟ‘ใฎ่ฉฑ้กŒ"
50 android:textColor="@android:color/white" 49 android:textColor="@android:color/white"
51 android:textSize="22sp" /> 50 android:textSize="22sp" />
52 51
53 <android.support.v4.widget.SwipeRefreshLayout 52 <android.support.v4.widget.SwipeRefreshLayout
54 android:id="@+id/swipe_topic" 53 android:id="@+id/swipe_topic"
55 android:layout_width="match_parent" 54 android:layout_width="match_parent"
56 android:layout_height="match_parent"> 55 android:layout_height="match_parent">
57 56
58 <android.support.v7.widget.RecyclerView 57 <android.support.v7.widget.RecyclerView
59 android:id="@+id/rcv_topic" 58 android:id="@+id/rcv_topic"
60 android:layout_width="match_parent" 59 android:layout_width="match_parent"
61 android:layout_height="match_parent" 60 android:layout_height="match_parent"
62 android:layout_marginTop="8dp" 61 android:layout_marginTop="8dp"
63 android:scrollbars="vertical" /> 62 android:scrollbars="vertical" />
64 </android.support.v4.widget.SwipeRefreshLayout> 63 </android.support.v4.widget.SwipeRefreshLayout>
65 </LinearLayout> 64 </LinearLayout>
66 65
67 </LinearLayout> 66 </LinearLayout>
app/src/main/res/layout/fragment_top.xml
1 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 1 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
2 xmlns:appNs="http://schemas.android.com/apk/res-auto" 2 xmlns:appNs="http://schemas.android.com/apk/res-auto"
3 android:layout_width="match_parent" 3 android:layout_width="match_parent"
4 android:layout_height="match_parent" 4 android:layout_height="match_parent"
5 android:background="@color/background_main"
6 android:orientation="vertical"> 5 android:orientation="vertical">
7 <FrameLayout 6 <FrameLayout
8 android:id="@+id/layout_top" 7 android:id="@+id/layout_top"
9 android:layout_width="match_parent" 8 android:layout_width="match_parent"
10 android:layout_height="match_parent"> 9 android:layout_height="match_parent">
11 </FrameLayout> 10 </FrameLayout>
12 </LinearLayout> 11 </LinearLayout>
13 12
app/src/main/res/layout/fragment_top_date.xml
1 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 1 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
2 xmlns:appNs="http://schemas.android.com/apk/res-auto" 2 xmlns:appNs="http://schemas.android.com/apk/res-auto"
3 android:layout_width="match_parent" 3 android:layout_width="match_parent"
4 android:layout_height="match_parent" 4 android:layout_height="match_parent">
5 android:background="@color/background_main">
6 5
7 <ScrollView 6 <ScrollView
8 android:layout_width="match_parent" 7 android:layout_width="match_parent"
9 android:layout_height="match_parent" 8 android:layout_height="match_parent"
10 android:layout_alignParentTop="true" 9 android:layout_alignParentTop="true"
11 android:layout_alignParentStart="true"> 10 android:layout_alignParentStart="true">
12 11
13 <LinearLayout 12 <LinearLayout
14 android:layout_width="match_parent" 13 android:layout_width="match_parent"
15 android:layout_height="wrap_content" 14 android:layout_height="wrap_content"
16 android:orientation="vertical" 15 android:orientation="vertical"
17 android:padding="10dp"> 16 android:padding="10dp">
18 17
19 <LinearLayout 18 <LinearLayout
20 android:layout_width="match_parent" 19 android:layout_width="match_parent"
21 android:layout_height="wrap_content" 20 android:layout_height="wrap_content"
22 android:orientation="horizontal"> 21 android:orientation="horizontal">
23 22
24 <ImageView 23 <de.hdodenhof.circleimageview.CircleImageView
25 android:id="@+id/iv_toDay" 24 android:id="@+id/iv_toDay"
26 android:layout_width="wrap_content" 25 android:layout_width="150dp"
27 android:layout_height="wrap_content" 26 android:layout_height="150dp"
28 android:src="@drawable/add_ic" /> 27 android:src="@drawable/ic_detail" />
29 28
30 <LinearLayout 29 <LinearLayout
31 android:layout_width="0dp" 30 android:layout_width="0dp"
32 android:layout_height="wrap_content" 31 android:layout_height="wrap_content"
33 android:layout_weight="1.0" 32 android:layout_weight="1.0"
34 android:orientation="horizontal" 33 android:orientation="horizontal"
35 android:paddingTop="10dp"> 34 android:paddingTop="10dp">
36 35
37 <ImageView 36 <ImageView
38 android:id="@+id/iv_back" 37 android:id="@+id/iv_back"
39 android:layout_width="@dimen/next_date_height" 38 android:layout_width="@dimen/next_date_height"
40 android:layout_height="@dimen/next_date_height" 39 android:layout_height="@dimen/next_date_height"
41 android:src="@drawable/back_ic" /> 40 android:src="@drawable/back_ic" />
42 41
43 <TextView 42 <TextView
44 android:id="@+id/tv_date" 43 android:id="@+id/tv_date"
45 android:layout_width="0dp" 44 android:layout_width="0dp"
46 android:layout_height="match_parent" 45 android:layout_height="match_parent"
47 android:layout_weight="1.0" 46 android:layout_weight="1.0"
48 android:gravity="center" 47 android:gravity="center"
49 android:text="2017ๅนด1ๆœˆ1ๆ—ฅ" 48 android:text="2017ๅนด1ๆœˆ1ๆ—ฅ"
50 android:textColor="@color/white" 49 android:textColor="@color/white"
51 android:textSize="21sp" /> 50 android:textSize="21sp" />
52 51
53 <ImageView 52 <ImageView
54 android:id="@+id/iv_next" 53 android:id="@+id/iv_next"
55 android:layout_width="@dimen/next_date_height" 54 android:layout_width="@dimen/next_date_height"
56 android:layout_height="@dimen/next_date_height" 55 android:layout_height="@dimen/next_date_height"
57 android:src="@drawable/next_ic" /> 56 android:src="@drawable/next_ic" />
58 57
59 </LinearLayout> 58 </LinearLayout>
60 59
61 </LinearLayout> 60 </LinearLayout>
62 61
63 <LinearLayout 62 <LinearLayout
64 android:layout_width="match_parent" 63 android:layout_width="match_parent"
65 android:layout_height="wrap_content" 64 android:layout_height="wrap_content"
66 android:orientation="horizontal" 65 android:orientation="horizontal"
67 android:gravity="right" 66 android:gravity="right"
68 android:paddingTop="10dp"> 67 android:paddingTop="10dp">
69 68
70 <TextView 69 <TextView
71 android:id="@+id/tv_step" 70 android:id="@+id/tv_step"
72 android:layout_width="wrap_content" 71 android:layout_width="wrap_content"
73 android:layout_height="wrap_content" 72 android:layout_height="wrap_content"
74 android:text="12,345" 73 android:text="12,345"
75 android:textColor="@color/white" 74 android:textColor="@color/white"
76 android:textSize="60sp"/> 75 android:textSize="60sp"/>
77 76
78 <TextView 77 <TextView
79 android:layout_width="wrap_content" 78 android:layout_width="wrap_content"
80 android:layout_height="wrap_content" 79 android:layout_height="wrap_content"
81 android:text="@string/step" 80 android:text="@string/step"
82 android:textColor="@color/white" 81 android:textColor="@color/white"
83 android:textSize="40sp" 82 android:textSize="40sp"
84 android:paddingLeft="10dp"/> 83 android:paddingLeft="10dp"/>
85 84
86 </LinearLayout> 85 </LinearLayout>
87 86
88 <LinearLayout 87 <LinearLayout
89 android:layout_width="match_parent" 88 android:layout_width="match_parent"
90 android:layout_height="wrap_content" 89 android:layout_height="wrap_content"
91 android:orientation="horizontal" 90 android:orientation="horizontal"
92 android:gravity="right"> 91 android:gravity="right">
93 92
94 <TextView 93 <TextView
95 android:id="@+id/textView" 94 android:id="@+id/textView"
96 android:layout_width="wrap_content" 95 android:layout_width="wrap_content"
97 android:layout_height="wrap_content" 96 android:layout_height="wrap_content"
98 android:text="@string/remaining_number_step" 97 android:text="@string/remaining_number_step"
99 android:textColor="@color/white" 98 android:textColor="@color/white"
100 android:textSize="16sp" /> 99 android:textSize="16sp" />
101 100
102 <TextView 101 <TextView
103 android:id="@+id/tv_remainingStep" 102 android:id="@+id/tv_remainingStep"
104 android:layout_width="wrap_content" 103 android:layout_width="wrap_content"
105 android:layout_height="wrap_content" 104 android:layout_height="wrap_content"
106 android:text="12,345" 105 android:text="12,345"
107 android:textColor="@color/white" 106 android:textColor="@color/white"
108 android:textSize="16sp" 107 android:textSize="16sp"
109 android:paddingLeft="10dp"/> 108 android:paddingLeft="10dp"/>
110 109
111 </LinearLayout> 110 </LinearLayout>
112 111
113 <LinearLayout 112 <LinearLayout
114 android:layout_width="match_parent" 113 android:layout_width="match_parent"
115 android:layout_height="wrap_content" 114 android:layout_height="wrap_content"
116 android:orientation="horizontal" 115 android:orientation="horizontal"
117 android:gravity="right"> 116 android:gravity="right">
118 117
119 <TextView 118 <TextView
120 android:layout_width="wrap_content" 119 android:layout_width="wrap_content"
121 android:layout_height="wrap_content" 120 android:layout_height="wrap_content"
122 android:text="@string/achiverment_rate" 121 android:text="@string/achiverment_rate"
123 android:textColor="@color/white" 122 android:textColor="@color/white"
124 android:textSize="16sp"/> 123 android:textSize="16sp"/>
125 124
126 <TextView 125 <TextView
127 android:id="@+id/tv_completeRate" 126 android:id="@+id/tv_completeRate"
128 android:layout_width="wrap_content" 127 android:layout_width="wrap_content"
129 android:layout_height="wrap_content" 128 android:layout_height="wrap_content"
130 android:text="12%" 129 android:text="12%"
131 android:textColor="@color/white" 130 android:textColor="@color/white"
132 android:textSize="16sp" 131 android:textSize="16sp"
133 android:paddingLeft="10dp"/> 132 android:paddingLeft="10dp"/>
134 133
135 </LinearLayout> 134 </LinearLayout>
136 135
137 <LinearLayout 136 <LinearLayout
138 android:layout_width="match_parent" 137 android:layout_width="match_parent"
139 android:layout_height="wrap_content" 138 android:layout_height="wrap_content"
140 android:orientation="vertical" 139 android:orientation="vertical"
141 android:paddingTop="50dp"> 140 android:paddingTop="50dp">
142 141
143 <TextView 142 <TextView
144 android:layout_width="wrap_content" 143 android:layout_width="wrap_content"
145 android:layout_height="wrap_content" 144 android:layout_height="wrap_content"
146 android:text="@string/notify" 145 android:text="@string/notify"
147 android:textColor="@color/white" 146 android:textColor="@color/white"
148 android:textSize="16sp"/> 147 android:textSize="16sp"/>
149 148
150 <com.dinhcv.lifelogpedometer.customview.ExpandableListCustomView 149 <com.dinhcv.lifelogpedometer.customview.ExpandableListCustomView
151 android:id="@+id/lv_notice" 150 android:id="@+id/lv_notice"
152 android:layout_width="match_parent" 151 android:layout_width="match_parent"
153 android:layout_height="wrap_content" 152 android:layout_height="wrap_content"
154 android:divider="@null" 153 android:divider="@null"
155 android:visibility="visible" /> 154 android:visibility="visible" />
156 155
157 </LinearLayout> 156 </LinearLayout>
158 157
159 158
160 159
161 160
162 </LinearLayout> 161 </LinearLayout>
163 </ScrollView> 162 </ScrollView>
164 <include layout="@layout/type_step" /> 163 <include layout="@layout/type_step" />
165 </RelativeLayout> 164 </RelativeLayout>
166 165
app/src/main/res/layout/fragment_top_today.xml
1 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 1 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
2 xmlns:appNs="http://schemas.android.com/apk/res-auto" 2 xmlns:appNs="http://schemas.android.com/apk/res-auto"
3 android:layout_width="match_parent" 3 android:layout_width="match_parent"
4 android:layout_height="match_parent" 4 android:layout_height="match_parent">
5 android:background="@color/background_main">
6 5
7 <ScrollView 6 <ScrollView
8 android:layout_width="match_parent" 7 android:layout_width="match_parent"
9 android:layout_height="match_parent" 8 android:layout_height="match_parent"
10 android:layout_alignParentTop="true" 9 android:layout_alignParentTop="true"
11 android:layout_alignParentStart="true" 10 android:layout_alignParentStart="true"
12 android:layout_above="@+id/ll_stepType"> 11 android:layout_above="@+id/ll_stepType">
13 12
14 <LinearLayout 13 <LinearLayout
15 android:layout_width="match_parent" 14 android:layout_width="match_parent"
16 android:layout_height="wrap_content" 15 android:layout_height="wrap_content"
17 android:orientation="vertical" 16 android:orientation="vertical"
18 android:padding="10dp"> 17 android:padding="10dp">
19 18
20 19
21 <LinearLayout 20 <LinearLayout
22 android:layout_width="match_parent" 21 android:layout_width="match_parent"
23 android:layout_height="wrap_content" 22 android:layout_height="wrap_content"
24 android:orientation="horizontal" 23 android:orientation="horizontal"
25 android:paddingTop="10dp"> 24 android:paddingTop="10dp">
26 25
27 <ImageView 26 <ImageView
28 android:id="@+id/iv_back" 27 android:id="@+id/iv_back"
29 android:layout_width="@dimen/next_date_height" 28 android:layout_width="@dimen/next_date_height"
30 android:layout_height="@dimen/next_date_height" 29 android:layout_height="@dimen/next_date_height"
31 android:src="@drawable/back_ic" /> 30 android:src="@drawable/back_ic" />
32 31
33 <TextView 32 <TextView
34 android:id="@+id/tv_date" 33 android:id="@+id/tv_date"
35 android:layout_width="0dp" 34 android:layout_width="0dp"
36 android:layout_height="match_parent" 35 android:layout_height="match_parent"
37 android:layout_weight="1.0" 36 android:layout_weight="1.0"
38 android:gravity="center" 37 android:gravity="center"
39 android:text="2017ๅนด1ๆœˆ1ๆ—ฅ" 38 android:text="2017ๅนด1ๆœˆ1ๆ—ฅ"
40 android:textColor="@color/white" 39 android:textColor="@color/white"
41 android:textSize="23sp" /> 40 android:textSize="23sp" />
42 41
43 <ImageView 42 <ImageView
44 android:id="@+id/iv_next" 43 android:id="@+id/iv_next"
45 android:layout_width="@dimen/next_date_height" 44 android:layout_width="@dimen/next_date_height"
46 android:layout_height="@dimen/next_date_height" 45 android:layout_height="@dimen/next_date_height"
47 android:src="@drawable/next_ic" /> 46 android:src="@drawable/next_ic" />
48 47
49 </LinearLayout> 48 </LinearLayout>
50 49
51 <LinearLayout 50 <LinearLayout
52 android:layout_width="match_parent" 51 android:layout_width="match_parent"
53 android:layout_height="wrap_content" 52 android:layout_height="wrap_content"
54 android:orientation="horizontal" 53 android:orientation="horizontal"
55 android:paddingTop="10dp" 54 android:paddingTop="10dp"
56 android:weightSum="100"> 55 android:weightSum="100">
57 56
58 <LinearLayout 57 <LinearLayout
59 android:layout_width="0dp" 58 android:layout_width="0dp"
60 android:layout_height="wrap_content" 59 android:layout_height="wrap_content"
61 android:layout_weight="15" 60 android:layout_weight="15"
62 android:orientation="vertical"> 61 android:orientation="vertical">
63 62
64 <ImageView 63 <ImageView
65 android:layout_width="match_parent" 64 android:layout_width="match_parent"
66 android:layout_height="wrap_content" 65 android:layout_height="wrap_content"
67 android:src="@drawable/goout_ic" 66 android:src="@drawable/goout_ic"
68 android:adjustViewBounds="true"/> 67 android:adjustViewBounds="true"/>
69 68
70 <ImageView 69 <ImageView
71 android:layout_width="match_parent" 70 android:layout_width="match_parent"
72 android:layout_height="wrap_content" 71 android:layout_height="wrap_content"
73 android:src="@drawable/ic_face" 72 android:src="@drawable/ic_face"
74 android:adjustViewBounds="true" 73 android:adjustViewBounds="true"
75 android:paddingTop="6dp"/> 74 android:paddingTop="6dp"/>
76 75
77 <ImageView 76 <ImageView
78 android:layout_width="match_parent" 77 android:layout_width="match_parent"
79 android:layout_height="wrap_content" 78 android:layout_height="wrap_content"
80 android:src="@drawable/ic_line" 79 android:src="@drawable/ic_line"
81 android:adjustViewBounds="true" 80 android:adjustViewBounds="true"
82 android:paddingTop="10dp"/> 81 android:paddingTop="10dp"/>
83 82
84 </LinearLayout> 83 </LinearLayout>
85 84
86 <RelativeLayout 85 <RelativeLayout
87 android:layout_width="0dp" 86 android:layout_width="0dp"
88 android:layout_height="wrap_content" 87 android:layout_height="wrap_content"
89 android:layout_weight="60" 88 android:layout_weight="60"
90 android:paddingLeft="10dp"> 89 android:paddingLeft="10dp">
91 90
92 <org.eazegraph.lib.charts.PieChart 91 <org.eazegraph.lib.charts.PieChart
93 xmlns:eaze="http://schemas.android.com/apk/res-auto" 92 xmlns:eaze="http://schemas.android.com/apk/res-auto"
94 android:id="@+id/graph" 93 android:id="@+id/graph"
95 android:layout_width="match_parent" 94 android:layout_width="match_parent"
96 android:layout_height="200dp" 95 android:layout_height="200dp"
97 android:layout_marginTop="10dp" 96 android:layout_marginTop="10dp"
98 eaze:egLegendHeight="0dp" 97 eaze:egLegendHeight="0dp"
99 eaze:egInnerPadding="93" 98 eaze:egInnerPadding="93"
100 eaze:egInnerPaddingColor="@color/background_main" 99 eaze:egInnerPaddingColor="@color/bg_main"
101 eaze:egHighlightStrength="1"/> 100 eaze:egHighlightStrength="1"/>
102 101
103 <LinearLayout 102 <LinearLayout
104 android:layout_width="match_parent" 103 android:layout_width="match_parent"
105 android:layout_height="200dp" 104 android:layout_height="200dp"
106 android:layout_marginTop="10dp" 105 android:layout_marginTop="10dp"
107 android:orientation="vertical" 106 android:orientation="vertical"
108 android:gravity="center_horizontal"> 107 android:gravity="center_horizontal">
109 108
110 <ImageView 109 <ImageView
111 android:layout_width="@dimen/walking_img_height" 110 android:layout_width="@dimen/walking_img_height"
112 android:layout_height="@dimen/walking_img_height" 111 android:layout_height="@dimen/walking_img_height"
113 android:layout_marginTop="25dp" 112 android:layout_marginTop="25dp"
114 android:gravity="center" 113 android:gravity="center"
115 android:src="@drawable/walking_ic"/> 114 android:src="@drawable/walking_ic"/>
116 115
117 <TextView 116 <TextView
118 android:id="@+id/steps" 117 android:id="@+id/steps"
119 android:layout_width="match_parent" 118 android:layout_width="match_parent"
120 android:layout_height="wrap_content" 119 android:layout_height="wrap_content"
121 android:gravity="center" 120 android:gravity="center"
122 android:textSize="45sp" 121 android:textSize="45sp"
123 android:text="10.000" 122 android:text="10.000"
124 android:textColor="@color/white"/> 123 android:textColor="@color/white"/>
125 124
126 <TextView 125 <TextView
127 android:id="@+id/tv_smallStepGoal" 126 android:id="@+id/tv_smallStepGoal"
128 android:layout_width="wrap_content" 127 android:layout_width="wrap_content"
129 android:layout_height="wrap_content" 128 android:layout_height="wrap_content"
130 android:text="@string/pie_text_content1" 129 android:text="@string/pie_text_content1"
131 android:textSize="14sp" 130 android:textSize="14sp"
132 android:padding="4dp" 131 android:padding="4dp"
133 android:textColor="@color/white"/> 132 android:textColor="@color/white"/>
134 133
135 <TextView 134 <TextView
136 android:layout_width="wrap_content" 135 android:layout_width="wrap_content"
137 android:layout_height="wrap_content" 136 android:layout_height="wrap_content"
138 android:text="@string/pie_text_content2" 137 android:text="@string/pie_text_content2"
139 android:textSize="14sp" 138 android:textSize="14sp"
140 android:textColor="@color/white"/> 139 android:textColor="@color/white"/>
141 140
142 <TextView 141 <TextView
143 android:id="@+id/tv_smallRemain" 142 android:id="@+id/tv_smallRemain"
144 android:layout_width="wrap_content" 143 android:layout_width="wrap_content"
145 android:layout_height="wrap_content" 144 android:layout_height="wrap_content"
146 android:layout_below="@+id/steps" 145 android:layout_below="@+id/steps"
147 android:layout_centerHorizontal="true" 146 android:layout_centerHorizontal="true"
148 android:text="@string/pie_text_content3" 147 android:text="@string/pie_text_content3"
149 android:textSize="14sp" 148 android:textSize="14sp"
150 android:textColor="@color/white"/> 149 android:textColor="@color/white"/>
151 150
152 </LinearLayout> 151 </LinearLayout>
153 152
154 </RelativeLayout> 153 </RelativeLayout>
155 154
156 <LinearLayout 155 <LinearLayout
157 android:layout_width="0dp" 156 android:layout_width="0dp"
158 android:layout_height="wrap_content" 157 android:layout_height="wrap_content"
159 android:layout_weight="25" 158 android:layout_weight="25"
160 android:gravity="center" 159 android:gravity="center"
161 android:orientation="vertical"> 160 android:orientation="vertical">
162 161
163 <TextView 162 <TextView
164 android:layout_width="wrap_content" 163 android:layout_width="wrap_content"
165 android:layout_height="wrap_content" 164 android:layout_height="wrap_content"
166 android:text="@string/goal_jp" 165 android:text="@string/goal_jp"
167 android:textColor="@color/white" 166 android:textColor="@color/white"
168 android:textSize="16sp" /> 167 android:textSize="16sp" />
169 168
170 <TextView 169 <TextView
171 android:id="@+id/tv_stepGoal" 170 android:id="@+id/tv_stepGoal"
172 android:layout_width="wrap_content" 171 android:layout_width="wrap_content"
173 android:layout_height="wrap_content" 172 android:layout_height="wrap_content"
174 android:paddingLeft="10dp" 173 android:paddingLeft="10dp"
175 android:text="10000ๆญฉ" 174 android:text="10000ๆญฉ"
176 android:textColor="@color/white" 175 android:textColor="@color/white"
177 android:textSize="16sp" /> 176 android:textSize="16sp" />
178 177
179 <TextView 178 <TextView
180 android:layout_width="wrap_content" 179 android:layout_width="wrap_content"
181 android:layout_height="wrap_content" 180 android:layout_height="wrap_content"
182 android:paddingTop="10dp" 181 android:paddingTop="10dp"
183 android:text="@string/remaining_number_step" 182 android:text="@string/remaining_number_step"
184 android:textColor="@color/white" 183 android:textColor="@color/white"
185 android:textSize="16sp" /> 184 android:textSize="16sp" />
186 185
187 <TextView 186 <TextView
188 android:id="@+id/tv_stepRemain" 187 android:id="@+id/tv_stepRemain"
189 android:layout_width="wrap_content" 188 android:layout_width="wrap_content"
190 android:layout_height="wrap_content" 189 android:layout_height="wrap_content"
191 android:paddingLeft="10dp" 190 android:paddingLeft="10dp"
192 android:text="3000ๆญฉ" 191 android:text="3000ๆญฉ"
193 android:textColor="@color/white" 192 android:textColor="@color/white"
194 android:textSize="16sp" /> 193 android:textSize="16sp" />
195 194
196 <TextView 195 <TextView
197 android:layout_width="wrap_content" 196 android:layout_width="wrap_content"
198 android:layout_height="wrap_content" 197 android:layout_height="wrap_content"
199 android:paddingTop="10dp" 198 android:paddingTop="10dp"
200 android:text="@string/achiverment_rate" 199 android:text="@string/achiverment_rate"
201 android:textColor="@color/white" 200 android:textColor="@color/white"
202 android:textSize="16sp" /> 201 android:textSize="16sp" />
203 202
204 <TextView 203 <TextView
205 android:id="@+id/tv_stepRateDone" 204 android:id="@+id/tv_stepRateDone"
206 android:layout_width="wrap_content" 205 android:layout_width="wrap_content"
207 android:layout_height="wrap_content" 206 android:layout_height="wrap_content"
208 android:paddingLeft="10dp" 207 android:paddingLeft="10dp"
209 android:text="78%" 208 android:text="78%"
210 android:textColor="@color/white" 209 android:textColor="@color/white"
211 android:textSize="16sp" /> 210 android:textSize="16sp" />
212 211
213 </LinearLayout> 212 </LinearLayout>
214 213
215 </LinearLayout> 214 </LinearLayout>
216 215
217 <LinearLayout 216 <LinearLayout
218 android:layout_width="match_parent" 217 android:layout_width="match_parent"
219 android:layout_height="wrap_content" 218 android:layout_height="wrap_content"
220 android:weightSum="100" 219 android:weightSum="100"
221 android:paddingTop="20dp" 220 android:paddingTop="20dp"
222 android:orientation="horizontal"> 221 android:orientation="horizontal">
223 222
224 <LinearLayout 223 <LinearLayout
225 android:layout_width="0dp" 224 android:layout_width="0dp"
226 android:layout_height="wrap_content" 225 android:layout_height="wrap_content"
227 android:layout_weight="10" 226 android:layout_weight="10"
228 android:gravity="center" 227 android:gravity="center"
229 android:orientation="vertical"> 228 android:orientation="vertical">
230 229
231 </LinearLayout> 230 </LinearLayout>
232 231
233 <LinearLayout 232 <LinearLayout
234 android:layout_width="0dp" 233 android:layout_width="0dp"
235 android:layout_height="wrap_content" 234 android:layout_height="wrap_content"
236 android:layout_weight="20" 235 android:layout_weight="20"
237 android:gravity="center" 236 android:gravity="center"
238 android:orientation="vertical"> 237 android:orientation="vertical">
239 238
240 <ImageView 239 <ImageView
241 android:layout_width="wrap_content" 240 android:layout_width="wrap_content"
242 android:layout_height="wrap_content" 241 android:layout_height="wrap_content"
243 android:src="@drawable/category" 242 android:src="@drawable/category"
244 android:adjustViewBounds="true"/> 243 android:adjustViewBounds="true"/>
245 244
246 </LinearLayout> 245 </LinearLayout>
247 246
248 <LinearLayout 247 <LinearLayout
249 android:layout_width="0dp" 248 android:layout_width="0dp"
250 android:layout_height="wrap_content" 249 android:layout_height="wrap_content"
251 android:layout_weight="30" 250 android:layout_weight="30"
252 android:gravity="center" 251 android:gravity="center"
253 android:orientation="vertical"> 252 android:orientation="vertical">
254 253
255 <TextView 254 <TextView
256 android:id="@+id/tv_distance" 255 android:id="@+id/tv_distance"
257 android:layout_width="wrap_content" 256 android:layout_width="wrap_content"
258 android:layout_height="wrap_content" 257 android:layout_height="wrap_content"
259 android:text="4.9" 258 android:text="4.9"
260 android:textColor="@color/white" 259 android:textColor="@color/white"
261 android:textSize="22sp" /> 260 android:textSize="22sp" />
262 261
263 </LinearLayout> 262 </LinearLayout>
264 263
265 <LinearLayout 264 <LinearLayout
266 android:layout_width="0dp" 265 android:layout_width="0dp"
267 android:layout_height="wrap_content" 266 android:layout_height="wrap_content"
268 android:layout_weight="30" 267 android:layout_weight="30"
269 android:gravity="center" 268 android:gravity="center"
270 android:orientation="vertical"> 269 android:orientation="vertical">
271 270
272 <TextView 271 <TextView
273 android:id="@+id/tv_time" 272 android:id="@+id/tv_time"
274 android:layout_width="wrap_content" 273 android:layout_width="wrap_content"
275 android:layout_height="wrap_content" 274 android:layout_height="wrap_content"
276 android:text="1:09" 275 android:text="1:09"
277 android:textColor="@color/white" 276 android:textColor="@color/white"
278 android:textSize="22sp" /> 277 android:textSize="22sp" />
279 278
280 </LinearLayout> 279 </LinearLayout>
281 280
282 <LinearLayout 281 <LinearLayout
283 android:layout_width="0dp" 282 android:layout_width="0dp"
284 android:layout_height="wrap_content" 283 android:layout_height="wrap_content"
285 android:layout_weight="10" 284 android:layout_weight="10"
286 android:gravity="center" 285 android:gravity="center"
287 android:orientation="vertical"> 286 android:orientation="vertical">
288 287
289 <ImageView 288 <ImageView
290 android:layout_width="@dimen/next_date_height" 289 android:layout_width="@dimen/next_date_height"
291 android:layout_height="wrap_content" 290 android:layout_height="wrap_content"
292 android:src="@drawable/pause" 291 android:src="@drawable/pause"
293 android:background="@color/white" 292 android:background="@color/white"
294 android:adjustViewBounds="true" 293 android:adjustViewBounds="true"
295 android:visibility="gone"/> 294 android:visibility="gone"/>
296 295
297 </LinearLayout> 296 </LinearLayout>
298 </LinearLayout> 297 </LinearLayout>
299 298
300 <LinearLayout 299 <LinearLayout
301 android:layout_width="match_parent" 300 android:layout_width="match_parent"
302 android:layout_height="wrap_content" 301 android:layout_height="wrap_content"
303 android:weightSum="100" 302 android:weightSum="100"
304 android:orientation="horizontal"> 303 android:orientation="horizontal">
305 304
306 <LinearLayout 305 <LinearLayout
307 android:layout_width="0dp" 306 android:layout_width="0dp"
308 android:layout_height="wrap_content" 307 android:layout_height="wrap_content"
309 android:layout_weight="20" 308 android:layout_weight="20"
310 android:gravity="center" 309 android:gravity="center"
311 android:orientation="vertical"> 310 android:orientation="vertical">
312 311
313 </LinearLayout> 312 </LinearLayout>
314 313
315 <LinearLayout 314 <LinearLayout
316 android:layout_width="0dp" 315 android:layout_width="0dp"
317 android:layout_height="wrap_content" 316 android:layout_height="wrap_content"
318 android:layout_weight="20" 317 android:layout_weight="20"
319 android:gravity="center" 318 android:gravity="center"
320 android:orientation="vertical"> 319 android:orientation="vertical">
321 320
322 <TextView 321 <TextView
323 android:layout_width="wrap_content" 322 android:layout_width="wrap_content"
324 android:layout_height="wrap_content" 323 android:layout_height="wrap_content"
325 android:text="@string/carori" 324 android:text="@string/carori"
326 android:textColor="@color/white" 325 android:textColor="@color/white"
327 android:textSize="16sp" /> 326 android:textSize="16sp" />
328 327
329 </LinearLayout> 328 </LinearLayout>
330 329
331 <LinearLayout 330 <LinearLayout
332 android:layout_width="0dp" 331 android:layout_width="0dp"
333 android:layout_height="wrap_content" 332 android:layout_height="wrap_content"
334 android:layout_weight="20" 333 android:layout_weight="20"
335 android:gravity="center" 334 android:gravity="center"
336 android:orientation="vertical"> 335 android:orientation="vertical">
337 336
338 <TextView 337 <TextView
339 android:layout_width="wrap_content" 338 android:layout_width="wrap_content"
340 android:layout_height="wrap_content" 339 android:layout_height="wrap_content"
341 android:text="@string/km" 340 android:text="@string/km"
342 android:textColor="@color/white" 341 android:textColor="@color/white"
343 android:textSize="16sp" /> 342 android:textSize="16sp" />
344 343
345 </LinearLayout> 344 </LinearLayout>
346 345
347 <LinearLayout 346 <LinearLayout
348 android:layout_width="0dp" 347 android:layout_width="0dp"
349 android:layout_height="wrap_content" 348 android:layout_height="wrap_content"
350 android:layout_weight="20" 349 android:layout_weight="20"
351 android:gravity="center" 350 android:gravity="center"
352 android:orientation="vertical"> 351 android:orientation="vertical">
353 352
354 <TextView 353 <TextView
355 android:layout_width="wrap_content" 354 android:layout_width="wrap_content"
356 android:layout_height="wrap_content" 355 android:layout_height="wrap_content"
357 android:text="@string/time" 356 android:text="@string/time"
358 android:textColor="@color/white" 357 android:textColor="@color/white"
359 android:textSize="16sp" /> 358 android:textSize="16sp" />
360 359
361 </LinearLayout> 360 </LinearLayout>
362 </LinearLayout> 361 </LinearLayout>
363 362
364 363
365 <LinearLayout 364 <LinearLayout
366 android:layout_width="match_parent" 365 android:layout_width="match_parent"
367 android:layout_height="120dp" 366 android:layout_height="120dp"
368 android:orientation="vertical" 367 android:orientation="vertical"
369 android:layout_marginTop="10dp"> 368 android:layout_marginTop="10dp">
370 369
371 <!--<org.eazegraph.lib.charts.BarChart--> 370 <!--<org.eazegraph.lib.charts.BarChart-->
372 <!--xmlns:eaze="http://schemas.android.com/apk/res-auto"--> 371 <!--xmlns:eaze="http://schemas.android.com/apk/res-auto"-->
373 <!--android:id="@+id/bargraph"--> 372 <!--android:id="@+id/bargraph"-->
374 <!--android:layout_width="match_parent"--> 373 <!--android:layout_width="match_parent"-->
375 <!--android:layout_height="120dp"--> 374 <!--android:layout_height="120dp"-->
376 <!--android:layout_below="@+id/averageandtotaltext"--> 375 <!--android:layout_below="@+id/averageandtotaltext"-->
377 <!--eaze:egLegendHeight="0dp"--> 376 <!--eaze:egLegendHeight="0dp"-->
378 <!--eaze:egShowValues="false" />--> 377 <!--eaze:egShowValues="false" />-->
379 <com.github.mikephil.charting.charts.BarChart 378 <com.github.mikephil.charting.charts.BarChart
380 android:id="@+id/chart" 379 android:id="@+id/chart"
381 android:layout_width="match_parent" 380 android:layout_width="match_parent"
382 android:layout_height="match_parent" /> 381 android:layout_height="match_parent" />
383 382
384 383
385 </LinearLayout> 384 </LinearLayout>
386 385
387 386
388 </LinearLayout> 387 </LinearLayout>
389 </ScrollView> 388 </ScrollView>
390 389
391 <include layout="@layout/type_step" /> 390 <include layout="@layout/type_step" />
392 </RelativeLayout> 391 </RelativeLayout>
393 392
app/src/main/res/layout/history_page_7_content.xml
1 <?xml version="1.0" encoding="utf-8"?> 1 <?xml version="1.0" encoding="utf-8"?>
2 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 2 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3 android:layout_width="match_parent" 3 android:layout_width="match_parent"
4 android:layout_height="match_parent" 4 android:layout_height="match_parent"
5 android:orientation="vertical" 5 android:orientation="vertical">
6 android:background="@color/background_main">
7 6
8 <LinearLayout 7 <LinearLayout
9 android:layout_width="match_parent" 8 android:layout_width="match_parent"
10 android:layout_height="wrap_content" 9 android:layout_height="wrap_content"
11 android:orientation="horizontal" 10 android:orientation="horizontal"
12 android:paddingTop="10dp"> 11 android:paddingTop="10dp">
13 12
14 <RelativeLayout 13 <RelativeLayout
15 android:id="@+id/rl_stepView" 14 android:id="@+id/rl_stepView"
16 android:layout_width="200dp" 15 android:layout_width="200dp"
17 android:layout_height="200dp" 16 android:layout_height="200dp"
18 android:paddingLeft="10dp" 17 android:paddingLeft="10dp"
19 android:background="@drawable/round_shape"> 18 android:background="@drawable/round_shape">
20 19
21 <LinearLayout 20 <LinearLayout
22 android:layout_width="match_parent" 21 android:layout_width="match_parent"
23 android:layout_height="170dp" 22 android:layout_height="170dp"
24 android:layout_marginTop="10dp" 23 android:layout_marginTop="10dp"
25 android:gravity="center_horizontal" 24 android:gravity="center_horizontal"
26 android:orientation="vertical"> 25 android:orientation="vertical">
27 26
28 <ImageView 27 <ImageView
29 android:layout_width="@dimen/email_img_height" 28 android:layout_width="@dimen/email_img_height"
30 android:layout_height="@dimen/email_img_height" 29 android:layout_height="@dimen/email_img_height"
31 android:layout_marginTop="25dp" 30 android:layout_marginTop="25dp"
32 android:gravity="center" 31 android:gravity="center"
33 android:src="@drawable/ic_email" /> 32 android:src="@drawable/ic_email" />
34 33
35 <TextView 34 <TextView
36 android:id="@+id/tv_steps" 35 android:id="@+id/tv_steps"
37 android:layout_width="match_parent" 36 android:layout_width="match_parent"
38 android:layout_height="wrap_content" 37 android:layout_height="wrap_content"
39 android:gravity="center" 38 android:gravity="center"
40 android:text="500 step" 39 android:text="500 step"
41 android:textColor="@color/black" 40 android:textColor="@color/black"
42 android:textSize="35sp" /> 41 android:textSize="35sp" />
43 42
44 <TextView 43 <TextView
45 android:layout_width="wrap_content" 44 android:layout_width="wrap_content"
46 android:layout_height="wrap_content" 45 android:layout_height="wrap_content"
47 android:text="@string/pie_text_content2" 46 android:text="@string/pie_text_content2"
48 android:textColor="@color/black" 47 android:textColor="@color/black"
49 android:textSize="14sp" /> 48 android:textSize="14sp" />
50 49
51 <TextView 50 <TextView
52 android:id="@+id/tv_smallRemain" 51 android:id="@+id/tv_smallRemain"
53 android:layout_width="wrap_content" 52 android:layout_width="wrap_content"
54 android:layout_height="wrap_content" 53 android:layout_height="wrap_content"
55 android:layout_below="@+id/steps" 54 android:layout_below="@+id/steps"
56 android:layout_centerHorizontal="true" 55 android:layout_centerHorizontal="true"
57 android:text="@string/pie_text_content3" 56 android:text="@string/pie_text_content3"
58 android:textColor="@color/black" 57 android:textColor="@color/black"
59 android:textSize="14sp" /> 58 android:textSize="14sp" />
60 59
61 </LinearLayout> 60 </LinearLayout>
62 61
63 </RelativeLayout> 62 </RelativeLayout>
64 63
65 <LinearLayout 64 <LinearLayout
66 android:layout_width="0dp" 65 android:layout_width="0dp"
67 android:layout_height="wrap_content" 66 android:layout_height="wrap_content"
68 android:layout_weight="1.0" 67 android:layout_weight="1.0"
69 android:gravity="center" 68 android:gravity="center"
70 android:paddingLeft="20dp" 69 android:paddingLeft="20dp"
71 android:layout_gravity="center" 70 android:layout_gravity="center"
72 android:orientation="vertical"> 71 android:orientation="vertical">
73 72
74 <LinearLayout 73 <LinearLayout
75 android:layout_width="match_parent" 74 android:layout_width="match_parent"
76 android:layout_height="wrap_content" 75 android:layout_height="wrap_content"
77 android:orientation="horizontal"> 76 android:orientation="horizontal">
78 77
79 <TextView 78 <TextView
80 android:layout_width="wrap_content" 79 android:layout_width="wrap_content"
81 android:layout_height="wrap_content" 80 android:layout_height="wrap_content"
82 android:text="@string/goal_jp" 81 android:text="@string/goal_jp"
83 android:textColor="@color/white" 82 android:textColor="@color/white"
84 android:textSize="16sp" /> 83 android:textSize="16sp" />
85 84
86 <TextView 85 <TextView
87 android:id="@+id/tv_stepGoal" 86 android:id="@+id/tv_stepGoal"
88 android:layout_width="wrap_content" 87 android:layout_width="wrap_content"
89 android:layout_height="wrap_content" 88 android:layout_height="wrap_content"
90 android:paddingLeft="10dp" 89 android:paddingLeft="10dp"
91 android:text="1000 step" 90 android:text="1000 step"
92 android:textColor="@color/white" 91 android:textColor="@color/white"
93 android:textSize="16sp" /> 92 android:textSize="16sp" />
94 93
95 </LinearLayout> 94 </LinearLayout>
96 95
97 <LinearLayout 96 <LinearLayout
98 android:layout_width="match_parent" 97 android:layout_width="match_parent"
99 android:layout_height="wrap_content" 98 android:layout_height="wrap_content"
100 android:orientation="horizontal"> 99 android:orientation="horizontal">
101 100
102 <TextView 101 <TextView
103 android:layout_width="wrap_content" 102 android:layout_width="wrap_content"
104 android:layout_height="wrap_content" 103 android:layout_height="wrap_content"
105 android:text="@string/remaining_number_step" 104 android:text="@string/remaining_number_step"
106 android:textColor="@color/white" 105 android:textColor="@color/white"
107 android:textSize="16sp" /> 106 android:textSize="16sp" />
108 107
109 <TextView 108 <TextView
110 android:id="@+id/tv_stepRemain" 109 android:id="@+id/tv_stepRemain"
111 android:layout_width="wrap_content" 110 android:layout_width="wrap_content"
112 android:layout_height="wrap_content" 111 android:layout_height="wrap_content"
113 android:paddingLeft="10dp" 112 android:paddingLeft="10dp"
114 android:text="300 step" 113 android:text="300 step"
115 android:textColor="@color/white" 114 android:textColor="@color/white"
116 android:textSize="16sp" /> 115 android:textSize="16sp" />
117 116
118 </LinearLayout> 117 </LinearLayout>
119 118
120 <LinearLayout 119 <LinearLayout
121 android:layout_width="match_parent" 120 android:layout_width="match_parent"
122 android:layout_height="wrap_content" 121 android:layout_height="wrap_content"
123 android:orientation="horizontal"> 122 android:orientation="horizontal">
124 123
125 <TextView 124 <TextView
126 android:layout_width="wrap_content" 125 android:layout_width="wrap_content"
127 android:layout_height="wrap_content" 126 android:layout_height="wrap_content"
128 android:text="@string/achiverment_rate" 127 android:text="@string/achiverment_rate"
129 android:textColor="@color/white" 128 android:textColor="@color/white"
130 android:textSize="16sp" /> 129 android:textSize="16sp" />
131 130
132 <TextView 131 <TextView
133 android:id="@+id/tv_stepRateDone" 132 android:id="@+id/tv_stepRateDone"
134 android:layout_width="wrap_content" 133 android:layout_width="wrap_content"
135 android:layout_height="wrap_content" 134 android:layout_height="wrap_content"
136 android:paddingLeft="10dp" 135 android:paddingLeft="10dp"
137 android:text="78%" 136 android:text="78%"
138 android:textColor="@color/white" 137 android:textColor="@color/white"
139 android:textSize="16sp" /> 138 android:textSize="16sp" />
140 </LinearLayout> 139 </LinearLayout>
141 </LinearLayout> 140 </LinearLayout>
142 141
143 </LinearLayout> 142 </LinearLayout>
144 143
145 <LinearLayout 144 <LinearLayout
146 android:layout_width="match_parent" 145 android:layout_width="match_parent"
147 android:layout_height="wrap_content" 146 android:layout_height="wrap_content"
148 android:orientation="horizontal" 147 android:orientation="horizontal"
149 android:paddingTop="20dp" 148 android:paddingTop="20dp"
150 android:weightSum="60"> 149 android:weightSum="60">
151 150
152 <LinearLayout 151 <LinearLayout
153 android:layout_width="0dp" 152 android:layout_width="0dp"
154 android:layout_height="wrap_content" 153 android:layout_height="wrap_content"
155 android:layout_weight="20" 154 android:layout_weight="20"
156 android:gravity="center" 155 android:gravity="center"
157 android:orientation="vertical"> 156 android:orientation="vertical">
158 157
159 <TextView 158 <TextView
160 android:layout_width="wrap_content" 159 android:layout_width="wrap_content"
161 android:layout_height="wrap_content" 160 android:layout_height="wrap_content"
162 android:text="@string/calo_consumed" 161 android:text="@string/calo_consumed"
163 android:textColor="@color/white" 162 android:textColor="@color/white"
164 android:textSize="16sp" /> 163 android:textSize="16sp" />
165 164
166 </LinearLayout> 165 </LinearLayout>
167 166
168 <LinearLayout 167 <LinearLayout
169 android:layout_width="0dp" 168 android:layout_width="0dp"
170 android:layout_height="wrap_content" 169 android:layout_height="wrap_content"
171 android:layout_weight="20" 170 android:layout_weight="20"
172 android:gravity="center" 171 android:gravity="center"
173 android:orientation="vertical"> 172 android:orientation="vertical">
174 173
175 <TextView 174 <TextView
176 android:id="@+id/tv_remainingStep" 175 android:id="@+id/tv_remainingStep"
177 android:layout_width="wrap_content" 176 android:layout_width="wrap_content"
178 android:layout_height="wrap_content" 177 android:layout_height="wrap_content"
179 android:text="@string/distance" 178 android:text="@string/distance"
180 android:textColor="@color/white" 179 android:textColor="@color/white"
181 android:textSize="16sp" /> 180 android:textSize="16sp" />
182 181
183 </LinearLayout> 182 </LinearLayout>
184 183
185 <LinearLayout 184 <LinearLayout
186 android:layout_width="0dp" 185 android:layout_width="0dp"
187 android:layout_height="wrap_content" 186 android:layout_height="wrap_content"
188 android:layout_weight="20" 187 android:layout_weight="20"
189 android:gravity="center" 188 android:gravity="center"
190 android:orientation="vertical"> 189 android:orientation="vertical">
191 190
192 <TextView 191 <TextView
193 android:layout_width="wrap_content" 192 android:layout_width="wrap_content"
194 android:layout_height="wrap_content" 193 android:layout_height="wrap_content"
195 android:text="@string/time" 194 android:text="@string/time"
196 android:textColor="@color/white" 195 android:textColor="@color/white"
197 android:textSize="16sp" /> 196 android:textSize="16sp" />
198 197
199 </LinearLayout> 198 </LinearLayout>
200 </LinearLayout> 199 </LinearLayout>
201 200
202 201
203 <LinearLayout 202 <LinearLayout
204 android:layout_width="match_parent" 203 android:layout_width="match_parent"
205 android:layout_height="wrap_content" 204 android:layout_height="wrap_content"
206 android:orientation="horizontal" 205 android:orientation="horizontal"
207 android:weightSum="60"> 206 android:weightSum="60">
208 207
209 <LinearLayout 208 <LinearLayout
210 android:layout_width="0dp" 209 android:layout_width="0dp"
211 android:layout_height="wrap_content" 210 android:layout_height="wrap_content"
212 android:layout_weight="20" 211 android:layout_weight="20"
213 android:gravity="center" 212 android:gravity="center"
214 android:orientation="vertical"> 213 android:orientation="vertical">
215 214
216 <TextView 215 <TextView
217 android:id="@+id/tv_caloConsumned" 216 android:id="@+id/tv_caloConsumned"
218 android:layout_width="wrap_content" 217 android:layout_width="wrap_content"
219 android:layout_height="wrap_content" 218 android:layout_height="wrap_content"
220 android:text="1000 kcal" 219 android:text="1000 kcal"
221 android:textColor="@color/white" 220 android:textColor="@color/white"
222 android:textSize="16sp" /> 221 android:textSize="16sp" />
223 222
224 </LinearLayout> 223 </LinearLayout>
225 224
226 <LinearLayout 225 <LinearLayout
227 android:layout_width="0dp" 226 android:layout_width="0dp"
228 android:layout_height="wrap_content" 227 android:layout_height="wrap_content"
229 android:layout_weight="20" 228 android:layout_weight="20"
230 android:gravity="center" 229 android:gravity="center"
231 android:orientation="vertical"> 230 android:orientation="vertical">
232 231
233 <TextView 232 <TextView
234 android:id="@+id/tv_distance" 233 android:id="@+id/tv_distance"
235 android:layout_width="wrap_content" 234 android:layout_width="wrap_content"
236 android:layout_height="wrap_content" 235 android:layout_height="wrap_content"
237 android:text="4.0 KM" 236 android:text="4.0 KM"
238 android:textColor="@color/white" 237 android:textColor="@color/white"
239 android:textSize="16sp" /> 238 android:textSize="16sp" />
240 239
241 </LinearLayout> 240 </LinearLayout>
242 241
243 <LinearLayout 242 <LinearLayout
244 android:layout_width="0dp" 243 android:layout_width="0dp"
245 android:layout_height="wrap_content" 244 android:layout_height="wrap_content"
246 android:layout_weight="20" 245 android:layout_weight="20"
247 android:gravity="center" 246 android:gravity="center"
248 android:orientation="vertical"> 247 android:orientation="vertical">
249 248
250 <TextView 249 <TextView
251 android:id="@+id/tv_time" 250 android:id="@+id/tv_time"
252 android:layout_width="wrap_content" 251 android:layout_width="wrap_content"
253 android:layout_height="wrap_content" 252 android:layout_height="wrap_content"
254 android:text="1:00 ๆ™‚้–“" 253 android:text="1:00 ๆ™‚้–“"
255 android:textColor="@color/white" 254 android:textColor="@color/white"
256 android:textSize="16sp" /> 255 android:textSize="16sp" />
257 256
258 </LinearLayout> 257 </LinearLayout>
259 258
260 </LinearLayout> 259 </LinearLayout>
261 260
262 </LinearLayout> 261 </LinearLayout>
263 262
app/src/main/res/layout/layout_rank_row.xml
1 <?xml version="1.0" encoding="utf-8"?> 1 <?xml version="1.0" encoding="utf-8"?>
2 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 2 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3 android:layout_width="match_parent" 3 android:layout_width="match_parent"
4 android:layout_height="102dp" 4 android:layout_height="102dp"
5 android:background="@android:color/white" 5 android:background="@android:color/white"
6 android:orientation="vertical"> 6 android:orientation="vertical">
7 7
8 <View 8 <View
9 android:layout_width="match_parent" 9 android:layout_width="match_parent"
10 android:layout_height="1dp" 10 android:layout_height="1dp"
11 android:background="@android:color/black" /> 11 android:background="@android:color/black" />
12 12
13 <RelativeLayout 13 <RelativeLayout
14 android:layout_width="match_parent" 14 android:layout_width="match_parent"
15 android:layout_height="100dp"> 15 android:layout_height="100dp">
16 16
17 <TextView 17 <TextView
18 android:id="@+id/tv_position" 18 android:id="@+id/tv_position"
19 android:layout_width="wrap_content" 19 android:layout_width="wrap_content"
20 android:layout_height="wrap_content" 20 android:layout_height="wrap_content"
21 android:layout_centerVertical="true" 21 android:layout_centerVertical="true"
22 android:layout_margin="8dp" 22 android:layout_margin="8dp"
23 android:layout_alignParentLeft="true"
23 android:text="1" 24 android:text="1"
24 android:textColor="@android:color/black" 25 android:textColor="@android:color/black"
25 android:textSize="36sp" /> 26 android:textSize="36sp" />
26 27
27 <ImageView 28 <ImageView
29 android:id="@+id/imv_position"
30 android:layout_width="56dp"
31 android:layout_height="40dp"
32 android:layout_centerVertical="true"
33 android:layout_marginRight="8dp"
34 android:layout_toRightOf="@id/tv_position"
35 android:layout_marginLeft="2dp"/>
36
37 <ImageView
28 android:id="@+id/imv_user_icon" 38 android:id="@+id/imv_user_icon"
29 android:layout_width="56dp" 39 android:layout_width="56dp"
30 android:layout_height="56dp" 40 android:layout_height="56dp"
31 android:layout_centerVertical="true" 41 android:layout_centerVertical="true"
32 android:layout_margin="8dp" 42 android:layout_margin="8dp"
33 android:layout_toRightOf="@id/tv_position" 43 android:layout_toRightOf="@id/imv_position"
34 android:background="@drawable/ic_user" /> 44 android:background="@drawable/ic_ava" />
35 45
36 <LinearLayout 46 <LinearLayout
37 android:layout_width="match_parent" 47 android:layout_width="match_parent"
38 android:layout_height="wrap_content" 48 android:layout_height="wrap_content"
39 android:layout_centerVertical="true" 49 android:layout_centerVertical="true"
40 android:layout_toLeftOf="@+id/imv_position"
41 android:layout_toRightOf="@+id/imv_user_icon" 50 android:layout_toRightOf="@+id/imv_user_icon"
42 android:orientation="vertical"> 51 android:orientation="vertical">
43 52
44 <LinearLayout 53 <LinearLayout
45 android:layout_width="match_parent" 54 android:layout_width="match_parent"
46 android:layout_height="wrap_content" 55 android:layout_height="wrap_content"
47 android:orientation="horizontal"> 56 android:orientation="horizontal">
48 57
49 <TextView 58 <TextView
50 android:layout_width="80dp" 59 android:layout_width="80dp"
51 android:layout_height="wrap_content" 60 android:layout_height="wrap_content"
52 android:text="ใƒฆใƒผใ‚ถใƒผ" /> 61 android:text="ใƒฆใƒผใ‚ถใƒผ" />
53 62
54 <TextView 63 <TextView
55 android:layout_width="match_parent" 64 android:layout_width="match_parent"
56 android:layout_height="wrap_content" 65 android:layout_height="wrap_content"
57 android:text="ใƒ‹ใƒƒใ‚ฏใƒใƒผใƒ " /> 66 android:text="ใƒ‹ใƒƒใ‚ฏใƒใƒผใƒ " />
58 </LinearLayout> 67 </LinearLayout>
59 68
60 <LinearLayout 69 <LinearLayout
61 android:layout_width="match_parent" 70 android:layout_width="match_parent"
62 android:layout_height="wrap_content" 71 android:layout_height="wrap_content"
63 android:orientation="horizontal"> 72 android:orientation="horizontal">
64 73
65 <TextView 74 <TextView
66 android:id="@+id/tv_steps" 75 android:id="@+id/tv_steps"
67 android:layout_width="80dp" 76 android:layout_width="80dp"
68 android:layout_height="wrap_content" 77 android:layout_height="wrap_content"
69 android:text="12345 ๆญฉ" /> 78 android:text="12345 ๆญฉ" />
70 79
71 <TextView 80 <TextView
72 android:id="@+id/tv_distance" 81 android:id="@+id/tv_distance"
73 android:layout_width="match_parent" 82 android:layout_width="match_parent"
74 android:layout_height="wrap_content" 83 android:layout_height="wrap_content"
75 android:text="123456 km" /> 84 android:text="123456 km" />
76 </LinearLayout> 85 </LinearLayout>
77 86
78 <LinearLayout 87 <LinearLayout
79 android:layout_width="match_parent" 88 android:layout_width="match_parent"
80 android:layout_height="wrap_content" 89 android:layout_height="wrap_content"
81 android:orientation="horizontal"> 90 android:orientation="horizontal">
82 91
83 <TextView 92 <TextView
84 android:id="@+id/tv_time" 93 android:id="@+id/tv_time"
85 android:layout_width="80dp" 94 android:layout_width="80dp"
86 android:layout_height="wrap_content" 95 android:layout_height="wrap_content"
87 android:text="11:22:33" /> 96 android:text="11:22:33" />
88 97
89 <TextView 98 <TextView
90 android:layout_width="match_parent" 99 android:layout_width="match_parent"
91 android:layout_height="wrap_content" 100 android:layout_height="wrap_content"
92 android:text="" /> 101 android:text="" />
93 </LinearLayout> 102 </LinearLayout>
94 </LinearLayout> 103 </LinearLayout>
95 104
96 <ImageView 105
97 android:id="@+id/imv_position"
98 android:layout_width="36dp"
99 android:layout_height="36dp"
100 android:layout_alignParentRight="true"
101 android:layout_centerVertical="true"
102 android:layout_marginRight="8dp"
app/src/main/res/layout/layout_sns_member_row.xml
1 <?xml version="1.0" encoding="utf-8"?> 1 <?xml version="1.0" encoding="utf-8"?>
2 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 2 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3 android:layout_width="match_parent" 3 android:layout_width="match_parent"
4 android:layout_height="82dp" 4 android:layout_height="82dp"
5 android:background="@android:color/white" 5 android:background="@android:color/white"
6 android:orientation="vertical"> 6 android:orientation="vertical">
7 7
8 <View 8 <View
9 android:layout_width="match_parent" 9 android:layout_width="match_parent"
10 android:layout_height="1dp" 10 android:layout_height="1dp"
11 android:background="@android:color/black" /> 11 android:background="@android:color/black" />
12 12
13 <LinearLayout 13 <LinearLayout
14 android:layout_width="match_parent" 14 android:layout_width="match_parent"
15 android:layout_height="80dp" 15 android:layout_height="80dp"
16 android:orientation="horizontal"> 16 android:orientation="horizontal">
17 <LinearLayout 17 <LinearLayout
18 android:layout_width="100dp" 18 android:layout_width="100dp"
19 android:layout_height="match_parent" 19 android:layout_height="match_parent"
20 android:gravity="center"> 20 android:gravity="center">
21 <ImageView 21 <ImageView
22 android:id="@+id/imv_user_icon" 22 android:id="@+id/imv_user_icon"
23 android:layout_width="60dp" 23 android:layout_width="60dp"
24 android:layout_height="60dp" 24 android:layout_height="60dp"
25 android:background="@drawable/ic_user"/> 25 android:background="@drawable/ic_ava"/>
26 </LinearLayout> 26 </LinearLayout>
27 <LinearLayout 27 <LinearLayout
28 android:layout_width="match_parent" 28 android:layout_width="match_parent"
29 android:layout_height="match_parent" 29 android:layout_height="match_parent"
30 android:orientation="vertical"> 30 android:orientation="vertical">
31 <TextView 31 <TextView
32 android:id="@+id/tv_username" 32 android:id="@+id/tv_username"
33 android:layout_width="match_parent" 33 android:layout_width="match_parent"
34 android:layout_height="wrap_content" 34 android:layout_height="wrap_content"
35 android:layout_marginTop="8dp" 35 android:layout_marginTop="8dp"
36 android:layout_marginLeft="4dp" 36 android:layout_marginLeft="4dp"
37 android:layout_marginRight="4dp" 37 android:layout_marginRight="4dp"
38 android:text="..." 38 android:text="..."
39 android:textColor="@android:color/black" 39 android:textColor="@android:color/black"
40 android:textSize="18sp" /> 40 android:textSize="18sp" />
41 </LinearLayout> 41 </LinearLayout>
42 </LinearLayout> 42 </LinearLayout>
43 43
44 <View 44 <View
45 android:layout_width="match_parent" 45 android:layout_width="match_parent"
46 android:layout_height="1dp" 46 android:layout_height="1dp"
47 android:background="@android:color/black" /> 47 android:background="@android:color/black" />
48 </LinearLayout> 48 </LinearLayout>
app/src/main/res/layout/layout_sns_search_row.xml
1 <?xml version="1.0" encoding="utf-8"?> 1 <?xml version="1.0" encoding="utf-8"?>
2 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 2 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3 android:layout_width="match_parent" 3 android:layout_width="match_parent"
4 android:layout_height="143dp" 4 android:layout_height="143dp"
5 android:orientation="vertical"> 5 android:orientation="vertical">
6 6
7 <View 7 <View
8 android:layout_width="match_parent" 8 android:layout_width="match_parent"
9 android:layout_height="1dp" 9 android:layout_height="1dp"
10 android:background="@android:color/darker_gray" /> 10 android:background="@android:color/darker_gray" />
11 11
12 <LinearLayout 12 <LinearLayout
13 android:layout_width="match_parent" 13 android:layout_width="match_parent"
14 android:layout_height="140dp" 14 android:layout_height="140dp"
15 android:background="@android:color/white" 15 android:background="@android:color/white"
16 android:orientation="horizontal"> 16 android:orientation="horizontal">
17 17
18 <LinearLayout 18 <LinearLayout
19 android:layout_width="80dp" 19 android:layout_width="80dp"
20 android:layout_height="match_parent" 20 android:layout_height="match_parent"
21 android:padding="8dp"> 21 android:padding="8dp">
22 22
23 <ImageView 23 <ImageView
24 android:id="@+id/imv_user_icon" 24 android:id="@+id/imv_user_icon"
25 android:layout_width="match_parent" 25 android:layout_width="match_parent"
26 android:layout_height="match_parent" 26 android:layout_height="match_parent"
27 android:background="@android:color/white" 27 android:background="@android:color/white"
28 android:src="@drawable/ic_user" /> 28 android:src="@drawable/ic_ava" />
29 </LinearLayout> 29 </LinearLayout>
30 30
31 <RelativeLayout 31 <RelativeLayout
32 android:layout_width="match_parent" 32 android:layout_width="match_parent"
33 android:layout_height="match_parent"> 33 android:layout_height="match_parent">
34 34
35 <LinearLayout 35 <LinearLayout
36 android:layout_width="match_parent" 36 android:layout_width="match_parent"
37 android:layout_height="match_parent" 37 android:layout_height="match_parent"
38 android:layout_toLeftOf="@+id/layout_type_user" 38 android:layout_toLeftOf="@+id/layout_type_user"
39 android:paddingBottom="16dp" 39 android:paddingBottom="16dp"
40 android:paddingTop="16dp"> 40 android:paddingTop="16dp">
41 41
42 <TextView 42 <TextView
43 android:id="@+id/tv_title" 43 android:id="@+id/tv_title"
44 android:layout_width="match_parent" 44 android:layout_width="match_parent"
45 android:layout_height="match_parent" 45 android:layout_height="match_parent"
46 android:text="ๅˆๅฟƒ่€…ใงR61ใ‚’่ตฐใ‚Šใพใ™" 46 android:text="ๅˆๅฟƒ่€…ใงR61ใ‚’่ตฐใ‚Šใพใ™"
47 android:textColor="@android:color/black" 47 android:textColor="@android:color/black"
48 android:textSize="18sp" /> 48 android:textSize="18sp" />
49 </LinearLayout> 49 </LinearLayout>
50 50
51 <LinearLayout 51 <LinearLayout
52 android:id="@+id/layout_type_user" 52 android:id="@+id/layout_type_user"
53 android:layout_width="80dp" 53 android:layout_width="80dp"
54 android:layout_height="match_parent" 54 android:layout_height="match_parent"
55 android:layout_alignParentRight="true" 55 android:layout_alignParentRight="true"
56 android:orientation="vertical" 56 android:orientation="vertical"
57 android:weightSum="100"> 57 android:weightSum="100">
58 58
59 <ImageView 59 <ImageView
60 android:layout_width="match_parent" 60 android:layout_width="match_parent"
61 android:layout_height="0dp" 61 android:layout_height="0dp"
62 android:layout_margin="8dp" 62 android:layout_margin="8dp"
63 android:layout_weight="50" 63 android:layout_weight="50"
64 android:background="@android:color/white" 64 android:background="@android:color/white"
65 android:src="@drawable/ic_1st" /> 65 android:src="@drawable/ic_1st" />
66 66
67 <ImageView 67 <ImageView
68 android:layout_width="match_parent" 68 android:layout_width="match_parent"
69 android:layout_height="0dp" 69 android:layout_height="0dp"
70 android:layout_margin="8dp" 70 android:layout_margin="8dp"
71 android:layout_weight="50" 71 android:layout_weight="50"
72 android:background="@android:color/white" 72 android:background="@android:color/white"
73 android:src="@drawable/ic_1st" /> 73 android:src="@drawable/ic_1st" />
74 </LinearLayout> 74 </LinearLayout>
75 </RelativeLayout> 75 </RelativeLayout>
76 </LinearLayout> 76 </LinearLayout>
77 77
78 <View 78 <View
79 android:layout_width="match_parent" 79 android:layout_width="match_parent"
80 android:layout_height="2dp" 80 android:layout_height="2dp"
81 android:background="@android:color/black" /> 81 android:background="@android:color/black" />
82 </LinearLayout> 82 </LinearLayout>
app/src/main/res/layout/layout_sns_topic_row.xml
1 <?xml version="1.0" encoding="utf-8"?> 1 <?xml version="1.0" encoding="utf-8"?>
2 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 2 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3 android:layout_width="match_parent" 3 android:layout_width="match_parent"
4 android:layout_height="143dp" 4 android:layout_height="143dp"
5 android:orientation="vertical"> 5 android:orientation="vertical">
6 6
7 <View 7 <View
8 android:layout_width="match_parent" 8 android:layout_width="match_parent"
9 android:layout_height="1dp" 9 android:layout_height="1dp"
10 android:background="@android:color/black" /> 10 android:background="@android:color/black" />
11 11
12 <LinearLayout 12 <LinearLayout
13 android:layout_width="match_parent" 13 android:layout_width="match_parent"
14 android:layout_height="140dp" 14 android:layout_height="140dp"
15 android:background="@android:color/white" 15 android:background="@android:color/white"
16 android:orientation="horizontal"> 16 android:orientation="horizontal">
17 17
18 <LinearLayout 18 <LinearLayout
19 android:layout_width="80dp" 19 android:layout_width="80dp"
20 android:layout_height="match_parent" 20 android:layout_height="match_parent"
21 android:padding="8dp"> 21 android:padding="8dp">
22 22
23 <ImageView 23 <ImageView
24 android:id="@+id/imv_user_icon" 24 android:id="@+id/imv_user_icon"
25 android:layout_width="match_parent" 25 android:layout_width="match_parent"
26 android:layout_height="match_parent" 26 android:layout_height="match_parent"
27 android:background="@android:color/white" 27 android:background="@android:color/white"
28 android:src="@drawable/ic_user" /> 28 android:src="@drawable/ic_ava" />
29 </LinearLayout> 29 </LinearLayout>
30 30
31 <LinearLayout 31 <LinearLayout
32 android:layout_width="match_parent" 32 android:layout_width="match_parent"
33 android:layout_height="match_parent" 33 android:layout_height="match_parent"
34 android:orientation="vertical" 34 android:orientation="vertical"
35 android:padding="8dp"> 35 android:padding="8dp">
36 36
37 <LinearLayout 37 <LinearLayout
38 android:layout_width="match_parent" 38 android:layout_width="match_parent"
39 android:layout_height="wrap_content" 39 android:layout_height="wrap_content"
40 android:orientation="horizontal" 40 android:orientation="horizontal"
41 android:weightSum="100"> 41 android:weightSum="100">
42 42
43 <TextView 43 <TextView
44 android:id="@+id/tv_start_date" 44 android:id="@+id/tv_start_date"
45 android:layout_width="0dp" 45 android:layout_width="0dp"
46 android:layout_height="wrap_content" 46 android:layout_height="wrap_content"
47 android:layout_weight="40" 47 android:layout_weight="40"
48 android:text="2017/01/25" 48 android:text="2017/01/25"
49 android:textColor="@android:color/black" 49 android:textColor="@android:color/black"
50 android:textSize="16sp" 50 android:textSize="16sp"
51 android:textStyle="bold" /> 51 android:textStyle="bold" />
52 52
53 <TextView 53 <TextView
54 android:id="@+id/tv_start_time" 54 android:id="@+id/tv_start_time"
55 android:layout_width="0dp" 55 android:layout_width="0dp"
56 android:layout_height="wrap_content" 56 android:layout_height="wrap_content"
57 android:layout_weight="25" 57 android:layout_weight="25"
58 android:text="11:22" 58 android:text="11:22"
59 android:textColor="@android:color/black" 59 android:textColor="@android:color/black"
60 android:textSize="16sp" 60 android:textSize="16sp"
61 android:textStyle="bold" /> 61 android:textStyle="bold" />
62 62
63 <TextView 63 <TextView
64 android:id="@+id/tv_user_name" 64 android:id="@+id/tv_user_name"
65 android:layout_width="0dp" 65 android:layout_width="0dp"
66 android:layout_height="wrap_content" 66 android:layout_height="wrap_content"
67 android:layout_weight="35" 67 android:layout_weight="35"
68 android:text="Kato" 68 android:text="Kato"
69 android:textColor="@android:color/black" 69 android:textColor="@android:color/black"
70 android:textSize="16sp" 70 android:textSize="16sp"
71 android:textStyle="bold" /> 71 android:textStyle="bold" />
72 </LinearLayout> 72 </LinearLayout>
73 73
74 <LinearLayout 74 <LinearLayout
75 android:layout_width="match_parent" 75 android:layout_width="match_parent"
76 android:layout_height="wrap_content"> 76 android:layout_height="wrap_content">
77 77
78 <TextView 78 <TextView
79 android:id="@+id/tv_message" 79 android:id="@+id/tv_message"
80 android:layout_width="match_parent" 80 android:layout_width="match_parent"
81 android:layout_height="wrap_content" 81 android:layout_height="wrap_content"
82 android:lines="3" 82 android:lines="3"
83 android:text="ไปŠๆ—ฅใฏใ€ใ‚ธใƒ ใƒžใ‚ทใƒณใง่ตฐใ‚Šใพใ—ใŸใ€‚ใกใ‚‡ใฃใจใ‚†ใฃใใ‚Š็›ฎใง่ตฐใฃใฆใฟใพใ—ใŸใ€‚" 83 android:text="ไปŠๆ—ฅใฏใ€ใ‚ธใƒ ใƒžใ‚ทใƒณใง่ตฐใ‚Šใพใ—ใŸใ€‚ใกใ‚‡ใฃใจใ‚†ใฃใใ‚Š็›ฎใง่ตฐใฃใฆใฟใพใ—ใŸใ€‚"
84 android:textColor="@android:color/darker_gray" 84 android:textColor="@android:color/darker_gray"
85 android:textSize="16sp" /> 85 android:textSize="16sp" />
86 </LinearLayout> 86 </LinearLayout>
87 87
88 <LinearLayout 88 <LinearLayout
89 android:layout_width="match_parent" 89 android:layout_width="match_parent"
90 android:layout_height="wrap_content" 90 android:layout_height="wrap_content"
91 android:orientation="horizontal" 91 android:orientation="horizontal"
92 android:weightSum="100"> 92 android:weightSum="100">
93 93
94 <TextView 94 <TextView
95 android:layout_width="0dp" 95 android:layout_width="0dp"
96 android:layout_height="wrap_content" 96 android:layout_height="wrap_content"
97 android:layout_weight="40" 97 android:layout_weight="40"
98 android:text="ใƒฉใƒณใƒ‹ใƒณใ‚ฐ" 98 android:text="ใƒฉใƒณใƒ‹ใƒณใ‚ฐ"
99 android:textColor="@android:color/black" 99 android:textColor="@android:color/black"
100 android:textSize="16sp" /> 100 android:textSize="16sp" />
101 101
102 <TextView 102 <TextView
103 android:id="@+id/tv_distance" 103 android:id="@+id/tv_distance"
104 android:layout_width="0dp" 104 android:layout_width="0dp"
105 android:layout_height="wrap_content" 105 android:layout_height="wrap_content"
106 android:layout_weight="30" 106 android:layout_weight="30"
107 android:text="1023 m" 107 android:text="1023 m"
108 android:textColor="@android:color/black" 108 android:textColor="@android:color/black"
109 android:textSize="16sp" 109 android:textSize="16sp"
110 android:textStyle="bold" /> 110 android:textStyle="bold" />
111 111
112 <TextView 112 <TextView
113 android:id="@+id/tv_duration" 113 android:id="@+id/tv_duration"
114 android:layout_width="0dp" 114 android:layout_width="0dp"
115 android:layout_height="wrap_content" 115 android:layout_height="wrap_content"
116 android:layout_weight="30" 116 android:layout_weight="30"
117 android:text="0:24:12" 117 android:text="0:24:12"
118 android:textColor="@android:color/black" 118 android:textColor="@android:color/black"
119 android:textSize="16sp" /> 119 android:textSize="16sp" />
120 </LinearLayout> 120 </LinearLayout>
121 </LinearLayout> 121 </LinearLayout>
122 </LinearLayout> 122 </LinearLayout>
123 123
124 <View 124 <View
125 android:layout_width="match_parent" 125 android:layout_width="match_parent"
126 android:layout_height="2dp" 126 android:layout_height="2dp"
127 android:background="@android:color/black" /> 127 android:background="@android:color/black" />
128 </LinearLayout> 128 </LinearLayout>
app/src/main/res/layout/layout_toolbar.xml
1 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 1 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
2 xmlns:appNs="http://schemas.android.com/apk/res-auto" 2 xmlns:appNs="http://schemas.android.com/apk/res-auto"
3 android:layout_width="match_parent" 3 android:layout_width="match_parent"
4 android:layout_height="wrap_content" 4 android:layout_height="wrap_content"
5 android:layout_alignParentTop="true" 5 android:layout_alignParentTop="true"
6 android:id="@+id/ll_toolBar" 6 android:id="@+id/ll_toolBar"
7 android:background="@color/tab_sub2_unselected"> 7 android:background="@color/bg_header">
8 8
9 <RelativeLayout 9 <RelativeLayout
10 android:layout_width="match_parent" 10 android:layout_width="match_parent"
11 android:layout_height="@dimen/toolbar_height" 11 android:layout_height="@dimen/toolbar_height"
12 android:orientation="vertical"> 12 android:orientation="vertical">
13 13
14 <ImageView 14 <ImageView
15 android:id="@+id/iv_home" 15 android:id="@+id/iv_home"
16 android:layout_width="wrap_content" 16 android:layout_width="wrap_content"
17 android:layout_height="wrap_content" 17 android:layout_height="wrap_content"
18 android:adjustViewBounds="true" 18 android:adjustViewBounds="true"
19 android:padding="5dp" 19 android:padding="5dp"
20 android:src="@drawable/home_ic"/> 20 android:src="@drawable/home_ic"/>
21 21
22 <LinearLayout 22 <LinearLayout
23 android:layout_width="match_parent" 23 android:layout_width="match_parent"
24 android:layout_height="match_parent" 24 android:layout_height="match_parent"
25 android:gravity="center" 25 android:gravity="center"
26 android:orientation="horizontal"> 26 android:orientation="horizontal">
27 27
28 <TextView 28 <TextView
29 android:id="@+id/tv_pageTitle" 29 android:id="@+id/tv_pageTitle"
30 android:layout_width="wrap_content" 30 android:layout_width="wrap_content"
31 android:layout_height="wrap_content" 31 android:layout_height="wrap_content"
32 android:text="HOME" 32 android:text="HOME"
33 android:textStyle="bold" 33 android:textStyle="bold"
34 android:textColor="@color/white"/> 34 android:textColor="@color/white"/>
35 35
36 </LinearLayout> 36 </LinearLayout>
37 37
38 38
39 <ImageView 39 <ImageView
40 android:id="@+id/imv_menu" 40 android:id="@+id/imv_menu"
41 android:layout_width="wrap_content" 41 android:layout_width="wrap_content"
42 android:layout_height="wrap_content" 42 android:layout_height="wrap_content"
43 android:adjustViewBounds="true" 43 android:adjustViewBounds="true"
44 android:layout_alignParentRight="true" 44 android:layout_alignParentRight="true"
45 android:padding="6dp"
45 android:src="@drawable/list_ic"/> 46 android:src="@drawable/list_ic"/>
46 47
47 48
48 </RelativeLayout> 49 </RelativeLayout>
49 50
50 </RelativeLayout> 51 </RelativeLayout>
51 52
app/src/main/res/layout/notice_list_item.xml
1 <?xml version="1.0" encoding="utf-8"?> 1 <?xml version="1.0" encoding="utf-8"?>
2 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 2 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3 android:orientation="vertical" 3 android:orientation="vertical"
4 android:layout_width="match_parent" 4 android:layout_width="match_parent"
5 android:layout_height="wrap_content" 5 android:layout_height="wrap_content"
6 android:background="@color/background_main"
7 android:padding="4dp"> 6 android:padding="4dp">
8 7
9 <TextView 8 <TextView
10 android:id="@+id/tv_content" 9 android:id="@+id/tv_content"
11 android:layout_width="match_parent" 10 android:layout_width="match_parent"
12 android:layout_height="wrap_content" 11 android:layout_height="wrap_content"
13 android:gravity="left" 12 android:gravity="left"
14 android:paddingLeft="20dp" 13 android:paddingLeft="20dp"
15 android:textColor="@color/white" 14 android:textColor="@color/white"
16 android:text="description" /> 15 android:text="description" />
17 16
18 17
19 </LinearLayout> 18 </LinearLayout>
20 19
app/src/main/res/layout/type_step.xml
1 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 1 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
2 xmlns:appNs="http://schemas.android.com/apk/res-auto" 2 xmlns:appNs="http://schemas.android.com/apk/res-auto"
3 android:layout_width="match_parent" 3 android:layout_width="match_parent"
4 android:layout_height="wrap_content" 4 android:layout_height="wrap_content"
5 android:layout_alignParentBottom="true" 5 android:layout_alignParentBottom="true"
6 android:id="@+id/ll_stepType" 6 android:id="@+id/ll_stepType"
7 android:layout_marginBottom="8dp" 7 android:layout_marginBottom="8dp"
8 android:background="@color/tab_sub2_unselected"> 8 android:background="@color/bg_header">
9 9
10 <LinearLayout 10 <LinearLayout
11 android:layout_width="match_parent" 11 android:layout_width="match_parent"
12 android:layout_height="@dimen/toolbar_height" 12 android:layout_height="@dimen/toolbar_height"
13 android:orientation="horizontal" 13 android:orientation="horizontal"
14 android:weightSum="90"> 14 android:weightSum="90">
15 15
16 <LinearLayout 16 <LinearLayout
17 android:id="@+id/ll_bike" 17 android:id="@+id/ll_bike"
18 android:layout_width="0dp" 18 android:layout_width="0dp"
19 android:layout_height="match_parent" 19 android:layout_height="match_parent"
20 android:layout_weight="30" 20 android:layout_weight="30"
21 android:gravity="center" 21 android:gravity="center"
22 android:background="@drawable/step_type_background" 22 android:background="@drawable/step_type_background"
23 android:orientation="horizontal"> 23 android:orientation="horizontal">
24 24
25 <TextView 25 <TextView
26 android:layout_width="wrap_content" 26 android:layout_width="wrap_content"
27 android:layout_height="wrap_content" 27 android:layout_height="wrap_content"
28 android:text="@string/bike" 28 android:text="@string/bike"
29 android:textStyle="bold" 29 android:textStyle="bold"
30 android:textColor="@color/white"/> 30 android:textColor="@color/white"/>
31 31
32 </LinearLayout> 32 </LinearLayout>
33 33
34 <LinearLayout 34 <LinearLayout
35 android:id="@+id/ll_walking" 35 android:id="@+id/ll_walking"
36 android:layout_width="0dp" 36 android:layout_width="0dp"
37 android:layout_height="match_parent" 37 android:layout_height="match_parent"
38 android:layout_weight="30" 38 android:layout_weight="30"
39 android:gravity="center" 39 android:gravity="center"
40 android:background="@drawable/step_type_background" 40 android:background="@drawable/step_type_background"
41 android:orientation="horizontal"> 41 android:orientation="horizontal">
42 42
43 <TextView 43 <TextView
44 android:layout_width="wrap_content" 44 android:layout_width="wrap_content"
45 android:layout_height="wrap_content" 45 android:layout_height="wrap_content"
46 android:text="@string/walking" 46 android:text="@string/walking"
47 android:textStyle="bold" 47 android:textStyle="bold"
48 android:textColor="@color/white"/> 48 android:textColor="@color/white"/>
49 49
50 </LinearLayout> 50 </LinearLayout>
51 51
52 <LinearLayout 52 <LinearLayout
53 android:id="@+id/ll_running" 53 android:id="@+id/ll_running"
54 android:layout_width="0dp" 54 android:layout_width="0dp"
55 android:layout_height="match_parent" 55 android:layout_height="match_parent"
56 android:layout_weight="30" 56 android:layout_weight="30"
57 android:gravity="center" 57 android:gravity="center"
58 android:background="@drawable/step_type_background" 58 android:background="@drawable/step_type_background"
59 android:orientation="horizontal"> 59 android:orientation="horizontal">
60 60
61 <TextView 61 <TextView
62 android:layout_width="wrap_content" 62 android:layout_width="wrap_content"
63 android:layout_height="wrap_content" 63 android:layout_height="wrap_content"
64 android:text="@string/running" 64 android:text="@string/running"
65 android:textStyle="bold" 65 android:textStyle="bold"
66 android:textColor="@color/white"/> 66 android:textColor="@color/white"/>
67 67
68 </LinearLayout> 68 </LinearLayout>
69 69
70 70
71 71
72 </LinearLayout> 72 </LinearLayout>
73 73
74 </RelativeLayout> 74 </RelativeLayout>
75 75
app/src/main/res/mipmap-hdpi/ic_launcher.png

2.89 KB | W: | H:

6.82 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
app/src/main/res/mipmap-mdpi/ic_launcher.png

2.03 KB | W: | H:

5.23 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
app/src/main/res/mipmap-xhdpi/ic_launcher.png

3.62 KB | W: | H:

8.51 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
app/src/main/res/mipmap-xxhdpi/ic_launcher.png

5.18 KB | W: | H:

12.3 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
app/src/main/res/mipmap-xxxhdpi/ic_launcher.png

21.9 KB | W: | H:

16.4 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
app/src/main/res/values/colors.xml
1 <?xml version="1.0" encoding="utf-8"?> 1 <?xml version="1.0" encoding="utf-8"?>
2 <resources> 2 <resources>
3 <color name="colorPrimary">#3F51B5</color> 3 <color name="colorPrimary">#3F51B5</color>
4 <color name="colorPrimaryDark">#303F9F</color> 4 <color name="colorPrimaryDark">#303F9F</color>
5 <color name="colorAccent">#FF4081</color> 5 <color name="colorAccent">#FF4081</color>
6 <color name="background_main">#000000</color> 6 <color name="background_main">#000000</color>
7 7
8 <color name="black">#000000</color> 8 <color name="black">#000000</color>
9 <color name="white">#ffffff</color> 9 <color name="white">#ffffff</color>
10 <color name="selected_tab_color">#464646</color> 10 <color name="selected_tab_color">#464646</color>
11 <color name="graph_color">#40CDEF</color> 11 <color name="graph_color">#40CDEF</color>
12 <color name="tab_sub2_unselected">#171717</color> 12 <color name="tab_sub2_unselected">#171717</color>
13 13
14 <color name="done_step_pie_color">#6FE7F7</color> 14 <color name="done_step_pie_color">#6FE7F7</color>
15 <color name="ad">#B7B8B6</color> 15 <color name="ad">#B7B8B6</color>
16 <color name="header_bg">#8FA0B7</color> 16 <color name="header_bg">#8FA0B7</color>
17 <color name="login_bg">#656565</color> 17 <color name="login_bg">#656565</color>
18 <color name="selected_bg">#FCAE3F</color> 18 <color name="selected_bg">#FCAE3F</color>
19 <color name="down_ic_bg">#6E6F70</color> 19 <color name="down_ic_bg">#6E6F70</color>
20 <color name="city_row">#DCDFE0</color> 20 <color name="city_row">#DCDFE0</color>
21 21
22 <color name="lev_selected">#4F97F3</color> 22 <color name="lev_selected">#4F97F3</color>
23 <color name="item_page8_top">#666666</color> 23 <color name="item_page8_top">#666666</color>
24 <color name="item_page8_top_end">#383838</color> 24 <color name="item_page8_top_end">#383838</color>
25 <color name="item_page8_content">#EEEEEE</color> 25 <color name="item_page8_content">#EEEEEE</color>
26
27 <color name="bg_main">#030087</color>
28 <color name="bg_header">#010137</color>
29
26 </resources> 30 </resources>
27 31