mirror of https://github.com/readrops/Readrops.git
Don't show the no folder case in feed edit dialog folder list for freshrss accounts as a freshrss feed's folder can't be null
This commit is contained in:
parent
c696b6c28d
commit
2c8ddf5030
|
@ -5,20 +5,27 @@ public class AccountConfig {
|
||||||
public static final AccountConfig LOCAL = new AccountConfigBuilder()
|
public static final AccountConfig LOCAL = new AccountConfigBuilder()
|
||||||
.setFeedUrlEditable(true)
|
.setFeedUrlEditable(true)
|
||||||
.setFolderCreation(true)
|
.setFolderCreation(true)
|
||||||
|
.setNoFolderCase(false)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
public static final AccountConfig NEXTNEWS = new AccountConfigBuilder()
|
public static final AccountConfig NEXTNEWS = new AccountConfigBuilder()
|
||||||
.setFeedUrlEditable(false)
|
.setFeedUrlEditable(false)
|
||||||
.setFolderCreation(true)
|
.setFolderCreation(true)
|
||||||
|
.setNoFolderCase(false)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
public static final AccountConfig FRESHRSS = new AccountConfigBuilder()
|
public static final AccountConfig FRESHRSS = new AccountConfigBuilder()
|
||||||
.setFeedUrlEditable(false)
|
.setFeedUrlEditable(false)
|
||||||
.setFolderCreation(false)
|
.setFolderCreation(false)
|
||||||
|
.setNoFolderCase(true)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
private boolean feedUrlEditable;
|
private boolean feedUrlEditable;
|
||||||
|
|
||||||
|
private boolean folderCreation;
|
||||||
|
|
||||||
|
private boolean noFolderCase;
|
||||||
|
|
||||||
public boolean isFeedUrlEditable() {
|
public boolean isFeedUrlEditable() {
|
||||||
return feedUrlEditable;
|
return feedUrlEditable;
|
||||||
}
|
}
|
||||||
|
@ -27,16 +34,20 @@ public class AccountConfig {
|
||||||
return folderCreation;
|
return folderCreation;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean folderCreation;
|
public boolean isNoFolderCase() {
|
||||||
|
return noFolderCase;
|
||||||
|
}
|
||||||
|
|
||||||
public AccountConfig(boolean feedUrlEditable, boolean folderCreation) {
|
public AccountConfig(AccountConfigBuilder builder) {
|
||||||
this.feedUrlEditable = feedUrlEditable;
|
this.feedUrlEditable = builder.feedUrlEditable;
|
||||||
this.folderCreation = folderCreation;
|
this.folderCreation = builder.folderCreation;
|
||||||
|
this.noFolderCase = builder.noFolderCase;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class AccountConfigBuilder {
|
public static class AccountConfigBuilder {
|
||||||
private boolean feedUrlEditable;
|
private boolean feedUrlEditable;
|
||||||
private boolean folderCreation;
|
private boolean folderCreation;
|
||||||
|
private boolean noFolderCase;
|
||||||
|
|
||||||
public AccountConfigBuilder setFeedUrlEditable(boolean feedUrlEditable) {
|
public AccountConfigBuilder setFeedUrlEditable(boolean feedUrlEditable) {
|
||||||
this.feedUrlEditable = feedUrlEditable;
|
this.feedUrlEditable = feedUrlEditable;
|
||||||
|
@ -48,8 +59,13 @@ public class AccountConfig {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public AccountConfigBuilder setNoFolderCase(boolean noFolderCase) {
|
||||||
|
this.noFolderCase = noFolderCase;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public AccountConfig build() {
|
public AccountConfig build() {
|
||||||
return new AccountConfig(feedUrlEditable, folderCreation);
|
return new AccountConfig(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,9 +16,9 @@ import androidx.lifecycle.ViewModelProviders;
|
||||||
import com.google.android.material.textfield.TextInputEditText;
|
import com.google.android.material.textfield.TextInputEditText;
|
||||||
import com.readrops.app.R;
|
import com.readrops.app.R;
|
||||||
import com.readrops.app.activities.ManageFeedsFoldersActivity;
|
import com.readrops.app.activities.ManageFeedsFoldersActivity;
|
||||||
import com.readrops.app.database.entities.account.Account;
|
|
||||||
import com.readrops.app.database.entities.Feed;
|
import com.readrops.app.database.entities.Feed;
|
||||||
import com.readrops.app.database.entities.Folder;
|
import com.readrops.app.database.entities.Folder;
|
||||||
|
import com.readrops.app.database.entities.account.Account;
|
||||||
import com.readrops.app.database.pojo.FeedWithFolder;
|
import com.readrops.app.database.pojo.FeedWithFolder;
|
||||||
import com.readrops.app.viewmodels.ManageFeedsFoldersViewModel;
|
import com.readrops.app.viewmodels.ManageFeedsFoldersViewModel;
|
||||||
|
|
||||||
|
@ -71,6 +71,8 @@ public class EditFeedDialog extends DialogFragment implements AdapterView.OnItem
|
||||||
|
|
||||||
viewModel.getFolders().observe(this, folders -> {
|
viewModel.getFolders().observe(this, folders -> {
|
||||||
values = new TreeMap<>(String::compareTo);
|
values = new TreeMap<>(String::compareTo);
|
||||||
|
|
||||||
|
if (!account.getAccountType().getAccountConfig().isNoFolderCase())
|
||||||
values.put(getString(R.string.no_folder), 0);
|
values.put(getString(R.string.no_folder), 0);
|
||||||
|
|
||||||
for (Folder folder : folders) {
|
for (Folder folder : folders) {
|
||||||
|
|
Loading…
Reference in New Issue