mirror of
https://github.com/sudoxnym/habitica-android.git
synced 2026-05-23 14:17:15 +00:00
Add feedback for Sleep button. Fixes #129
This commit is contained in:
parent
26804dfc36
commit
7d964fca8c
1 changed files with 11 additions and 0 deletions
|
|
@ -14,6 +14,7 @@ import android.widget.ImageView;
|
|||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.habitrpg.android.habitica.HabiticaApplication;
|
||||
import com.habitrpg.android.habitica.R;
|
||||
import com.habitrpg.android.habitica.events.commands.CopyChatAsTodoCommand;
|
||||
import com.habitrpg.android.habitica.events.commands.DeleteChatMessageCommand;
|
||||
|
|
@ -190,6 +191,7 @@ public class ChatRecyclerViewAdapter extends RecyclerView.Adapter<ChatRecyclerVi
|
|||
btnToggleInn.setOnClickListener(this);
|
||||
|
||||
ViewHelper.SetBackgroundTint(btnToggleInn, res.getColor(R.color.brand));
|
||||
changeSleepButton(true);
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
@ -345,6 +347,7 @@ public class ChatRecyclerViewAdapter extends RecyclerView.Adapter<ChatRecyclerVi
|
|||
|
||||
if (v == btnToggleInn) {
|
||||
EventBus.getDefault().post(new ToggleInnCommand());
|
||||
changeSleepButton(false);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -357,6 +360,14 @@ public class ChatRecyclerViewAdapter extends RecyclerView.Adapter<ChatRecyclerVi
|
|||
textNewMessage.setText("");
|
||||
}
|
||||
|
||||
public void changeSleepButton(boolean startupButton){
|
||||
if(HabiticaApplication.User.getPreferences().getSleep() && startupButton){
|
||||
btnToggleInn.setText("Leave the Inn");
|
||||
}else{
|
||||
btnToggleInn.setText("Rest in the Inn");
|
||||
}
|
||||
}
|
||||
|
||||
private void toggleLike() {
|
||||
int newCount = currentUserLikedPost ? --likeCount : ++likeCount;
|
||||
currentUserLikedPost = !currentUserLikedPost;
|
||||
|
|
|
|||
Loading…
Reference in a new issue