Merge branch 'feature_board_view' of https://git.norangeb.it/kanban/wedroid into feature_board_view
This commit is contained in:
commit
47fa49aa07
@ -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.SharedPreferenceHelper
|
||||
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 kotlinx.android.synthetic.main.activity_boards_lists.*
|
||||
|
@ -23,10 +23,10 @@ import java.util.Objects;
|
||||
|
||||
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.util.SharedPreferenceHelper;
|
||||
import it.unisannio.ding.ids.wedroid.app.view.adapter.WListsAdapter;
|
||||
import it.unisannio.ding.ids.wedroid.app.viewmodel.WListsListViewModel;
|
||||
|
||||
public class WListsListActivity extends AppCompatActivity {
|
||||
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package it.unisannio.ding.ids.wedroid.app.viewModel;
|
||||
package it.unisannio.ding.ids.wedroid.app.viewmodel;
|
||||
|
||||
import android.app.Application;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
package it.unisannio.ding.ids.wedroid.app.viewModel;
|
||||
package it.unisannio.ding.ids.wedroid.app.viewmodel;
|
||||
|
||||
import android.app.Application;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user