child login
This commit is contained in:
800
android/OldPeopleHome/.idea/workspace.xml
generated
800
android/OldPeopleHome/.idea/workspace.xml
generated
File diff suppressed because it is too large
Load Diff
@@ -80,6 +80,7 @@
|
||||
</activity>
|
||||
<activity android:name=".modules.oldpeople.activity.OldPeopleMainActivity" />
|
||||
<activity android:name=".modules.children.activity.ChildMainActivity" />
|
||||
<activity android:name=".modules.loginregister.RegisterActivity" />
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
@@ -10,6 +10,7 @@ import android.support.v4.content.ContextCompat;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
|
||||
|
||||
import com.scorpiomiku.oldpeoplehome.bean.User;
|
||||
import com.scorpiomiku.oldpeoplehome.modules.loginregister.LoginActivity;
|
||||
import com.scorpiomiku.oldpeoplehome.utils.LogUtils;
|
||||
import com.scorpiomiku.oldpeoplehome.utils.WebUtils;
|
||||
@@ -26,6 +27,15 @@ public abstract class BaseActivity extends AppCompatActivity {
|
||||
protected Handler handler;
|
||||
protected HashMap<String, String> data = new HashMap<>();
|
||||
private WebUtils webUtils;
|
||||
private User user;
|
||||
|
||||
public User getUser() {
|
||||
return user;
|
||||
}
|
||||
|
||||
public void setUser(User user) {
|
||||
this.user = user;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
|
||||
@@ -10,6 +10,7 @@ import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
|
||||
import com.scorpiomiku.oldpeoplehome.bean.User;
|
||||
import com.scorpiomiku.oldpeoplehome.utils.LogUtils;
|
||||
import com.scorpiomiku.oldpeoplehome.utils.WebUtils;
|
||||
|
||||
@@ -25,6 +26,15 @@ public abstract class BaseFragment extends Fragment {
|
||||
protected Handler handler;
|
||||
protected HashMap<String, String> data = new HashMap<>();
|
||||
private WebUtils webUtils;
|
||||
private User user;
|
||||
|
||||
public User getUser() {
|
||||
return user;
|
||||
}
|
||||
|
||||
public void setUser(User user) {
|
||||
this.user = user;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
package com.scorpiomiku.oldpeoplehome.bean;
|
||||
|
||||
/**
|
||||
* Created by ScorpioMiku on 2019/9/4.
|
||||
*/
|
||||
|
||||
public class Child implements User {
|
||||
private String childSex;
|
||||
private String childPassword;
|
||||
private String childAccount;
|
||||
private String childName;
|
||||
private String childLongId;
|
||||
private String childPhone;
|
||||
|
||||
public String getChildSex() {
|
||||
return childSex;
|
||||
}
|
||||
|
||||
public void setChildSex(String childSex) {
|
||||
this.childSex = childSex;
|
||||
}
|
||||
|
||||
public String getChildPassword() {
|
||||
return childPassword;
|
||||
}
|
||||
|
||||
public void setChildPassword(String childPassword) {
|
||||
this.childPassword = childPassword;
|
||||
}
|
||||
|
||||
public String getChildAccount() {
|
||||
return childAccount;
|
||||
}
|
||||
|
||||
public void setChildAccount(String childAccount) {
|
||||
this.childAccount = childAccount;
|
||||
}
|
||||
|
||||
public String getChildName() {
|
||||
return childName;
|
||||
}
|
||||
|
||||
public void setChildName(String childName) {
|
||||
this.childName = childName;
|
||||
}
|
||||
|
||||
public String getChildLongId() {
|
||||
return childLongId;
|
||||
}
|
||||
|
||||
public void setChildLongId(String childLongId) {
|
||||
this.childLongId = childLongId;
|
||||
}
|
||||
|
||||
public String getChildPhone() {
|
||||
return childPhone;
|
||||
}
|
||||
|
||||
public void setChildPhone(String childPhone) {
|
||||
this.childPhone = childPhone;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Child{" +
|
||||
"childSex='" + childSex + '\'' +
|
||||
", childPassword='" + childPassword + '\'' +
|
||||
", childAccount='" + childAccount + '\'' +
|
||||
", childName='" + childName + '\'' +
|
||||
", childLongId='" + childLongId + '\'' +
|
||||
", childPhone='" + childPhone + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package com.scorpiomiku.oldpeoplehome.bean;
|
||||
|
||||
/**
|
||||
* Created by ScorpioMiku on 2019/9/4.
|
||||
*/
|
||||
|
||||
public class SleepData {
|
||||
private String parent;
|
||||
private String date;
|
||||
private String deep;
|
||||
private String light;
|
||||
private String awake;
|
||||
|
||||
public String getParent() {
|
||||
return parent;
|
||||
}
|
||||
|
||||
public void setParent(String parent) {
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
public String getDate() {
|
||||
return date;
|
||||
}
|
||||
|
||||
public void setDate(String date) {
|
||||
this.date = date;
|
||||
}
|
||||
|
||||
public String getDeep() {
|
||||
return deep;
|
||||
}
|
||||
|
||||
public void setDeep(String deep) {
|
||||
this.deep = deep;
|
||||
}
|
||||
|
||||
public String getLight() {
|
||||
return light;
|
||||
}
|
||||
|
||||
public void setLight(String light) {
|
||||
this.light = light;
|
||||
}
|
||||
|
||||
public String getAwake() {
|
||||
return awake;
|
||||
}
|
||||
|
||||
public void setAwake(String awake) {
|
||||
this.awake = awake;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.scorpiomiku.oldpeoplehome.bean;
|
||||
|
||||
/**
|
||||
* Created by ScorpioMiku on 2019/9/4.
|
||||
*/
|
||||
|
||||
public interface User {
|
||||
}
|
||||
@@ -104,13 +104,13 @@ public class MapFragment extends BaseFragment {
|
||||
* 轨迹
|
||||
*/
|
||||
private void drawLine() {
|
||||
// LatLng p1 = new LatLng(38.019467, 112.455778);
|
||||
// LatLng p2 = new LatLng(38.019467, 112.465778);1
|
||||
// LatLng p3 = new LatLng(38.019467, 112.455978);
|
||||
LatLng p1 = new LatLng(38.019467, 112.455778);
|
||||
LatLng p2 = new LatLng(38.019467, 112.465778);
|
||||
LatLng p3 = new LatLng(38.019467, 112.455978);
|
||||
List<LatLng> points = new ArrayList<LatLng>();
|
||||
// points.add(p1);
|
||||
// points.add(p2);
|
||||
// points.add(p3);
|
||||
points.add(p1);
|
||||
points.add(p2);
|
||||
points.add(p3);
|
||||
//设置折线的属性
|
||||
OverlayOptions mOverlayOptions = new PolylineOptions()
|
||||
.width(10)
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
package com.scorpiomiku.oldpeoplehome.modules.loginregister;
|
||||
|
||||
import android.Manifest;
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.support.v4.app.ActivityCompat;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.view.View;
|
||||
@@ -13,15 +15,25 @@ import android.widget.EditText;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.scorpiomiku.oldpeoplehome.R;
|
||||
import com.scorpiomiku.oldpeoplehome.base.BaseActivity;
|
||||
import com.scorpiomiku.oldpeoplehome.bean.Child;
|
||||
import com.scorpiomiku.oldpeoplehome.modules.children.activity.ChildMainActivity;
|
||||
import com.scorpiomiku.oldpeoplehome.modules.oldpeople.activity.OldPeopleMainActivity;
|
||||
import com.scorpiomiku.oldpeoplehome.utils.LogUtils;
|
||||
import com.scorpiomiku.oldpeoplehome.utils.TimeUtils;
|
||||
import com.scorpiomiku.oldpeoplehome.utils.WebUtils;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import butterknife.OnClick;
|
||||
import okhttp3.Call;
|
||||
import okhttp3.Callback;
|
||||
import okhttp3.Response;
|
||||
|
||||
public class LoginActivity extends BaseActivity {
|
||||
|
||||
@@ -37,9 +49,25 @@ public class LoginActivity extends BaseActivity {
|
||||
@BindView(R.id.login_find_pwd)
|
||||
TextView loginFindPwd;
|
||||
|
||||
@SuppressLint("HandlerLeak")
|
||||
@Override
|
||||
protected Handler initHandle() {
|
||||
return null;
|
||||
return new Handler() {
|
||||
@Override
|
||||
public void handleMessage(Message msg) {
|
||||
super.handleMessage(msg);
|
||||
switch (msg.what) {
|
||||
case 1:
|
||||
Intent intent = new Intent(LoginActivity.this, ChildMainActivity.class);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
break;
|
||||
case 2:
|
||||
LogUtils.shortToast("密码错误");
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -69,14 +97,45 @@ public class LoginActivity extends BaseActivity {
|
||||
public void onViewClicked(View view) {
|
||||
switch (view.getId()) {
|
||||
case R.id.login_btn_login:
|
||||
Intent intent = new Intent(LoginActivity.this, OldPeopleMainActivity.class);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
login();
|
||||
break;
|
||||
case R.id.linear_layout_btn_register:
|
||||
Intent intent1 = new Intent(LoginActivity.this, RegisterActivity.class);
|
||||
startActivity(intent1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 登录
|
||||
*/
|
||||
private void login() {
|
||||
String account = loginEdtUsername.getText().toString();
|
||||
String password = loginEdtPassword.getText().toString();
|
||||
data.clear();
|
||||
data.put("account", account);
|
||||
data.put("password", password);
|
||||
getWebUtils().loginChild(data, new Callback() {
|
||||
@Override
|
||||
public void onFailure(Call call, IOException e) {
|
||||
LogUtils.loge(e.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResponse(Call call, Response response) throws IOException {
|
||||
try {
|
||||
JsonObject jsonObject = getWebUtils().getJsonObj(response);
|
||||
Gson gson = new Gson();
|
||||
Child child = gson.fromJson(jsonObject, Child.class);
|
||||
setUser(child);
|
||||
handler.sendEmptyMessage(1);
|
||||
} catch (Exception e) {
|
||||
LogUtils.loge(e.getMessage());
|
||||
handler.sendEmptyMessage(2);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,23 +1,86 @@
|
||||
package com.scorpiomiku.oldpeoplehome.modules.loginregister;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.RadioButton;
|
||||
import android.widget.RadioGroup;
|
||||
|
||||
import com.scorpiomiku.oldpeoplehome.R;
|
||||
import com.scorpiomiku.oldpeoplehome.base.BaseActivity;
|
||||
import com.scorpiomiku.oldpeoplehome.utils.LogUtils;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import butterknife.OnClick;
|
||||
import okhttp3.Call;
|
||||
import okhttp3.Callback;
|
||||
import okhttp3.Response;
|
||||
|
||||
/**
|
||||
* Created by ScorpioMiku on 2019/8/18.
|
||||
*/
|
||||
|
||||
public class RegisterActivity extends BaseActivity {
|
||||
@BindView(R.id.phone)
|
||||
EditText phone;
|
||||
@BindView(R.id.id_card)
|
||||
EditText idCard;
|
||||
@BindView(R.id.name)
|
||||
EditText name;
|
||||
@BindView(R.id.account)
|
||||
EditText account;
|
||||
@BindView(R.id.man_rb)
|
||||
RadioButton manRb;
|
||||
@BindView(R.id.woman_rb)
|
||||
RadioButton womanRb;
|
||||
@BindView(R.id.password)
|
||||
EditText password;
|
||||
@BindView(R.id.register_button)
|
||||
Button registerButton;
|
||||
@BindView(R.id.sex_r_g)
|
||||
RadioGroup sexRG;
|
||||
private String sexText;
|
||||
private String phoneText;
|
||||
private String nameText;
|
||||
private String accountText;
|
||||
private String passwordText;
|
||||
private String idCardText;
|
||||
|
||||
|
||||
@SuppressLint("HandlerLeak")
|
||||
@Override
|
||||
protected Handler initHandle() {
|
||||
return null;
|
||||
return new Handler() {
|
||||
@Override
|
||||
public void handleMessage(Message msg) {
|
||||
super.handleMessage(msg);
|
||||
switch (msg.what) {
|
||||
case 1:
|
||||
finish();
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public void iniview() {
|
||||
|
||||
sexRG.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(RadioGroup radioGroup, int checkedId) {
|
||||
if (checkedId == manRb.getId()) {
|
||||
sexText = "男";
|
||||
} else if (checkedId == womanRb.getId()) {
|
||||
sexText = "女";
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -34,4 +97,46 @@ public class RegisterActivity extends BaseActivity {
|
||||
public void onPointerCaptureChanged(boolean hasCapture) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
// TODO: add setContentView(...) invocation
|
||||
ButterKnife.bind(this);
|
||||
}
|
||||
|
||||
@OnClick(R.id.register_button)
|
||||
public void onViewClicked() {
|
||||
getText();
|
||||
data.clear();
|
||||
data.put("childSex", sexText);
|
||||
data.put("childPassword", passwordText);
|
||||
data.put("childAccount", accountText);
|
||||
data.put("childName", nameText);
|
||||
data.put("childLongId", idCardText);
|
||||
data.put("childPhone", phoneText);
|
||||
getWebUtils().registerChild(data, new Callback() {
|
||||
@Override
|
||||
public void onFailure(Call call, IOException e) {
|
||||
LogUtils.loge(e.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResponse(Call call, Response response) throws IOException {
|
||||
handler.sendEmptyMessage(1);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 获得数据
|
||||
*/
|
||||
private void getText() {
|
||||
nameText = name.getText().toString();
|
||||
phoneText = phone.getText().toString();
|
||||
idCardText = idCard.getText().toString();
|
||||
accountText = account.getText().toString();
|
||||
passwordText = password.getText().toString();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -59,6 +59,8 @@ public class OldPeopleMainActivity extends BaseActivity {
|
||||
BottomNavigationView navigation;
|
||||
@BindView(R.id.floating_button)
|
||||
FloatingActionButton floatingButton;
|
||||
@BindView(R.id.close_button)
|
||||
FloatingActionButton closeButton;
|
||||
|
||||
private String step;
|
||||
private String cal;
|
||||
@@ -71,6 +73,8 @@ public class OldPeopleMainActivity extends BaseActivity {
|
||||
private String bloodPressureDiastole = "0";
|
||||
private String oxygen;
|
||||
|
||||
private Boolean mIsBound = false;
|
||||
|
||||
private BottomNavigationView.OnNavigationItemSelectedListener mOnNavigationItemSelectedListener;
|
||||
private FragmentManager fragmentManager;
|
||||
private BaseFragment[] fragments = {
|
||||
@@ -493,6 +497,7 @@ public class OldPeopleMainActivity extends BaseActivity {
|
||||
@Override
|
||||
public void onServiceConnected(ComponentName componentName, IBinder service) {
|
||||
LogUtils.shortToast("Service connected");
|
||||
mIsBound = true;
|
||||
mService = IRemoteService.Stub.asInterface(service);
|
||||
|
||||
try {
|
||||
@@ -638,19 +643,11 @@ public class OldPeopleMainActivity extends BaseActivity {
|
||||
private void getNewHandData() {
|
||||
try {
|
||||
mService.getCurSportData();
|
||||
for (int i = 5; i >= 0; i--) {
|
||||
|
||||
}
|
||||
} catch (RemoteException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@OnClick(R.id.floating_button)
|
||||
public void onViewClicked() {
|
||||
getNewHandData();
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新UI调用
|
||||
*/
|
||||
@@ -681,4 +678,26 @@ public class OldPeopleMainActivity extends BaseActivity {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@OnClick({R.id.floating_button, R.id.close_button})
|
||||
public void onViewClicked(View view) {
|
||||
switch (view.getId()) {
|
||||
case R.id.floating_button:
|
||||
getNewHandData();
|
||||
break;
|
||||
case R.id.close_button:
|
||||
callRemoteDisconnect();
|
||||
if (mIsBound) {
|
||||
try {
|
||||
mService.unregisterCallback(mServiceCallback);
|
||||
} catch (RemoteException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
unbindService(mServiceConnection);
|
||||
}
|
||||
mIsBound = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
package com.scorpiomiku.oldpeoplehome.modules.oldpeople.fragmemt;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
@@ -54,10 +56,32 @@ public class HeartRateFragment extends BaseFragment {
|
||||
@BindView(R.id.title_time_text)
|
||||
TextView titleTimeText;
|
||||
private Boolean loading = false;
|
||||
private float heartRate;
|
||||
|
||||
@SuppressLint("HandlerLeak")
|
||||
@Override
|
||||
protected Handler initHandle() {
|
||||
return null;
|
||||
return new Handler(){
|
||||
@Override
|
||||
public void handleMessage(Message msg) {
|
||||
super.handleMessage(msg);
|
||||
switch (msg.what){
|
||||
case 1:
|
||||
getWebUtils().upHeartRates(data, new okhttp3.Callback() {
|
||||
@Override
|
||||
public void onFailure(Call call, IOException e) {
|
||||
LogUtils.loge(e.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResponse(Call call, Response response) throws IOException {
|
||||
LogUtils.logd("心率上传成功");
|
||||
}
|
||||
});
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -72,7 +96,7 @@ public class HeartRateFragment extends BaseFragment {
|
||||
|
||||
@Override
|
||||
protected void initView() {
|
||||
initChart();
|
||||
// initChart();
|
||||
titleTimeText.setText(TimeUtils.getUpDate());
|
||||
}
|
||||
|
||||
@@ -125,32 +149,25 @@ public class HeartRateFragment extends BaseFragment {
|
||||
public void changeText(String heart, String systolic, String diastolic, String oxy) {
|
||||
if (systolic.equals(this.systolic.getText().toString())) {
|
||||
if (!loading) {
|
||||
progressBar.setVisibility(View.VISIBLE);
|
||||
// progressBar.setVisibility(View.VISIBLE);
|
||||
}
|
||||
} else {
|
||||
loading = false;
|
||||
progressBar.setVisibility(View.GONE);
|
||||
// begin.setText("开启");
|
||||
data.clear();
|
||||
data.put("parentId", "1");
|
||||
data.put("time", TimeUtils.getTime());
|
||||
data.put("rate1", systolic);
|
||||
data.put("rate2", diastolic);
|
||||
data.put("oxy", oxy);
|
||||
getWebUtils().upHeartRates(data, new Callback() {
|
||||
@Override
|
||||
public void onFailure(Call call, IOException e) {
|
||||
LogUtils.loge(e.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResponse(Call call, Response response) throws IOException {
|
||||
LogUtils.logd("心率上传成功");
|
||||
}
|
||||
});
|
||||
initChart();
|
||||
handler.sendEmptyMessage(1);
|
||||
}
|
||||
heartRateText.setText(heart);
|
||||
this.diastolic.setText(diastolic);
|
||||
this.systolic.setText(systolic);
|
||||
this.oxy.setText(oxy);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,8 +14,11 @@ import android.widget.TextView;
|
||||
import com.rbrooks.indefinitepagerindicator.IndefinitePagerIndicator;
|
||||
import com.scorpiomiku.oldpeoplehome.R;
|
||||
import com.scorpiomiku.oldpeoplehome.base.BaseFragment;
|
||||
import com.scorpiomiku.oldpeoplehome.bean.SleepData;
|
||||
import com.scorpiomiku.oldpeoplehome.utils.TimeUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import butterknife.Unbinder;
|
||||
@@ -30,7 +33,6 @@ public class SleepFragment extends BaseFragment {
|
||||
WaveLoadingView waveLoadingView;
|
||||
@BindView(R.id.sleep_text)
|
||||
TextView sleepText;
|
||||
|
||||
Unbinder unbinder;
|
||||
@BindView(R.id.viewpager_pager_indicator)
|
||||
IndefinitePagerIndicator viewpagerPagerIndicator;
|
||||
@@ -38,6 +40,7 @@ public class SleepFragment extends BaseFragment {
|
||||
ViewPager viewPager;
|
||||
@BindView(R.id.title_time_text)
|
||||
TextView titleTimeText;
|
||||
private ArrayList<SleepData> data = new ArrayList<>();
|
||||
|
||||
@Override
|
||||
protected Handler initHandle() {
|
||||
@@ -56,7 +59,6 @@ public class SleepFragment extends BaseFragment {
|
||||
|
||||
@Override
|
||||
protected void initView() {
|
||||
// initPie();
|
||||
initViewPager();
|
||||
titleTimeText.setText(TimeUtils.getUpDate());
|
||||
}
|
||||
@@ -120,12 +122,12 @@ public class SleepFragment extends BaseFragment {
|
||||
viewPager.setAdapter(new FragmentPagerAdapter(fragmentManager) {
|
||||
@Override
|
||||
public Fragment getItem(int i) {
|
||||
return new SleepViewPagerItem();
|
||||
return SleepViewPagerItem.instance(data.get(i));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return 10;
|
||||
return data.size();
|
||||
}
|
||||
});
|
||||
viewpagerPagerIndicator.attachToViewPager(viewPager);
|
||||
|
||||
@@ -16,6 +16,7 @@ import com.github.mikephil.charting.data.PieEntry;
|
||||
import com.github.mikephil.charting.formatter.PercentFormatter;
|
||||
import com.scorpiomiku.oldpeoplehome.R;
|
||||
import com.scorpiomiku.oldpeoplehome.base.BaseFragment;
|
||||
import com.scorpiomiku.oldpeoplehome.bean.SleepData;
|
||||
import com.scorpiomiku.oldpeoplehome.utils.TimeUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -33,6 +34,14 @@ public class SleepViewPagerItem extends BaseFragment {
|
||||
@BindView(R.id.pie_chart)
|
||||
PieChart sleepPie;
|
||||
Unbinder unbinder;
|
||||
private SleepData sleepData;
|
||||
|
||||
|
||||
public static SleepViewPagerItem instance(SleepData sleepData) {
|
||||
SleepViewPagerItem sleepViewPagerItem = new SleepViewPagerItem();
|
||||
sleepViewPagerItem.sleepData = sleepData;
|
||||
return sleepViewPagerItem;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Handler initHandle() {
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
package com.scorpiomiku.oldpeoplehome.modules.oldpeople.fragmemt;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
@@ -58,9 +60,30 @@ public class StepFragment extends BaseFragment {
|
||||
@BindView(R.id.title_time_text)
|
||||
TextView titleTimeText;
|
||||
|
||||
@SuppressLint("HandlerLeak")
|
||||
@Override
|
||||
protected Handler initHandle() {
|
||||
return null;
|
||||
return new Handler() {
|
||||
@Override
|
||||
public void handleMessage(Message msg) {
|
||||
super.handleMessage(msg);
|
||||
switch (msg.what) {
|
||||
case 1:
|
||||
getWebUtils().UpSport(data, new okhttp3.Callback() {
|
||||
@Override
|
||||
public void onFailure(Call call, IOException e) {
|
||||
LogUtils.loge(e.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResponse(Call call, Response response) throws IOException {
|
||||
LogUtils.logd("运动数据上传成功");
|
||||
}
|
||||
});
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -118,16 +141,12 @@ public class StepFragment extends BaseFragment {
|
||||
data.put("distance", distance);
|
||||
data.put("time", sportTime);
|
||||
data.put("energy", cal);
|
||||
getWebUtils().UpSport(data, new Callback() {
|
||||
@Override
|
||||
public void onFailure(Call call, IOException e) {
|
||||
LogUtils.loge(e.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResponse(Call call, Response response) throws IOException {
|
||||
LogUtils.logd("运动数据上传成功");
|
||||
}
|
||||
});
|
||||
handler.sendEmptyMessage(1);
|
||||
float temp = Float.valueOf(step) / 10000 * 100;
|
||||
waveLoadingView.setProgressValue((int) temp);
|
||||
caloriePb.setProgress((int) (temp - 6));
|
||||
distancePb.setProgress((int) (temp - 1));
|
||||
timePb.setProgress((int) (temp + 8));
|
||||
finishPercent.setText((int) temp + "");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -136,4 +136,30 @@ public class WebUtils {
|
||||
Call call = mClient.newCall(request);
|
||||
call.enqueue(callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* 注册child
|
||||
*
|
||||
* @param hashMap
|
||||
* @param callback
|
||||
*/
|
||||
public void registerChild(HashMap<String, String> hashMap, Callback callback) {
|
||||
Request request = new Request.Builder().post(getRequestBody(hashMap))
|
||||
.url(webHost + "/child/add/").build();
|
||||
Call call = mClient.newCall(request);
|
||||
call.enqueue(callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* child login
|
||||
*
|
||||
* @param hashMap
|
||||
* @param callback
|
||||
*/
|
||||
public void loginChild(HashMap<String, String> hashMap, Callback callback) {
|
||||
Request request = new Request.Builder().post(getRequestBody(hashMap))
|
||||
.url(webHost + "/child/login/").build();
|
||||
Call call = mClient.newCall(request);
|
||||
call.enqueue(callback);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0">
|
||||
<path
|
||||
android:fillColor="#e4e4e4"
|
||||
android:pathData="M19,6.41L17.59,5 12,10.59 6.41,5 5,6.41 10.59,12 5,17.59 6.41,19 12,13.41 17.59,19 19,17.59 13.41,12z"/>
|
||||
</vector>
|
||||
@@ -50,6 +50,20 @@
|
||||
app:borderWidth="0dp"
|
||||
app:fabSize="normal"/>
|
||||
|
||||
<android.support.design.widget.FloatingActionButton
|
||||
android:id="@+id/close_button"
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="30dp"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_margin="16dp"
|
||||
android:alpha="0.6"
|
||||
android:scaleType="center"
|
||||
android:src="@drawable/ic_clear_black_24dp"
|
||||
app:backgroundTint="#53d6d6"
|
||||
app:borderWidth="0dp"
|
||||
app:fabSize="normal"/>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<android.support.design.widget.BottomNavigationView
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
<android.support.v7.widget.CardView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="370dp"
|
||||
android:layout_height="390dp"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_marginRight="16dp"
|
||||
android:layout_marginTop="45dp"
|
||||
@@ -37,8 +37,7 @@
|
||||
<ImageView
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_marginBottom="30dp"
|
||||
android:layout_centerVertical="true"
|
||||
android:src="@mipmap/night_biz_pc_account_username_icon" />
|
||||
</RelativeLayout>
|
||||
|
||||
@@ -69,6 +68,160 @@
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:layout_centerVertical="true"
|
||||
android:src="@mipmap/night_biz_pc_account_username_icon" />
|
||||
</RelativeLayout>
|
||||
|
||||
<android.support.design.widget.TextInputLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/id_card"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:layout_marginStart="5dp"
|
||||
android:background="@null"
|
||||
android:hint="身份证号"
|
||||
android:inputType="textAutoComplete"
|
||||
android:lines="1"
|
||||
android:maxLines="1"
|
||||
android:paddingBottom="10dp"
|
||||
android:paddingLeft="5dp"
|
||||
android:paddingRight="5dp"
|
||||
android:paddingTop="15dp"
|
||||
android:textColorHint="#b3b3b0"
|
||||
android:textSize="15sp"
|
||||
tools:ignore="TextFields" />
|
||||
</android.support.design.widget.TextInputLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:layout_centerVertical="true"
|
||||
android:src="@mipmap/night_biz_pc_account_username_icon" />
|
||||
</RelativeLayout>
|
||||
|
||||
<android.support.design.widget.TextInputLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/name"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:layout_marginStart="5dp"
|
||||
android:background="@null"
|
||||
android:hint="名字"
|
||||
android:inputType="textAutoComplete"
|
||||
android:lines="1"
|
||||
android:maxLines="1"
|
||||
android:paddingBottom="10dp"
|
||||
android:paddingLeft="5dp"
|
||||
android:paddingRight="5dp"
|
||||
android:paddingTop="15dp"
|
||||
android:textColorHint="#b3b3b0"
|
||||
android:textSize="15sp"
|
||||
tools:ignore="TextFields" />
|
||||
</android.support.design.widget.TextInputLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:layout_centerVertical="true"
|
||||
android:src="@mipmap/night_biz_pc_account_username_icon" />
|
||||
</RelativeLayout>
|
||||
|
||||
<android.support.design.widget.TextInputLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/account"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:layout_marginStart="5dp"
|
||||
android:background="@null"
|
||||
android:hint="登陆账号"
|
||||
android:inputType="textAutoComplete"
|
||||
android:lines="1"
|
||||
android:maxLines="1"
|
||||
android:paddingBottom="10dp"
|
||||
android:paddingLeft="5dp"
|
||||
android:paddingRight="5dp"
|
||||
android:paddingTop="15dp"
|
||||
android:textColorHint="#b3b3b0"
|
||||
android:textSize="15sp"
|
||||
tools:ignore="TextFields" />
|
||||
</android.support.design.widget.TextInputLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<RadioGroup
|
||||
android:id="@+id/sex_r_g"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/man_rb"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="男" />
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/woman_rb"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="女" />
|
||||
</RadioGroup>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
@@ -81,8 +234,7 @@
|
||||
<ImageView
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_marginBottom="30dp"
|
||||
android:layout_centerVertical="true"
|
||||
android:src="@mipmap/night_biz_pc_account_pwd_icon" />
|
||||
</RelativeLayout>
|
||||
|
||||
@@ -112,59 +264,6 @@
|
||||
</android.support.design.widget.TextInputLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<!--<LinearLayout-->
|
||||
<!--android:layout_width="match_parent"-->
|
||||
<!--android:layout_height="0dp"-->
|
||||
<!--android:layout_weight="1"-->
|
||||
<!--android:gravity="center_vertical">-->
|
||||
|
||||
<!--<RelativeLayout-->
|
||||
<!--android:layout_width="wrap_content"-->
|
||||
<!--android:layout_height="match_parent">-->
|
||||
|
||||
<!--<ImageView-->
|
||||
<!--android:layout_width="22dp"-->
|
||||
<!--android:layout_height="22dp"-->
|
||||
<!--android:layout_alignParentBottom="true"-->
|
||||
<!--android:layout_marginBottom="10dp"-->
|
||||
<!--app:srcCompat="@drawable/ic_assignment_ind_black_24dp"-->
|
||||
<!--tools:ignore="VectorDrawableCompat" />-->
|
||||
<!--</RelativeLayout>-->
|
||||
|
||||
<!--<android.support.design.widget.TextInputLayout-->
|
||||
<!--android:layout_width="match_parent"-->
|
||||
<!--android:layout_height="match_parent"-->
|
||||
<!--android:gravity="center_vertical">-->
|
||||
|
||||
<!--<EditText-->
|
||||
<!--android:id="@+id/id_card"-->
|
||||
<!--android:layout_width="match_parent"-->
|
||||
<!--android:layout_height="wrap_content"-->
|
||||
<!--android:layout_marginLeft="5dp"-->
|
||||
<!--android:layout_marginStart="5dp"-->
|
||||
<!--android:background="@null"-->
|
||||
<!--android:hint="学号/教工号"-->
|
||||
<!--android:inputType="textAutoComplete"-->
|
||||
<!--android:lines="1"-->
|
||||
<!--android:maxLines="1"-->
|
||||
<!--android:paddingBottom="10dp"-->
|
||||
<!--android:paddingLeft="5dp"-->
|
||||
<!--android:paddingRight="5dp"-->
|
||||
<!--android:paddingTop="15dp"-->
|
||||
<!--android:textColorHint="#b3b3b0"-->
|
||||
<!--android:textSize="15sp" />-->
|
||||
<!--</android.support.design.widget.TextInputLayout>-->
|
||||
|
||||
<!--</LinearLayout>-->
|
||||
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/teacher_checkbox"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginTop="25dp"
|
||||
android:text="是否为子女" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/register_button"
|
||||
|
||||
@@ -217,7 +217,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:text="公里"
|
||||
android:text="米"
|
||||
android:textColor="@color/step_bg"
|
||||
android:textSize="14sp" />
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
android:layout_gravity="center"
|
||||
app:wlv_borderColor="#ef906b"
|
||||
app:wlv_borderWidth="8dp"
|
||||
app:wlv_progressValue="40"
|
||||
app:wlv_progressValue="0"
|
||||
app:wlv_round_rectangle="true"
|
||||
app:wlv_shapeType="circle"
|
||||
app:wlv_titleCenter=""
|
||||
@@ -97,7 +97,7 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dp"
|
||||
android:text="4000"
|
||||
android:text="10000"
|
||||
android:textColor="#FFF"
|
||||
android:textSize="14sp" />
|
||||
|
||||
@@ -130,7 +130,7 @@
|
||||
android:id="@+id/finish_percent"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="10"
|
||||
android:text="0"
|
||||
android:textColor="#FFF"
|
||||
android:textSize="14sp" />
|
||||
|
||||
@@ -225,7 +225,7 @@
|
||||
app:zpb_max="100"
|
||||
app:zpb_padding="0dp"
|
||||
app:zpb_pb_color="@color/step_bg"
|
||||
app:zpb_progress="30" />
|
||||
app:zpb_progress="0" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
@@ -285,7 +285,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:text="公里"
|
||||
android:text="米"
|
||||
android:textColor="@color/step_bg"
|
||||
android:textSize="14sp" />
|
||||
|
||||
@@ -310,7 +310,7 @@
|
||||
app:zpb_max="100"
|
||||
app:zpb_padding="0dp"
|
||||
app:zpb_pb_color="@color/step_bg"
|
||||
app:zpb_progress="30" />
|
||||
app:zpb_progress="0" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
@@ -395,7 +395,7 @@
|
||||
app:zpb_max="100"
|
||||
app:zpb_padding="0dp"
|
||||
app:zpb_pb_color="@color/step_bg"
|
||||
app:zpb_progress="30" />
|
||||
app:zpb_progress="0" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user