Skip to content

Commit

Permalink
Refresh list after importing DB
Browse files Browse the repository at this point in the history
  • Loading branch information
iSoron committed Jul 17, 2016
1 parent 35e93fd commit c1e10e0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ protected void onCreate(Bundle savedInstanceState)
screen = new ListHabitsScreen(this, rootView);
menu = new ListHabitsMenu(this, screen, adapter);
selectionMenu = new ListHabitsSelectionMenu(habits, screen, adapter);
controller = new ListHabitsController(habits, screen, system);
controller = new ListHabitsController(habits, screen, system, adapter);

adapter.setProgressBar(
new AndroidProgressBar(rootView.getProgressBar()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import org.isoron.uhabits.tasks.*;
import org.isoron.uhabits.ui.*;
import org.isoron.uhabits.ui.habits.list.controllers.*;
import org.isoron.uhabits.ui.habits.list.model.*;
import org.isoron.uhabits.utils.*;

import java.io.*;
Expand All @@ -47,6 +48,8 @@ public class ListHabitsController
@NonNull
private final HabitList habitList;

private HabitCardListAdapter adapter;

@Inject
Preferences prefs;

Expand All @@ -55,11 +58,13 @@ public class ListHabitsController

public ListHabitsController(@NonNull HabitList habitList,
@NonNull ListHabitsScreen screen,
@NonNull BaseSystem system)
@NonNull BaseSystem system,
@NonNull HabitCardListAdapter adapter)
{
this.screen = screen;
this.system = system;
this.habitList = habitList;
this.adapter = adapter;
HabitsApplication.getComponent().inject(this);
}

Expand Down Expand Up @@ -115,7 +120,7 @@ public void onImportDataFinished(int result)
switch (result)
{
case ImportDataTask.SUCCESS:
screen.invalidate();
adapter.refresh();
screen.showMessage(R.string.habits_imported);
break;

Expand Down

0 comments on commit c1e10e0

Please sign in to comment.