Merge branch 'feature_board_view' of https://git.norangeb.it/kanban/wedroid into feature_board_view

This commit is contained in:
Umberto Furno 2020-01-11 15:10:12 +01:00
commit 47fa49aa07
6 changed files with 5 additions and 52 deletions

View File

@ -20,7 +20,7 @@
<activity
android:name=".view.NewBoardActivity"
android:label="@string/title_activity_new_board"
android:theme="@style/AppTheme.NoActionBar" />
android:theme="@style/AppTheme.NoActionBar"/>
<activity
android:name=".view.BoardViewActivity"

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.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.*

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.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 {

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;

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;