Fix sleep button. Fixes #130

This commit is contained in:
Franze Jr 2015-12-08 23:02:48 -03:00
parent e55c806d97
commit 304ac30db1

View file

@ -191,7 +191,11 @@ public class ChatRecyclerViewAdapter extends RecyclerView.Adapter<ChatRecyclerVi
btnToggleInn.setOnClickListener(this);
ViewHelper.SetBackgroundTint(btnToggleInn, res.getColor(R.color.brand));
changeSleepButton(true);
if(HabiticaApplication.User.getPreferences().getSleep()){
btnToggleInn.setText("Check Out of Inn");
}else{
btnToggleInn.setText("Rest in the Inn");
}
break;
}
@ -347,7 +351,11 @@ public class ChatRecyclerViewAdapter extends RecyclerView.Adapter<ChatRecyclerVi
if (v == btnToggleInn) {
EventBus.getDefault().post(new ToggleInnCommand());
changeSleepButton(false);
if(!HabiticaApplication.User.getPreferences().getSleep()){
btnToggleInn.setText("Check Out of Inn");
}else{
btnToggleInn.setText("Rest in the Inn");
}
return;
}
@ -360,14 +368,6 @@ public class ChatRecyclerViewAdapter extends RecyclerView.Adapter<ChatRecyclerVi
textNewMessage.setText("");
}
public void changeSleepButton(boolean startupButton){
if(HabiticaApplication.User.getPreferences().getSleep() && startupButton){
btnToggleInn.setText("Check Out of Inn");
}else{
btnToggleInn.setText("Rest in the Inn");
}
}
private void toggleLike() {
int newCount = currentUserLikedPost ? --likeCount : ++likeCount;
currentUserLikedPost = !currentUserLikedPost;