mirror of
https://e.coding.net/mcontext/mContext/sdu.git
synced 2024-09-18 02:24:54 +08:00
1.添加宝宝页面
2.输入邀请码页面
This commit is contained in:
parent
a86c2ec2a3
commit
449e60c7bd
@ -22,7 +22,12 @@
|
||||
android:usesCleartextTraffic="true"
|
||||
tools:ignore="UnusedAttribute"
|
||||
tools:replace="android:allowBackup">
|
||||
<activity android:name=".post.PostDetailActivity"></activity>
|
||||
<activity
|
||||
android:name=".ui.account.home.InputCodeActivity"
|
||||
android:windowSoftInputMode="stateVisible" />
|
||||
<activity android:name=".ui.account.home.CreateHomeActivity" />
|
||||
<activity android:name=".ui.baby.BabyListActivity" />
|
||||
<activity android:name=".post.PostDetailActivity" />
|
||||
<activity android:name=".ui.info.InfoEditActivity" />
|
||||
|
||||
<meta-data
|
||||
|
@ -1,7 +1,8 @@
|
||||
package com.yuxihan.sdu.comm;
|
||||
|
||||
public class Const {
|
||||
|
||||
public static final String BASE_URL = "https://www.yuxihan.com/";
|
||||
public static final String ERROR_CODE_NORMAL = "0";
|
||||
public static boolean NEED_RELOAD_PROFILE = false;
|
||||
|
||||
public static final String LOGIN_STATE = "LoginState";
|
||||
|
@ -1,5 +0,0 @@
|
||||
package com.yuxihan.sdu.comm;
|
||||
|
||||
public class Constant {
|
||||
public static final String BASE_URL = "https://www.yuxihan.com/";
|
||||
}
|
@ -95,7 +95,7 @@ public class SDUApp extends Application {
|
||||
|
||||
mRetrofit = new Retrofit.Builder()
|
||||
.client(httpClientBuilder.build())
|
||||
.baseUrl(Constant.BASE_URL)
|
||||
.baseUrl(Const.BASE_URL)
|
||||
.addConverterFactory(GsonConverterFactory.create())
|
||||
.build();
|
||||
}
|
||||
|
@ -0,0 +1,123 @@
|
||||
package com.yuxihan.sdu.comm.widget.selector;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.Color;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.FrameLayout;
|
||||
|
||||
import com.yuxihan.sdu.R;
|
||||
|
||||
/**
|
||||
* it is a customized view acts like a checkbox.
|
||||
* it can be selected or unselected, the background will change accordingly. wrapping this business logic into a single view for clean code in Fragment
|
||||
*/
|
||||
public abstract class Selector extends FrameLayout implements View.OnClickListener {
|
||||
/**
|
||||
* the unique tag for a selector
|
||||
*/
|
||||
private String tag;
|
||||
/**
|
||||
* the tag indicates which group this selector belongs to,
|
||||
* set the same group tag for selectors which want single choice mode
|
||||
*/
|
||||
private String groupTag;
|
||||
/**
|
||||
* the group which this Selector belongs to
|
||||
*/
|
||||
private SelectorGroup selectorGroup;
|
||||
|
||||
public Selector(Context context) {
|
||||
super(context);
|
||||
initView(context, null);
|
||||
}
|
||||
|
||||
public Selector(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
initView(context, attrs);
|
||||
}
|
||||
|
||||
public Selector(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
initView(context, attrs);
|
||||
}
|
||||
|
||||
private void initView(Context context, AttributeSet attrs) {
|
||||
//read declared attributes
|
||||
if (attrs != null) {
|
||||
TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.Selector);
|
||||
int tagResId = typedArray.getResourceId(R.styleable.Selector_tag, 0);
|
||||
tag = context.getString(tagResId);
|
||||
onObtainAttrs(typedArray);
|
||||
typedArray.recycle();
|
||||
} else {
|
||||
tag = "default tag";
|
||||
}
|
||||
//inflate views
|
||||
View view = onCreateView();
|
||||
LayoutParams params = new LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
|
||||
this.addView(view, params);
|
||||
this.setOnClickListener(this);
|
||||
|
||||
}
|
||||
|
||||
public void onObtainAttrs(TypedArray typedArray) {
|
||||
}
|
||||
|
||||
/**
|
||||
* add this Selector into a SelectorGroup
|
||||
*
|
||||
* @param selectorGroup
|
||||
* @return
|
||||
*/
|
||||
public Selector setGroup(String groupTag, SelectorGroup selectorGroup) {
|
||||
this.selectorGroup = selectorGroup;
|
||||
this.groupTag = groupTag;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getGroupTag(){
|
||||
return groupTag;
|
||||
}
|
||||
|
||||
/**
|
||||
* design how the selector looks like
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
protected abstract View onCreateView();
|
||||
|
||||
public String getSelectorTag() {
|
||||
return tag;
|
||||
}
|
||||
|
||||
public void setSelectorTag(String tag) {
|
||||
this.tag = tag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSelected(boolean selected) {
|
||||
boolean isPreSelected = isSelected();
|
||||
super.setSelected(selected);
|
||||
if (isPreSelected != selected) {
|
||||
onSwitchSelected(selected);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
//deliver the click event to the SelectorGroup
|
||||
if (selectorGroup != null) {
|
||||
selectorGroup.onSelectorClick(this);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* it will be invoked when select state changes
|
||||
*
|
||||
* @param isSelect
|
||||
*/
|
||||
protected abstract void onSwitchSelected(boolean isSelect);
|
||||
}
|
@ -0,0 +1,151 @@
|
||||
package com.yuxihan.sdu.comm.widget.selector;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
/**
|
||||
* it controls the states between several choices which is a {@link Selector},
|
||||
* there are two modes by default: {@link #MODE_SINGLE_CHOICE} act as RadioButton + RadioGroup ,{@link #MODE_MULTIPLE_CHOICE } act as CheckBox
|
||||
* the advantage of this class is it don't need to be the parent view of several choices, thus you could place the choices whatever your like
|
||||
* and choice mode could be extends by implementing {#link #ChoiceAction} interface
|
||||
*/
|
||||
public class SelectorGroup {
|
||||
public static final int MODE_SINGLE_CHOICE = 1;
|
||||
public static final int MODE_MULTIPLE_CHOICE = 2;
|
||||
|
||||
private ChoiceAction choiceMode;
|
||||
private StateListener onStateChangeListener;
|
||||
/**
|
||||
* a map to keep previous selected selector
|
||||
*/
|
||||
private HashMap<String, Selector> selectorMap = new HashMap<>();
|
||||
|
||||
/**
|
||||
* customized an choice mode by yourself
|
||||
*
|
||||
* @param choiceMode
|
||||
*/
|
||||
public void setChoiceMode(ChoiceAction choiceMode) {
|
||||
this.choiceMode = choiceMode;
|
||||
}
|
||||
|
||||
/**
|
||||
* set a default choice mode
|
||||
*
|
||||
* @param mode
|
||||
*/
|
||||
public void setChoiceMode(int mode) {
|
||||
switch (mode) {
|
||||
case MODE_MULTIPLE_CHOICE:
|
||||
choiceMode = new MultipleAction();
|
||||
break;
|
||||
case MODE_SINGLE_CHOICE:
|
||||
choiceMode = new SingleAction();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void setStateListener(StateListener onStateChangeListener) {
|
||||
this.onStateChangeListener = onStateChangeListener;
|
||||
}
|
||||
|
||||
/**
|
||||
* get the selector which clicked last time by the specific group tag
|
||||
*
|
||||
* @param groupTag a tag which the previous selector belongs to
|
||||
* @return
|
||||
*/
|
||||
public Selector getPreSelector(String groupTag) {
|
||||
return selectorMap.get(groupTag);
|
||||
}
|
||||
|
||||
/**
|
||||
* toggle or cancel one choice
|
||||
*
|
||||
* @param selected
|
||||
* @param selector
|
||||
*/
|
||||
public void setSelected(boolean selected, Selector selector) {
|
||||
if (selector == null) {
|
||||
return;
|
||||
}
|
||||
if (selected) {
|
||||
//keep click selector in map
|
||||
selectorMap.put(selector.getGroupTag(), selector);
|
||||
}
|
||||
selector.setSelected(selected);
|
||||
if (onStateChangeListener != null) {
|
||||
onStateChangeListener.onStateChange(selector.getGroupTag(), selector.getSelectorTag(), selected);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* cancel selected state of one Selector when another is selected
|
||||
*
|
||||
* @param selector the Selector which is selected right now
|
||||
*/
|
||||
private void cancelPreSelector(Selector selector) {
|
||||
String groupTag = selector.getGroupTag();
|
||||
Selector preSelector = getPreSelector(groupTag);
|
||||
if (preSelector != null) {
|
||||
preSelector.setSelected(false);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* add extra layer which means more complex
|
||||
*
|
||||
* @param selector
|
||||
*/
|
||||
void onSelectorClick(Selector selector) {
|
||||
if (choiceMode != null) {
|
||||
choiceMode.onChoose(selector, this, onStateChangeListener);
|
||||
}
|
||||
//keep click selector in map
|
||||
selectorMap.put(selector.getGroupTag(), selector);
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
if (selectorMap != null) {
|
||||
selectorMap.clear();
|
||||
}
|
||||
}
|
||||
|
||||
public interface ChoiceAction {
|
||||
/**
|
||||
* invoked when one selector is clicked
|
||||
*
|
||||
* @param selector the clicked selector
|
||||
* @param selectorGroup
|
||||
* @param stateListener
|
||||
*/
|
||||
void onChoose(Selector selector, SelectorGroup selectorGroup, StateListener stateListener);
|
||||
}
|
||||
|
||||
/**
|
||||
* pre-defined choice mode: previous choice will be canceled if there is a new choice
|
||||
*/
|
||||
private class SingleAction implements ChoiceAction {
|
||||
|
||||
@Override
|
||||
public void onChoose(Selector selector, SelectorGroup selectorGroup, StateListener stateListener) {
|
||||
cancelPreSelector(selector);
|
||||
setSelected(true, selector);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* pre-defined choice mode: all choices will be preserved
|
||||
*/
|
||||
private class MultipleAction implements ChoiceAction {
|
||||
|
||||
@Override
|
||||
public void onChoose(Selector selector, SelectorGroup selectorGroup, StateListener stateListener) {
|
||||
boolean isSelected = selector.isSelected();
|
||||
setSelected(!isSelected, selector);
|
||||
}
|
||||
}
|
||||
|
||||
public interface StateListener {
|
||||
void onStateChange(String groupTag, String tag, boolean isSelected);
|
||||
}
|
||||
}
|
@ -1,48 +1,32 @@
|
||||
package com.yuxihan.sdu.data;
|
||||
|
||||
/**
|
||||
* A generic class that holds a result success w/ data or an error exception.
|
||||
*/
|
||||
public class Result<T> {
|
||||
// hide the private constructor to limit subclass types (Success, Error)
|
||||
private Result() {
|
||||
|
||||
private String errCode;
|
||||
private String errMsg;
|
||||
private T result;
|
||||
|
||||
public String getErrCode() {
|
||||
return errCode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
if (this instanceof Result.Success) {
|
||||
Result.Success success = (Result.Success) this;
|
||||
return "Success[data=" + success.getData().toString() + "]";
|
||||
} else if (this instanceof Result.Error) {
|
||||
Result.Error error = (Result.Error) this;
|
||||
return "Error[exception=" + error.getError().toString() + "]";
|
||||
}
|
||||
return "";
|
||||
public void setErrCode(String errCode) {
|
||||
this.errCode = errCode;
|
||||
}
|
||||
|
||||
// Success sub-class
|
||||
public final static class Success<T> extends Result {
|
||||
private T data;
|
||||
|
||||
public Success(T data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public T getData() {
|
||||
return this.data;
|
||||
}
|
||||
public String getErrMsg() {
|
||||
return errMsg;
|
||||
}
|
||||
|
||||
// Error sub-class
|
||||
public final static class Error extends Result {
|
||||
private Exception error;
|
||||
|
||||
public Error(Exception error) {
|
||||
this.error = error;
|
||||
}
|
||||
|
||||
public Exception getError() {
|
||||
return this.error;
|
||||
}
|
||||
public void setErrMsg(String errMsg) {
|
||||
this.errMsg = errMsg;
|
||||
}
|
||||
}
|
||||
|
||||
public T getResult() {
|
||||
return result;
|
||||
}
|
||||
|
||||
public void setResult(T result) {
|
||||
this.result = result;
|
||||
}
|
||||
}
|
48
app/src/main/java/com/yuxihan/sdu/data/Result0.java
Normal file
48
app/src/main/java/com/yuxihan/sdu/data/Result0.java
Normal file
@ -0,0 +1,48 @@
|
||||
package com.yuxihan.sdu.data;
|
||||
|
||||
/**
|
||||
* A generic class that holds a result success w/ data or an error exception.
|
||||
*/
|
||||
public class Result0<T> {
|
||||
// hide the private constructor to limit subclass types (Success, Error)
|
||||
private Result0() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
if (this instanceof Result0.Success) {
|
||||
Result0.Success success = (Result0.Success) this;
|
||||
return "Success[data=" + success.getData().toString() + "]";
|
||||
} else if (this instanceof Result0.Error) {
|
||||
Result0.Error error = (Result0.Error) this;
|
||||
return "Error[exception=" + error.getError().toString() + "]";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
// Success sub-class
|
||||
public final static class Success<T> extends Result0 {
|
||||
private T data;
|
||||
|
||||
public Success(T data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public T getData() {
|
||||
return this.data;
|
||||
}
|
||||
}
|
||||
|
||||
// Error sub-class
|
||||
public final static class Error extends Result0 {
|
||||
private Exception error;
|
||||
|
||||
public Error(Exception error) {
|
||||
this.error = error;
|
||||
}
|
||||
|
||||
public Exception getError() {
|
||||
return this.error;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,12 +1,15 @@
|
||||
package com.yuxihan.sdu.data;
|
||||
|
||||
|
||||
import com.yuxihan.sdu.comm.network.BaseRequestParams;
|
||||
import com.yuxihan.sdu.data.model.DataBean;
|
||||
import com.yuxihan.sdu.data.model.LoginParams;
|
||||
import com.yuxihan.sdu.data.model.RegParams;
|
||||
import com.yuxihan.sdu.data.model.SMSParams;
|
||||
import com.yuxihan.sdu.data.model.UpdateNicknameParams;
|
||||
import com.yuxihan.sdu.data.model.UpdateUserHeadParams;
|
||||
import com.yuxihan.sdu.ui.account.AccountViewModel;
|
||||
import com.yuxihan.sdu.ui.account.HomeBean;
|
||||
|
||||
import retrofit2.Call;
|
||||
import retrofit2.http.Body;
|
||||
@ -43,4 +46,9 @@ public interface UpdateService {
|
||||
@Body SMSParams params
|
||||
);
|
||||
|
||||
@POST("/getFamilyList")
|
||||
Call<Result<HomeBean>> getFamilyList(
|
||||
@Body BaseRequestParams params
|
||||
);
|
||||
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ public class PostDetailViewModel extends ViewModel {
|
||||
public void onResponse(Call<DataBean> call, Response<DataBean> response) {
|
||||
//请求成功,返回是一个封装为DataBean的响应
|
||||
Log.e("TAG", "接口返回内容 ===== " + response.body().getResult());
|
||||
if ("0".equals(response.body().getErrCode())) {
|
||||
if (Const.ERROR_CODE_NORMAL.equals(response.body().getErrCode())) {
|
||||
// updateNicknameState.setValue(new UpdateNicknameState(nickname));
|
||||
} else {
|
||||
Toast.makeText(SDUApp.getAppContext(), "保存失败,请重新登陆后再试!", Toast.LENGTH_LONG).show();
|
||||
|
@ -6,10 +6,10 @@ import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.lifecycle.Observer;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
|
||||
@ -19,6 +19,9 @@ import com.yuxihan.sdu.comm.BaseFragment;
|
||||
import com.yuxihan.sdu.comm.Const;
|
||||
import com.yuxihan.sdu.comm.util.AccountUtils;
|
||||
import com.yuxihan.sdu.comm.util.DataUtil;
|
||||
import com.yuxihan.sdu.ui.account.home.CreateHomeActivity;
|
||||
import com.yuxihan.sdu.ui.account.home.InputCodeActivity;
|
||||
import com.yuxihan.sdu.ui.baby.BabyListActivity;
|
||||
import com.yuxihan.sdu.ui.info.InfoEditActivity;
|
||||
import com.yuxihan.sdu.ui.login.LoginActivity;
|
||||
|
||||
@ -30,6 +33,9 @@ public class AccountFragment extends BaseFragment implements View.OnClickListene
|
||||
private CircleImageView civHead;
|
||||
private TextView tvUserName;
|
||||
private TextView tvNickName;
|
||||
private LinearLayout homeList;
|
||||
private View ll_input_invitation_code;
|
||||
private View ll_create_home;
|
||||
|
||||
public View onCreateView(@NonNull LayoutInflater inflater,
|
||||
ViewGroup container, Bundle savedInstanceState) {
|
||||
@ -37,28 +43,44 @@ public class AccountFragment extends BaseFragment implements View.OnClickListene
|
||||
new ViewModelProvider(this).get(AccountViewModel.class);
|
||||
View root = inflater.inflate(R.layout.fragment_account, container, false);
|
||||
initView(root);
|
||||
getServerData();
|
||||
return root;
|
||||
}
|
||||
|
||||
|
||||
private void initView(View root) {
|
||||
final TextView textView = root.findViewById(R.id.text_notifications);
|
||||
homeList = root.findViewById(R.id.home_list);
|
||||
View ll_add_baby = root.findViewById(R.id.ll_add_baby);
|
||||
ll_add_baby.setOnClickListener(this);
|
||||
root.findViewById(R.id.text_sign_out).setOnClickListener(this);
|
||||
root.findViewById(R.id.rl_personal_info).setOnClickListener(this);
|
||||
tvNickName = root.findViewById(R.id.tv_nick_name);
|
||||
tvUserName = root.findViewById(R.id.tv_user_name);
|
||||
civHead = root.findViewById(R.id.civ_head);
|
||||
ll_input_invitation_code = root.findViewById(R.id.ll_input_invitation_code);
|
||||
ll_input_invitation_code.setOnClickListener(this);
|
||||
ll_create_home = root.findViewById(R.id.ll_create_home);
|
||||
ll_create_home.setOnClickListener(this);
|
||||
|
||||
setPersonalInfo();
|
||||
|
||||
accountViewModel.getText().observe(getViewLifecycleOwner(), new Observer<String>() {
|
||||
accountViewModel.getHomeBean().observe(getViewLifecycleOwner(), new Observer<HomeBean>() {
|
||||
@Override
|
||||
public void onChanged(@Nullable String s) {
|
||||
textView.setText(s);
|
||||
public void onChanged(HomeBean homeBean) {
|
||||
homeList.removeAllViews();
|
||||
for (HomeBean.FamilyListBean bean : homeBean.getFamilyList()) {
|
||||
homeList.addView(new AgeSelector(getContext()));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private void getServerData() {
|
||||
accountViewModel.getFamilyList();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
switch (v.getId()) {
|
||||
@ -74,6 +96,18 @@ public class AccountFragment extends BaseFragment implements View.OnClickListene
|
||||
//打开资料编辑页面
|
||||
startActivity(new Intent(getContext(), InfoEditActivity.class));
|
||||
break;
|
||||
case R.id.ll_add_baby:
|
||||
//添加宝宝
|
||||
startActivity(new Intent(getContext(), BabyListActivity.class));
|
||||
break;
|
||||
case R.id.ll_input_invitation_code:
|
||||
//输入邀请码
|
||||
startActivity(new Intent(getContext(), InputCodeActivity.class));
|
||||
break;
|
||||
case R.id.ll_create_home:
|
||||
//创建家庭
|
||||
startActivity(new Intent(getContext(), CreateHomeActivity.class));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -1,12 +1,30 @@
|
||||
package com.yuxihan.sdu.ui.account;
|
||||
|
||||
import android.util.Log;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.lifecycle.LiveData;
|
||||
import androidx.lifecycle.MutableLiveData;
|
||||
import androidx.lifecycle.ViewModel;
|
||||
|
||||
import com.yuxihan.sdu.comm.Const;
|
||||
import com.yuxihan.sdu.comm.SDUApp;
|
||||
import com.yuxihan.sdu.comm.network.BaseRequestParams;
|
||||
import com.yuxihan.sdu.data.Result;
|
||||
import com.yuxihan.sdu.data.UpdateService;
|
||||
|
||||
import retrofit2.Call;
|
||||
import retrofit2.Callback;
|
||||
import retrofit2.Response;
|
||||
|
||||
public class AccountViewModel extends ViewModel {
|
||||
|
||||
private MutableLiveData<String> mText;
|
||||
private MutableLiveData<HomeBean> homeBean = new MutableLiveData<HomeBean>();
|
||||
|
||||
public MutableLiveData<HomeBean> getHomeBean() {
|
||||
return homeBean;
|
||||
}
|
||||
|
||||
public AccountViewModel() {
|
||||
mText = new MutableLiveData<>();
|
||||
@ -16,4 +34,34 @@ public class AccountViewModel extends ViewModel {
|
||||
public LiveData<String> getText() {
|
||||
return mText;
|
||||
}
|
||||
|
||||
|
||||
public void getFamilyList() {
|
||||
UpdateService updateService = SDUApp.getRetrofit().create(UpdateService.class);
|
||||
Call<Result<HomeBean>> call = updateService.getFamilyList(new BaseRequestParams());
|
||||
call.enqueue(new Callback<Result<HomeBean>>() {
|
||||
@Override
|
||||
public void onResponse(Call<Result<HomeBean>> call,
|
||||
Response<Result<HomeBean>> response) {
|
||||
//请求成功,返回是一个封装为DataBean的响应
|
||||
Log.e("TAG", "接口返回内容 ===== " + response.body().getResult());
|
||||
if (Const.ERROR_CODE_NORMAL.equals(response.body().getErrCode())) {
|
||||
homeBean.setValue(response.body().getResult());
|
||||
} else {
|
||||
Toast.makeText(SDUApp.getAppContext(), response.body().getErrMsg(),
|
||||
Toast.LENGTH_LONG).show();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<Result<HomeBean>> call, Throwable t) {
|
||||
//请求失败
|
||||
Log.e("TAG", "请求失败:" + t.getMessage());
|
||||
Toast.makeText(SDUApp.getAppContext(), "服务器开小差了!", Toast.LENGTH_LONG).show();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
}
|
108
app/src/main/java/com/yuxihan/sdu/ui/account/AgeSelector.java
Normal file
108
app/src/main/java/com/yuxihan/sdu/ui/account/AgeSelector.java
Normal file
@ -0,0 +1,108 @@
|
||||
package com.yuxihan.sdu.ui.account;
|
||||
|
||||
import android.animation.ValueAnimator;
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.Color;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.TypedValue;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.animation.AccelerateDecelerateInterpolator;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.yuxihan.sdu.R;
|
||||
import com.yuxihan.sdu.comm.widget.selector.Selector;
|
||||
|
||||
public class AgeSelector extends Selector {
|
||||
private TextView tvTitle;
|
||||
private ImageView ivIcon;
|
||||
private ImageView ivSelector;
|
||||
private ValueAnimator valueAnimator;
|
||||
private String text;
|
||||
private int iconResId;
|
||||
private int indicatorResId;
|
||||
private int textColor;
|
||||
private int textSize;
|
||||
|
||||
public AgeSelector(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
public AgeSelector(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
}
|
||||
|
||||
public AgeSelector(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
}
|
||||
|
||||
private void onBindView(String text, int iconResId, int indicatorResId, int textColor, int textSize) {
|
||||
if (tvTitle != null) {
|
||||
tvTitle.setText(text);
|
||||
tvTitle.setTextSize(TypedValue.COMPLEX_UNIT_SP, textSize);
|
||||
tvTitle.setTextColor(textColor);
|
||||
}
|
||||
if (ivIcon != null) {
|
||||
ivIcon.setImageResource(iconResId);
|
||||
}
|
||||
if (ivSelector != null) {
|
||||
ivSelector.setImageResource(indicatorResId);
|
||||
ivSelector.setAlpha(0);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onObtainAttrs(TypedArray typedArray) {
|
||||
text = typedArray.getString(R.styleable.Selector_text);
|
||||
iconResId = typedArray.getResourceId(R.styleable.Selector_img, 0);
|
||||
indicatorResId = typedArray.getResourceId(R.styleable.Selector_indicator, 0);
|
||||
textColor = typedArray.getColor(R.styleable.Selector_text_color, Color.parseColor("#FF222222"));
|
||||
textSize = typedArray.getInteger(R.styleable.Selector_text_size, 15);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected View onCreateView() {
|
||||
View view = LayoutInflater.from(this.getContext()).inflate(R.layout.item_home, null);
|
||||
tvTitle = view.findViewById(R.id.tv_home_name);
|
||||
ivIcon = view.findViewById(R.id.iv_home_head);
|
||||
ivSelector = view.findViewById(R.id.iv_select_status);
|
||||
onBindView(text, iconResId, indicatorResId, textColor, textSize);
|
||||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onSwitchSelected(boolean isSelect) {
|
||||
if (isSelect) {
|
||||
playSelectedAnimation();
|
||||
} else {
|
||||
playUnselectedAnimation();
|
||||
}
|
||||
}
|
||||
|
||||
private void playUnselectedAnimation() {
|
||||
if (ivSelector == null) {
|
||||
return;
|
||||
}
|
||||
if (valueAnimator != null) {
|
||||
valueAnimator.reverse();
|
||||
}
|
||||
}
|
||||
|
||||
private void playSelectedAnimation() {
|
||||
if (ivSelector == null) {
|
||||
return;
|
||||
}
|
||||
valueAnimator = ValueAnimator.ofInt(0, 255);
|
||||
valueAnimator.setDuration(400);
|
||||
valueAnimator.setInterpolator(new AccelerateDecelerateInterpolator());
|
||||
valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
|
||||
@Override
|
||||
public void onAnimationUpdate(ValueAnimator animation) {
|
||||
ivSelector.setAlpha((int) animation.getAnimatedValue());
|
||||
}
|
||||
});
|
||||
valueAnimator.start();
|
||||
}
|
||||
}
|
102
app/src/main/java/com/yuxihan/sdu/ui/account/HomeBean.java
Normal file
102
app/src/main/java/com/yuxihan/sdu/ui/account/HomeBean.java
Normal file
@ -0,0 +1,102 @@
|
||||
package com.yuxihan.sdu.ui.account;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class HomeBean {
|
||||
|
||||
private List<FamilyListBean> familyList;
|
||||
|
||||
public List<FamilyListBean> getFamilyList() {
|
||||
return familyList;
|
||||
}
|
||||
|
||||
public void setFamilyList(List<FamilyListBean> familyList) {
|
||||
this.familyList = familyList;
|
||||
}
|
||||
|
||||
public static class FamilyListBean {
|
||||
/**
|
||||
* familyName : 狗胖
|
||||
* familyId : 3
|
||||
* userId : 0
|
||||
* invitedCode : null
|
||||
* membersCount : 2
|
||||
* recordCount : 0
|
||||
* createdUserName : null
|
||||
* isTop : 1
|
||||
*/
|
||||
|
||||
private String familyName;
|
||||
private int familyId;
|
||||
private int userId;
|
||||
private String invitedCode;
|
||||
private int membersCount;
|
||||
private int recordCount;
|
||||
private String createdUserName;
|
||||
private int isTop;
|
||||
|
||||
public String getFamilyName() {
|
||||
return familyName;
|
||||
}
|
||||
|
||||
public void setFamilyName(String familyName) {
|
||||
this.familyName = familyName;
|
||||
}
|
||||
|
||||
public int getFamilyId() {
|
||||
return familyId;
|
||||
}
|
||||
|
||||
public void setFamilyId(int familyId) {
|
||||
this.familyId = familyId;
|
||||
}
|
||||
|
||||
public int getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
public void setUserId(int userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public String getInvitedCode() {
|
||||
return invitedCode;
|
||||
}
|
||||
|
||||
public void setInvitedCode(String invitedCode) {
|
||||
this.invitedCode = invitedCode;
|
||||
}
|
||||
|
||||
public int getMembersCount() {
|
||||
return membersCount;
|
||||
}
|
||||
|
||||
public void setMembersCount(int membersCount) {
|
||||
this.membersCount = membersCount;
|
||||
}
|
||||
|
||||
public int getRecordCount() {
|
||||
return recordCount;
|
||||
}
|
||||
|
||||
public void setRecordCount(int recordCount) {
|
||||
this.recordCount = recordCount;
|
||||
}
|
||||
|
||||
public String getCreatedUserName() {
|
||||
return createdUserName;
|
||||
}
|
||||
|
||||
public void setCreatedUserName(String createdUserName) {
|
||||
this.createdUserName = createdUserName;
|
||||
}
|
||||
|
||||
public int getIsTop() {
|
||||
return isTop;
|
||||
}
|
||||
|
||||
public void setIsTop(int isTop) {
|
||||
this.isTop = isTop;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
package com.yuxihan.sdu.ui.account.adapter;
|
||||
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
public class AccountHomeListAdapter extends RecyclerView.Adapter {
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return 0;
|
||||
}
|
||||
}
|
@ -0,0 +1,89 @@
|
||||
package com.yuxihan.sdu.ui.account.adapter;
|
||||
|
||||
import androidx.recyclerview.widget.DiffUtil;
|
||||
import androidx.recyclerview.widget.ListAdapter;
|
||||
|
||||
import com.yuxihan.sdu.data.model.PostDetailBean;
|
||||
import com.yuxihan.sdu.ui.account.HomeBean;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 介绍:核心类 用来判断 新旧Item是否相等
|
||||
* 作者:zhangxutong
|
||||
* 邮箱:zhangxutong@imcoming.com
|
||||
* 时间: 2016/9/12.
|
||||
*/
|
||||
|
||||
public class DiffCallBack extends DiffUtil.Callback {
|
||||
private List<HomeBean> mOldDatas, mNewDatas;//看名字
|
||||
|
||||
public DiffCallBack(List<HomeBean> mOldDatas, List<HomeBean> mNewDatas) {
|
||||
this.mOldDatas = mOldDatas;
|
||||
this.mNewDatas = mNewDatas;
|
||||
}
|
||||
|
||||
//老数据集size
|
||||
@Override
|
||||
public int getOldListSize() {
|
||||
return mOldDatas != null ? mOldDatas.size() : 0;
|
||||
}
|
||||
|
||||
//新数据集size
|
||||
@Override
|
||||
public int getNewListSize() {
|
||||
return mNewDatas != null ? mNewDatas.size() : 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called by the DiffUtil to decide whether two object represent the same Item.
|
||||
* 被DiffUtil调用,用来判断 两个对象是否是相同的Item。
|
||||
* For example, if your items have unique ids, this method should check their id equality.
|
||||
* 例如,如果你的Item有唯一的id字段,这个方法就 判断id是否相等。
|
||||
* 本例判断name字段是否一致
|
||||
*
|
||||
* @param oldItemPosition The position of the item in the old list
|
||||
* @param newItemPosition The position of the item in the new list
|
||||
* @return True if the two items represent the same object or false if they are different.
|
||||
*/
|
||||
@Override
|
||||
public boolean areItemsTheSame(int oldItemPosition, int newItemPosition) {
|
||||
// return mOldDatas.get(oldItemPosition).getName().equals(mNewDatas.get(newItemPosition).getName());
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called by the DiffUtil when it wants to check whether two items have the same data.
|
||||
* 被DiffUtil调用,用来检查 两个item是否含有相同的数据
|
||||
* DiffUtil uses this information to detect if the contents of an item has changed.
|
||||
* DiffUtil用返回的信息(true false)来检测当前item的内容是否发生了变化
|
||||
* DiffUtil uses this method to check equality instead of {@link Object#equals(Object)}
|
||||
* DiffUtil 用这个方法替代equals方法去检查是否相等。
|
||||
* so that you can change its behavior depending on your UI.
|
||||
* 所以你可以根据你的UI去改变它的返回值
|
||||
* For example, if you are using DiffUtil with a
|
||||
* {@link ListAdapter}, you should
|
||||
* return whether the items' visual representations are the same.
|
||||
* 例如,如果你用RecyclerView.Adapter 配合DiffUtil使用,你需要返回Item的视觉表现是否相同。
|
||||
* This method is called only if {@link #areItemsTheSame(int, int)} returns
|
||||
* {@code true} for these items.
|
||||
* 这个方法仅仅在areItemsTheSame()返回true时,才调用。
|
||||
*
|
||||
* @param oldItemPosition The position of the item in the old list
|
||||
* @param newItemPosition The position of the item in the new list which replaces the
|
||||
* oldItem
|
||||
* @return True if the contents of the items are the same or false if they are different.
|
||||
*/
|
||||
@Override
|
||||
public boolean areContentsTheSame(int oldItemPosition, int newItemPosition) {
|
||||
// TestBean beanOld = mOldDatas.get(oldItemPosition);
|
||||
// TestBean beanNew = mNewDatas.get(newItemPosition);
|
||||
// if (!beanOld.getDesc().equals(beanNew.getDesc())) {
|
||||
// return false;//如果有内容不同,就返回false
|
||||
// }
|
||||
// if (beanOld.getPic() != beanNew.getPic()) {
|
||||
// return false;//如果有内容不同,就返回false
|
||||
// }
|
||||
return true; //默认两个data内容是相同的
|
||||
}
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
package com.yuxihan.sdu.ui.account.home;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
|
||||
import com.yuxihan.sdu.R;
|
||||
import com.yuxihan.sdu.comm.BaseActivity;
|
||||
|
||||
public class CreateHomeActivity extends BaseActivity implements View.OnClickListener {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_create_home);
|
||||
initView();
|
||||
}
|
||||
|
||||
private void initView() {
|
||||
findViewById(R.id.iv_back).setOnClickListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
switch (v.getId()){
|
||||
case R.id.iv_back:
|
||||
finish();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,73 @@
|
||||
package com.yuxihan.sdu.ui.account.home;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.text.Editable;
|
||||
import android.text.TextUtils;
|
||||
import android.text.TextWatcher;
|
||||
import android.view.View;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.EditText;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.yuxihan.sdu.R;
|
||||
import com.yuxihan.sdu.comm.BaseActivity;
|
||||
|
||||
public class InputCodeActivity extends BaseActivity implements View.OnClickListener {
|
||||
EditText et_input_code;
|
||||
TextView btn_submit;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_input_code);
|
||||
initView();
|
||||
}
|
||||
|
||||
private void initView() {
|
||||
findViewById(R.id.iv_back).setOnClickListener(this);
|
||||
btn_submit = findViewById(R.id.btn_submit);
|
||||
btn_submit.setOnClickListener(this);
|
||||
et_input_code = findViewById(R.id.et_input_code);
|
||||
et_input_code.addTextChangedListener(afterTextChangedListener);
|
||||
et_input_code.requestFocus();
|
||||
// InputMethodManager manager =
|
||||
// ((InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE));
|
||||
// if (manager != null) {
|
||||
// manager.hideSoftInputFromWindow(et_input_code.getWindowToken(),
|
||||
// InputMethodManager.SHOW_FORCED);
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
switch (v.getId()) {
|
||||
case R.id.iv_back:
|
||||
finish();
|
||||
break;
|
||||
case R.id.btn_submit:
|
||||
|
||||
finish();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
TextWatcher afterTextChangedListener = new TextWatcher() {
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
||||
// ignore
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
// ignore
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) {
|
||||
btn_submit.setEnabled(!TextUtils.isEmpty(s.toString()));
|
||||
}
|
||||
};
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
package com.yuxihan.sdu.ui.account.home;
|
||||
|
||||
import androidx.lifecycle.ViewModel;
|
||||
|
||||
public class InputCodeViewModel extends ViewModel {
|
||||
|
||||
}
|
@ -0,0 +1,36 @@
|
||||
package com.yuxihan.sdu.ui.baby;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
|
||||
import com.yuxihan.sdu.R;
|
||||
import com.yuxihan.sdu.comm.BaseActivity;
|
||||
|
||||
public class BabyListActivity extends BaseActivity implements View.OnClickListener {
|
||||
BabyListViewModel babyListViewModel;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_baby_list);
|
||||
babyListViewModel = new ViewModelProvider(this, new BabyListViewModelFactory())
|
||||
.get(BabyListViewModel.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
switch (v.getId()) {
|
||||
case R.id.iv_back:
|
||||
finish();
|
||||
break;
|
||||
case R.id.tv_add_baby:
|
||||
startActivity(new Intent(BabyListActivity.this, BabyListActivity.class));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,53 @@
|
||||
package com.yuxihan.sdu.ui.baby;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.lifecycle.MutableLiveData;
|
||||
import androidx.lifecycle.ViewModel;
|
||||
|
||||
import com.yuxihan.sdu.comm.Const;
|
||||
import com.yuxihan.sdu.comm.SDUApp;
|
||||
import com.yuxihan.sdu.comm.util.AccountUtils;
|
||||
import com.yuxihan.sdu.data.UpdateService;
|
||||
import com.yuxihan.sdu.data.model.DataBean;
|
||||
import com.yuxihan.sdu.data.model.LoggedInUser;
|
||||
import com.yuxihan.sdu.data.model.LoginParams;
|
||||
|
||||
import retrofit2.Call;
|
||||
import retrofit2.Callback;
|
||||
import retrofit2.Response;
|
||||
|
||||
public class BabyListViewModel extends ViewModel {
|
||||
private MutableLiveData<LoggedInUser> loggedInUser = new MutableLiveData<>();
|
||||
|
||||
public void login(final String username, String password) {
|
||||
|
||||
UpdateService updateService = SDUApp.getRetrofit().create(UpdateService.class);
|
||||
Call<DataBean> call = updateService.login(new LoginParams(username, password));
|
||||
call.enqueue(new Callback<DataBean>() {
|
||||
@Override
|
||||
public void onResponse(Call<DataBean> call, Response<DataBean> response) {
|
||||
//请求成功,返回是一个封装为DataBean的响应
|
||||
Log.e("TAG", "接口返回内容 ===== " + response.body().getResult());
|
||||
if (Const.ERROR_CODE_NORMAL.equals(response.body().getErrCode())) {
|
||||
String token = response.body().getResult().getToken();
|
||||
String nickName = response.body().getResult().getNickname();
|
||||
String userHead = response.body().getResult().getUserHead();
|
||||
loggedInUser.setValue(new LoggedInUser(username, username));
|
||||
AccountUtils.saveLoginState(username, token, nickName, userHead);
|
||||
} else {
|
||||
loggedInUser.setValue(new LoggedInUser(username, response.body().getErrMsg(),
|
||||
false));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<DataBean> call, Throwable t) {
|
||||
//请求失败
|
||||
Log.e("TAG", "请求失败:" + t.getMessage());
|
||||
loggedInUser.setValue(new LoggedInUser(username, "服务器开小差了!", false));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
package com.yuxihan.sdu.ui.baby;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.lifecycle.ViewModel;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
|
||||
import com.yuxihan.sdu.ui.login.LoginViewModel;
|
||||
|
||||
/**
|
||||
* ViewModel provider factory to instantiate LoginViewModel.
|
||||
* Required given LoginViewModel has a non-empty constructor
|
||||
*/
|
||||
public class BabyListViewModelFactory implements ViewModelProvider.Factory {
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public <T extends ViewModel> T create(@NonNull Class<T> modelClass) {
|
||||
if (modelClass.isAssignableFrom(BabyListViewModel.class)) {
|
||||
return (T) new BabyListViewModel();
|
||||
} else {
|
||||
throw new IllegalArgumentException("Unknown ViewModel class");
|
||||
}
|
||||
}
|
||||
}
|
@ -48,7 +48,7 @@ public class InfoEditViewModel extends ViewModel {
|
||||
public void onResponse(Call<DataBean> call, Response<DataBean> response) {
|
||||
//请求成功,返回是一个封装为DataBean的响应
|
||||
Log.e("TAG", "接口返回内容 ===== " + response.body().getResult());
|
||||
if ("0".equals(response.body().getErrCode())) {
|
||||
if (Const.ERROR_CODE_NORMAL.equals(response.body().getErrCode())) {
|
||||
updateNicknameState.setValue(new UpdateNicknameState(nickname));
|
||||
} else {
|
||||
Toast.makeText(SDUApp.getAppContext(), "保存失败,请重新登陆后再试!", Toast.LENGTH_LONG).show();
|
||||
@ -72,7 +72,7 @@ public class InfoEditViewModel extends ViewModel {
|
||||
public void onResponse(Call<DataBean> call, Response<DataBean> response) {
|
||||
//请求成功,返回是一个封装为DataBean的响应
|
||||
Log.e("TAG", "接口返回内容 ===== " + response.body().getResult());
|
||||
if ("0".equals(response.body().getErrCode())) {
|
||||
if (Const.ERROR_CODE_NORMAL.equals(response.body().getErrCode())) {
|
||||
updateUserHead.setValue(new UpdateUserHeadState(accessUrl));
|
||||
} else {
|
||||
Toast.makeText(SDUApp.getAppContext(), "保存失败,请重新登陆后再试!", Toast.LENGTH_LONG).show();
|
||||
|
@ -6,6 +6,7 @@ import androidx.lifecycle.LiveData;
|
||||
import androidx.lifecycle.MutableLiveData;
|
||||
import androidx.lifecycle.ViewModel;
|
||||
|
||||
import com.yuxihan.sdu.comm.Const;
|
||||
import com.yuxihan.sdu.comm.SDUApp;
|
||||
import com.yuxihan.sdu.comm.util.AccountUtils;
|
||||
import com.yuxihan.sdu.comm.util.FormatUtils;
|
||||
@ -47,7 +48,7 @@ public class LoginViewModel extends ViewModel {
|
||||
public void onResponse(Call<DataBean> call, Response<DataBean> response) {
|
||||
//请求成功,返回是一个封装为DataBean的响应
|
||||
Log.e("TAG", "接口返回内容 ===== " + response.body().getResult());
|
||||
if ("0".equals(response.body().getErrCode())) {
|
||||
if (Const.ERROR_CODE_NORMAL.equals(response.body().getErrCode())) {
|
||||
String token = response.body().getResult().getToken();
|
||||
String nickName = response.body().getResult().getNickname();
|
||||
String userHead = response.body().getResult().getUserHead();
|
||||
|
@ -9,6 +9,7 @@ import androidx.lifecycle.LiveData;
|
||||
import androidx.lifecycle.MutableLiveData;
|
||||
import androidx.lifecycle.ViewModel;
|
||||
|
||||
import com.yuxihan.sdu.comm.Const;
|
||||
import com.yuxihan.sdu.comm.SDUApp;
|
||||
import com.yuxihan.sdu.comm.util.FormatUtils;
|
||||
import com.yuxihan.sdu.data.UpdateService;
|
||||
@ -47,7 +48,7 @@ public class RegViewModel extends ViewModel {
|
||||
public void onResponse(Call<DataBean> call, Response<DataBean> response) {
|
||||
//请求成功,返回是一个封装为DataBean的响应
|
||||
Log.e("TAG", "接口返回内容 ===== " + response.body().getResult());
|
||||
if ("0".equals(response.body().getErrCode())) {
|
||||
if (Const.ERROR_CODE_NORMAL.equals(response.body().getErrCode())) {
|
||||
String token = response.body().getResult().getToken();
|
||||
sendSMSResult.setValue(new SendSMSResult(true));
|
||||
} else {
|
||||
@ -75,7 +76,7 @@ public class RegViewModel extends ViewModel {
|
||||
public void onResponse(Call<DataBean> call, Response<DataBean> response) {
|
||||
//请求成功,返回是一个封装为DataBean的响应
|
||||
Log.e("TAG", "接口返回内容 ===== " + response.body().getResult());
|
||||
if ("0".equals(response.body().getErrCode())) {
|
||||
if (Const.ERROR_CODE_NORMAL.equals(response.body().getErrCode())) {
|
||||
String token = response.body().getResult().getToken();
|
||||
loggedInUser.setValue(new LoggedInUser(username, username));
|
||||
} else {
|
||||
|
5
app/src/main/res/drawable/bg_submit_btn.xml
Normal file
5
app/src/main/res/drawable/bg_submit_btn.xml
Normal file
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@color/btn_red" android:state_enabled="true" />
|
||||
<item android:drawable="@color/btn_red_disable" />
|
||||
</selector>
|
9
app/src/main/res/drawable/ic_add_baby.xml
Normal file
9
app/src/main/res/drawable/ic_add_baby.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="200dp"
|
||||
android:height="200dp"
|
||||
android:viewportWidth="1024"
|
||||
android:viewportHeight="1024">
|
||||
<path
|
||||
android:fillColor="#C6C7CB"
|
||||
android:pathData="M902.53,567.69l-335.82,0 0,335.82c0,30.91 -25.06,55.96 -55.97,55.96 -30.91,0 -55.97,-25.06 -55.97,-55.96l0,-335.82 -335.82,0c-30.91,0 -55.97,-25.06 -55.97,-55.98 0,-30.91 25.06,-55.96 55.97,-55.96l335.82,0 0,-335.82c0,-30.91 25.06,-55.97 55.97,-55.97 30.91,0 55.97,25.06 55.97,55.97l0,335.82 335.82,0c30.91,0 55.97,25.05 55.97,55.96C958.5,542.63 933.45,567.69 902.53,567.69z"/>
|
||||
</vector>
|
12
app/src/main/res/drawable/ic_selected.xml
Normal file
12
app/src/main/res/drawable/ic_selected.xml
Normal file
@ -0,0 +1,12 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="200dp"
|
||||
android:height="200dp"
|
||||
android:viewportWidth="1024"
|
||||
android:viewportHeight="1024">
|
||||
<path
|
||||
android:pathData="M771.87,296.62c14.22,-13.54 36.64,-13.08 50.29,1.02 13.54,14.22 13.08,36.64 -1.02,50.29L400.73,750.93 202.87,561.38c-14.22,-13.54 -14.68,-36.07 -1.02,-50.29 13.54,-14.22 36.07,-14.68 50.29,-1.02l148.59,142.34 371.14,-355.78z"
|
||||
android:fillColor="#007fff"/>
|
||||
<path
|
||||
android:pathData="M512,1021.72C230.51,1021.72 2.28,793.49 2.28,512S230.51,2.28 512,2.28s509.72,228.24 509.72,509.72 -228.24,509.72 -509.72,509.72zM512,950.61c242.23,0 438.61,-196.38 438.61,-438.61S754.23,73.39 512,73.39 73.39,269.77 73.39,512 269.77,950.61 512,950.61z"
|
||||
android:fillColor="#007fff"/>
|
||||
</vector>
|
12
app/src/main/res/drawable/ic_unselected.xml
Normal file
12
app/src/main/res/drawable/ic_unselected.xml
Normal file
@ -0,0 +1,12 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="200dp"
|
||||
android:height="200dp"
|
||||
android:viewportWidth="1024"
|
||||
android:viewportHeight="1024">
|
||||
<path
|
||||
android:pathData="M771.87,296.62c14.22,-13.54 36.64,-13.08 50.29,1.02 13.54,14.22 13.08,36.64 -1.02,50.29L400.73,750.93 202.87,561.38c-14.22,-13.54 -14.68,-36.07 -1.02,-50.29 13.54,-14.22 36.07,-14.68 50.29,-1.02l148.59,142.34 371.14,-355.78z"
|
||||
android:fillColor="#bfbfbf"/>
|
||||
<path
|
||||
android:pathData="M512,1021.72C230.51,1021.72 2.28,793.49 2.28,512S230.51,2.28 512,2.28s509.72,228.24 509.72,509.72 -228.24,509.72 -509.72,509.72zM512,950.61c242.23,0 438.61,-196.38 438.61,-438.61S754.23,73.39 512,73.39 73.39,269.77 73.39,512 269.77,950.61 512,950.61z"
|
||||
android:fillColor="#bfbfbf"/>
|
||||
</vector>
|
BIN
app/src/main/res/drawable/input_invitation_code.png
Normal file
BIN
app/src/main/res/drawable/input_invitation_code.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.3 KiB |
48
app/src/main/res/layout/activity_baby_list.xml
Normal file
48
app/src/main/res/layout/activity_baby_list.xml
Normal file
@ -0,0 +1,48 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/divider_gray"
|
||||
tools:context=".ui.baby.BabyListActivity">
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/rl_account_title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="75dp"
|
||||
android:background="@color/white_bg"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingTop="25dp"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_back"
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="50dp"
|
||||
android:padding="14dp"
|
||||
android:src="@drawable/ic_arrow_left" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:paddingTop="12dp"
|
||||
android:text="@string/info_baby_list"
|
||||
android:textColor="@color/text_black"
|
||||
android:textSize="20sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_add_baby"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_marginEnd="12dp"
|
||||
android:paddingTop="12dp"
|
||||
android:text="@string/info_baby_add"
|
||||
android:textColor="@color/text_red"
|
||||
android:textSize="20sp" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
</LinearLayout>
|
43
app/src/main/res/layout/activity_create_home.xml
Normal file
43
app/src/main/res/layout/activity_create_home.xml
Normal file
@ -0,0 +1,43 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".ui.account.home.CreateHomeActivity">
|
||||
<RelativeLayout
|
||||
android:id="@+id/rl_account_title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="75dp"
|
||||
android:background="@color/white_bg"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingTop="25dp"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_back"
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="50dp"
|
||||
android:padding="14dp"
|
||||
android:src="@drawable/ic_arrow_left" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:paddingTop="12dp"
|
||||
android:text="@string/create_home"
|
||||
android:textColor="@color/text_black"
|
||||
android:textSize="20sp" />
|
||||
|
||||
<ImageView
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="30dp"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_marginEnd="12dp"
|
||||
android:padding="2dp"
|
||||
android:src="@drawable/ic_add"
|
||||
android:visibility="gone" />
|
||||
</RelativeLayout>
|
||||
|
||||
</LinearLayout>
|
102
app/src/main/res/layout/activity_input_code.xml
Normal file
102
app/src/main/res/layout/activity_input_code.xml
Normal file
@ -0,0 +1,102 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
tools:context=".ui.account.home.InputCodeActivity">
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/rl_account_title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="75dp"
|
||||
android:background="@color/white_bg"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingTop="25dp"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_back"
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="50dp"
|
||||
android:padding="14dp"
|
||||
android:src="@drawable/ic_arrow_left" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:paddingTop="12dp"
|
||||
android:text="@string/input_invitation_code"
|
||||
android:textColor="@color/text_black"
|
||||
android:textSize="20sp" />
|
||||
|
||||
<ImageView
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="30dp"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_marginEnd="12dp"
|
||||
android:padding="2dp"
|
||||
android:src="@drawable/ic_add"
|
||||
android:visibility="gone" />
|
||||
</RelativeLayout>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="33dp"
|
||||
android:text="@string/input_invitation_code"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="33sp" />
|
||||
|
||||
<androidx.cardview.widget.CardView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="30dp"
|
||||
android:layout_marginEnd="30dp"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:background="@android:color/white"
|
||||
app:cardCornerRadius="22dp">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/et_input_code"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp"
|
||||
android:background="#F6F6F6"
|
||||
android:inputType="number"
|
||||
android:hint="@string/input_code_to_join_home"
|
||||
android:paddingStart="20dp"
|
||||
android:paddingEnd="20dp" />
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="30dp"
|
||||
android:text="@string/go_get_code" />
|
||||
|
||||
<androidx.cardview.widget.CardView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="30dp"
|
||||
android:layout_marginTop="30dp"
|
||||
android:layout_marginEnd="30dp"
|
||||
android:background="@android:color/white"
|
||||
app:cardCornerRadius="22dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/btn_submit"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp"
|
||||
android:background="@drawable/bg_submit_btn"
|
||||
android:gravity="center"
|
||||
android:paddingStart="20dp"
|
||||
android:paddingEnd="20dp"
|
||||
android:text="@string/submit"
|
||||
android:enabled="false"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="20sp" />
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
</LinearLayout>
|
@ -46,7 +46,7 @@
|
||||
<RelativeLayout
|
||||
android:id="@+id/rl_personal_info"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="125dp"
|
||||
android:layout_height="100dp"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<de.hdodenhof.circleimageview.CircleImageView
|
||||
@ -89,28 +89,111 @@
|
||||
|
||||
<include layout="@layout/view_divider" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text_notifications"
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_add_baby"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:gravity="center"
|
||||
android:textSize="14sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
android:gravity="center_vertical"
|
||||
android:paddingStart="20dp"
|
||||
android:paddingEnd="20dp">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:src="@drawable/ic_add_baby" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:gravity="center"
|
||||
android:text="@string/add_baby"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="15sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<include layout="@layout/view_divider" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_add_home"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingStart="20dp">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_input_invitation_code"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:src="@drawable/input_invitation_code" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:gravity="center"
|
||||
android:text="@string/input_invitation_code"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="15sp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:text="@string/input_invitation_code_tip"
|
||||
android:textColor="@color/text_hint"
|
||||
android:textSize="12sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_create_home"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"
|
||||
android:visibility="gone">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:src="@drawable/ic_add_baby" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:gravity="center"
|
||||
android:text="@string/create_home"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="13sp" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/place_holder"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="250dp" />
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/divider_gray"
|
||||
android:paddingStart="10dp"
|
||||
android:paddingTop="8dp"
|
||||
android:paddingEnd="10dp"
|
||||
android:paddingBottom="8dp"
|
||||
android:text="@string/home_list"
|
||||
android:textSize="13sp" />
|
||||
|
||||
<include layout="@layout/view_divider" />
|
||||
<LinearLayout
|
||||
android:id="@+id/home_list"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="300dp"
|
||||
android:background="@color/divider_gray"
|
||||
android:orientation="vertical" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text_sign_out"
|
||||
@ -121,7 +204,7 @@
|
||||
android:paddingEnd="20dp"
|
||||
android:text="@string/sign_out"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="20sp" />
|
||||
android:textSize="15sp" />
|
||||
|
||||
<include layout="@layout/view_divider" />
|
||||
|
||||
|
63
app/src/main/res/layout/item_home.xml
Normal file
63
app/src/main/res/layout/item_home.xml
Normal file
@ -0,0 +1,63 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="84dp"
|
||||
android:padding="10dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_home_head"
|
||||
android:layout_width="41dp"
|
||||
android:layout_height="41dp"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_home_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:text="HOMENAME"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="15sp"
|
||||
app:layout_constraintLeft_toRightOf="@+id/iv_home_head"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_record_member_count"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:text="@string/count_show"
|
||||
android:textSize="12sp"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/iv_home_head"
|
||||
app:layout_constraintLeft_toRightOf="@+id/iv_home_head" />
|
||||
<TextView
|
||||
android:id="@+id/tv_creator"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/divider_gray"
|
||||
android:layout_marginStart="10dp"
|
||||
android:text="@string/creator"
|
||||
android:textSize="12sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toRightOf="@+id/iv_home_head" />
|
||||
<ImageView
|
||||
android:id="@+id/iv_select_status"
|
||||
android:layout_width="25dp"
|
||||
android:layout_height="25dp"
|
||||
android:visibility="gone"
|
||||
android:background="@drawable/ic_selected"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
<TextView
|
||||
android:id="@+id/tv_home_setting"
|
||||
android:visibility="gone"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="5dp"
|
||||
android:textSize="15sp"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:text="@string/setting"/>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
11
app/src/main/res/values/attrs.xml
Normal file
11
app/src/main/res/values/attrs.xml
Normal file
@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<declare-styleable name="Selector">
|
||||
<attr name="text" format="string" />
|
||||
<attr name="img" format="reference" />
|
||||
<attr name="indicator" format="reference" />
|
||||
<attr name="text_size" format="integer" />
|
||||
<attr name="text_color" format="color" />
|
||||
<attr name="tag" format="reference" />
|
||||
</declare-styleable>
|
||||
</resources>
|
@ -6,9 +6,12 @@
|
||||
<color name="white">#FFFFFF</color>
|
||||
<color name="black">#000000</color>
|
||||
<color name="text_black">#101010</color>
|
||||
<color name="text_red">#FF0000</color>
|
||||
<color name="gray">#888888</color>
|
||||
<color name="white_bg">#fafafa</color>
|
||||
<color name="divider_gray">#eeeeee</color>
|
||||
<color name="btn_red">#ff5635</color>
|
||||
<color name="btn_red_disable">#ffcdc4</color>
|
||||
|
||||
<color name="shape1">#5d8df7</color>
|
||||
<color name="shape2">#5EB9F8</color>
|
||||
|
@ -19,10 +19,23 @@
|
||||
<string name="title_dashboard">Dashboard</string>
|
||||
<string name="title_notifications">Notifications</string>
|
||||
<string name="sign_out">注销登录</string>
|
||||
<string name="account_show">账号:%1$s</string>
|
||||
<string name="account_show">账号:%1$s</string>
|
||||
<string name="info_edit">资料编辑</string>
|
||||
<string name="info_baby_list">宝宝管理</string>
|
||||
<string name="info_baby_add">添加</string>
|
||||
<string name="grow_record_detail">记录详情</string>
|
||||
<string name="head_icon">头像</string>
|
||||
<string name="nick_name">昵称</string>
|
||||
<string name="account_id">账号</string>
|
||||
<string name="add_baby">添加宝宝</string>
|
||||
<string name="creator">创建者</string>
|
||||
<string name="count_show">记录数:%1$d     成员:%2$d</string>
|
||||
<string name="setting">设置</string>
|
||||
<string name="home_list">家庭列表</string>
|
||||
<string name="create_home">创建家庭</string>
|
||||
<string name="input_invitation_code">输入邀请码</string>
|
||||
<string name="input_invitation_code_tip">(输入家人发给你的邀请码加入家庭)</string>
|
||||
<string name="input_code_to_join_home">输入邀请码加入家庭</string>
|
||||
<string name="submit">提交</string>
|
||||
<string name="go_get_code">邀请码请找家人获取</string>
|
||||
</resources>
|
||||
|
Loading…
Reference in New Issue
Block a user