diff --git a/.idea/caches/gradle_models.ser b/.idea/caches/gradle_models.ser index 54302cbd..536ad078 100644 Binary files a/.idea/caches/gradle_models.ser and b/.idea/caches/gradle_models.ser differ diff --git a/app/src/main/java/com/readrops/app/activities/ItemActivity.java b/app/src/main/java/com/readrops/app/activities/ItemActivity.java index fd2d72a2..3f6bc726 100644 --- a/app/src/main/java/com/readrops/app/activities/ItemActivity.java +++ b/app/src/main/java/com/readrops/app/activities/ItemActivity.java @@ -18,7 +18,7 @@ import android.widget.ImageView; import android.widget.RelativeLayout; import android.widget.TextView; -import com.readrops.app.views.ItemViewModel; +import com.readrops.app.viewmodels.ItemViewModel; import com.readrops.app.R; import com.readrops.app.database.pojo.ItemWithFeed; import com.readrops.app.database.entities.Item; diff --git a/app/src/main/java/com/readrops/app/activities/MainActivity.java b/app/src/main/java/com/readrops/app/activities/MainActivity.java index 2525fab6..5542fd65 100644 --- a/app/src/main/java/com/readrops/app/activities/MainActivity.java +++ b/app/src/main/java/com/readrops/app/activities/MainActivity.java @@ -28,7 +28,7 @@ import com.bumptech.glide.util.ViewPreloadSizeProvider; import com.github.clans.fab.FloatingActionMenu; import com.readrops.app.views.AddFeedDialog; import com.readrops.app.views.MainItemListAdapter; -import com.readrops.app.views.MainViewModel; +import com.readrops.app.viewmodels.MainViewModel; import com.readrops.app.R; import com.readrops.app.views.SimpleCallback; import com.readrops.app.database.pojo.ItemWithFeed; diff --git a/app/src/main/java/com/readrops/app/activities/ManageFeedsActivity.java b/app/src/main/java/com/readrops/app/activities/ManageFeedsActivity.java index 316e33c6..b19b068c 100644 --- a/app/src/main/java/com/readrops/app/activities/ManageFeedsActivity.java +++ b/app/src/main/java/com/readrops/app/activities/ManageFeedsActivity.java @@ -9,7 +9,7 @@ import android.support.v7.widget.RecyclerView; import com.mikepenz.fastadapter.FastAdapter; import com.mikepenz.fastadapter.adapters.ModelAdapter; import com.readrops.app.views.FeedWithFolderItem; -import com.readrops.app.views.ManageFeedsViewModel; +import com.readrops.app.viewmodels.ManageFeedsViewModel; import com.readrops.app.R; import com.readrops.app.database.pojo.FeedWithFolder; diff --git a/app/src/main/java/com/readrops/app/repositories/BasedRepository.java b/app/src/main/java/com/readrops/app/repositories/BasedRepository.java deleted file mode 100644 index 3d90667e..00000000 --- a/app/src/main/java/com/readrops/app/repositories/BasedRepository.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.readrops.app.repositories; - -import android.app.Application; -import android.arch.lifecycle.LiveData; - -import com.readrops.app.database.pojo.ItemWithFeed; -import com.readrops.app.database.entities.Feed; -import com.readrops.readropslibrary.ParsingResult; - -public class BasedRepository extends ARepository { - - protected BasedRepository(Application application) { - super(application); - } - - public LiveData getItemById(int id) { - return database.itemDao().getItemById(id); - } - - - @Override - public void sync() { - - } - - @Override - public void addFeed(ParsingResult result) { - - } - - @Override - public void deleteFeed(Feed feed) { - - } -} diff --git a/app/src/main/java/com/readrops/app/views/ItemViewModel.java b/app/src/main/java/com/readrops/app/viewmodels/ItemViewModel.java similarity index 66% rename from app/src/main/java/com/readrops/app/views/ItemViewModel.java rename to app/src/main/java/com/readrops/app/viewmodels/ItemViewModel.java index 5ed62768..3d5a1666 100644 --- a/app/src/main/java/com/readrops/app/views/ItemViewModel.java +++ b/app/src/main/java/com/readrops/app/viewmodels/ItemViewModel.java @@ -1,25 +1,24 @@ -package com.readrops.app.views; +package com.readrops.app.viewmodels; import android.app.Application; import android.arch.lifecycle.AndroidViewModel; import android.arch.lifecycle.LiveData; import android.support.annotation.NonNull; +import com.readrops.app.database.Database; import com.readrops.app.database.pojo.ItemWithFeed; -import com.readrops.app.repositories.BasedRepository; public class ItemViewModel extends AndroidViewModel { - BasedRepository repository; + private Database db; public ItemViewModel(@NonNull Application application) { super(application); - - repository = new BasedRepository(application); + db = Database.getInstance(application); } public LiveData getItemById(int id) { - return repository.getItemById(id); + return db.itemDao().getItemById(id); } diff --git a/app/src/main/java/com/readrops/app/views/MainViewModel.java b/app/src/main/java/com/readrops/app/viewmodels/MainViewModel.java similarity index 93% rename from app/src/main/java/com/readrops/app/views/MainViewModel.java rename to app/src/main/java/com/readrops/app/viewmodels/MainViewModel.java index 47160ed5..068fcf91 100644 --- a/app/src/main/java/com/readrops/app/views/MainViewModel.java +++ b/app/src/main/java/com/readrops/app/viewmodels/MainViewModel.java @@ -1,4 +1,4 @@ -package com.readrops.app.views; +package com.readrops.app.viewmodels; import android.app.Application; import android.arch.lifecycle.AndroidViewModel; @@ -7,6 +7,7 @@ import android.support.annotation.NonNull; import com.readrops.app.database.pojo.ItemWithFeed; import com.readrops.app.repositories.LocalFeedRepository; +import com.readrops.app.views.SimpleCallback; import com.readrops.readropslibrary.ParsingResult; import java.util.List; diff --git a/app/src/main/java/com/readrops/app/views/ManageFeedsViewModel.java b/app/src/main/java/com/readrops/app/viewmodels/ManageFeedsViewModel.java similarity index 95% rename from app/src/main/java/com/readrops/app/views/ManageFeedsViewModel.java rename to app/src/main/java/com/readrops/app/viewmodels/ManageFeedsViewModel.java index be6b22dc..3df4c9e0 100644 --- a/app/src/main/java/com/readrops/app/views/ManageFeedsViewModel.java +++ b/app/src/main/java/com/readrops/app/viewmodels/ManageFeedsViewModel.java @@ -1,4 +1,4 @@ -package com.readrops.app.views; +package com.readrops.app.viewmodels; import android.app.Application; import android.app.ListActivity;