Hide unsubscribed folders

This commit is contained in:
M66B
2019-04-25 19:14:31 +02:00
parent abe3226f26
commit 67fb4a0e72
4 changed files with 17 additions and 4 deletions

View File

@@ -20,6 +20,8 @@ package eu.faircode.email;
*/
import android.content.Context;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;
import androidx.annotation.NonNull;
import androidx.room.Entity;
@@ -199,6 +201,16 @@ public class EntityFolder implements Serializable {
return R.drawable.baseline_folder_24;
}
boolean isHidden(Context context) {
if (hide)
return true;
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
boolean subscriptions = prefs.getBoolean("subscriptions", false);
return (subscriptions && subscribed != null && !subscribed);
}
String getDisplayName(Context context) {
return (display == null ? Helper.localizeFolderName(context, name) : display);
}