Hide empty message

pull/30/head
Alinson S. Xavier 10 years ago
parent 3d79f5d928
commit 48cfec7605

@ -7,7 +7,6 @@ import android.graphics.Color;
import android.graphics.Point; import android.graphics.Point;
import android.graphics.Typeface; import android.graphics.Typeface;
import android.net.Uri; import android.net.Uri;
import android.os.AsyncTask;
import android.os.Bundle; import android.os.Bundle;
import android.os.Vibrator; import android.os.Vibrator;
import android.util.DisplayMetrics; import android.util.DisplayMetrics;
@ -61,8 +60,8 @@ public class ListHabitsFragment extends Fragment
TextView tvNameHeader; TextView tvNameHeader;
long lastLongClick = 0; long lastLongClick = 0;
private int tvNameWidth; private int tvNameWidth;
private int button_count; private int button_count;
private View llEmpty;
@Override @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, public View onCreateView(LayoutInflater inflater, ViewGroup container,
@ -95,16 +94,11 @@ public class ListHabitsFragment extends Fragment
listView.setOnTouchListener(controller); listView.setOnTouchListener(controller);
listView.setDragEnabled(true); listView.setDragEnabled(true);
if (Habit.getCount() == 0) Typeface fontawesome =
{ Typeface.createFromAsset(getActivity().getAssets(), "fontawesome-webfont.ttf");
Log.d("x", "Removing listView"); ((TextView) view.findViewById(R.id.tvStarEmpty)).setTypeface(fontawesome);
Typeface fontawesome = llEmpty = view.findViewById(R.id.llEmpty);
Typeface.createFromAsset(getActivity().getAssets(), "fontawesome-webfont.ttf"); updateEmptyMessage();
((TextView) view.findViewById(R.id.tvStarEmpty)).setTypeface(fontawesome);
((ViewGroup) listView.getParent()).removeView(listView);
}
GregorianCalendar day = new GregorianCalendar(TimeZone.getTimeZone("GMT")); GregorianCalendar day = new GregorianCalendar(TimeZone.getTimeZone("GMT"));
day.setTimeInMillis(DateHelper.getStartOfDay(DateHelper.getLocalTime())); day.setTimeInMillis(DateHelper.getStartOfDay(DateHelper.getLocalTime()));
@ -198,9 +192,16 @@ public class ListHabitsFragment extends Fragment
public void notifyDataSetChanged() public void notifyDataSetChanged()
{ {
updateEmptyMessage();
adapter.notifyDataSetChanged(); adapter.notifyDataSetChanged();
} }
private void updateEmptyMessage()
{
Log.d("x", "updating empty message");
llEmpty.setVisibility(Habit.getCount() > 0 ? View.GONE : View.VISIBLE);
}
@Override @Override
public boolean onLongClick(View v) public boolean onLongClick(View v)
{ {

@ -29,7 +29,7 @@
<EditText <EditText
android:id="@+id/input_description" android:id="@+id/input_description"
android:hint="@string/description" android:hint="@string/description_hint"
style="@style/dialogFormInputMultiline" /> style="@style/dialogFormInputMultiline" />
<LinearLayout <LinearLayout

@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:dslv="http://schemas.android.com/apk/res-auto" xmlns:dslv="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="#ffffff"> android:background="#ffffff">
<com.mobeta.android.dslv.DragSortListView <com.mobeta.android.dslv.DragSortListView
android:id="@+id/listView" android:id="@+id/listView"
@ -18,7 +18,7 @@
/> />
<LinearLayout <LinearLayout
android:id="@+id/tvEmpty" android:id="@+id/llEmpty"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:gravity="center" android:gravity="center"
@ -31,27 +31,25 @@
android:textSize="80sp"/> android:textSize="80sp"/>
<TextView <TextView
android:text="@string/no_habits_found" style="@style/habitsListEmptyStyle"
style="@style/habitsListEmptyStyle"/> android:text="@string/no_habits_found"/>
</LinearLayout> </LinearLayout>
<LinearLayout style="@style/habitsListHeaderStyle"> <LinearLayout style="@style/habitsListHeaderStyle">
<TextView <TextView
android:id="@+id/tvStarHeader" android:id="@+id/tvStarHeader"
style="@style/habitsListStarStyle" /> style="@style/habitsListStarStyle"/>
<TextView <TextView
android:id="@+id/tvNameHeader" android:id="@+id/tvNameHeader"
style="@style/habitsListNameStyle" style="@style/habitsListNameStyle"
android:text="" /> android:text=""/>
<LinearLayout <LinearLayout
android:id="@+id/llButtonsHeader" android:id="@+id/llButtonsHeader"
style="@style/habitsListButtonsPanelStyle" /> style="@style/habitsListButtonsPanelStyle"/>
</LinearLayout> </LinearLayout>
</RelativeLayout> </RelativeLayout>

@ -47,6 +47,7 @@
<string name="history">History</string> <string name="history">History</string>
<string name="clear">Clear</string> <string name="clear">Clear</string>
<string name="description">Description</string> <string name="description">Description</string>
<string name="description_hint">Description</string>
<string name="repeat">Repeat</string> <string name="repeat">Repeat</string>
<string name="default_freq_num">3</string> <string name="default_freq_num">3</string>
<string name="times_every">times every</string> <string name="times_every">times every</string>

Loading…
Cancel
Save