Skip to content

Commit

Permalink
now showing notes in show habits
Browse files Browse the repository at this point in the history
  • Loading branch information
Rechee committed Jan 9, 2020
1 parent 8b042f3 commit 2c46e89
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@

import android.content.*;
import android.os.*;
import android.view.View;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.appcompat.widget.*;
Expand Down Expand Up @@ -52,6 +54,9 @@ public class ShowHabitRootView extends BaseRootView
@BindView(R.id.subtitleCard)
SubtitleCard subtitleCard;

@BindView(R.id.habitNotes)
TextView habitNotes;

@BindView(R.id.overviewCard)
OverviewCard overviewCard;

Expand Down Expand Up @@ -136,6 +141,7 @@ protected void onDetachedFromWindow()
private void initCards()
{
subtitleCard.setHabit(habit);
initHabitNotes();
overviewCard.setHabit(habit);
scoreCard.setHabit(habit);
historyCard.setHabit(habit);
Expand All @@ -144,6 +150,14 @@ private void initCards()
barCard.setHabit(habit);
}

private void initHabitNotes() {
final String description = habit.getDescription();
if(!description.isEmpty()){
habitNotes.setText(description);
habitNotes.setVisibility(View.VISIBLE);
}
}

public interface Controller extends HistoryCard.Controller
{
default void onToolbarChanged() {}
Expand Down
10 changes: 10 additions & 0 deletions android/uhabits-android/src/main/res/layout/show_habit_inner.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,16 @@
android:id="@+id/subtitleCard"
style="@style/ShowHabit.Subtitle"/>

<TextView
android:id="@+id/habitNotes"
android:layout_width="match_parent"
android:layout_height="wrap_content"
style="@style/Card"
android:gravity="center"
android:textColor="?highContrastTextColor"
tools:text="This is some example text for the notes"
android:visibility="gone"/>

<View
android:id="@+id/headerShadow"
style="@style/ToolbarShadow"/>
Expand Down

0 comments on commit 2c46e89

Please sign in to comment.