Fix showing empty state after loading

This commit is contained in:
PavelRatushny 2017-08-11 12:11:16 +03:00
parent 3419175299
commit b9b0702628
4 changed files with 8 additions and 5 deletions

View file

@ -18,6 +18,7 @@
android:drawSelectorOnTop="false"
android:groupIndicator="@android:color/transparent"/>
<include layout="@layout/empty_state_my_tracks"/>
<include layout="@layout/empty_state_my_tracks"
android:id="@android:id/empty"/>
</LinearLayout>

View file

@ -2,7 +2,7 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:osmand="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@android:id/empty"
android:visibility="gone"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_horizontal"

View file

@ -19,6 +19,7 @@
android:drawSelectorOnTop="false"
android:groupIndicator="@android:color/transparent"/>
<include layout="@layout/empty_state_favourites"/>
<include layout="@layout/empty_state_favourites"
android:id="@android:id/empty"/>
</LinearLayout>

View file

@ -124,6 +124,7 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
private View currentGpxView;
private View footerView;
private boolean importing = false;
private View emptyView;
@Override
public void onAttach(Context activity) {
@ -327,7 +328,7 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
}
footerView = inflater.inflate(R.layout.list_shadow_footer, null, false);
listView.addFooterView(footerView);
View emptyView = v.findViewById(android.R.id.empty);
emptyView = v.findViewById(android.R.id.empty);
ImageView emptyImageView = (ImageView) emptyView.findViewById(R.id.empty_state_image_view);
emptyImageView.setImageResource(app.getSettings().isLightContent() ? R.drawable.ic_empty_state_trip_day_result : R.drawable.ic_empty_state_trip_night_result);
Button importButton = (Button) emptyView.findViewById(R.id.import_button);
@ -337,7 +338,6 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
addTrack();
}
});
listView.setEmptyView(emptyView);
if (this.adapter != null) {
listView.setAdapter(this.adapter);
}
@ -1608,6 +1608,7 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
@Override
protected void onPostExecute(Void aVoid) {
asyncProcessor = null;
listView.setEmptyView(emptyView);
}
}