mirror of
https://github.com/iSoron/uhabits.git
synced 2025-12-06 01:08:50 -06:00
Hide empty message
This commit is contained in:
@@ -7,7 +7,6 @@ import android.graphics.Color;
|
||||
import android.graphics.Point;
|
||||
import android.graphics.Typeface;
|
||||
import android.net.Uri;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import android.os.Vibrator;
|
||||
import android.util.DisplayMetrics;
|
||||
@@ -61,8 +60,8 @@ public class ListHabitsFragment extends Fragment
|
||||
TextView tvNameHeader;
|
||||
long lastLongClick = 0;
|
||||
private int tvNameWidth;
|
||||
|
||||
private int button_count;
|
||||
private View llEmpty;
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
@@ -95,16 +94,11 @@ public class ListHabitsFragment extends Fragment
|
||||
listView.setOnTouchListener(controller);
|
||||
listView.setDragEnabled(true);
|
||||
|
||||
if (Habit.getCount() == 0)
|
||||
{
|
||||
Log.d("x", "Removing listView");
|
||||
Typeface fontawesome =
|
||||
Typeface.createFromAsset(getActivity().getAssets(), "fontawesome-webfont.ttf");
|
||||
|
||||
((TextView) view.findViewById(R.id.tvStarEmpty)).setTypeface(fontawesome);
|
||||
|
||||
((ViewGroup) listView.getParent()).removeView(listView);
|
||||
}
|
||||
llEmpty = view.findViewById(R.id.llEmpty);
|
||||
updateEmptyMessage();
|
||||
|
||||
GregorianCalendar day = new GregorianCalendar(TimeZone.getTimeZone("GMT"));
|
||||
day.setTimeInMillis(DateHelper.getStartOfDay(DateHelper.getLocalTime()));
|
||||
@@ -198,9 +192,16 @@ public class ListHabitsFragment extends Fragment
|
||||
|
||||
public void notifyDataSetChanged()
|
||||
{
|
||||
updateEmptyMessage();
|
||||
adapter.notifyDataSetChanged();
|
||||
}
|
||||
|
||||
private void updateEmptyMessage()
|
||||
{
|
||||
Log.d("x", "updating empty message");
|
||||
llEmpty.setVisibility(Habit.getCount() > 0 ? View.GONE : View.VISIBLE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onLongClick(View v)
|
||||
{
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
|
||||
<EditText
|
||||
android:id="@+id/input_description"
|
||||
android:hint="@string/description"
|
||||
android:hint="@string/description_hint"
|
||||
style="@style/dialogFormInputMultiline" />
|
||||
|
||||
<LinearLayout
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/tvEmpty"
|
||||
android:id="@+id/llEmpty"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center"
|
||||
@@ -31,13 +31,11 @@
|
||||
android:textSize="80sp"/>
|
||||
|
||||
<TextView
|
||||
android:text="@string/no_habits_found"
|
||||
style="@style/habitsListEmptyStyle"/>
|
||||
style="@style/habitsListEmptyStyle"
|
||||
android:text="@string/no_habits_found"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
|
||||
<LinearLayout style="@style/habitsListHeaderStyle">
|
||||
|
||||
<TextView
|
||||
|
||||
@@ -47,6 +47,7 @@
|
||||
<string name="history">History</string>
|
||||
<string name="clear">Clear</string>
|
||||
<string name="description">Description</string>
|
||||
<string name="description_hint">Description</string>
|
||||
<string name="repeat">Repeat</string>
|
||||
<string name="default_freq_num">3</string>
|
||||
<string name="times_every">times every</string>
|
||||
|
||||
Reference in New Issue
Block a user