feature_board_view #28

Merged
norangebit merged 19 commits from feature_board_view into develop 2020-01-16 18:33:24 +00:00
6 changed files with 5 additions and 52 deletions
Showing only changes of commit 47fa49aa07 - Show all commits

View File

@ -13,7 +13,7 @@ import it.unisannio.ding.ids.wedroid.app.R
import it.unisannio.ding.ids.wedroid.app.util.PreferenceReader import it.unisannio.ding.ids.wedroid.app.util.PreferenceReader
import it.unisannio.ding.ids.wedroid.app.util.SharedPreferenceHelper import it.unisannio.ding.ids.wedroid.app.util.SharedPreferenceHelper
import it.unisannio.ding.ids.wedroid.app.view.adapter.BoardsListAdapter import it.unisannio.ding.ids.wedroid.app.view.adapter.BoardsListAdapter
import it.unisannio.ding.ids.wedroid.app.viewModel.BoardsListViewModel import it.unisannio.ding.ids.wedroid.app.viewmodel.BoardsListViewModel
import it.unisannio.ding.ids.wedroid.wrapper.entity.BoardBackgroundColor import it.unisannio.ding.ids.wedroid.wrapper.entity.BoardBackgroundColor
import kotlinx.android.synthetic.main.activity_boards_lists.* import kotlinx.android.synthetic.main.activity_boards_lists.*

View File

@ -23,10 +23,10 @@ import java.util.Objects;
import it.unisannio.ding.ids.wedroid.app.R; import it.unisannio.ding.ids.wedroid.app.R;
import it.unisannio.ding.ids.wedroid.app.viewModel.WListsListViewModel;
import it.unisannio.ding.ids.wedroid.app.data.entity.WList; import it.unisannio.ding.ids.wedroid.app.data.entity.WList;
import it.unisannio.ding.ids.wedroid.app.util.SharedPreferenceHelper; import it.unisannio.ding.ids.wedroid.app.util.SharedPreferenceHelper;
import it.unisannio.ding.ids.wedroid.app.view.adapter.WListsAdapter; import it.unisannio.ding.ids.wedroid.app.view.adapter.WListsAdapter;
import it.unisannio.ding.ids.wedroid.app.viewmodel.WListsListViewModel;
public class WListsListActivity extends AppCompatActivity { public class WListsListActivity extends AppCompatActivity {

View File

@ -1,47 +0,0 @@
package it.unisannio.ding.ids.wedroid.app.viewModel;
import android.app.Application;
import androidx.annotation.NonNull;
import androidx.lifecycle.AndroidViewModel;
import androidx.lifecycle.LiveData;
import java.util.List;
import it.unisannio.ding.ids.wedroid.app.data.database.WListDatabase;
import it.unisannio.ding.ids.wedroid.app.data.entity.WList;
import it.unisannio.ding.ids.wedroid.app.data.repository.WListRepository;
import it.unisannio.ding.ids.wedroid.app.util.PreferenceReader;
import it.unisannio.ding.ids.wedroid.app.util.ServicesFactory;
import it.unisannio.ding.ids.wedroid.app.util.SharedPreferenceHelper;
public class WListsListViewModel extends AndroidViewModel {
private WListRepository wListRepository;
private LiveData<List<WList>> allWLists;
public WListsListViewModel(@NonNull Application application) {
super(application);
PreferenceReader reader = new SharedPreferenceHelper(application);
wListRepository = new WListRepository(
WListDatabase.getDatabase(application).wListDao(),
ServicesFactory.Companion.getInstance(reader).getListService(),
reader);
allWLists = wListRepository.getAllWLists();
}
public LiveData<List<WList>> getAllWLists(){
return allWLists;
}
public void deleteWList(int position, String idBoard) {
List<WList> wList = allWLists.getValue();
if (wList != null)
wListRepository.deleteWList(idBoard, wList.get(position).getId());
}
public void refresh() {
wListRepository.synchronize();
}
}

View File

@ -1,4 +1,4 @@
package it.unisannio.ding.ids.wedroid.app.viewModel; package it.unisannio.ding.ids.wedroid.app.viewmodel;
import android.app.Application; import android.app.Application;

View File

@ -1,4 +1,4 @@
package it.unisannio.ding.ids.wedroid.app.viewModel; package it.unisannio.ding.ids.wedroid.app.viewmodel;
import android.app.Application; import android.app.Application;