mirror of https://github.com/readrops/Readrops.git
Use an unique key for feeds
This commit is contained in:
parent
bb4308e01f
commit
35d520169f
|
@ -42,6 +42,8 @@ import io.reactivex.android.schedulers.AndroidSchedulers;
|
|||
import io.reactivex.observers.DisposableSingleObserver;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
|
||||
import static com.readrops.app.utils.ReadropsKeys.FEEDS;
|
||||
|
||||
public class AddFeedActivity extends AppCompatActivity implements View.OnClickListener {
|
||||
|
||||
private AccountArrayAdapter arrayAdapter;
|
||||
|
@ -311,7 +313,7 @@ public class AddFeedActivity extends AppCompatActivity implements View.OnClickLi
|
|||
public void finish() {
|
||||
if (!feedsToUpdate.isEmpty()) {
|
||||
Intent intent = new Intent();
|
||||
intent.putParcelableArrayListExtra("feedIds", feedsToUpdate);
|
||||
intent.putParcelableArrayListExtra(FEEDS, feedsToUpdate);
|
||||
|
||||
setResult(RESULT_OK, intent);
|
||||
}
|
||||
|
|
|
@ -64,6 +64,7 @@ import io.reactivex.observers.DisposableSingleObserver;
|
|||
import io.reactivex.schedulers.Schedulers;
|
||||
|
||||
import static com.readrops.app.utils.ReadropsKeys.ACCOUNT;
|
||||
import static com.readrops.app.utils.ReadropsKeys.FEEDS;
|
||||
import static com.readrops.app.utils.ReadropsKeys.IMAGE_URL;
|
||||
import static com.readrops.app.utils.ReadropsKeys.ITEM_ID;
|
||||
import static com.readrops.app.utils.ReadropsKeys.SETTINGS;
|
||||
|
@ -502,7 +503,7 @@ public class MainActivity extends AppCompatActivity implements SwipeRefreshLayou
|
|||
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
|
||||
if (requestCode == ADD_FEED_REQUEST && resultCode == RESULT_OK) {
|
||||
if (data != null) {
|
||||
ArrayList<Feed> feeds = data.getParcelableArrayListExtra("feedIds");
|
||||
ArrayList<Feed> feeds = data.getParcelableArrayListExtra(FEEDS);
|
||||
|
||||
if (feeds != null && feeds.size() > 0 && viewModel.isAccountLocal()) {
|
||||
refreshLayout.setRefreshing(true);
|
||||
|
|
|
@ -13,6 +13,8 @@ import com.readrops.app.utils.feedscolors.FeedsColorsIntentService;
|
|||
import java.util.ArrayList;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
import static com.readrops.app.utils.ReadropsKeys.FEEDS;
|
||||
|
||||
public class SettingsFragment extends PreferenceFragmentCompat {
|
||||
|
||||
@Override
|
||||
|
@ -28,7 +30,7 @@ public class SettingsFragment extends PreferenceFragmentCompat {
|
|||
database.feedDao().getAllFeeds().observe(getActivity(), feeds -> {
|
||||
if (!serviceStarted.get()) {
|
||||
Intent intent = new Intent(getContext(), FeedsColorsIntentService.class);
|
||||
intent.putParcelableArrayListExtra(FeedsColorsIntentService.FEEDS, new ArrayList<>(feeds));
|
||||
intent.putParcelableArrayListExtra(FEEDS, new ArrayList<>(feeds));
|
||||
|
||||
getContext().startService(intent);
|
||||
serviceStarted.set(true);
|
||||
|
|
|
@ -26,6 +26,8 @@ import io.reactivex.Completable;
|
|||
import io.reactivex.Observable;
|
||||
import io.reactivex.Single;
|
||||
|
||||
import static com.readrops.app.utils.ReadropsKeys.FEEDS;
|
||||
|
||||
public abstract class ARepository<T> {
|
||||
|
||||
protected Application application;
|
||||
|
@ -156,7 +158,7 @@ public abstract class ARepository<T> {
|
|||
|
||||
protected void setFeedsColors(List<Feed> feeds) {
|
||||
Intent intent = new Intent(application, FeedsColorsIntentService.class);
|
||||
intent.putParcelableArrayListExtra(FeedsColorsIntentService.FEEDS, new ArrayList<>(feeds));
|
||||
intent.putParcelableArrayListExtra(FEEDS, new ArrayList<>(feeds));
|
||||
|
||||
application.startService(intent);
|
||||
}
|
||||
|
|
|
@ -14,4 +14,6 @@ object ReadropsKeys {
|
|||
|
||||
const val WEB_URL = "WEB_URL_KEY"
|
||||
const val ACTION_BAR_COLOR = "ACTION_BAR_COLOR_KEY"
|
||||
|
||||
const val FEEDS = "FEEDS"
|
||||
}
|
|
@ -6,14 +6,15 @@ import androidx.core.app.NotificationCompat
|
|||
import androidx.core.app.NotificationManagerCompat
|
||||
import androidx.core.content.ContextCompat
|
||||
import com.readrops.app.R
|
||||
import com.readrops.app.ReadropsApp
|
||||
import com.readrops.app.database.Database
|
||||
import com.readrops.app.database.entities.Feed
|
||||
import com.readrops.app.ReadropsApp
|
||||
import com.readrops.app.utils.ReadropsKeys.FEEDS
|
||||
|
||||
class FeedsColorsIntentService : IntentService("FeedsColorsIntentService") {
|
||||
|
||||
override fun onHandleIntent(intent: Intent?) {
|
||||
val feeds: List<Feed> = intent!!.getParcelableArrayListExtra(FEEDS)
|
||||
val feeds: List<Feed> = intent!!.getParcelableArrayListExtra(FEEDS)!!
|
||||
val database = Database.getInstance(this)
|
||||
|
||||
val notificationBuilder = NotificationCompat.Builder(this, ReadropsApp.FEEDS_COLORS_CHANNEL_ID)
|
||||
|
@ -42,7 +43,6 @@ class FeedsColorsIntentService : IntentService("FeedsColorsIntentService") {
|
|||
|
||||
companion object {
|
||||
private const val NOTIFICATION_ID = 1
|
||||
const val FEEDS = "feeds"
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue